Skip to content

Commit

Permalink
simplify ram usage info
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Sep 14, 2024
1 parent 9bd22f5 commit e293747
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
4 changes: 1 addition & 3 deletions source/extrainfo.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t*>("89 1D ? ? ? ? 89 2D ? ? ? ? 85 FF", 2);

static auto PauseHook = safetyhook::create_mid(pattern.get_first(0), [](SafetyHookContext& regs)
{
static std::wstring extra = L"";
Expand All @@ -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");
Expand Down
31 changes: 16 additions & 15 deletions source/fixes.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>(pattern.get_first(0), 0xE990, true); // jnz -> jmp
}
else
{
pattern = find_pattern("75 7E A1 ? ? ? ? 85 C0");
if (!pattern.empty())
injector::WriteMemory<uint8_t>(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)
Expand Down Expand Up @@ -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<uint16_t>(pattern.get_first(0), 0xE990, true); // jnz -> jmp
}
else
{
pattern = find_pattern("75 7E A1 ? ? ? ? 85 C0");
if (!pattern.empty())
injector::WriteMemory<uint8_t>(pattern.get_first(0), 0xEB, true); // jnz -> jmp
}
}
};
}
} Fixes;

0 comments on commit e293747

Please sign in to comment.