Fix connecting + scheduler mp addresses

This commit is contained in:
Federico Cecchetto 2022-02-26 20:12:05 +01:00
parent d043a3a954
commit 6372e6214b
3 changed files with 31 additions and 28 deletions

View File

@ -225,6 +225,9 @@ namespace auth
utils::hook::jump(0x140488BC1, get_direct_connect_stub(), true); // H1(1.4)
utils::hook::call(0x140250ED2, send_connect_data_stub); // H1(1.4)
// Check for sending connect packet
utils::hook::set(0x14059A6E0, 0xC301B0);
}
command::add("guid", []()

View File

@ -174,9 +174,9 @@ namespace patches
// Fix mouse lag
utils::hook::nop(SELECT_VALUE(0x1403E3C05, 0x1404DB1AF), 6);
scheduler::loop([]()
{
SetThreadExecutionState(ES_DISPLAY_REQUIRED);
}, scheduler::pipeline::main);
{
SetThreadExecutionState(ES_DISPLAY_REQUIRED);
}, scheduler::pipeline::main);
// Prevent game from overriding cg_fov and cg_fovscale values
gscr_set_save_dvar_hook.create(SELECT_VALUE(0x1402AE020, 0x14036B600), &gscr_set_save_dvar_stub);

View File

@ -36,33 +36,33 @@ namespace scheduler
void execute()
{
callbacks_.access([&](task_list& tasks)
{
this->merge_callbacks();
for (auto i = tasks.begin(); i != tasks.end();)
{
this->merge_callbacks();
const auto now = std::chrono::high_resolution_clock::now();
const auto diff = now - i->last_call;
for (auto i = tasks.begin(); i != tasks.end();)
if (diff < i->interval)
{
const auto now = std::chrono::high_resolution_clock::now();
const auto diff = now - i->last_call;
if (diff < i->interval)
{
++i;
continue;
}
i->last_call = now;
const auto res = i->handler();
if (res == cond_end)
{
i = tasks.erase(i);
}
else
{
++i;
}
++i;
continue;
}
});
i->last_call = now;
const auto res = i->handler();
if (res == cond_end)
{
i = tasks.erase(i);
}
else
{
++i;
}
}
});
}
private:
@ -181,8 +181,8 @@ namespace scheduler
void post_unpack() override
{
r_end_frame_hook.create(SELECT_VALUE(0x1404F7310, 0x1405FE470), scheduler::r_end_frame_stub); // H1(1.4)
g_run_frame_hook.create(SELECT_VALUE(0x1402772D0, 0x1402772D0), scheduler::server_frame_stub); // H1(1.4)
main_frame_hook.create(SELECT_VALUE(0x1401CE8D0, 0x1401CE8D0), scheduler::main_frame_stub); // H1(1.4)
g_run_frame_hook.create(SELECT_VALUE(0x1402772D0, 0x14033A640), scheduler::server_frame_stub); // H1(1.4)
main_frame_hook.create(SELECT_VALUE(0x1401CE8D0, 0x1400D82A0), scheduler::main_frame_stub); // H1(1.4)
}
void pre_destroy() override