From 2d239f93eae804df7e26cba2e11c6cacb3898641 Mon Sep 17 00:00:00 2001 From: Farewell_ Date: Sun, 19 Jan 2025 22:10:07 +0100 Subject: [PATCH] Added option to not move files for BNA1 OS This should allow settings to be saved properly now --- dist/config.toml | 13 ++++--- src/dllmain.cpp | 6 ++- src/patches/versions/CHN00.cpp | 43 ++++++++++---------- src/patches/versions/JPN00.cpp | 33 +++++++++------- src/patches/versions/JPN08.cpp | 33 +++++++++------- src/patches/versions/JPN39.cpp | 71 ++++++++++++++++++---------------- 6 files changed, 108 insertions(+), 91 deletions(-) diff --git a/dist/config.toml b/dist/config.toml index 86b90bb..1e9cbd1 100644 --- a/dist/config.toml +++ b/dist/config.toml @@ -14,7 +14,8 @@ version = "auto" # Patch version # | - JPN08: For use with Taiko JPN 08.18 # | - JPN39: For use with Taiko JPN 39.06 # | - CHN00: For use with Taiko CHN 00.32 -unlock_songs = true +unlock_songs = true # Self-explanatory +local_files = true # Only set this to false if you're using this on a Nijiiro Cabinet, running on BNA1 [patches.chn00] # These patches are only available for version CHN00 fix_language = false # Sync test mode language to attract etc @@ -32,10 +33,10 @@ qr = true # Disable this if you want to use an original Namco [graphics] res = { x = 1920, y = 1080 } -windowed = false # not windowed will automatically fullscreen -cursor = true # fullscreen will automatically hide cursor -vsync = false # enable this if you are using a 120fps screen (and use "Let Application Decide" in Nvidia panel) -# fpslimit = 0 # temporoly remove it, limit it to 120 in Nvidia panel instead!!! +windowed = false # if set to false, will automatically go Fullscreen +cursor = true # Fullscreen will automatically hide cursor +vsync = false # Enable this if you are using a 120fps screen (and use "Let Application Decide" in Nvidia panel) +# fpslimit = 0 # Temporarily disabled, limit to 120 fps in Nvidia panel instead!!! model_res_rate = 1.0 # Don-Model resolution rate (currently JPN39 only) # | rate <= 0: default 1280x720 # | rate > 0: current resolution * rate @@ -46,7 +47,7 @@ wasapi_shared = false # Wasapi shared mode, allows you to have multiple au asio = false # Use asio audio mode asio_driver = "ASIO4ALL v2" # Asio driver name # | If you're not using asio4all, open up regedit then navigate to HKEY_LOCAL_MACHINE\SOFTWARE\ASIO for your driver's name. - # | It is case sensitive. + # | It is case-sensitive. [qr] diff --git a/src/dllmain.cpp b/src/dllmain.cpp index d8f6f78..0549c2e 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -31,6 +31,7 @@ bool emulateUsio = true; bool emulateCardReader = true; bool emulateQr = true; bool acceptInvalidCards = false; +bool localFiles = true; HKL currentLayout = nullptr; i32 xRes = 1920; i32 yRes = 1080; @@ -196,7 +197,10 @@ DllMain (HMODULE module, const DWORD reason, LPVOID reserved) { std::strcat (placeId, countryCode.c_str ()); std::strcat (placeId, "0FF0"); } - if (const auto patches = openConfigSection (config, "patches")) version = readConfigString (patches, "version", version); + if (const auto patches = openConfigSection (config, "patches")) { + version = readConfigString (patches, "version", version); + localFiles = readConfigBool (patches, "local_files", localFiles); + } if (const auto emulation = openConfigSection (config, "emulation")) { emulateUsio = readConfigBool (emulation, "usio", emulateUsio); emulateCardReader = readConfigBool (emulation, "card_reader", emulateCardReader); diff --git a/src/patches/versions/CHN00.cpp b/src/patches/versions/CHN00.cpp index 9996ecb..110b356 100644 --- a/src/patches/versions/CHN00.cpp +++ b/src/patches/versions/CHN00.cpp @@ -5,6 +5,7 @@ extern std::string chassisId; extern i32 xRes; extern i32 yRes; extern bool vsync; +extern bool localFiles; namespace patches::CHN00 { int language = 0; @@ -156,17 +157,6 @@ Init () { // Disable SSLVerify WRITE_MEMORY (ASLR (0x14034C182), u8, 0x00); - // Move various files to current directory - WRITE_MEMORY (ASLR (0x140C33C40), char, "./"); // F:/ - WRITE_MEMORY (ASLR (0x140C33C44), char, "./"); // G:/ - WRITE_MEMORY (ASLR (0x140C7B158), char, ".\\SettingChina1.bin"); - WRITE_MEMORY (ASLR (0x140C7B2B8), char, ".\\SettingChina1.bin"); - WRITE_MEMORY (ASLR (0x140C7B2A0), char, ".\\SettingChina2.bin"); - WRITE_MEMORY (ASLR (0x140C3CF58), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); - WRITE_MEMORY (ASLR (0x140C3CFC8), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); - WRITE_MEMORY (ASLR (0x140C3CF90), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); - WRITE_MEMORY (ASLR (0x140C3D000), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); - // Remove datatable size limit { for (const auto address : memsetSizeAddresses) @@ -203,14 +193,27 @@ Init () { const auto amHandle = reinterpret_cast (GetModuleHandle ("AMFrameWork.dll")); INSTALL_HOOK_DYNAMIC (AMFWTerminate, reinterpret_cast (amHandle + 0x25A00)); - // Move various files to current directory - WRITE_MEMORY (amHandle + 0xC652, u8, 0xEB); // CreditLogPathA - WRITE_MEMORY (amHandle + 0xC819, u8, 0xEB); // CreditLogPathB - WRITE_MEMORY (amHandle + 0x243BA, u8, 0xEB); // ErrorLogPathA - WRITE_MEMORY (amHandle + 0x24539, u8, 0xEB); // ErrorLogPathB - WRITE_MEMORY (amHandle + 0x24901, u8, 0xEB); // CommonLogPathA - WRITE_MEMORY (amHandle + 0x24A85, u8, 0xEB); // CommonLogPathB - WRITE_NOP (amHandle + 0x24DD1, 0x05); // BackupDataPathA - WRITE_NOP (amHandle + 0x24E47, 0x05); // BackupDataPathB + if (localFiles) { + // Move various files to current directory + WRITE_MEMORY (ASLR (0x140C33C40), char, "./"); // F:/ + WRITE_MEMORY (ASLR (0x140C33C44), char, "./"); // G:/ + WRITE_MEMORY (ASLR (0x140C7B158), char, ".\\SettingChina1.bin"); + WRITE_MEMORY (ASLR (0x140C7B2B8), char, ".\\SettingChina1.bin"); + WRITE_MEMORY (ASLR (0x140C7B2A0), char, ".\\SettingChina2.bin"); + WRITE_MEMORY (ASLR (0x140C3CF58), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); + WRITE_MEMORY (ASLR (0x140C3CFC8), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); + WRITE_MEMORY (ASLR (0x140C3CF90), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); + WRITE_MEMORY (ASLR (0x140C3D000), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); + + // Move various files to current directory + WRITE_MEMORY (amHandle + 0xC652, u8, 0xEB); // CreditLogPathA + WRITE_MEMORY (amHandle + 0xC819, u8, 0xEB); // CreditLogPathB + WRITE_MEMORY (amHandle + 0x243BA, u8, 0xEB); // ErrorLogPathA + WRITE_MEMORY (amHandle + 0x24539, u8, 0xEB); // ErrorLogPathB + WRITE_MEMORY (amHandle + 0x24901, u8, 0xEB); // CommonLogPathA + WRITE_MEMORY (amHandle + 0x24A85, u8, 0xEB); // CommonLogPathB + WRITE_NOP (amHandle + 0x24DD1, 0x05); // BackupDataPathA + WRITE_NOP (amHandle + 0x24E47, 0x05); // BackupDataPathB + } } } // namespace patches::CHN00 diff --git a/src/patches/versions/JPN00.cpp b/src/patches/versions/JPN00.cpp index fe1e492..62cedbf 100644 --- a/src/patches/versions/JPN00.cpp +++ b/src/patches/versions/JPN00.cpp @@ -4,6 +4,7 @@ extern i32 xRes; extern i32 yRes; extern bool vsync; +extern bool localFiles; namespace patches::JPN00 { @@ -62,12 +63,6 @@ Init () { // Use TLS v1.2 WRITE_MEMORY (ASLR (0x140309AC9), u8, 0x10); - // Move various files to current dir - WRITE_MEMORY (ASLR (0x140018351), u8, 0x02); - WRITE_MEMORY (ASLR (0x1409A7138), char, "./"); // F:/ - WRITE_MEMORY (ASLR (0x1409D23B8), char, ".\\Setting1.bin"); - WRITE_MEMORY (ASLR (0x1409D23C8), char, ".\\Setting2.bin"); - // Remove datatable size limit { for (const auto address : memsetSizeAddresses) @@ -83,14 +78,22 @@ Init () { const auto amHandle = reinterpret_cast (GetModuleHandle ("AMFrameWork.dll")); INSTALL_HOOK_DYNAMIC (AMFWTerminate, reinterpret_cast (amHandle + 0x24B80)); - // Move various files to current directory - WRITE_MEMORY (amHandle + 0x1473F, u8, 0xEB); // CreditLogPathA - WRITE_MEMORY (amHandle + 0x148AA, u8, 0xEB); // CreditLogPathB - WRITE_MEMORY (amHandle + 0x321A7, u8, 0xEB); // ErrorLogPathA - WRITE_MEMORY (amHandle + 0x322FA, u8, 0xEB); // ErrorLogPathB - WRITE_MEMORY (amHandle + 0x326D9, u8, 0xEB); // CommonLogPathA - WRITE_MEMORY (amHandle + 0x3282C, u8, 0xEB); // CommonLogPathB - WRITE_MEMORY (amHandle + 0x32C2A, u8, 0xEB); // BackupDataPathA - WRITE_MEMORY (amHandle + 0x32D7D, u8, 0xEB); // BackupDataPathB + if (localFiles) { + // Move various files to current dir + WRITE_MEMORY (ASLR (0x140018351), u8, 0x02); + WRITE_MEMORY (ASLR (0x1409A7138), char, "./"); // F:/ + WRITE_MEMORY (ASLR (0x1409D23B8), char, ".\\Setting1.bin"); + WRITE_MEMORY (ASLR (0x1409D23C8), char, ".\\Setting2.bin"); + + // Move various files to current directory + WRITE_MEMORY (amHandle + 0x1473F, u8, 0xEB); // CreditLogPathA + WRITE_MEMORY (amHandle + 0x148AA, u8, 0xEB); // CreditLogPathB + WRITE_MEMORY (amHandle + 0x321A7, u8, 0xEB); // ErrorLogPathA + WRITE_MEMORY (amHandle + 0x322FA, u8, 0xEB); // ErrorLogPathB + WRITE_MEMORY (amHandle + 0x326D9, u8, 0xEB); // CommonLogPathA + WRITE_MEMORY (amHandle + 0x3282C, u8, 0xEB); // CommonLogPathB + WRITE_MEMORY (amHandle + 0x32C2A, u8, 0xEB); // BackupDataPathA + WRITE_MEMORY (amHandle + 0x32D7D, u8, 0xEB); // BackupDataPathB + } } } // namespace patches::JPN00 diff --git a/src/patches/versions/JPN08.cpp b/src/patches/versions/JPN08.cpp index 851b4f3..c2df32e 100644 --- a/src/patches/versions/JPN08.cpp +++ b/src/patches/versions/JPN08.cpp @@ -6,6 +6,7 @@ extern void *song_data; extern i32 xRes; extern i32 yRes; extern bool vsync; +extern bool localFiles; #define RDX_MOV 0x48, 0xBA #define R8_MOV 0x49, 0xB8 @@ -71,12 +72,6 @@ Init () { // Use TLS v1.2 WRITE_MEMORY (ASLR (0x14044B1A9), u8, 0x10); - // Move various files to current directory - WRITE_MEMORY (ASLR (0x14001C941), u8, 0x02); - WRITE_MEMORY (ASLR (0x140B1B4B0), char, "./"); // F:/ - WRITE_MEMORY (ASLR (0x140B5C528), char, ".\\Setting1.bin"); - WRITE_MEMORY (ASLR (0x140B5C538), char, ".\\Setting2.bin"); - // Remove datatable size limit { for (auto address : memsetSizeAddresses) @@ -158,14 +153,22 @@ Init () { auto amHandle = reinterpret_cast (GetModuleHandle ("AMFrameWork.dll")); INSTALL_HOOK_DYNAMIC (AMFWTerminate, reinterpret_cast (amHandle + 0x35A00)); - // Move various files to current directory - WRITE_MEMORY (amHandle + 0x148AF, u8, 0xEB); // CreditLogPathA - WRITE_MEMORY (amHandle + 0x14A1A, u8, 0xEB); // CreditLogPathB - WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB); // ErrorLogPathA - WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB); // ErrorLogPathB - WRITE_MEMORY (amHandle + 0x34429, u8, 0xEB); // CommonLogPathA - WRITE_MEMORY (amHandle + 0x3457C, u8, 0xEB); // CommonLogPathB - WRITE_MEMORY (amHandle + 0x3497A, u8, 0xEB); // BackupDataPathA - WRITE_MEMORY (amHandle + 0x34ACD, u8, 0xEB); // BackupDataPathB + if (localFiles) { + // Move various files to current directory + WRITE_MEMORY (ASLR (0x14001C941), u8, 0x02); + WRITE_MEMORY (ASLR (0x140B1B4B0), char, "./"); // F:/ + WRITE_MEMORY (ASLR (0x140B5C528), char, ".\\Setting1.bin"); + WRITE_MEMORY (ASLR (0x140B5C538), char, ".\\Setting2.bin"); + + // Move various files to current directory + WRITE_MEMORY (amHandle + 0x148AF, u8, 0xEB); // CreditLogPathA + WRITE_MEMORY (amHandle + 0x14A1A, u8, 0xEB); // CreditLogPathB + WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB); // ErrorLogPathA + WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB); // ErrorLogPathB + WRITE_MEMORY (amHandle + 0x34429, u8, 0xEB); // CommonLogPathA + WRITE_MEMORY (amHandle + 0x3457C, u8, 0xEB); // CommonLogPathB + WRITE_MEMORY (amHandle + 0x3497A, u8, 0xEB); // BackupDataPathA + WRITE_MEMORY (amHandle + 0x34ACD, u8, 0xEB); // BackupDataPathB + } } } // namespace patches::JPN08 diff --git a/src/patches/versions/JPN39.cpp b/src/patches/versions/JPN39.cpp index 284a718..8366b8d 100644 --- a/src/patches/versions/JPN39.cpp +++ b/src/patches/versions/JPN39.cpp @@ -6,6 +6,7 @@ extern i32 xRes; extern i32 yRes; extern bool vsync; +extern bool localFiles; namespace patches::JPN39 { int language = 0; @@ -388,31 +389,6 @@ Init () { // Use TLS v1.2 WRITE_MEMORY (ASLR (0x140580459), u8, 0x10); - // Disable F/G check - WRITE_MEMORY (ASLR (0x140CD4858), char, "./"); - - // Move various files to current directory - WRITE_MEMORY (ASLR (0x140C8AB60), char, "./"); // F:/ - WRITE_MEMORY (ASLR (0x140C8AB5C), char, "./"); // G:/ - WRITE_MEMORY (ASLR (0x140CD4DC0), char, ".\\Setting1.bin"); - WRITE_MEMORY (ASLR (0x140CD4DB0), char, ".\\Setting2.bin"); - WRITE_MEMORY (ASLR (0x140C95B40), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); - WRITE_MEMORY (ASLR (0x140C95B78), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); - WRITE_MEMORY (ASLR (0x140C95BB0), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); - WRITE_MEMORY (ASLR (0x140C95BE8), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); - WRITE_MEMORY (ASLR (0x140CC0508), char, ".\\Garmc\\BillingData\\GarmcBillingData.dat"); - WRITE_MEMORY (ASLR (0x140CC0538), char, ".\\Garmc\\BillingData\\GarmcBillingData.dat"); - WRITE_MEMORY (ASLR (0x140CC0660), char, ".\\Garmc\\BillingData\\GarmcOBillingData.dat"); - WRITE_MEMORY (ASLR (0x140CC0690), char, ".\\Garmc\\BillingData\\GarmcOBillingData.dat"); - WRITE_MEMORY (ASLR (0x140CC05E0), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcBillingNetIdLocationId.dat"); - WRITE_MEMORY (ASLR (0x140CC0620), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcBillingNetIdLocationId.dat"); - WRITE_MEMORY (ASLR (0x140CC0830), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcOBillingNetIdLocationId.dat"); - WRITE_MEMORY (ASLR (0x140CC0880), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcOBillingNetIdLocationId.dat"); - WRITE_MEMORY (ASLR (0x140CC06C0), char, ".\\Garmc\\ErrorLogData\\GarmcErrorLogData.dat"); - WRITE_MEMORY (ASLR (0x140CC06F0), char, ".\\Garmc\\ErrorLogData\\GarmcErrorLogData.dat"); - WRITE_MEMORY (ASLR (0x140CC0580), char, ".\\Garmc\\ErrorLogData\\GarmcOErrorLogData.dat"); - WRITE_MEMORY (ASLR (0x140CC05B0), char, ".\\Garmc\\ErrorLogData\\GarmcOErrorLogData.dat"); - // Remove datatable size limit ReplaceDatatableBufferAddresses (); @@ -511,15 +487,42 @@ Init () { auto amHandle = reinterpret_cast (GetModuleHandle ("AMFrameWork.dll")); INSTALL_FAST_HOOK_DYNAMIC (AMFWTerminate, reinterpret_cast (amHandle + 0x42DE0)); - // Move various files to current directory - WRITE_MEMORY (amHandle + 0x15252, u8, 0xEB); // CreditLogPathA - WRITE_MEMORY (amHandle + 0x15419, u8, 0xEB); // CreditLogPathB - WRITE_MEMORY (amHandle + 0x416DA, u8, 0xEB); // ErrorLogPathA - WRITE_MEMORY (amHandle + 0x41859, u8, 0xEB); // ErrorLogPathB - WRITE_MEMORY (amHandle + 0x41C21, u8, 0xEB); // CommonLogPathA - WRITE_MEMORY (amHandle + 0x41DA5, u8, 0xEB); // CommonLogPathB - WRITE_NOP (amHandle + 0x420F1, 0x05); // BackupDataPathA - WRITE_NOP (amHandle + 0x42167, 0x05); // BackupDataPathB + if (localFiles){ + // Disable F/G check + WRITE_MEMORY (ASLR (0x140CD4858), char, "./"); + + // Move various files to current directory + WRITE_MEMORY (ASLR (0x140C8AB60), char, "./"); // F:/ + WRITE_MEMORY (ASLR (0x140C8AB5C), char, "./"); // G:/ + WRITE_MEMORY (ASLR (0x140CD4DC0), char, ".\\Setting1.bin"); + WRITE_MEMORY (ASLR (0x140CD4DB0), char, ".\\Setting2.bin"); + WRITE_MEMORY (ASLR (0x140C95B40), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); + WRITE_MEMORY (ASLR (0x140C95B78), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); + WRITE_MEMORY (ASLR (0x140C95BB0), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); + WRITE_MEMORY (ASLR (0x140C95BE8), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); + WRITE_MEMORY (ASLR (0x140CC0508), char, ".\\Garmc\\BillingData\\GarmcBillingData.dat"); + WRITE_MEMORY (ASLR (0x140CC0538), char, ".\\Garmc\\BillingData\\GarmcBillingData.dat"); + WRITE_MEMORY (ASLR (0x140CC0660), char, ".\\Garmc\\BillingData\\GarmcOBillingData.dat"); + WRITE_MEMORY (ASLR (0x140CC0690), char, ".\\Garmc\\BillingData\\GarmcOBillingData.dat"); + WRITE_MEMORY (ASLR (0x140CC05E0), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcBillingNetIdLocationId.dat"); + WRITE_MEMORY (ASLR (0x140CC0620), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcBillingNetIdLocationId.dat"); + WRITE_MEMORY (ASLR (0x140CC0830), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcOBillingNetIdLocationId.dat"); + WRITE_MEMORY (ASLR (0x140CC0880), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcOBillingNetIdLocationId.dat"); + WRITE_MEMORY (ASLR (0x140CC06C0), char, ".\\Garmc\\ErrorLogData\\GarmcErrorLogData.dat"); + WRITE_MEMORY (ASLR (0x140CC06F0), char, ".\\Garmc\\ErrorLogData\\GarmcErrorLogData.dat"); + WRITE_MEMORY (ASLR (0x140CC0580), char, ".\\Garmc\\ErrorLogData\\GarmcOErrorLogData.dat"); + WRITE_MEMORY (ASLR (0x140CC05B0), char, ".\\Garmc\\ErrorLogData\\GarmcOErrorLogData.dat"); + + // Move various files to current directory + WRITE_MEMORY (amHandle + 0x15252, u8, 0xEB); // CreditLogPathA + WRITE_MEMORY (amHandle + 0x15419, u8, 0xEB); // CreditLogPathB + WRITE_MEMORY (amHandle + 0x416DA, u8, 0xEB); // ErrorLogPathA + WRITE_MEMORY (amHandle + 0x41859, u8, 0xEB); // ErrorLogPathB + WRITE_MEMORY (amHandle + 0x41C21, u8, 0xEB); // CommonLogPathA + WRITE_MEMORY (amHandle + 0x41DA5, u8, 0xEB); // CommonLogPathB + WRITE_NOP (amHandle + 0x420F1, 0x05); // BackupDataPathA + WRITE_NOP (amHandle + 0x42167, 0x05); // BackupDataPathB + } // Redirect garmc requests auto garmcHandle = reinterpret_cast (GetModuleHandle ("garmc.dll"));