create types.h and also move everything to src

This commit is contained in:
2026-01-20 16:02:29 +01:00
parent 41d9bba1d1
commit 67f0941dbd
5 changed files with 41 additions and 37 deletions

View File

@@ -4,7 +4,7 @@ liblua:
rm *.o
build: liblua
gcc -O2 -shared -static -o luahost.dll plugin.c api.c liblua -lgdi32 -luser32 -lshell32 \
gcc -O2 -shared -static -o luahost.dll src/*.c liblua -lgdi32 -luser32 -lshell32 -Ilua \
-Wl,--add-stdcall-alias \
-ffunction-sections -fdata-sections

View File

View File

@@ -1,24 +1,11 @@
#pragma once
#include <windows.h>
#include <shlobj.h>
#include <stdint.h>
#include "lua/lua.h"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
typedef struct {
uint8_t len;
uint8_t data[255];
} ShortString;
typedef struct {
ShortString Key;
ShortString Value;
} TRecord;
typedef struct {
int32_t Count;
TRecord Records[255];
} TDB;
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "types.h"
extern HFONT g_hCurrentFont;
#define FONT_NAME "Segoe UI"

View File

@@ -2,21 +2,6 @@
#include <stdio.h>
#include <string.h>
typedef struct {
uint16_t Year;
uint8_t Month;
uint8_t Day;
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
uint8_t Centisecond;
uint16_t RFU;
int32_t Blk1;
int32_t Blk2;
int32_t Blk3;
int32_t Blk4;
} TRDSGroup;
static TRDSGroup Group;
static HWND hWnd = NULL;
@@ -393,8 +378,7 @@ __declspec(dllexport) int WINAPI Initialize(HANDLE hHandle, TDB* DBPointer) {
return (int)hWnd;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) hInst = hinstDLL;
return TRUE;
}

33
src/types.h Normal file
View File

@@ -0,0 +1,33 @@
#pragma once
#include <stdint.h>
typedef struct {
uint8_t len;
uint8_t data[255];
} ShortString;
typedef struct {
ShortString Key;
ShortString Value;
} TRecord;
typedef struct {
int32_t Count;
TRecord Records[255];
} TDB;
typedef struct {
uint16_t Year;
uint8_t Month;
uint8_t Day;
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
uint8_t Centisecond;
uint16_t RFU;
int32_t Blk1;
int32_t Blk2;
int32_t Blk3;
int32_t Blk4;
} TRDSGroup;