From d7e3d1d45f0d9b58a00d6321761fc2461a4f68f8 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Tue, 1 Mar 2022 21:38:16 +0100 Subject: [PATCH] Memory fix flag --- src/client/component/patches.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 1bea10b2..e8897ce5 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -2,18 +2,18 @@ #include "loader/component_loader.hpp" #include "dvars.hpp" +#include "version.h" +#include "command.hpp" +#include "console.hpp" +#include "network.hpp" +#include "scheduler.hpp" #include "game/game.hpp" #include "game/dvars.hpp" #include #include -#include - -#include "version.h" -#include -#include -#include +#include namespace patches { @@ -258,6 +258,16 @@ namespace patches // Prevent clients from sending invalid reliableAcknowledge // utils::hook::call(0x1404899C6, sv_execute_client_message_stub); // H1(1.4) + + // "fix" for rare 'Out of memory error' error + if (utils::flags::has_flag("memoryfix")) + { + utils::hook::jump(0x140578BE0, malloc); + utils::hook::jump(0x140578B00, _aligned_malloc); + utils::hook::jump(0x140578C40, free); + utils::hook::jump(0x140578D30, realloc); + utils::hook::jump(0x140578B60, _aligned_realloc); + } } }; }