From e293747e014dace91186f5718322a3f82b255c4f Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Sat, 14 Sep 2024 23:54:48 +0800 Subject: [PATCH] simplify ram usage info --- source/extrainfo.ixx | 4 +--- source/fixes.ixx | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/source/extrainfo.ixx b/source/extrainfo.ixx index 48bbd175..d74da0b4 100644 --- a/source/extrainfo.ixx +++ b/source/extrainfo.ixx @@ -25,8 +25,6 @@ public: auto pattern = hook::pattern("F3 0F 10 44 24 ? 6A FF 6A FF 50 83 EC 08 F3 0F 11 44 24 ? F3 0F 10 44 24 ? F3 0F 11 04 24 E8 ? ? ? ? 83 C4 14"); if (!pattern.empty()) { - static auto dword_1BB5538 = *hook::get_pattern("89 1D ? ? ? ? 89 2D ? ? ? ? 85 FF", 2); - static auto PauseHook = safetyhook::create_mid(pattern.get_first(0), [](SafetyHookContext& regs) { static std::wstring extra = L""; @@ -52,7 +50,7 @@ public: ::PROCESS_MEMORY_COUNTERS pmc; if (::GetProcessMemoryInfo(::GetCurrentProcess(), &pmc, sizeof(pmc))) { - extra += L"; RAM: " + std::to_wstring(pmc.WorkingSetSize / 1000 / 1000) + L" / " + std::to_wstring(*dword_1BB5538 / 1000 / 1000) + L" MB"; + extra += L"; RAM: " + std::to_wstring(pmc.WorkingSetSize / 1000 / 1000) + L" MB"; } auto FF_WARN1 = CText::getText("FF_WARN1"); diff --git a/source/fixes.ixx b/source/fixes.ixx index c1a35697..12d65de5 100644 --- a/source/fixes.ixx +++ b/source/fixes.ixx @@ -206,6 +206,22 @@ public: auto sub_477300 = injector::GetBranchDestination(pattern.get_first(0)); pattern = find_pattern("E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? 83 C4 2C C3", "E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? 8B 35 ? ? ? ? E8 ? ? ? ? 25 FF FF 00 00"); injector::MakeCALL(pattern.get_first(0), sub_477300, true); + + // related to the same issue + if (bForceNoMemRestrict) + { + pattern = find_pattern("0F 85 ? ? ? ? A1 ? ? ? ? 85 C0 74 5C", "0F 85 ? ? ? ? A1 ? ? ? ? 85 C0 74 5A"); + if (!pattern.empty()) + { + injector::WriteMemory(pattern.get_first(0), 0xE990, true); // jnz -> jmp + } + else + { + pattern = find_pattern("75 7E A1 ? ? ? ? 85 C0"); + if (!pattern.empty()) + injector::WriteMemory(pattern.get_first(0), 0xEB, true); // jnz -> jmp + } + } } // Make LOD lights appear at the appropriate time like on the console version (consoles: 7 PM, pc: 10 PM) @@ -474,21 +490,6 @@ public: } } } - - if (bForceNoMemRestrict) - { - auto pattern = find_pattern("0F 85 ? ? ? ? A1 ? ? ? ? 85 C0 74 5C", "0F 85 ? ? ? ? A1 ? ? ? ? 85 C0 74 5A"); - if (!pattern.empty()) - { - injector::WriteMemory(pattern.get_first(0), 0xE990, true); // jnz -> jmp - } - else - { - pattern = find_pattern("75 7E A1 ? ? ? ? 85 C0"); - if (!pattern.empty()) - injector::WriteMemory(pattern.get_first(0), 0xEB, true); // jnz -> jmp - } - } }; } } Fixes; \ No newline at end of file