Skip to content

Commit

Permalink
Add heap size patch
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Apr 18, 2024
1 parent 472cbce commit e01f25b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/modules/Patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ Patches::Patches()
MH_CreateHook((void*)GET_ADDRESS(0x4642F0, 0x467E60, 0x000000), MakePeHandle, nullptr);
#endif

if (m_heapSize.GetValue() > 0)
{
PatchHeapSize();
}

// Insert DeathState hooks
MH_CreateHook((void*)GET_ADDRESS(0x55DEC0, 0x5581D0, 0x75AA50), DeathState_Entry, (void**)&s_DeathState_Entry);
MH_CreateHook((void*)GET_ADDRESS(0x56EC70, 0x5699C0, 0x75AF90), DeathState_Process, (void**)&s_DeathState_Process);
Expand All @@ -117,6 +122,15 @@ void Patches::RemoveIntro() const noexcept
Hooking::Patch(match.get_first(2), mainState);
}

void Patches::PatchHeapSize() const noexcept
{
auto match = hook::pattern("68 00 00 00 10 6A 00 C7 06").count(1);
auto size = m_heapSize.GetValue();

Hooking::Patch(match.get_first(1), size);
Hooking::Patch(match.get_first(19), size);
}

void Patches::OnInput(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Remove the quit message
Expand Down
3 changes: 3 additions & 0 deletions src/modules/Patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class Patches : public Module
Option<bool> m_noCinematicBars{ "NoCinematicBars", true };
Option<bool> m_noMotionBlur{ "NoMotionBlur", false };

Option<unsigned int> m_heapSize{ "HeapSize", 0 };

void RemoveIntro() const noexcept;
void PatchHeapSize() const noexcept;

public:
Patches();
Expand Down

0 comments on commit e01f25b

Please sign in to comment.