From f09756946f336a0790a7bfca60915583a9ab9f00 Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Sat, 14 Sep 2024 14:55:27 +0800 Subject: [PATCH] add ForceNoMemRestrict --- data/plugins/GTAIV.EFLC.FusionFix.ini | 1 + source/extrainfo.ixx | 10 ++++++++++ source/fixes.ixx | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/data/plugins/GTAIV.EFLC.FusionFix.ini b/data/plugins/GTAIV.EFLC.FusionFix.ini index 9027ea95..efcb66a9 100644 --- a/data/plugins/GTAIV.EFLC.FusionFix.ini +++ b/data/plugins/GTAIV.EFLC.FusionFix.ini @@ -1,6 +1,7 @@ [MAIN] RecoilFix = 1 AimingZoomFix = 1 +ForceNoMemRestrict = 1 // forces -nomemrestrict commandline parameter, necessary if playing with high draw distance sliders to prevent pop-in [SHADOWS] ExtraDynamicShadows = 2 // adds some missing shadows | 1: for fences and grates | 2: for fences, grates and vegetation diff --git a/source/extrainfo.ixx b/source/extrainfo.ixx index 58ffef94..48bbd175 100644 --- a/source/extrainfo.ixx +++ b/source/extrainfo.ixx @@ -1,6 +1,7 @@ module; #include +#include export module extrainfo; @@ -24,6 +25,8 @@ 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""; @@ -45,6 +48,13 @@ public: auto FF_WARN0 = CText::getText("FF_WARN0"); extra += (FF_WARN0[0] ? FF_WARN0 : L"~p~IMG Files:") + std::wstring(L" ") + std::to_wstring(imgNum) + L" / " + std::to_wstring(imgArrSize); + + ::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"; + } + auto FF_WARN1 = CText::getText("FF_WARN1"); if (imgNum >= imgArrSize) extra += FF_WARN1[0] ? FF_WARN1 : L"; ~r~WARNING: 255 IMG limit exceeded, will cause streaming issues."; diff --git a/source/fixes.ixx b/source/fixes.ixx index 40b8425f..c1a35697 100644 --- a/source/fixes.ixx +++ b/source/fixes.ixx @@ -64,6 +64,7 @@ public: int32_t nAimingZoomFix = iniReader.ReadInteger("MAIN", "AimingZoomFix", 1); bool bRecoilFix = iniReader.ReadInteger("MAIN", "RecoilFix", 1) != 0; + bool bForceNoMemRestrict = iniReader.ReadInteger("MAIN", "ForceNoMemRestrict", 1) != 0; //[MISC] bool bDefaultCameraAngleInTLAD = iniReader.ReadInteger("MISC", "DefaultCameraAngleInTLAD", 0) != 0; @@ -473,6 +474,21 @@ 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