mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Minor fixes
- fixes /map command on the same map disconnecting - fixes disconnect with virtuallobby on
This commit is contained in:
parent
c02bc0f1b8
commit
212d9a58b6
@ -208,17 +208,6 @@ namespace party
|
||||
return;
|
||||
}
|
||||
|
||||
if (!game::environment::is_dedi())
|
||||
{
|
||||
if(game::SV_Loaded())
|
||||
{
|
||||
const auto* args = "Leave";
|
||||
game::UI_RunMenuScript(0, &args);
|
||||
}
|
||||
|
||||
perform_game_initialization();
|
||||
}
|
||||
|
||||
auto* current_mapname = game::Dvar_FindVar("mapname");
|
||||
if (current_mapname && utils::string::to_lower(current_mapname->current.string) ==
|
||||
utils::string::to_lower(mapname) && (game::SV_Loaded() && !game::VirtualLobby_Loaded()))
|
||||
@ -228,6 +217,17 @@ namespace party
|
||||
return;
|
||||
}
|
||||
|
||||
if (!game::environment::is_dedi())
|
||||
{
|
||||
if (game::SV_Loaded())
|
||||
{
|
||||
const auto* args = "Leave";
|
||||
game::UI_RunMenuScript(0, &args);
|
||||
}
|
||||
|
||||
perform_game_initialization();
|
||||
}
|
||||
|
||||
printf("Starting map: %s\n", mapname.data());
|
||||
|
||||
auto* gametype = game::Dvar_FindVar("g_gametype");
|
||||
@ -249,29 +249,22 @@ namespace party
|
||||
}
|
||||
}
|
||||
|
||||
void send_disconnect()
|
||||
void disconnect_stub()
|
||||
{
|
||||
if (game::CL_IsCgameInitialized() && !game::VirtualLobby_Loaded())
|
||||
if (!game::VirtualLobby_Loaded())
|
||||
{
|
||||
// CL_ForwardCommandToServer
|
||||
reinterpret_cast<void (*)(int, const char*)>(0x14020B310)(0, "disconnect");
|
||||
// CL_WritePacket
|
||||
reinterpret_cast<void (*)(int)>(0x1402058F0)(0);
|
||||
if (game::CL_IsCgameInitialized())
|
||||
{
|
||||
// CL_ForwardCommandToServer
|
||||
reinterpret_cast<void (*)(int, const char*)>(0x14020B310)(0, "disconnect");
|
||||
// CL_WritePacket
|
||||
reinterpret_cast<void (*)(int)>(0x1402058F0)(0);
|
||||
}
|
||||
// CL_Disconnect
|
||||
reinterpret_cast<void (*)(int)>(0x140209EC0)(0);
|
||||
}
|
||||
}
|
||||
|
||||
const auto disconnect_stub = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
{
|
||||
a.pushad64();
|
||||
a.call_aligned(send_disconnect);
|
||||
a.popad64();
|
||||
|
||||
a.mov(edx, 1);
|
||||
a.xor_(ecx, ecx);
|
||||
|
||||
a.jmp(0x140209EC0);
|
||||
});
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
@ -283,7 +276,7 @@ namespace party
|
||||
}
|
||||
|
||||
// hook disconnect command function
|
||||
utils::hook::jump(0x14020A010, disconnect_stub, true);
|
||||
utils::hook::jump(0x14020A010, disconnect_stub);
|
||||
|
||||
command::add("map", [](const command::params& argument)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user