diff --git a/src/client/component/dedicated_patches.cpp b/src/client/component/dedicated_patches.cpp index ecf47d5c..7b1a8944 100644 --- a/src/client/component/dedicated_patches.cpp +++ b/src/client/component/dedicated_patches.cpp @@ -2,6 +2,7 @@ #include "loader/component_loader.hpp" #include "game/game.hpp" +#include "scheduler.hpp" #include @@ -13,6 +14,11 @@ namespace dedicated_patches { game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 1); } + + game::eNetworkModes get_online_mode() + { + return game::MODE_NETWORK_ONLINE; + } } struct component final : server_component @@ -21,6 +27,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); + + scheduler::once([]() + { + game::Com_SessionMode_SetNetworkMode(game::MODE_NETWORK_ONLINE); + game::Com_SessionMode_SetGameMode(game::MODE_GAME_MATCHMAKING_PLAYLIST); + }, scheduler::pipeline::main, 1s); } }; } diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index aed71cff..7d673c07 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -227,29 +227,6 @@ namespace party const auto address = *reinterpret_cast(0x1453DABB8_g) + (0x25780 * local_client_num) + 0x10; return *reinterpret_cast(address); } - - bool is_mp() - { - return game::Com_SessionMode_GetMode() == game::MODE_MULTIPLAYER; - } - - int should_transfer_stub(uint8_t* storage_file_info) - { - auto should_transfer = game::ShouldTransfer(storage_file_info); - const auto offset = storage_file_info - reinterpret_cast(0x14343CDF0_g); - const auto index = offset / 120; - - // Choose between multiplayer or zombies indices - const auto stats_index = is_mp() ? 12 : 17; - const auto loadout_index = is_mp() ? 15 : 20; - - if (index >= stats_index && index <= loadout_index && is_connecting_to_dedi && get_connected_server() == connect_host) - { - should_transfer = !should_transfer; - } - - return should_transfer; - } } void query_server(const game::netadr_t& host, query_callback callback) @@ -270,7 +247,6 @@ namespace party void post_unpack() override { utils::hook::jump(0x141EE6030_g, connect_stub); - utils::hook::call(0x1422781E3_g, should_transfer_stub); network::on("infoResponse", [](const game::netadr_t& target, const network::data_view& data) { diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index 89b34ec1..56a00d63 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -18,6 +18,17 @@ namespace game CONTROLLER_INDEX_COUNT = 0x4, }; + enum eGameModes + { + MODE_GAME_MATCHMAKING_PLAYLIST = 0x0, + MODE_GAME_MATCHMAKING_MANUAL = 0x1, + MODE_GAME_DEFAULT = 0x2, + MODE_GAME_LEAGUE = 0x3, + MODE_GAME_THEATER = 0x4, + MODE_GAME_COUNT = 0x5, + MODE_GAME_INVALID = 0x5, + }; + enum eModes { MODE_ZOMBIES = 0x0, @@ -28,6 +39,15 @@ namespace game MODE_FIRST = 0x0, }; + enum eNetworkModes + { + MODE_NETWORK_OFFLINE = 0x0, + MODE_NETWORK_SYSTEMLINK = 0x1, + MODE_NETWORK_ONLINE = 0x2, + MODE_NETWORK_COUNT = 0x3, + MODE_NETWORK_INVALID = 0x3, + }; + enum bdLobbyErrorCode { BD_NO_ERROR = 0x0, diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 34ad4b7e..aa9d572f 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -21,6 +21,8 @@ namespace game WEAK symbol Com_Printf{0x1421499C0, 0x140505630}; WEAK symbol Com_Error_{0x1420F8BD0}; WEAK symbol Com_SessionMode_IsMode{0x1420F7DD0}; + WEAK symbol Com_SessionMode_SetNetworkMode{0x1420F8010, 0x140500B80}; + WEAK symbol Com_SessionMode_SetGameMode{0x0, 0x140500B40}; WEAK symbol Com_IsRunningUILevel{0x142148DB0}; WEAK symbol Com_SwitchMode{ 0x14214AF30