From bde65eec2033064935e3eee072df5686be264477 Mon Sep 17 00:00:00 2001 From: esuo1198 <54134.es@gmail.com> Date: Sun, 24 Sep 2023 01:35:01 +0900 Subject: [PATCH] cleanup --- src/dllmain.cpp | 4 ++-- src/patches/cn_jun_2023.cpp | 6 +++--- src/patches/jp_nov_2020.cpp | 25 ++++++++++++------------- src/patches/qr.cpp | 14 +++++++++----- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 575c476..d69bc4d 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -114,9 +114,9 @@ DllMain (HMODULE module, DWORD reason, LPVOID reserved) { auto configPath = std::filesystem::current_path () / "config.toml"; toml_table_t *config = openConfig (configPath); if (config) { - auto amauth = openConfigSection(config, "amauth"); + auto amauth = openConfigSection (config, "amauth"); if (amauth) { - server = readConfigString(amauth, "server", server); + server = readConfigString (amauth, "server", server); } toml_free (config); } diff --git a/src/patches/cn_jun_2023.cpp b/src/patches/cn_jun_2023.cpp index 6b0e117..2a2ce05 100644 --- a/src/patches/cn_jun_2023.cpp +++ b/src/patches/cn_jun_2023.cpp @@ -22,8 +22,8 @@ HOOK (i32, HaspRead, PROC_ADDRESS ("hasp_windows_x64.dll", "hasp_read"), i32, i3 void Init () { - i32 xRes = 1360; - i32 yRes = 768; + i32 xRes = 1920; + i32 yRes = 1080; bool unlockSongs = true; bool sharedAudio = true; bool vsync = false; @@ -48,7 +48,7 @@ Init () { auto configPath = std::filesystem::current_path () / "config.toml"; toml_table_t *config = openConfig (configPath); if (config) { - auto patches = openConfigSection(config, "patches"); + auto patches = openConfigSection (config, "patches"); if (patches) { auto res = openConfigSection (patches, "res"); if (res) { diff --git a/src/patches/jp_nov_2020.cpp b/src/patches/jp_nov_2020.cpp index e513385..cbd8010 100644 --- a/src/patches/jp_nov_2020.cpp +++ b/src/patches/jp_nov_2020.cpp @@ -13,8 +13,8 @@ void *song_data; namespace patches::JP_NOV_2020 { void Init () { - i32 xRes = 1360; - i32 yRes = 768; + i32 xRes = 1920; + i32 yRes = 1080; bool unlockSongs = true; bool sharedAudio = true; bool vsync = false; @@ -22,7 +22,7 @@ Init () { auto configPath = std::filesystem::current_path () / "config.toml"; toml_table_t *config = openConfig (configPath); if (config) { - auto patches = openConfigSection(config, "patches"); + auto patches = openConfigSection (config, "patches"); if (patches) { auto res = openConfigSection (patches, "res"); if (res) { @@ -119,18 +119,17 @@ Init () { } // Move various files to current directory - auto amHandle = GetModuleHandle ("AMFrameWork.dll"); - WRITE_MEMORY ((u64)amHandle + 0x33EF7, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x3404A, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x34429, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x3457C, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x3497A, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x34ACD, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x148AF, u8, 0xEB); - WRITE_MEMORY ((u64)amHandle + 0x14A1A, u8, 0xEB); + auto amHandle = reinterpret_cast (GetModuleHandle ("AMFrameWork.dll")); + WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x34429, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x3457C, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x3497A, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x34ACD, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x148AF, u8, 0xEB); + WRITE_MEMORY (amHandle + 0x14A1A, u8, 0xEB); patches::Qr::Init (); - patches::AmAuth::Init (); } } // namespace patches::JP_NOV_2020 diff --git a/src/patches/qr.cpp b/src/patches/qr.cpp index 8f457b2..c31bbf2 100644 --- a/src/patches/qr.cpp +++ b/src/patches/qr.cpp @@ -17,10 +17,13 @@ enum class State { Ready, CopyWait, AfterCopy1, - AfterCopy2, + AfterCopy2 }; -enum class Mode { Card, Data }; +enum class Mode { + Card, + Data +}; State gState = State::Ready; Mode gMode = Mode::Card; @@ -72,11 +75,11 @@ HOOK_DYNAMIC (int64_t, __fastcall, copy_data, int64_t this_, void *dest, int len if (gMode == Mode::Card) { std::string card = ""; if (config) { - auto qr = openConfigSection(config, "qr"); + auto qr = openConfigSection (config, "qr"); if (qr) { - card = readConfigString(qr, "card", ""); + card = readConfigString (qr, "card", ""); } - toml_free(config); + toml_free (config); } memcpy (dest, card.c_str (), card.size () + 1); @@ -97,6 +100,7 @@ HOOK_DYNAMIC (int64_t, __fastcall, copy_data, int64_t this_, void *dest, int len songNoes = readConfigIntArray (data, "song_no", songNoes); } } + toml_free (config); } BYTE serial_length = static_cast (serial.size ());