Skip to content

Commit 8acef74

Browse files
authored
fix(anticheat): fix anticheat bypass (#843)
1 parent dbfd436 commit 8acef74

14 files changed

Lines changed: 104 additions & 68 deletions

File tree

src/core/hooking/Hooking.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace YimMenu
1717
BaseHook::Add<Hooks::SwapChain::ResizeBuffers>(new DetourHook("ResizeBuffers", swapchain_vft[Hooks::SwapChain::VMTResizeBuffersIdx], Hooks::SwapChain::ResizeBuffers));
1818

1919
// BaseHook::Add<Hooks::Anticheat::QueueDependency>(new DetourHook("QueueDependency", Pointers.QueueDependency, Hooks::Anticheat::QueueDependency));
20+
BaseHook::Add<Hooks::Anticheat::GameSkeletonUpdate>(new DetourHook("GameSkeletonUpdate", Pointers.GameSkeletonUpdate, Hooks::Anticheat::GameSkeletonUpdate));
2021
BaseHook::Add<Hooks::Anticheat::PrepareMetricForSending>(new DetourHook("PrepareMetricForSending", Pointers.PrepareMetricForSending, Hooks::Anticheat::PrepareMetricForSending));
2122
BaseHook::Add<Hooks::Anticheat::GetThreadContext>(new DetourHook("GetThreadContext", reinterpret_cast<void*>(GetProcAddress(LoadLibraryA("kernel32.dll"), "GetThreadContext")), Hooks::Anticheat::GetThreadContext));
2223
BaseHook::Add<Hooks::Anticheat::HttpStartRequest>(new DetourHook("HttpStartRequest", Pointers.HttpStartRequest, Hooks::Anticheat::HttpStartRequest));

src/core/renderer/Renderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ namespace YimMenu
190190
m_HeapAllocator.Create(m_Device.Get(), m_DescriptorHeap.Get());
191191

192192
// never returns false, useless to check return
193-
ImGui::CreateContext(&GetInstance().m_FontAtlas);
193+
ImGui::CreateContext();
194194
ImGui_ImplWin32_Init(*Pointers.Hwnd);
195195

196196
ImGui_ImplDX12_InitInfo init_info = {};

src/game/backend/AnticheatBypass.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "game/pointers/Pointers.hpp"
66
#include "game/backend/NativeHooks.hpp"
77
#include "game/gta/Natives.hpp"
8-
#include "types/rage/gameSkeleton.hpp"
98
#include "types/anticheat/CAnticheatContext.hpp"
109

1110
using FnGetVersion = int (*)();
@@ -33,57 +32,6 @@ namespace YimMenu
3332
return NativeInvoker::GetNativeHandler(NativeIndex::NET_GAMESERVER_BEGIN_SERVICE)(ctx);
3433
}
3534

