From 03e5a9b00fa7af3c17c7e901326bba0b45ad76c0 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Wed, 17 Aug 2022 03:06:56 +0200 Subject: [PATCH] Fix vid_restart/snd_restart crashing --- src/client/component/patches.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 0719a188..955d2229 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -57,6 +57,23 @@ namespace patches return dvar_register_float_hook.invoke(hash, dvarName, value, min, max, flags); } + + void free_lui_memory() + { + utils::hook::invoke(0x14032A540); // properly free lui memory + } + + void vid_restart_stub_1() + { + free_lui_memory(); + utils::hook::invoke(0x1405A6480); + } + + void vid_restart_stub_2() + { + free_lui_memory(); + utils::hook::invoke(0x1406B5290); + } } class component final : public component_interface @@ -92,6 +109,10 @@ namespace patches game::DVAR_FLAG_SAVED, "Scale applied to the field of view"); dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub); + + // fix vid_restart crashing + utils::hook::call(0x1403D7413, vid_restart_stub_1); + utils::hook::jump(0x1403D7402, vid_restart_stub_2); } }; }