Fix game freezing at dw start + correct pointer

This commit is contained in:
Federico Cecchetto 2022-02-26 23:53:05 +01:00
parent e93ac3a906
commit a4f82c66f7
3 changed files with 5 additions and 15 deletions

View File

@ -585,6 +585,8 @@ namespace demonware
utils::hook::set(0x140728E90, 0xC301B0); utils::hook::set(0x140728E90, 0xC301B0);
// Update check // Update check
utils::hook::set(0x1403A5390, 0xC301B0); utils::hook::set(0x1403A5390, 0xC301B0);
utils::hook::nop(0x14057DBC5, 5);
} }
void pre_destroy() override void pre_destroy() override

View File

@ -17,8 +17,6 @@ namespace patches
{ {
namespace namespace
{ {
utils::hook::detour live_get_local_client_name_hook;
const char* live_get_local_client_name() const char* live_get_local_client_name()
{ {
return game::Dvar_FindVar("name")->current.string; return game::Dvar_FindVar("name")->current.string;
@ -157,7 +155,7 @@ namespace patches
return; return;
} }
reinterpret_cast<void(*)(game::mp::client_t*, game::msg_t*)>(0x14043AA90)(client, msg); reinterpret_cast<void(*)(game::mp::client_t*, game::msg_t*)>(0x140481A00)(client, msg);
} }
} }
@ -188,11 +186,7 @@ namespace patches
dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub); dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub);
if (game::environment::is_sp) if (game::environment::is_mp())
{
}
else
{ {
patch_mp(); patch_mp();
} }
@ -201,7 +195,7 @@ namespace patches
static void patch_mp() static void patch_mp()
{ {
// Use name dvar // 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 // Patch SV_KickClientNum
sv_kick_client_num_hook.create(0x14047ED00, &sv_kick_client_num); // H1(1.4) sv_kick_client_num_hook.create(0x14047ED00, &sv_kick_client_num); // H1(1.4)

View File

@ -7,12 +7,6 @@ namespace steam
{ {
const char* friends::GetPersonaName() const char* friends::GetPersonaName()
{ {
static const auto* name = game::Dvar_FindVar("name");
if (name)
{
return name->current.string;
}
return "1337"; return "1337";
} }