From e198af0d6dbaf6b88cdbf7f496ca29133bf60cc3 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sat, 25 Jun 2022 03:05:42 +0200 Subject: [PATCH] Fix gamepad related crash --- src/client/component/patches.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 343254e5..a025dae8 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -169,6 +169,15 @@ namespace patches { return 1; } + + utils::hook::detour cl_gamepad_scrolling_buttons_hook; + void cl_gamepad_scrolling_buttons_stub(int local_client_num, int a2) + { + if (local_client_num <= 3) + { + cl_gamepad_scrolling_buttons_hook.invoke(local_client_num, a2); + } + } } class component final : public component_interface @@ -302,6 +311,9 @@ namespace patches // Dont free server/client memory on asset loading (fixes crashing on map rotation) utils::hook::nop(0x132474_b, 5); + + // Fix gamepad related crash + cl_gamepad_scrolling_buttons_hook.create(0x133210_b, cl_gamepad_scrolling_buttons_stub); } }; }