1+ #include " core/commands/BoolCommand.hpp"
2+ #include " core/hooking/DetourHook.hpp"
3+ #include " game/backend/NativeHooks.hpp"
4+ #include " game/gta/Natives.hpp"
5+ #include " game/hooks/Hooks.hpp"
6+ #include " game/pointers/Pointers.hpp"
7+ #include " types/game_files/CGameDataHash.hpp"
8+
9+ namespace YimMenu ::Features
10+ {
11+ class DumpDataHash : public Command
12+ {
13+ using Command::Command;
14+
15+ virtual void OnCall () override
16+ {
17+ auto log = LOG (VERBOSE);
18+ log << " DLC Hash: "
19+ << BaseHook::Get<Hooks::Network::GetDLCHash, DetourHook<decltype (&Hooks::Network::GetDLCHash)>>()->Original ()(
20+ *Pointers.DLCManager ,
21+ 0 )
22+ << " \n " ;
23+ if (auto hashes = Pointers.GameDataHash )
24+ {
25+ log << " validHashes = {" << " \n " ;
26+ for (int i = 0 ; i < hashes->m_Data .size (); i++)
27+ log << hashes->m_Data [i].getData () << " , // " << i << " \n " ;
28+ log << " };" ;
29+ }
30+ }
31+ };
32+ static DumpDataHash _DumpDataHash{" dumpdatahash" , " Dump Data Hash" , " Dumps the current data hash into the console" };
33+
34+ static void PackOrderHook (rage::scrNativeCallContext* ctx);
35+ class SpoofDataHash : public BoolCommand
36+ {
37+ using BoolCommand::BoolCommand;
38+
39+ std::array<std::uint32_t , 16 > origHashes;
40+
41+ virtual void OnEnable () override
42+ {
43+ NativeHooks::AddHook (NativeHooks::ALL_SCRIPTS, NativeIndex::GET_EVER_HAD_BAD_PACK_ORDER, &PackOrderHook);
44+
45+ constexpr std::array<std::uint32_t , 16 > validHashes = {
46+ 1222354255 , // 0
47+ 1017 , // 1
48+ 2008403316 , // 2
49+ 472 , // 3
50+ 0 , // 4
51+ 0 , // 5
52+ 1061472380 , // 6
53+ 0 , // 7
54+ 0 , // 8
55+ 1731098795 , // 9
56+ 234493012 , // 10
57+ 19919 , // 11
58+ 4002619495 , // 12
59+ 307143837 , // 13
60+ 2941593772 , // 14
61+ 200299391 , // 15
62+ };
63+ if (auto hashes = Pointers.GameDataHash )
64+ {
65+ for (int i = 0 ; i < hashes->m_Data .size (); i++)
66+ origHashes[i] = hashes->m_Data [i];
67+
68+ for (int i = 0 ; i < validHashes.size (); i++)
69+ hashes->m_Data [i] = validHashes[i];
70+ }
71+ }
72+
73+ virtual void OnDisable () override
74+ {
75+ if (auto hashes = Pointers.GameDataHash )
76+ {
77+ for (int i = 0 ; i < origHashes.size (); i++)
78+ hashes->m_Data [i] = origHashes[i];
79+ }
80+ }
81+ };
82+
83+ static SpoofDataHash _SpoofDataHash{" spoofdatahash" , " Spoof Data Hash" , " Allows you to join players with rpf mods (or a half installed game)." };
84+
85+ static void PackOrderHook (rage::scrNativeCallContext* ctx)
86+ {
87+ return ctx->SetReturnValue (FALSE );
88+ }
89+ }
90+
91+ namespace YimMenu ::Hooks
92+ {
93+ uint32_t Network::GetDLCHash (void * manager, uint32_t seed)
94+ {
95+ if (YimMenu::Features::_SpoofDataHash.GetState ())
96+ return 2784221708 ;
97+
98+ return BaseHook::Get<Network::GetDLCHash, DetourHook<decltype (&Network::GetDLCHash)>>()->Original ()(manager, seed);
99+ }
100+ }
0 commit comments