You've already forked rdsspy-lua-host
mirror of
https://github.com/KubaPro010/rdsspy-lua-host.git
synced 2026-02-26 18:35:01 +01:00
fix bugs, make wider and now also event buttons when double clicked send the event+(event_count)
This commit is contained in:
46
plugin.c
46
plugin.c
@@ -2,29 +2,30 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "lua/lua.h"
|
#include "lua/lua.h"
|
||||||
#include "lua/lualib.h"
|
#include "lua/lualib.h"
|
||||||
#include "lua/lauxlib.h"
|
#include "lua/lauxlib.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned short Year;
|
uint16_t Year;
|
||||||
unsigned char Month;
|
uint8_t Month;
|
||||||
unsigned char Day;
|
uint8_t Day;
|
||||||
unsigned char Hour;
|
uint8_t Hour;
|
||||||
unsigned char Minutes;
|
uint8_t Minutes;
|
||||||
unsigned char Second;
|
uint8_t Second;
|
||||||
unsigned char Centisecond;
|
uint8_t Centisecond;
|
||||||
unsigned short RFU;
|
uint16_t RFU;
|
||||||
int Blk1;
|
int32_t Blk1;
|
||||||
int Blk2;
|
int32_t Blk2;
|
||||||
int Blk3;
|
int32_t Blk3;
|
||||||
int Blk4;
|
int32_t Blk4;
|
||||||
} TRDSGroup;
|
} TRDSGroup;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// fuckass delphi
|
// fuckass delphi
|
||||||
unsigned char len;
|
uint8_t len;
|
||||||
char data[255];
|
uint8_t data[255];
|
||||||
} ShortString;
|
} ShortString;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -33,7 +34,7 @@ typedef struct {
|
|||||||
} TRecord;
|
} TRecord;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int Count;
|
int32_t Count;
|
||||||
TRecord Records[255];
|
TRecord Records[255];
|
||||||
} TDB;
|
} TDB;
|
||||||
|
|
||||||
@@ -53,8 +54,8 @@ static HFONT g_hCurrentFont = NULL;
|
|||||||
#define IDC_MAIN_BUTTON 101
|
#define IDC_MAIN_BUTTON 101
|
||||||
|
|
||||||
#define WINDOW_HEIGHT 380
|
#define WINDOW_HEIGHT 380
|
||||||
#define WINDOW_WIDTH 545
|
#define WINDOW_WIDTH 620
|
||||||
#define BUTTON_COUNT 6
|
#define BUTTON_COUNT 7
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#define TOSTRING(x) STRINGIFY(x)
|
#define TOSTRING(x) STRINGIFY(x)
|
||||||
@@ -62,7 +63,7 @@ static HFONT g_hCurrentFont = NULL;
|
|||||||
#define EVENT_BUTTON(I) \
|
#define EVENT_BUTTON(I) \
|
||||||
HWND hButton_event##I = CreateWindowEx( \
|
HWND hButton_event##I = CreateWindowEx( \
|
||||||
0, "BUTTON", "Event " TOSTRING(I), \
|
0, "BUTTON", "Event " TOSTRING(I), \
|
||||||
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, \
|
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY, \
|
||||||
10 + (75 * I), WINDOW_HEIGHT-62, \
|
10 + (75 * I), WINDOW_HEIGHT-62, \
|
||||||
70, 30, hWnd, \
|
70, 30, hWnd, \
|
||||||
(HMENU)(IDC_MAIN_BUTTON + I), hInst, NULL \
|
(HMENU)(IDC_MAIN_BUTTON + I), hInst, NULL \
|
||||||
@@ -105,12 +106,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
ShowWindow(hwnd, SW_HIDE);
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED)
|
||||||
{
|
{
|
||||||
int controlId = LOWORD(wParam);
|
int controlId = LOWORD(wParam);
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
if(HIWORD(wParam) == BN_DOUBLECLICKED) offset = BUTTON_COUNT;
|
||||||
|
|
||||||
if (controlId == IDC_MAIN_BUTTON) InitLua();
|
if (controlId == IDC_MAIN_BUTTON) InitLua();
|
||||||
else if (controlId > IDC_MAIN_BUTTON && controlId <= IDC_MAIN_BUTTON + BUTTON_COUNT) lua_event(controlId - IDC_MAIN_BUTTON);
|
else if (controlId > IDC_MAIN_BUTTON && controlId <= IDC_MAIN_BUTTON + BUTTON_COUNT) lua_event((controlId - IDC_MAIN_BUTTON) + offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
@@ -164,6 +168,7 @@ void CreatePluginWindow(HWND hOwner) {
|
|||||||
EVENT_BUTTON(4)
|
EVENT_BUTTON(4)
|
||||||
EVENT_BUTTON(5)
|
EVENT_BUTTON(5)
|
||||||
EVENT_BUTTON(6)
|
EVENT_BUTTON(6)
|
||||||
|
EVENT_BUTTON(7)
|
||||||
|
|
||||||
HFONT hFont = CreateFont(18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, FONT_NAME);
|
HFONT hFont = CreateFont(18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, FONT_NAME);
|
||||||
SendMessage(hEditControl, WM_SETFONT, (WPARAM)hFont, TRUE);
|
SendMessage(hEditControl, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
@@ -174,6 +179,7 @@ void CreatePluginWindow(HWND hOwner) {
|
|||||||
SendMessage(hButton_event4, WM_SETFONT, (WPARAM)hFont, TRUE);
|
SendMessage(hButton_event4, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
SendMessage(hButton_event5, WM_SETFONT, (WPARAM)hFont, TRUE);
|
SendMessage(hButton_event5, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
SendMessage(hButton_event6, WM_SETFONT, (WPARAM)hFont, TRUE);
|
SendMessage(hButton_event6, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
SendMessage(hButton_event7, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
HICON hIconBig = (HICON)SendMessage(hOwner, WM_GETICON, ICON_BIG, 0);
|
HICON hIconBig = (HICON)SendMessage(hOwner, WM_GETICON, ICON_BIG, 0);
|
||||||
HICON hIconSmall = (HICON)SendMessage(hOwner, WM_GETICON, ICON_SMALL, 0);
|
HICON hIconSmall = (HICON)SendMessage(hOwner, WM_GETICON, ICON_SMALL, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user