This commit is contained in:
quaK 2022-10-06 17:23:31 +03:00
commit 741a9fb62f
3 changed files with 26 additions and 9 deletions

View File

@ -531,6 +531,9 @@ namespace demonware
utils::hook::set<uint8_t>(0x52A6D0_b, 0xC3); utils::hook::set<uint8_t>(0x52A6D0_b, 0xC3);
utils::hook::jump(0x52B800_b, get_patching_status_stub); utils::hook::jump(0x52B800_b, get_patching_status_stub);
// Skip some other thing in Live_SyncOnlineDataFlags
utils::hook::set(0x533390_b, 0xC301B0);
utils::hook::set<uint8_t>(0xDC0C00_b, 0xC3); // Live_CheckForFullDisconnect utils::hook::set<uint8_t>(0xDC0C00_b, 0xC3); // Live_CheckForFullDisconnect
// isProfanity // isProfanity

View File

@ -410,7 +410,7 @@ namespace network
utils::hook::jump(0xD57C7E_b, net_init_stub); utils::hook::jump(0xD57C7E_b, net_init_stub);
// use our own protocol version // use our own protocol version
//utils::hook::jump(0xCE8290_b, get_protocol_version_stub); utils::hook::jump(0xCE8290_b, get_protocol_version_stub);
//utils::hook::set<uint8_t>(0x4030F0_b, 0xC3); //utils::hook::set<uint8_t>(0x4030F0_b, 0xC3);
//utils::hook::nop(0x9B014B_b, 2); //utils::hook::nop(0x9B014B_b, 2);
@ -430,4 +430,4 @@ namespace network
}; };
} }
//REGISTER_COMPONENT(network::component) REGISTER_COMPONENT(network::component)

View File

@ -40,7 +40,7 @@ namespace party
//command::execute("entitlements_delay 0", true); //command::execute("entitlements_delay 0", true);
} }
void connect_to_party(const game::netadr_s& target, const std::string& mapname, const std::string& gametype) void connect_to_party(const game::netadr_s& target, const std::string& mapname, const std::string& gametype, int sv_maxclients)
{ {
if (game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_MP && if (game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_MP &&
game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_CP) game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_CP)
@ -48,7 +48,7 @@ namespace party
return; return;
} }
/*if (game::Live_SyncOnlineDataFlags(0) != 0) if (game::Live_SyncOnlineDataFlags(0) != 0)
{ {
// initialize the game after onlinedataflags is 32 (workaround) // initialize the game after onlinedataflags is 32 (workaround)
if (game::Live_SyncOnlineDataFlags(0) == 32) if (game::Live_SyncOnlineDataFlags(0) == 32)
@ -58,7 +58,7 @@ namespace party
command::execute("xstartprivateparty", true); command::execute("xstartprivateparty", true);
command::execute("disconnect", true); // 32 -> 0 command::execute("disconnect", true); // 32 -> 0
connect_to_party(target, mapname, gametype); connect_to_party(target, mapname, gametype, sv_maxclients);
}, scheduler::pipeline::main, 1s); }, scheduler::pipeline::main, 1s);
return; return;
} }
@ -66,14 +66,20 @@ namespace party
{ {
scheduler::once([=]() scheduler::once([=]()
{ {
connect_to_party(target, mapname, gametype); connect_to_party(target, mapname, gametype, sv_maxclients);
}, scheduler::pipeline::main, 1s); }, scheduler::pipeline::main, 1s);
return; return;
} }
}*/ }
const auto ui_maxclients = game::Dvar_FindVar("ui_maxclients");
game::Dvar_SetInt(ui_maxclients, sv_maxclients);
perform_game_initialization(); perform_game_initialization();
// setup agent count
utils::hook::invoke<void>(0xC19B00_b, gametype.data());
// connect // connect
char session_info[0x100] = {}; char session_info[0x100] = {};
game::CL_MainMP_ConnectAndPreloadMap(0, reinterpret_cast<void*>(session_info), &target, mapname.data(), gametype.data()); game::CL_MainMP_ConnectAndPreloadMap(0, reinterpret_cast<void*>(session_info), &target, mapname.data(), gametype.data());
@ -420,13 +426,21 @@ namespace party
return; return;
} }
const auto sv_maxclients_str = info.get("sv_maxclients");
const auto sv_maxclients = std::atoi(sv_maxclients_str.data());
if (!sv_maxclients)
{
info_response_error("Invalid sv_maxclients.");
return;
}
//party::sv_motd = info.get("sv_motd"); //party::sv_motd = info.get("sv_motd");
//party::sv_maxclients = std::stoi(info.get("sv_maxclients")); //party::sv_maxclients = std::stoi(info.get("sv_maxclients"));
connect_to_party(target, mapname, gametype); connect_to_party(target, mapname, gametype, sv_maxclients);
}); });
} }
}; };
} }
//REGISTER_COMPONENT(party::component) REGISTER_COMPONENT(party::component)