fix(anticheat): Fix AC bypass not working when injecting too early (#2473)

This commit is contained in:
yubie 2023-12-02 11:31:09 -05:00 committed by GitHub
parent 468af617d7
commit c5c3713137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,8 +39,9 @@
namespace big
{
void disable_anticheat_skeleton()
bool disable_anticheat_skeleton()
{
bool patched = false;
for (rage::game_skeleton_update_mode* mode = g_pointers->m_gta.m_game_skeleton->m_update_modes; mode; mode = mode->m_next)
{
for (rage::game_skeleton_update_base* update_node = mode->m_head; update_node; update_node = update_node->m_next)
@ -54,6 +55,7 @@ namespace big
// TamperActions is a leftover from the old AC, but still useful to block anyway
if (group_child_node->m_hash != 0xA0F39FB6 && group_child_node->m_hash != RAGE_JOAAT("TamperActions"))
continue;
patched = true;
//LOG(INFO) << "Patching problematic skeleton update";
reinterpret_cast<rage::game_skeleton_update_element*>(group_child_node)->m_function =
g_pointers->m_gta.m_nullsub;
@ -66,10 +68,10 @@ namespace big
{
if (i.m_hash != 0xA0F39FB6 && i.m_hash != RAGE_JOAAT("TamperActions"))
continue;
//LOG(INFO) << "Patching problematic skeleton init/shutdown";
i.m_init_func = reinterpret_cast<uint64_t>(g_pointers->m_gta.m_nullsub);
i.m_shutdown_func = reinterpret_cast<uint64_t>(g_pointers->m_gta.m_nullsub);
}
return patched;
}
}
@ -111,7 +113,11 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
auto pointers_instance = std::make_unique<pointers>();
LOG(INFO) << "Pointers initialized.";
disable_anticheat_skeleton();
while(!disable_anticheat_skeleton())
{
LOG(WARNING) << "Failed patching anticheat gameskeleton (injected too early?). Waiting 100ms and trying again";
std::this_thread::sleep_for(100ms);
}
LOG(INFO) << "Disabled anticheat gameskeleton.";
auto byte_patch_manager_instance = std::make_unique<byte_patch_manager>();