From df3fdb79917d3b57de8bf08a0de169577e3695d9 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sun, 22 May 2022 00:38:15 +0200 Subject: [PATCH] Fix crash on map rotation --- src/client/component/dedicated.cpp | 3 --- src/client/component/patches.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 46f5f402..bb4dda0b 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -316,9 +316,6 @@ namespace dedicated // Workaround for server spamming 'exec default_xboxlive.cfg' when not running ui_set_active_menu_hook.create(0x1E4D80_b, ui_set_active_menu_stub); - // Dont free server client memory on asset loading - utils::hook::nop(0x132474_b, 5); - // initialize the game after onlinedataflags is 32 (workaround) scheduler::schedule([=]() { diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 65bc2af9..d7dbd62c 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -124,10 +124,10 @@ namespace patches command::params_sv params{}; const auto menu_id = atoi(params.get(1)); - const auto client = svs_clients[ent->s.entityNum]; + const auto client = &svs_clients[ent->s.entityNum]; // 22 => "end_game" - if (menu_id == 22 && client.header.remoteAddress.type != game::NA_LOOPBACK) + if (menu_id == 22 && client->header.remoteAddress.type != game::NA_LOOPBACK) { return; } @@ -308,6 +308,9 @@ namespace patches // Change default hostname and make it replicated dvars::override::register_string("sv_hostname", "^2H1-Mod^7 Default Server", game::DVAR_FLAG_REPLICATED); + + // Dont free server/client memory on asset loading (fixes crashing on map rotation) + utils::hook::nop(0x132474_b, 5); } }; }