36-
static void NopGameSkeletonElement(rage::gameSkeletonUpdateElement* element)
37-
{
38-
// TODO: small memory leak
39-
// Hey rockstar if you keep up with this I'll make you integrity check everything until you can't anymore, please grow a brain and realize that this is futile
40-
// and kills performance if you're the host
41-
auto vtable = *reinterpret_cast<void***>(element);
42-
if (vtable[1] == Pointers.Nullsub)
43-
return; // already nopped
44-
45-
auto new_vtable = new void*[3];
46-
memcpy(new_vtable, vtable, sizeof(void*) * 3);
47-
new_vtable[1] = Pointers.Nullsub;
48-
*reinterpret_cast<void***>(element) = new_vtable;
49-
}
50-
51-
static void DefuseSigscanner()
52-
{
53-
bool patched = false;
54-
for (auto mode = Pointers.GameSkeleton->m_UpdateModes; mode; mode = mode->m_Next)
55-
{
56-
for (auto update_node = mode->m_Head; update_node; update_node = update_node->m_Next)
57-
{
58-
if (update_node->m_Hash != "Common Main"_J)
59-
continue;
60-
61-
auto group = reinterpret_cast<rage::gameSkeletonUpdateGroup*>(update_node);
62-
63-
for (auto group_child_node = group->m_Head; group_child_node; group_child_node = group_child_node->m_Next)
64-
{
65-
// TamperActions is a leftover from the old AC, but still useful to block anyway
66-
if (group_child_node->m_Hash != 0xA0F39FB6 && group_child_node->m_Hash != "TamperActions"_J)
67-
continue;
68-
patched = true;
69-
70-
NopGameSkeletonElement(reinterpret_cast<rage::gameSkeletonUpdateElement*>(group_child_node));
71-
}
72-
break;
73-
}
74-
}
75-
76-
77-
if (patched)
78-
{
79-
LOGF(VERBOSE, "DefuseSigscanner: Patched out the sigscanner");
80-
}
81-
else
82-
{
83-
LOGF(WARNING, "DefuseSigscanner: Failed to patch the sigscanner");
84-
}
85-
}
86-
8735
void AnticheatBypass::RunOnStartupImpl()
8836
{
8937
bool loaded_late = false;
@@ -102,8 +50,6 @@ namespace YimMenu
10250

10351
void AnticheatBypass::RunScriptImpl()
10452
{
105-
DefuseSigscanner();
106-
10753
NativeHooks::AddHook("shop_controller"_J, NativeIndex::NET_GAMESERVER_BEGIN_SERVICE, &TransactionHook);
10854

10955
m_IsFSLLoaded = CheckForFSL();

src/game/backend/NativeHooks.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "game/gta/invoker/Invoker.hpp"
44

55
#include "types/script/scrProgram.hpp"
6-
#include "types/script/scrThread.hpp"
76

87

98
namespace YimMenu

src/game/frontend/submenus/Network/SavedPlayers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace YimMenu::Submenus
2727

2828
static bool ShouldRenderPlayer(std::string_view name, std::string_view search)
2929
{
30-
if (!search[0])
30+
if (search.empty())
3131
return true;
3232

3333
if (name.size() < search.size())

src/game/frontend/submenus/Player/Info.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,37 @@ namespace YimMenu::Submenus
6565
ImGui::SetClipboardText(std::to_string(rid1).c_str());
6666
}
6767

68+
auto& platformAccountId = Players::GetSelected().GetHandle()->m_PlatformAccountId;
69+
switch (platformAccountId.m_Platform)
70+
{
71+
case PlatformAccountId::PLATFORM_XBOX:
72+
ImGui::Text("Xbox User ID:");
73+
ImGui::SameLine();
74+
if (ImGui::SmallButton(std::to_string(platformAccountId.m_XboxUserId).c_str()))
75+
{
76+
ImGui::SetClipboardText(std::to_string(platformAccountId.m_XboxUserId).c_str());
77+
}
78+
break;
79+
case PlatformAccountId::PLATFORM_STEAM:
80+
ImGui::Text("Steam ID:");
81+
ImGui::SameLine();
82+
if (ImGui::SmallButton(std::to_string(platformAccountId.m_SteamId).c_str()))
83+
{
84+
ImGui::SetClipboardText(std::to_string(platformAccountId.m_SteamId).c_str());
85+
}
86+
break;
87+
case PlatformAccountId::PLATFORM_EPIC:
88+
ImGui::Text("Epic Account ID:");
89+
ImGui::SameLine();
90+
if (ImGui::SmallButton(platformAccountId.m_EpicAccountId))
91+
{
92+
ImGui::SetClipboardText(platformAccountId.m_EpicAccountId);
93+
}
94+
break;
95+
default:
96+
break;
97+
}
98+
6899

69100
auto ip = Players::GetSelected().GetExternalAddress();
70101

@@ -83,14 +114,14 @@ namespace YimMenu::Submenus
83114
if (ImGui::Button("View SC Profile"))
84115
FiberPool::Push([] {
85116
uint64_t handle[13];
86-
NETWORK::NETWORK_HANDLE_FROM_PLAYER(Players::GetSelected().GetId(), handle, sizeof(handle));
117+
NETWORK::NETWORK_HANDLE_FROM_PLAYER(Players::GetSelected().GetId(), handle, std::size(handle));
87118
NETWORK::NETWORK_SHOW_PROFILE_UI(handle);
88119
});
89120
ImGui::SameLine();
90121
if (ImGui::Button("Add Friend"))
91122
FiberPool::Push([] {
92123
uint64_t handle[13];
93-
NETWORK::NETWORK_HANDLE_FROM_PLAYER(Players::GetSelected().GetId(), handle, sizeof(handle));
124+
NETWORK::NETWORK_HANDLE_FROM_PLAYER(Players::GetSelected().GetId(), handle, std::size(handle));
94125
NETWORK::NETWORK_ADD_FRIEND(handle, "");
95126
});
96127

src/game/frontend/submenus/Settings/GUISettings.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "core/frontend/manager/Category.hpp"
44
#include "game/frontend/items/Items.hpp"
5-
#include <memory>
65

76
namespace YimMenu
87
{
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "game/hooks/Hooks.hpp"
2+
#include "core/util/Joaat.hpp"
3+
#include "types/rage/gameSkeleton.hpp"
4+
5+
namespace YimMenu::Hooks
6+
{
7+
void Anticheat::GameSkeletonUpdate(rage::gameSkeleton* skeleton, int type)
8+
{
9+
for (auto mode = skeleton->m_UpdateModes; mode; mode = mode->m_Next)
10+
{
11+
if (mode->m_Type != type)
12+
continue;
13+
14+
for (auto group = mode->m_Head; group; group = group->m_Next)
15+
{
16+
if (group->m_Hash != "Common Main"_J)
17+
{
18+
group->Run();
19+
continue;
20+
}
21+
22+
for (auto item = static_cast<rage::gameSkeletonUpdateGroup*>(group)->m_Head; item; item = item->m_Next)
23+
{
24+
if (item->m_Hash != 0xA0F39FB6 && item->m_Hash != "TamperActions"_J)
25+
{
26+
item->Run();
27+
}
28+
}
29+
}
30+
31+
break;
32+
}
33+
}
34+
}

src/game/hooks/Hooks.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace rage
2121
class rlSessionDetailMsg;
2222
class rlSessionInfo;
2323
struct rlTaskStatus;
24+
struct gameSkeleton;
2425
}
2526

2627
class MatchmakingAttributes;
@@ -44,6 +45,7 @@ namespace YimMenu::Hooks
4445
namespace Anticheat
4546
{
4647
extern void QueueDependency(__int64 a1);
48+
extern void GameSkeletonUpdate(rage::gameSkeleton* skeleton, int type);
4749
extern bool PrepareMetricForSending(rage::JsonSerializer* ser, void* a2, void* a3, rage::rlMetric* metric);
4850
extern BOOL GetThreadContext(HANDLE hThread, LPCONTEXT lpContext);
4951
extern void HttpStartRequest(void* request);

src/game/pointers/Pointers.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,6 @@ namespace YimMenu
411411
AssistedAimFindNewTarget = ptr.Sub(0x33).As<Functions::AssistedAimFindNewTarget>();
412412
});
413413

414-
constexpr auto gameSkeletonPtrn = Pattern<"0F B6 C0 8D 14 00 83 C2 02">("GameSkeleton");
415-
scanner.Add(gameSkeletonPtrn, [this](PointerCalculator ptr) {
416-
GameSkeleton = ptr.Add(0x9).Add(3).Rip().As<rage::gameSkeleton*>();
417-
});
418-
419414
constexpr auto anticheatInitializedHashPtrn = Pattern<"89 9E C8 00 00 00 48 8B 0D ? ? ? ? 48 85 C9 74 46">("AnticheatInitializedHash&GetAnticheatInitializedHash");
420415
scanner.Add(anticheatInitializedHashPtrn, [this](PointerCalculator ptr) {
421416
AnticheatInitializedHash = ptr.Add(9).Rip().As<rage::Obf32**>();
@@ -457,6 +452,11 @@ namespace YimMenu
457452
MatchmakingSessionDetailSendResponse = addr.Add(0x2F).Rip().As<PVOID>();
458453
});
459454

455+
static constexpr auto gameSkeletonUpdatePtrn = Pattern<"56 48 83 EC 20 48 8B 81 40 01 00 00 48 85 C0">("GameSkeletonUpdate");
456+
scanner.Add(gameSkeletonUpdatePtrn, [this](PointerCalculator addr) {
457+
GameSkeletonUpdate = addr.As<PVOID>();
458+
});
459+
460460
if (!scanner.Scan())
461461
{
462462
LOG(FATAL) << "Some patterns could not be found, unloading.";

0 commit comments

Comments
 (0)