From 1d8eab6490a653f00a5ff90bd1efbf75cf005b53 Mon Sep 17 00:00:00 2001 From: Skull Merlin <86374920+skkuull@users.noreply.github.com> Date: Wed, 9 Mar 2022 19:33:00 +0200 Subject: [PATCH] small cleanup --- src/client/component/demonware.cpp | 27 +++++------- src/client/component/fps.cpp | 2 +- src/client/component/input.cpp | 4 +- src/client/component/lui.cpp | 2 +- src/client/component/network.cpp | 66 ++++++++++++++--------------- src/client/component/patches.cpp | 34 +++++++-------- src/client/component/slowmotion.cpp | 2 +- src/client/component/splash.cpp | 6 +-- src/client/component/videos.cpp | 2 +- 9 files changed, 70 insertions(+), 75 deletions(-) diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index 4cb3362c..d74889a5 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -537,34 +537,29 @@ namespace demonware void post_unpack() override { - /* - mwr has upgraded some networking methods and the gethostbyname import from winsock library is no longer used - gethostbyname has been replaced with getaddrinfo - btw, still you can't get online.. - */ - utils::hook::jump(SELECT_VALUE(0x140610320, 0x1407400B0), bd_logger_stub); // H1MP64(1.4) + utils::hook::jump(SELECT_VALUE(0x140610320, 0x1407400B0), bd_logger_stub); if (game::environment::is_sp()) { - utils::hook::set(0x1405FCA00, 0xC3); // bdAuthSteam H1(1.4) - utils::hook::set(0x140333A00, 0xC3); // dwNet H1(1.4) + utils::hook::set(0x1405FCA00, 0xC3); // bdAuthSteam + utils::hook::set(0x140333A00, 0xC3); // dwNet return; } - utils::hook::set(0x140715039, 0x0); // CURLOPT_SSL_VERIFYPEER H1MP64(1.4) - utils::hook::set(0x140715025, 0xAF); // CURLOPT_SSL_VERIFYHOST H1MP64(1.4) - utils::hook::set(0x14095433C, 0x0); // HTTPS -> HTTP [MWR OK][S1X: 0x14088D0E8] + utils::hook::set(0x140715039, 0x0); // CURLOPT_SSL_VERIFYPEER + utils::hook::set(0x140715025, 0xAF); // CURLOPT_SSL_VERIFYHOST + utils::hook::set(0x14095433C, 0x0); // HTTPS -> HTTP //HTTPS -> HTTP - utils::hook::inject(0x14006DDA9, "http://prod.umbrella.demonware.net/v1.0/"); // ---> [H1MP1.4 - S1X: 0x14003852E] - utils::hook::inject(0x14006E11C, "http://prod.umbrella.demonware.net/v1.0/"); // ---> [H1MP1.4 - S1X: 0x14003884F] - utils::hook::inject(0x14006E2FB, "http://prod.umbrella.demonware.net/v1.0/"); // ---> [H1MP1.4 - S1X: 0x140038A07] + utils::hook::inject(0x14006DDA9, "http://prod.umbrella.demonware.net/v1.0/"); + utils::hook::inject(0x14006E11C, "http://prod.umbrella.demonware.net/v1.0/"); + utils::hook::inject(0x14006E2FB, "http://prod.umbrella.demonware.net/v1.0/"); utils::hook::inject(0x14006E9A9, "http://prod.uno.demonware.net/v1.0/"); utils::hook::inject(0x14006ED49, "http://prod.uno.demonware.net/v1.0/"); utils::hook::inject(0x140728170, "http://%s:%d/auth/"); - utils::hook::set(0x14047F290, 0xC3); // SV_SendMatchData H1MP64(1.4) - utils::hook::set(0x140598990, 0xC3); // Live_CheckForFullDisconnect H1MP64(1.4) + utils::hook::set(0x14047F290, 0xC3); // SV_SendMatchData + utils::hook::set(0x140598990, 0xC3); // Live_CheckForFullDisconnect #ifdef DEBUG // yes diff --git a/src/client/component/fps.cpp b/src/client/component/fps.cpp index a0ea9299..f0a62b69 100644 --- a/src/client/component/fps.cpp +++ b/src/client/component/fps.cpp @@ -88,7 +88,7 @@ namespace fps perf_calc_fps(&cg_perf, cg_perf.frame_ms); - utils::hook::invoke(SELECT_VALUE(0x1405487A0, 0x1406575A0)); // H1(1.4) + utils::hook::invoke(SELECT_VALUE(0x1405487A0, 0x1406575A0)); } void cg_draw_fps() diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index 4fc59741..a10ac12a 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -45,8 +45,8 @@ namespace input return; } - cl_char_event_hook.create(SELECT_VALUE(0x1401871A0, 0x14024E810), cl_char_event_stub); // H1(1.4) - cl_key_event_hook.create(SELECT_VALUE(0x1401874D0, 0x14024EA60), cl_key_event_stub); // H1(1.4) + cl_char_event_hook.create(SELECT_VALUE(0x1401871A0, 0x14024E810), cl_char_event_stub); + cl_key_event_hook.create(SELECT_VALUE(0x1401874D0, 0x14024EA60), cl_key_event_stub); } }; } diff --git a/src/client/component/lui.cpp b/src/client/component/lui.cpp index d3a7edca..9bc87113 100644 --- a/src/client/component/lui.cpp +++ b/src/client/component/lui.cpp @@ -16,7 +16,7 @@ namespace lui void post_unpack() override { // Don't show create cod account popup - //utils::hook::set(0x14017C957, 0); // H1(1.4) + //utils::hook::set(0x14017C957, 0); //#ifdef _DEBUG // Enable development menus (causes issues in sp) diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 47ca2b20..353f8ee1 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -67,11 +67,11 @@ namespace network // Command handled a.popad64(); a.mov(al, 1); - a.jmp(0x140252AF8); // H1MP64(1.4) + a.jmp(0x140252AF8); a.bind(return_unhandled); a.popad64(); - a.jmp(0x14025234C); // H1MP64(1.4) + a.jmp(0x14025234C); } int net_compare_base_address(const game::netadr_s* a1, const game::netadr_s* a2) @@ -237,46 +237,46 @@ namespace network // redirect dw_sendto to raw socket //utils::hook::jump(0x1404D850A, reinterpret_cast(0x1404D849A)); - utils::hook::call(0x140513467, dw_send_to_stub); // H1MP64(1.4) - utils::hook::jump(game::Sys_SendPacket, dw_send_to_stub); // H1MP64(1.4) + utils::hook::call(0x140513467, dw_send_to_stub); + utils::hook::jump(game::Sys_SendPacket, dw_send_to_stub); // intercept command handling - utils::hook::jump(0x140252327, utils::hook::assemble(handle_command_stub), true); // H1MP64(1.4) + utils::hook::jump(0x140252327, utils::hook::assemble(handle_command_stub), true); // handle xuid without secure connection - utils::hook::nop(0x140486AAF, 6); // H1MP64(1.4) + utils::hook::nop(0x140486AAF, 6); - utils::hook::jump(0x140424F20, net_compare_address); // H1MP64(1.4) - utils::hook::jump(0x140424F70, net_compare_base_address); // H1MP64(1.4) + utils::hook::jump(0x140424F20, net_compare_address); + utils::hook::jump(0x140424F70, net_compare_base_address); // don't establish secure conenction - utils::hook::set(0x14027EA4D, 0xEB); // H1MP64(1.4) - utils::hook::set(0x14027EB1E, 0xEB); // H1MP64(1.4) - utils::hook::set(0x14027EF8D, 0xEB); // H1MP64(1.4) - utils::hook::set(0x14025081F, 0xEB); // H1MP64(1.4) + utils::hook::set(0x14027EA4D, 0xEB); + utils::hook::set(0x14027EB1E, 0xEB); + utils::hook::set(0x14027EF8D, 0xEB); + utils::hook::set(0x14025081F, 0xEB); // ignore unregistered connection - utils::hook::jump(0x140480F46, 0x140480EE5); // H1MP64(1.4) - utils::hook::set(0x140480F3B, 0xEB); // H1MP64(1.4) + utils::hook::jump(0x140480F46, 0x140480EE5); + utils::hook::set(0x140480F3B, 0xEB); // disable xuid verification - utils::hook::set(0x14005B62D, 0xEB); // H1MP64(1.4) - utils::hook::set(0x14005B649, 0xEB); // H1MP64(1.4) + utils::hook::set(0x14005B62D, 0xEB); + utils::hook::set(0x14005B649, 0xEB); // disable xuid verification utils::hook::nop(0x14048382C, 2); - utils::hook::set(0x140483889, 0xEB); // H1MP64(1.4) + utils::hook::set(0x140483889, 0xEB); // ignore configstring mismatch - utils::hook::set(0x1402591C9, 0xEB); // H1MP64(1.4) + utils::hook::set(0x1402591C9, 0xEB); // ignore dw handle in SV_PacketEvent utils::hook::set(0x1404898E2, 0xEB); - utils::hook::call(0x1404898D6, &net_compare_address); // H1MP64(1.4) + utils::hook::call(0x1404898D6, &net_compare_address); // ignore dw handle in SV_FindClientByAddress utils::hook::set(0x140488EFD, 0xEB); - utils::hook::call(0x140488EF1, &net_compare_address); // H1MP64(1.4) + utils::hook::call(0x140488EF1, &net_compare_address); // ignore dw handle in SV_DirectConnect utils::hook::set(0x140480C58, 0xEB); @@ -291,32 +291,32 @@ namespace network dvars::override::register_int("sv_remote_client_snapshot_msec", 33, 33, 100, game::DVAR_FLAG_NONE); // ignore impure client - utils::hook::jump(0x140481B58, reinterpret_cast(0x140481BEE)); // H1MP64(1.4) + utils::hook::jump(0x140481B58, reinterpret_cast(0x140481BEE)); // don't send checksum - utils::hook::set(0x140513433, 0); // H1MP64(1.4) mov: r8d, edi ; LEN - utils::hook::set(0x14051345A, 0); // H1MP64(1.4) + utils::hook::set(0x140513433, 0); + utils::hook::set(0x14051345A, 0); // don't read checksum - utils::hook::set(0x1404F6620, 0xC301B0); // H1MP64(1.4) + utils::hook::set(0x1404F6620, 0xC301B0); // don't try to reconnect client - utils::hook::call(0x140480DFF, reconnect_migratated_client); // H1MP64(1.4) - utils::hook::nop(0x140480DDB, 4); // H1MP64(1.4) this crashes when reconnecting for some reason + utils::hook::call(0x140480DFF, reconnect_migratated_client); + utils::hook::nop(0x140480DDB, 4); // this crashes when reconnecting for some reason // allow server owner to modify net_port before the socket bind - utils::hook::call(0x140512BE5, register_netport_stub); // H1MP64(1.4) - utils::hook::call(0x140512D20, register_netport_stub); // H1MP64(1.4) + utils::hook::call(0x140512BE5, register_netport_stub); + utils::hook::call(0x140512D20, register_netport_stub); // increase allowed packet size const auto max_packet_size = 0x20000; - utils::hook::set(0x1404255F1, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x140425630, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x140425522, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x140425545, max_packet_size); // H1MP64(1.4) + utils::hook::set(0x1404255F1, max_packet_size); + utils::hook::set(0x140425630, max_packet_size); + utils::hook::set(0x140425522, max_packet_size); + utils::hook::set(0x140425545, max_packet_size); // ignore built in "print" oob command and add in our own - utils::hook::set(0x14025280E, 0xEB); // H1MP64(1.4) + utils::hook::set(0x14025280E, 0xEB); on("print", [](const game::netadr_s&, const std::string_view& data) { const std::string message{data}; diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 75406f95..3d86b406 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -161,10 +161,10 @@ namespace patches void post_unpack() override { // Register dvars - com_register_dvars_hook.create(SELECT_VALUE(0x140351B80, 0x1400D9320), &com_register_dvars_stub); // H1(1.4) + com_register_dvars_hook.create(SELECT_VALUE(0x140351B80, 0x1400D9320), &com_register_dvars_stub); // Unlock fps in main menu - utils::hook::set(SELECT_VALUE(0x14018D47B, 0x14025B86B), 0xEB); // H1(1.4) + utils::hook::set(SELECT_VALUE(0x14018D47B, 0x14025B86B), 0xEB); if (!game::environment::is_dedi()) { @@ -197,16 +197,16 @@ namespace patches static void patch_mp() { // Use name dvar - utils::hook::jump(0x14050FF90, &live_get_local_client_name); // H1(1.4) + utils::hook::jump(0x14050FF90, &live_get_local_client_name); // 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); // block changing name in-game - utils::hook::set(0x14047FC90, 0xC3); // H1(1.4) + utils::hook::set(0x14047FC90, 0xC3); // patch "Couldn't find the bsp for this map." error to not be fatal in mp - utils::hook::call(0x1402BA26B, bsp_sys_error_stub); // H1(1.4) + utils::hook::call(0x1402BA26B, bsp_sys_error_stub); // client side aim assist dvar dvars::aimassist_enabled = dvars::register_bool("aimassist_enabled", true, @@ -215,12 +215,12 @@ namespace patches utils::hook::call(0x14009EE9E, aim_assist_add_to_target_list); // unlock all items - utils::hook::jump(0x140413E60, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable_LocalClient H1(1.4) - utils::hook::jump(0x140413860, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable H1(1.4) - utils::hook::jump(0x140412B70, is_item_unlocked); // idk ( unlocks loot etc ) H1(1.4) + utils::hook::jump(0x140413E60, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable_LocalClient + utils::hook::jump(0x140413860, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable + utils::hook::jump(0x140412B70, is_item_unlocked); // idk ( unlocks loot etc ) // isProfanity - utils::hook::set(0x1402877D0, 0xC3C033); // MAY BE WRONG H1(1.4) + utils::hook::set(0x1402877D0, 0xC3C033); // disable emblems dvars::override::register_int("emblems_active", 0, 0, 0, game::DVAR_FLAG_NONE); @@ -228,16 +228,16 @@ namespace patches // disable elite_clan dvars::override::register_int("elite_clan_active", 0, 0, 0, game::DVAR_FLAG_NONE); - utils::hook::set(0x140585680, 0xC3); // don't register commands H1(1.4) + utils::hook::set(0x140585680, 0xC3); // don't register commands // disable codPointStore dvars::override::register_int("codPointStore_enabled", 0, 0, 0, game::DVAR_FLAG_NONE); // don't register every replicated dvar as a network dvar - utils::hook::nop(0x14039E58E, 5); // dvar_foreach H1(1.4) + utils::hook::nop(0x14039E58E, 5); // dvar_foreach // patch "Server is different version" to show the server client version - utils::hook::inject(0x140480952, VERSION); // H1(1.4) + utils::hook::inject(0x140480952, VERSION); // prevent servers overriding our fov utils::hook::call(0x14023279E, set_client_dvar_from_server_stub); @@ -246,8 +246,8 @@ namespace patches utils::hook::set(0x14021D22A, 0xEB); // unlock safeArea_* - utils::hook::jump(0x1402624F5, 0x140262503); // H1(1.4) - utils::hook::jump(0x14026251C, 0x140262547); // H1(1.4) + utils::hook::jump(0x1402624F5, 0x140262503); + utils::hook::jump(0x14026251C, 0x140262547); dvars::override::register_int("safeArea_adjusted_horizontal", 1, 0, 1, game::DVAR_FLAG_SAVED); dvars::override::register_int("safeArea_adjusted_vertical", 1, 0, 1, game::DVAR_FLAG_SAVED); dvars::override::register_int("safeArea_horizontal", 1, 0, 1, game::DVAR_FLAG_SAVED); @@ -269,10 +269,10 @@ namespace patches dvars::override::register_int("com_maxfps", 0, 0, 1000, game::DVAR_FLAG_SAVED); // Prevent clients from ending the game as non host by sending 'end_game' lui notification - // cmd_lui_notify_server_hook.create(0x140335A70, cmd_lui_notify_server_stub); // H1(1.4) + // cmd_lui_notify_server_hook.create(0x140335A70, cmd_lui_notify_server_stub); // Prevent clients from sending invalid reliableAcknowledge - // utils::hook::call(0x1404899C6, sv_execute_client_message_stub); // H1(1.4) + // utils::hook::call(0x1404899C6, sv_execute_client_message_stub); // "fix" for rare 'Out of memory error' error if (utils::flags::has_flag("memoryfix")) diff --git a/src/client/component/slowmotion.cpp b/src/client/component/slowmotion.cpp index 71f66dbf..f75f8a7e 100644 --- a/src/client/component/slowmotion.cpp +++ b/src/client/component/slowmotion.cpp @@ -45,7 +45,7 @@ namespace slowmotion return; } - utils::hook::jump(0x140365480, scr_cmd_set_slow_motion); // H1(1.4) + utils::hook::jump(0x140365480, scr_cmd_set_slow_motion); } }; } diff --git a/src/client/component/splash.cpp b/src/client/component/splash.cpp index 79d23bd1..c9ec30be 100644 --- a/src/client/component/splash.cpp +++ b/src/client/component/splash.cpp @@ -30,9 +30,9 @@ namespace splash void post_unpack() override { // Disable native splash screen - utils::hook::nop(SELECT_VALUE(0x1403E192E, 0x1405123E2), 5); // H1(1.4) - utils::hook::jump(SELECT_VALUE(0x1403E2E70, 0x140513AF0), destroy_stub); // H1(1.4) - utils::hook::jump(SELECT_VALUE(0x1403E2EB0, 0x140513B30), destroy_stub); // H1(1.4) + utils::hook::nop(SELECT_VALUE(0x1403E192E, 0x1405123E2), 5); + utils::hook::jump(SELECT_VALUE(0x1403E2E70, 0x140513AF0), destroy_stub); + utils::hook::jump(SELECT_VALUE(0x1403E2EB0, 0x140513B30), destroy_stub); } void pre_destroy() override diff --git a/src/client/component/videos.cpp b/src/client/component/videos.cpp index a602cc8a..c17dd899 100644 --- a/src/client/component/videos.cpp +++ b/src/client/component/videos.cpp @@ -35,7 +35,7 @@ namespace videos public: void post_unpack() override { - playvid_hook.create(SELECT_VALUE(0x1404A9D00, 0x1405B0AF0), &playvid); // H1(1.4) + playvid_hook.create(SELECT_VALUE(0x1404A9D00, 0x1405B0AF0), &playvid); if (game::environment::is_mp()) {