From 481c4c5ef438a1fbcf764f1a9bcf65ad1b0c621b Mon Sep 17 00:00:00 2001 From: BroGamer <64546358+BroGamer4256@users.noreply.github.com> Date: Fri, 24 Jun 2022 15:40:39 +1200 Subject: [PATCH] Format --- Makefile | 1 + patches/8.18/dllmain.c | 32 +++++++++++++++----------------- src/dllmain.c | 2 ++ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 29ecd9a..a3437d6 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ ${OUT}: dirs ${DEPS} ${OBJ} .PHONY: fmt fmt: @cd src && clang-format -i *.h *.c -style=file + @cd patches/8.18 && clang-format -i *.c -style=file .PHONY: clean clean: diff --git a/patches/8.18/dllmain.c b/patches/8.18/dllmain.c index 6dceb00..41a1599 100644 --- a/patches/8.18/dllmain.c +++ b/patches/8.18/dllmain.c @@ -2,24 +2,22 @@ #include "helpers.h" i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) { - if (cause != DLL_PROCESS_ATTACH) - return 1; - - void *handle = GetModuleHandle (0); - - WRITE_MEMORY (ASLR(0x1400239C0, handle), u8, 0xC3); // Stop error - WRITE_MEMORY (ASLR(0x140314E8D, handle), u8, 0xB0, 0x01); // Unlock songs - WRITE_MEMORY (ASLR(0x140692E17, handle), u8, 0xEB); // Shared audio - WRITE_MEMORY (ASLR(0x140313726, handle), u8, 0x00, 0x7F); // Remove song limit - WRITE_MEMORY (ASLR(0x140517339, handle), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, - 0x90); // Disable VSync - // 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); + if (cause != DLL_PROCESS_ATTACH) return 1; + void *handle = GetModuleHandle (0); + WRITE_MEMORY (ASLR (0x1400239C0, handle), u8, 0xC3); // Stop error + WRITE_MEMORY (ASLR (0x140314E8D, handle), u8, 0xB0, 0x01); // Unlock songs + WRITE_MEMORY (ASLR (0x140692E17, handle), u8, 0xEB); // Shared audio + WRITE_MEMORY (ASLR (0x140313726, handle), u8, 0x00, 0x7F); // Remove song limit + WRITE_MEMORY (ASLR (0x140517339, handle), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90); // Disable VSync + // Save settings cross session without F:/ and G:/ drive + WRITE_MEMORY (ASLR (0x140B5C528, handle), u8, "./Setting1.bin"); + WRITE_MEMORY (ASLR (0x140B5C538, handle), u8, "./Setting2.bin"); + // Move F:/ files to current directory + WRITE_MEMORY (ASLR (0x140B1B4B0, handle), u8, "./"); + WRITE_MEMORY (ASLR (0x14001C941, handle), u8, 0x02); + + // Move various files to current directory void *amHandle = GetModuleHandle ("AMFrameWork.dll"); WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB); WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB); diff --git a/src/dllmain.c b/src/dllmain.c index 06d60a1..8225a90 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -43,9 +43,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 HWND windowHandle = 0; + if (!inited) { windowHandle = FindWindowA ("nuFoundation.Window", 0);