From 046383747c8a26c6c807f19f0460e4800ae18516 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sat, 26 Feb 2022 23:53:05 +0100 Subject: [PATCH] Fix game freezing at dw start + correct pointer --- src/client/component/demonware.cpp | 2 ++ src/client/component/patches.cpp | 12 +++--------- src/client/steam/interfaces/friends.cpp | 6 ------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index b745023b..acbe1394 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -585,6 +585,8 @@ namespace demonware utils::hook::set(0x140728E90, 0xC301B0); // Update check utils::hook::set(0x1403A5390, 0xC301B0); + + utils::hook::nop(0x14057DBC5, 5); } void pre_destroy() override diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 539a9ac4..e7442f7b 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -17,8 +17,6 @@ namespace patches { namespace { - utils::hook::detour live_get_local_client_name_hook; - const char* live_get_local_client_name() { return game::Dvar_FindVar("name")->current.string; @@ -157,7 +155,7 @@ namespace patches return; } - reinterpret_cast(0x14043AA90)(client, msg); + reinterpret_cast(0x140481A00)(client, msg); } } @@ -188,11 +186,7 @@ namespace patches dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub); - if (game::environment::is_sp) - { - - } - else + if (game::environment::is_mp()) { patch_mp(); } @@ -201,7 +195,7 @@ namespace patches static void patch_mp() { // Use name dvar - live_get_local_client_name_hook.create(0x14050FF90, &live_get_local_client_name); // H1(1.4) + utils::hook::jump(0x14050FF90, &live_get_local_client_name); // H1(1.4) // Patch SV_KickClientNum sv_kick_client_num_hook.create(0x14047ED00, &sv_kick_client_num); // H1(1.4) diff --git a/src/client/steam/interfaces/friends.cpp b/src/client/steam/interfaces/friends.cpp index 26dfe18c..8c29dd26 100644 --- a/src/client/steam/interfaces/friends.cpp +++ b/src/client/steam/interfaces/friends.cpp @@ -7,12 +7,6 @@ namespace steam { const char* friends::GetPersonaName() { - static const auto* name = game::Dvar_FindVar("name"); - if (name) - { - return name->current.string; - } - return "1337"; }