From 47c2a28b4957172a11b69081c7cee5e56ebc2d9d Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Sat, 25 Feb 2023 18:46:00 +0100 Subject: [PATCH 1/2] Fix server/client gametype out of sync --- src/client/component/client_patches.cpp | 2 +- src/client/component/party.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/client/component/client_patches.cpp b/src/client/component/client_patches.cpp index 5fb92afd..0a2cf29d 100644 --- a/src/client/component/client_patches.cpp +++ b/src/client/component/client_patches.cpp @@ -38,8 +38,8 @@ namespace client_patches void preload_map_stub(int localClientNum, const char* mapname, const char* gametype) { + game::Com_GametypeSettings_SetGametype(gametype, false, false); stop_zombies_intro_if_needed(); - preload_map_hook.invoke(localClientNum, mapname, gametype); } diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 497927c8..5c919727 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -173,8 +173,7 @@ namespace party { if (is_connecting_to_dedi) { - game::Com_SessionMode_SetGameMode(game::MODE_GAME_DEFAULT); - game::Com_GametypeSettings_SetGametype(gametype.data(), false, false); + game::Com_SessionMode_SetGameMode(game::MODE_GAME_MATCHMAKING_PLAYLIST); } //connect_to_session(target, hostname, xuid, mode); From 89f377f58674a8d01e7721c7a20de47c1c6dccd0 Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Sat, 25 Feb 2023 19:26:40 +0100 Subject: [PATCH 2/2] Make dedicated servers ranked --- src/client/component/dedicated_patches.cpp | 52 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/client/component/dedicated_patches.cpp b/src/client/component/dedicated_patches.cpp index 7b1a8944..3d68008b 100644 --- a/src/client/component/dedicated_patches.cpp +++ b/src/client/component/dedicated_patches.cpp @@ -15,10 +15,49 @@ namespace dedicated_patches game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 1); } - game::eNetworkModes get_online_mode() + game::eNetworkModes get_online_mode_stub() { return game::MODE_NETWORK_ONLINE; } + + bool is_online_stub() + { + return true; + } + + bool is_mod_loaded_stub() + { + return false; + } + + void patch_is_mod_loaded_checks() + { + const std::vector is_mod_loaded_addresses = + { + { 0x1401DA1B5_g }, + { 0x14024D4A0_g }, + { 0x14024D669_g }, + { 0x14024D939_g }, + { 0x14024DC64_g }, + { 0x14024E13A_g }, + { 0x14024E5A3_g }, + { 0x14024FFB9_g }, + { 0x140251E9E_g }, + { 0x140253680_g }, + { 0x140257BF6_g }, + { 0x1402D25E2_g }, // unsure if needed to patch + { 0x1402D296D_g }, // unsure + { 0x1402D58E9_g }, // unsure + { 0x1402DC5BB_g }, // unsure + { 0x140468374_g }, + { 0x14046B796_g } + }; + + for (const auto& address : is_mod_loaded_addresses) + { + utils::hook::call(address, is_mod_loaded_stub); + } + } } struct component final : server_component @@ -28,8 +67,15 @@ namespace dedicated_patches // Fix infinite loop utils::hook::jump(0x1402E86B0_g, scr_are_textures_loaded_stub); - utils::hook::jump(0x1405003E0_g, get_online_mode); - utils::hook::jump(0x1405003B0_g, get_online_mode); + // Online classes + utils::hook::jump(0x1405003E0_g, get_online_mode_stub); + utils::hook::jump(0x1405003B0_g, get_online_mode_stub); + + // Progression / Ranked + utils::hook::jump(0x140500A50_g, is_online_stub); + utils::hook::jump(0x140500980_g, is_online_stub); + utils::hook::jump(0x1402565D0_g, is_online_stub); + patch_is_mod_loaded_checks(); scheduler::once([]() {