From 619285c41258759157f93e0dbf585e00dfa66ec1 Mon Sep 17 00:00:00 2001 From: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Date: Thu, 4 Sep 2025 08:42:54 +0200 Subject: [PATCH] ekt: move files around --- common/hooklib/config.c | 96 +++++++++++++++++++++++++++ common/hooklib/config.h | 19 ++++++ common/hooklib/meson.build | 4 ++ common/{y3io => hooklib}/y3-dll.c | 8 ++- common/{y3io => hooklib}/y3-dll.h | 4 +- common/{y3io => hooklib}/y3.c | 3 +- common/{y3io => hooklib}/y3.h | 2 +- common/y3io/config.c | 100 ----------------------------- common/y3io/config.h | 29 --------- common/y3io/impl/dummy/y3io.c | 3 +- common/y3io/impl/websockets/y3io.c | 2 +- common/y3io/meson.build | 6 -- games/ekthook/config.c | 8 +-- games/ekthook/config.h | 6 +- games/ekthook/dllmain.c | 4 +- 15 files changed, 140 insertions(+), 154 deletions(-) rename common/{y3io => hooklib}/y3-dll.c (98%) rename common/{y3io => hooklib}/y3-dll.h (90%) rename common/{y3io => hooklib}/y3.c (99%) rename common/{y3io => hooklib}/y3.h (98%) delete mode 100644 common/y3io/config.c delete mode 100644 common/y3io/config.h diff --git a/common/hooklib/config.c b/common/hooklib/config.c index 1fa8b38..705dcb1 100644 --- a/common/hooklib/config.c +++ b/common/hooklib/config.c @@ -7,6 +7,8 @@ #include "hooklib/config.h" #include "hooklib/dvd.h" +#include "hooklib/y3.h" +#include "hooklib/y3-dll.h" void dvd_config_load(struct dvd_config *cfg, const wchar_t *filename) { @@ -148,3 +150,97 @@ void printer_cx_config_load(struct printer_cx_config *cfg, const wchar_t *filena filename); } + +void y3_dll_config_load( + struct y3_dll_config *cfg, + const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + GetPrivateProfileStringW( + L"y3io", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); +} + +void y3_config_load( + struct y3_config *cfg, + const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + wchar_t tmpstr[5]; + + memset(cfg->firm_name_field, ' ', sizeof(cfg->firm_name_field) - 1); + cfg->firm_name_field[sizeof(cfg->firm_name_field) - 1] = '\0'; + + memset(cfg->firm_name_printer, ' ', sizeof(cfg->firm_name_printer) - 1); + cfg->firm_name_printer[sizeof(cfg->firm_name_printer) - 1] = '\0'; + + memset(cfg->target_code_field, ' ', sizeof(cfg->target_code_field) - 1); + cfg->target_code_field[sizeof(cfg->target_code_field) - 1] = '\0'; + + memset(cfg->target_code_printer, ' ', sizeof(cfg->target_code_printer) - 1); + cfg->target_code_printer[sizeof(cfg->target_code_printer) - 1] = '\0'; + + cfg->enable = GetPrivateProfileIntW(L"flatPanelReader", L"enable", 1, filename); + cfg->port_field = GetPrivateProfileIntW(L"flatPanelReader", L"port_field", 10, filename); + cfg->port_printer = GetPrivateProfileIntW(L"flatPanelReader", L"port_printer", 11, filename); + + cfg->dll_version = (float)GetPrivateProfileIntW( + L"flatPanelReader", + L"dllVersion", + 1, + filename); + + cfg->firm_version = (float)GetPrivateProfileIntW( + L"flatPanelReader", + L"firmVersion", + 1, + filename); + + GetPrivateProfileStringW( + L"flatPanelReader", + L"firmNameField", + L"SFPR", + tmpstr, + _countof(tmpstr), + filename); + + wcstombs(cfg->firm_name_field, tmpstr, sizeof(cfg->firm_name_field) - 1); + + GetPrivateProfileStringW( + L"flatPanelReader", + L"firmNamePrinter", + L"SPRT", + tmpstr, + _countof(tmpstr), + filename); + + wcstombs(cfg->firm_name_printer, tmpstr, sizeof(cfg->firm_name_printer) - 1); + + GetPrivateProfileStringW( + L"flatPanelReader", + L"targetCodeField", + L"SFR0", + tmpstr, + _countof(tmpstr), + filename); + + wcstombs(cfg->target_code_field, tmpstr, sizeof(cfg->target_code_field) - 1); + + GetPrivateProfileStringW( + L"flatPanelReader", + L"targetCodePrinter", + L"SPT0", + tmpstr, + _countof(tmpstr), + filename); + + wcstombs(cfg->target_code_printer, tmpstr, sizeof(cfg->target_code_printer) - 1); +} \ No newline at end of file diff --git a/common/hooklib/config.h b/common/hooklib/config.h index db8045b..b776407 100644 --- a/common/hooklib/config.h +++ b/common/hooklib/config.h @@ -7,7 +7,26 @@ #include "hooklib/printer_chc.h" #include "hooklib/printer_cx.h" +struct y3_config { + bool enable; + + float dll_version; + float firm_version; + char firm_name_field[5]; + char firm_name_printer[5]; + char target_code_field[5]; + char target_code_printer[5]; + uint8_t port_field; + uint8_t port_printer; +}; + +struct y3_dll_config { + wchar_t path[MAX_PATH]; +}; + void dvd_config_load(struct dvd_config *cfg, const wchar_t *filename); void touch_screen_config_load(struct touch_screen_config *cfg, const wchar_t *filename); void printer_chc_config_load(struct printer_chc_config *cfg, const wchar_t *filename); void printer_cx_config_load(struct printer_cx_config *cfg, const wchar_t *filename); +void y3_config_load(struct y3_config *cfg, const wchar_t *filename); +void y3_dll_config_load(struct y3_dll_config *cfg, const wchar_t *filename); \ No newline at end of file diff --git a/common/hooklib/meson.build b/common/hooklib/meson.build index 6c1fb8f..de87676 100644 --- a/common/hooklib/meson.build +++ b/common/hooklib/meson.build @@ -37,5 +37,9 @@ hooklib_lib = static_library( 'printer_chc.h', 'printer_cx.c', 'printer_cx.h', + 'y3.c', + 'y3.h', + 'y3-dll.c', + 'y3-dll.h', ], ) diff --git a/common/y3io/y3-dll.c b/common/hooklib/y3-dll.c similarity index 98% rename from common/y3io/y3-dll.c rename to common/hooklib/y3-dll.c index 0afeb8a..e3f112f 100644 --- a/common/y3io/y3-dll.c +++ b/common/hooklib/y3-dll.c @@ -3,12 +3,14 @@ #include #include -#include "config.h" -#include "y3.h" -#include "y3-dll.h" +#include "hooklib/config.h" + #include "util/dll-bind.h" #include "util/dprintf.h" +#include "y3.h" +#include "y3-dll.h" + const struct dll_bind_sym y3_dll_syms[] = { { .sym = "y3_io_init", diff --git a/common/y3io/y3-dll.h b/common/hooklib/y3-dll.h similarity index 90% rename from common/y3io/y3-dll.h rename to common/hooklib/y3-dll.h index 7006290..5b2eec8 100644 --- a/common/y3io/y3-dll.h +++ b/common/hooklib/y3-dll.h @@ -4,8 +4,8 @@ #include #include -#include "config.h" -#include "y3.h" +#include "hooklib/y3.h" + struct y3_dll { uint16_t api_version; diff --git a/common/y3io/y3.c b/common/hooklib/y3.c similarity index 99% rename from common/y3io/y3.c rename to common/hooklib/y3.c index 79625d5..d799293 100644 --- a/common/y3io/y3.c +++ b/common/hooklib/y3.c @@ -7,11 +7,12 @@ #include #include "y3.h" -#include "y3-dll.h" #include "hook/table.h" #include "hook/procaddr.h" +#include "hooklib/y3-dll.h" + #include "util/dprintf.h" #define CALL __cdecl diff --git a/common/y3io/y3.h b/common/hooklib/y3.h similarity index 98% rename from common/y3io/y3.h rename to common/hooklib/y3.h index 5927172..a42841b 100644 --- a/common/y3io/y3.h +++ b/common/hooklib/y3.h @@ -3,7 +3,7 @@ #include #include -#include "config.h" +#include "hooklib/config.h" #pragma pack(push, 1) diff --git a/common/y3io/config.c b/common/y3io/config.c deleted file mode 100644 index c416218..0000000 --- a/common/y3io/config.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "y3io/config.h" - -#include -#include -#include -#include - -void y3_config_load( - struct y3_config *cfg, - const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - wchar_t tmpstr[5]; - - memset(cfg->firm_name_field, ' ', sizeof(cfg->firm_name_field) - 1); - cfg->firm_name_field[sizeof(cfg->firm_name_field) - 1] = '\0'; - - memset(cfg->firm_name_printer, ' ', sizeof(cfg->firm_name_printer) - 1); - cfg->firm_name_printer[sizeof(cfg->firm_name_printer) - 1] = '\0'; - - memset(cfg->target_code_field, ' ', sizeof(cfg->target_code_field) - 1); - cfg->target_code_field[sizeof(cfg->target_code_field) - 1] = '\0'; - - memset(cfg->target_code_printer, ' ', sizeof(cfg->target_code_printer) - 1); - cfg->target_code_printer[sizeof(cfg->target_code_printer) - 1] = '\0'; - - cfg->enable = GetPrivateProfileIntW(L"flatPanelReader", L"enable", 1, filename); - cfg->port_field = GetPrivateProfileIntW(L"flatPanelReader", L"port_field", 10, filename); - cfg->port_printer = GetPrivateProfileIntW(L"flatPanelReader", L"port_printer", 11, filename); - - cfg->dll_version = (float)GetPrivateProfileIntW( - L"flatPanelReader", - L"dllVersion", - 1, - filename); - - cfg->firm_version = (float)GetPrivateProfileIntW( - L"flatPanelReader", - L"firmVersion", - 1, - filename); - - GetPrivateProfileStringW( - L"flatPanelReader", - L"firmNameField", - L"SFPR", - tmpstr, - _countof(tmpstr), - filename); - - wcstombs(cfg->firm_name_field, tmpstr, sizeof(cfg->firm_name_field) - 1); - - GetPrivateProfileStringW( - L"flatPanelReader", - L"firmNamePrinter", - L"SPRT", - tmpstr, - _countof(tmpstr), - filename); - - wcstombs(cfg->firm_name_printer, tmpstr, sizeof(cfg->firm_name_printer) - 1); - - GetPrivateProfileStringW( - L"flatPanelReader", - L"targetCodeField", - L"SFR0", - tmpstr, - _countof(tmpstr), - filename); - - wcstombs(cfg->target_code_field, tmpstr, sizeof(cfg->target_code_field) - 1); - - GetPrivateProfileStringW( - L"flatPanelReader", - L"targetCodePrinter", - L"SPT0", - tmpstr, - _countof(tmpstr), - filename); - - wcstombs(cfg->target_code_printer, tmpstr, sizeof(cfg->target_code_printer) - 1); -} - -void y3_dll_config_load( - struct y3_dll_config *cfg, - const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - GetPrivateProfileStringW( - L"y3io", - L"path", - L"", - cfg->path, - _countof(cfg->path), - filename); -} \ No newline at end of file diff --git a/common/y3io/config.h b/common/y3io/config.h deleted file mode 100644 index 8efebca..0000000 --- a/common/y3io/config.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include -#include -#include - -struct y3_config { - bool enable; - - float dll_version; - float firm_version; - char firm_name_field[5]; - char firm_name_printer[5]; - char target_code_field[5]; - char target_code_printer[5]; - uint8_t port_field; - uint8_t port_printer; -}; - -struct y3_dll_config { - wchar_t path[MAX_PATH]; -}; - -void y3_config_load( - struct y3_config *cfg, - const wchar_t *filename); - -void y3_dll_config_load( - struct y3_dll_config *cfg, - const wchar_t *filename); \ No newline at end of file diff --git a/common/y3io/impl/dummy/y3io.c b/common/y3io/impl/dummy/y3io.c index 6dd840c..c8ccdc3 100644 --- a/common/y3io/impl/dummy/y3io.c +++ b/common/y3io/impl/dummy/y3io.c @@ -2,7 +2,8 @@ #include #include "util/dprintf.h" -#include "y3io/y3.h" + +#include "hooklib/y3.h" uint16_t y3_io_get_api_version() { diff --git a/common/y3io/impl/websockets/y3io.c b/common/y3io/impl/websockets/y3io.c index 303bdb6..43dbbe2 100644 --- a/common/y3io/impl/websockets/y3io.c +++ b/common/y3io/impl/websockets/y3io.c @@ -6,7 +6,7 @@ #include "3rdparty/websockets/websocket.h" #include "3rdparty/cjson/cJSON.h" #include "util/dprintf.h" -#include "y3io/y3.h" +#include "../../../hooklib/y3.h" DWORD __stdcall y3_websocket_thread_proc(LPVOID ctx); diff --git a/common/y3io/meson.build b/common/y3io/meson.build index 376df55..b370c92 100644 --- a/common/y3io/meson.build +++ b/common/y3io/meson.build @@ -11,12 +11,6 @@ y3io_lib = static_library( util_lib ], sources : [ - 'config.c', - 'config.h', - 'y3-dll.c', - 'y3-dll.h', - 'y3.c', - 'y3.h', 'impl/dummy/y3io.c', 'impl/websockets/y3io.c', 'impl/websockets/3rdparty/websockets/aw-base64.h', diff --git a/games/ekthook/config.c b/games/ekthook/config.c index eee218e..e3f015b 100644 --- a/games/ekthook/config.c +++ b/games/ekthook/config.c @@ -3,15 +3,13 @@ #include "board/config.h" +#include "ekthook/config.h" +#include "ekthook/ekt-dll.h" + #include "hooklib/config.h" #include "platform/config.h" -#include "ekthook/config.h" -#include "y3io/config.h" - -#include "ekthook/ekt-dll.h" - void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename) { assert(cfg != NULL); diff --git a/games/ekthook/config.h b/games/ekthook/config.h index 9997008..358e3b9 100644 --- a/games/ekthook/config.h +++ b/games/ekthook/config.h @@ -6,6 +6,9 @@ #include "board/config.h" #include "board/led15093.h" +#include "ekthook/ekt-dll.h" + +#include "hooklib/config.h" #include "hooklib/dvd.h" #include "hooklib/printer_cx.h" @@ -13,9 +16,6 @@ #include "unityhook/config.h" -#include "ekthook/ekt-dll.h" -#include "y3io/config.h" - struct ekt_hook_config { struct platform_config platform; struct aime_config aime; diff --git a/games/ekthook/dllmain.c b/games/ekthook/dllmain.c index a8af610..202f302 100644 --- a/games/ekthook/dllmain.c +++ b/games/ekthook/dllmain.c @@ -42,8 +42,8 @@ #include "util/dprintf.h" #include "util/env.h" -#include "y3io/y3-dll.h" -#include "y3io/y3.h" +#include "hooklib/y3-dll.h" +#include "hooklib/y3.h" static HMODULE ekt_hook_mod; static process_entry_t ekt_startup;