Dispatch connect packet in the server thread

This commit is contained in:
Maurice Heumann 2023-04-12 18:43:16 +02:00
parent 4b1808c331
commit c29d9e5806
3 changed files with 13 additions and 6 deletions

View File

@ -196,7 +196,10 @@ namespace auth
std::string final_packet{};
if (game::fragment_handler::handle(target, buffer, final_packet))
{
dispatch_connect_packet(target, final_packet);
scheduler::once([t = target, p = std::move(final_packet)]
{
dispatch_connect_packet(t, p);
});
}
}
}

View File

@ -88,7 +88,6 @@ namespace scheduler
task_pipeline pipelines[pipeline::count];
utils::hook::detour r_end_frame_hook;
utils::hook::detour g_run_frame_hook;
utils::hook::detour main_frame_hook;
@ -98,9 +97,9 @@ namespace scheduler
r_end_frame_hook.invoke<void>();
}
void server_frame_stub()
void g_clear_vehicle_inputs_stub()
{
g_run_frame_hook.invoke<void>();
game::G_ClearVehicleInputs();
execute(pipeline::server);
}
@ -168,12 +167,14 @@ namespace scheduler
{
if (!game::is_server())
{
r_end_frame_hook.create(0x142272B00_g, r_end_frame_stub);
// some func called before R_EndFrame, maybe SND_EndFrame?
r_end_frame_hook.create(0x142272B00_g, r_end_frame_stub);
}
main_frame_hook.create(game::select(0x1420F8E00, 0x1405020E0), main_frame_stub);
// Com_Frame_Try_Block_Function
main_frame_hook.create(game::select(0x1420F8E00, 0x1405020E0), main_frame_stub);
utils::hook::call(game::select(0x14225522E, 0x140538427), g_clear_vehicle_inputs_stub);
}
void pre_destroy() override

View File

@ -75,6 +75,9 @@ namespace game
WEAK symbol<bool(const char* zoneName, int source)> DB_FileExists{0x141420B40};
WEAK symbol<void()> DB_ReleaseXAssets{0x1414247C0};
// G
WEAK symbol<void()> G_ClearVehicleInputs{0x1423812E0, 0x1405C1200};
// Live
WEAK symbol<bool(uint64_t, int*, bool)> Live_GetConnectivityInformation{0x141E0C380};