From fbb8e7b6ed436b9b7f814c449fe86507c90510b8 Mon Sep 17 00:00:00 2001 From: BroGamer <64546358+BroGamer4256@users.noreply.github.com> Date: Thu, 23 Jun 2022 05:30:36 +1200 Subject: [PATCH] Move cabinetofflinedata to exe folder --- patches/8.18/dllmain.c | 3 +++ src/dllmain.c | 21 +++++---------------- src/poll.h | 10 ++++++---- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/patches/8.18/dllmain.c b/patches/8.18/dllmain.c index 4754499..6dceb00 100644 --- a/patches/8.18/dllmain.c +++ b/patches/8.18/dllmain.c @@ -16,6 +16,9 @@ i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) { // Save settings cross session WRITE_MEMORY (ASLR(0x140B5C528, handle), u8, "./Setting1.bin"); WRITE_MEMORY (ASLR(0x140B5C538, handle), u8, "./Setting2.bin"); + // CabinetOfflineData + WRITE_MEMORY (ASLR(0x140b1b4b0, handle), u8, "./"); + WRITE_MEMORY (ASLR(0x14001c941, handle), u8, 0x02); void *amHandle = GetModuleHandle ("AMFrameWork.dll"); WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB); diff --git a/src/dllmain.c b/src/dllmain.c index 94635c1..06d60a1 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -2,19 +2,6 @@ #include "helpers.h" #include "poll.h" -HWND windowHandle = 0; - -int CALLBACK -enumWindows (HWND handle, LPARAM param) { - char buf[64]; - GetClassName (handle, buf, 64); - if (!strcmp (buf, "nuFoundation.Window")) { - windowHandle = handle; - return 0; - } - return 1; -} - // force show cursor HOOK_DYNAMIC (i32, __stdcall, ShowMouse, i32 show) { return originalShowMouse (true); } @@ -57,9 +44,11 @@ u16 __fastcall bnusio_GetAnalogIn (u8 which) { u16 __fastcall bnusio_GetCoin (i32 a1) { static int coin_count = 0; if (a1 == 1) { - static bool inited = false; + static bool inited = false; + static HWND windowHandle = 0; if (!inited) { - EnumWindows (enumWindows, 0); + windowHandle = FindWindowA ("nuFoundation.Window", 0); + InitializePoll (windowHandle); toml_table_t *config = openConfig (configPath ("keyconfig.toml")); @@ -115,7 +104,7 @@ i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) { // Set current directory to the directory of the executable // Find all files in the plugins directory that end with .dll - // Call loadlibraryA on those files + // Call loadlibraryW on those files // Create a message box if they fail to load wchar_t path[MAX_PATH]; GetModuleFileNameW (NULL, path, MAX_PATH); diff --git a/src/poll.h b/src/poll.h index 54d61ba..42628d3 100644 --- a/src/poll.h +++ b/src/poll.h @@ -47,10 +47,12 @@ enum EnumType { none, keycode, button, axis, scroll }; struct ConfigValue { enum EnumType type; - uint8_t keycode; - SDL_GameControllerButton button; - enum SDLAxis axis; - enum Scroll scroll; + union { + uint8_t keycode; + SDL_GameControllerButton button; + enum SDLAxis axis; + enum Scroll scroll; + }; }; struct InternalButtonState {