Merge pull request #40 from Joelrau/feature/quaK

Minor fixes
This commit is contained in:
Maurice Heumann 2021-03-21 14:33:27 +01:00 committed by GitHub
commit bb485252a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{