diff --git a/src/core/frontend/manager/UIManager.hpp b/src/core/frontend/manager/UIManager.hpp index 1d7b059..c250e7b 100644 --- a/src/core/frontend/manager/UIManager.hpp +++ b/src/core/frontend/manager/UIManager.hpp @@ -58,6 +58,6 @@ namespace YimMenu std::shared_ptr m_ActiveSubmenu; std::vector> m_Submenus; ImFont* m_OptionsFont = nullptr; - bool m_ShowContentWindow = false; + bool m_ShowContentWindow = true; }; } diff --git a/src/core/hooking/Hooking.cpp b/src/core/hooking/Hooking.cpp index d777b3c..64ed8af 100644 --- a/src/core/hooking/Hooking.cpp +++ b/src/core/hooking/Hooking.cpp @@ -22,6 +22,7 @@ namespace YimMenu BaseHook::Add(new DetourHook("HttpStartRequest", Pointers.HttpStartRequest, Hooks::Anticheat::HttpStartRequest)); BaseHook::Add(new DetourHook("BattlEyeServerProcessPlayerJoin", Pointers.BattlEyeServerProcessPlayerJoin, Hooks::Anticheat::BattlEyeServerProcessPlayerJoin)); BaseHook::Add(new DetourHook("GetAnticheatInitializedHash", Pointers.GetAnticheatInitializedHash, Hooks::Anticheat::GetAnticheatInitializedHash)); + BaseHook::Add(new DetourHook("GetAnticheatInitializedHash2", Pointers.GetAnticheatInitializedHash2, Hooks::Anticheat::GetAnticheatInitializedHash2)); BaseHook::Add(new DetourHook("RunScriptThreads", Pointers.RunScriptThreads, Hooks::Script::RunScriptThreads)); BaseHook::Add(new DetourHook("InitNativeTables", Pointers.InitNativeTables, Hooks::Script::InitNativeTables)); diff --git a/src/game/backend/AnticheatBypass.cpp b/src/game/backend/AnticheatBypass.cpp index f6c5d9a..3767836 100644 --- a/src/game/backend/AnticheatBypass.cpp +++ b/src/game/backend/AnticheatBypass.cpp @@ -6,7 +6,8 @@ #include "game/backend/NativeHooks.hpp" #include "game/gta/Natives.hpp" #include "types/rage/gameSkeleton.hpp" - +#include "types/anticheat/CAnticheatContext.hpp" +#include "types/game_files/CGameDataHash.hpp" using FnGetVersion = int (*)(); using FnLocalSaves = bool (*)(); diff --git a/src/game/hooks/Anticheat/GetAnticheatInitializedHash2.cpp b/src/game/hooks/Anticheat/GetAnticheatInitializedHash2.cpp new file mode 100644 index 0000000..b74eb13 --- /dev/null +++ b/src/game/hooks/Anticheat/GetAnticheatInitializedHash2.cpp @@ -0,0 +1,17 @@ +#include "core/hooking/DetourHook.hpp" +#include "game/hooks/Hooks.hpp" +#include "game/pointers/Pointers.hpp" +#include "types/anticheat/CAnticheatContext.hpp" + +namespace YimMenu::Hooks +{ + std::uint32_t Anticheat::GetAnticheatInitializedHash2(void* ac_var, std::uint32_t seed) + { + auto orig = (*Pointers.AnticheatContext) ? (*Pointers.AnticheatContext)->m_BattlEyeEnabled : false; + (*Pointers.AnticheatContext)->m_BattlEyeEnabled = true; // integ checks will boot us out if we set this outside this function + auto ret = BaseHook::Get>()->Original()(ac_var, seed); + if (*Pointers.AnticheatContext) + (*Pointers.AnticheatContext)->m_BattlEyeEnabled = orig; + return ret; + } +} \ No newline at end of file diff --git a/src/game/hooks/Hooks.hpp b/src/game/hooks/Hooks.hpp index f2de963..58ae6e7 100644 --- a/src/game/hooks/Hooks.hpp +++ b/src/game/hooks/Hooks.hpp @@ -43,6 +43,7 @@ namespace YimMenu::Hooks extern void HttpStartRequest(void* request); extern bool BattlEyeServerProcessPlayerJoin(CBattlEyePlayerModifyInterface* server_iface, CBattlEyePlayerModifyContext* context); extern std::uint32_t GetAnticheatInitializedHash(); + extern std::uint32_t GetAnticheatInitializedHash2(void* ac_var, std::uint32_t seed); } namespace Info diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index dfbae39..f2a7732 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -395,12 +395,22 @@ namespace YimMenu GameSkeleton = ptr.Add(0x9).Add(3).Rip().As(); }); - constexpr auto anticheatInitializedHashPtrn = Pattern<"89 9E C8 00 00 00 48 8B 0D ? ? ? ? 48 85 C9 74 46">("AnticheatInitializedHash"); + constexpr auto anticheatInitializedHashPtrn = Pattern<"89 9E C8 00 00 00 48 8B 0D ? ? ? ? 48 85 C9 74 46">("AnticheatInitializedHash&GetAnticheatInitializedHash"); scanner.Add(anticheatInitializedHashPtrn, [this](PointerCalculator ptr) { AnticheatInitializedHash = ptr.Add(9).Rip().As(); GetAnticheatInitializedHash = ptr.Add(0x13).Rip().As(); }); + constexpr auto anticheatContextPtrn = Pattern<"48 8D BB 70 0A 00 00 4C 8D 35 ? ? ? ? 66 90">("AnticheatContext"); + scanner.Add(anticheatContextPtrn, [this](PointerCalculator ptr) { + AnticheatContext = ptr.Sub(0x12).Add(3).Rip().As(); + }); + + constexpr auto getAnticheatInitializedHash2Ptrn = Pattern<"89 9E E8 00 00 00 89 C2 E8 ? ? ? ? 69">("GetAnticheatInitializedHash2"); + scanner.Add(getAnticheatInitializedHash2Ptrn, [this](PointerCalculator ptr) { + GetAnticheatInitializedHash2 = ptr.Add(0x9).Rip().As(); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index 11f65ca..c760203 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -43,6 +43,7 @@ class CStatsMgr; class CNetShopTransaction; class CNetworkSession; class CStatsMpCharacterMappingData; +class CAnticheatContext; namespace YimMenu { @@ -159,6 +160,8 @@ namespace YimMenu PVOID Nullsub; rage::Obf32** AnticheatInitializedHash; PVOID GetAnticheatInitializedHash; + PVOID GetAnticheatInitializedHash2; + CAnticheatContext** AnticheatContext; }; struct Pointers : PointerData diff --git a/src/types/anticheat/CAnticheatContext.hpp b/src/types/anticheat/CAnticheatContext.hpp new file mode 100644 index 0000000..36a45c1 --- /dev/null +++ b/src/types/anticheat/CAnticheatContext.hpp @@ -0,0 +1,26 @@ +#pragma once +#include "types/rage/ObfVar.hpp" + +struct CAnticheatContext +{ + rage::Obf32 m_LastScanTime; + rage::Obf32 m_ScanInterval; + void* m_ScanData; + rage::Obf32 m_ScanDataSize; + rage::Obf32 m_ScanDataSize2; + rage::Obf32 m_GameBuild; + std::uint64_t qword58; + std::uint32_t dword60; + char gap64[2572]; + std::uint32_t dwordA70; + std::uint64_t qwordA78; + std::uint32_t dwordA80; + char gapA84[3]; + char byteA87[9]; + bool m_DebugBattlEyeEnabled; + bool m_BattlEyeEnabled; + bool m_IsDebugMode; + volatile __int32 m_CurrentScanIndex; + std::uint64_t qwordA98; +}; +static_assert(sizeof(CAnticheatContext) == 0xAA0); \ No newline at end of file diff --git a/src/types/game_files/CGameDataHash.hpp b/src/types/game_files/CGameDataHash.hpp new file mode 100644 index 0000000..9d10050 --- /dev/null +++ b/src/types/game_files/CGameDataHash.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "types/rage/ObfVar.hpp" +#include + +#pragma pack(push, 8) +class CGameDataHash +{ +public: + bool m_IsJapaneseVersion; + std::array m_Data; +}; +static_assert(sizeof(CGameDataHash) == 0x104); +#pragma pack(pop) \ No newline at end of file