SHOW:
|
|
- or go back to the newest paste.
1 | - | inline bool bittest(int data, unsigned char index) |
1 | + | inline bool bittest(int data, unsigned char index) |
2 | { | |
3 | return (data & (1 << index)) != 0; | |
4 | } | |
5 | ||
6 | - | array<System::Collections::ObjectModel::ReadOnlyCollection<int> ^> ^GetVehicleModels(UINT64 baseFuncAddr, int classOffset) |
6 | + | array<int> ^GetVehicleModels(UINT64 baseFuncAddr) |
7 | { | |
8 | UINT16 HashTableEntries = *reinterpret_cast<UINT16*>(baseFuncAddr + *reinterpret_cast<int*>(baseFuncAddr + 3) + 7); | |
9 | int cmp1 = *reinterpret_cast<int*>(*reinterpret_cast<int*>(baseFuncAddr + 0x52) + baseFuncAddr + 0x56); | |
10 | UINT64 mov2 = *reinterpret_cast<UINT64*>(*reinterpret_cast<int*>(baseFuncAddr + 0x63) + baseFuncAddr + 0x67); | |
11 | UINT64 mul3 = *reinterpret_cast<UINT64*>(*reinterpret_cast<int*>(baseFuncAddr + 0x7A) + baseFuncAddr + 0x7E); | |
12 | UINT64 add4 = *reinterpret_cast<UINT64*>(*reinterpret_cast<int*>(baseFuncAddr + 0x81) + baseFuncAddr + 0x85); | |
13 | struct HashNode | |
14 | { | |
15 | int hash; | |
16 | UINT16 data; | |
17 | UINT16 padding; | |
18 | HashNode* next; | |
19 | }; | |
20 | HashNode** HashMap = *reinterpret_cast<HashNode***>(*reinterpret_cast<int*>(baseFuncAddr + 0x24) + baseFuncAddr + 0x28); | |
21 | - | //I know 0x20 items are defined but there are only 0x16 vehicle classes. |
21 | + | List<int> ^hashes = gcnew List<int>(); |
22 | - | //But keeping it at 0x20 is just being safe as the & 0x1F in theory supports up to 0x20 |
22 | + | |
23 | - | array<List<int>^> ^hashes = gcnew array<List<int>^>(0x20); |
23 | + | |
24 | - | for (int i = 0; i<0x20;i++) |
24 | + | |
25 | { | |
26 | - | hashes[i] = gcnew List<int>(); |
26 | + | |
27 | UINT16 data = cur->data; | |
28 | if ((int)data < cmp1 && bittest(*reinterpret_cast<int*>(mov2 + (4 * data >> 5)), data & 0x1F)) | |
29 | { | |
30 | UINT64 addr1 = add4 + mul3 * data; | |
31 | if (addr1) | |
32 | { | |
33 | UINT64 addr2 = *reinterpret_cast<PUINT64>(addr1); | |
34 | if (addr2) | |
35 | { | |
36 | if ((*reinterpret_cast<PBYTE>(addr2 + 157) & 0x1F) == 5) | |
37 | { | |
38 | hashes->Add(cur->hash); | |
39 | } | |
40 | } | |
41 | } | |
42 | } | |
43 | } | |
44 | - | hashes[*reinterpret_cast<PBYTE>(addr2 + classOffset) & 0x1F]->Add(cur->hash); |
44 | + | |
45 | return hashes->ToArray(); | |
46 | } | |
47 | ||
48 | // | |
49 | address = FindPattern("\x0F\xB6\xDB\xBA\x00\x00\x00\x00\x24\x1F\x3C\x05", "xxxx????xxxx"); | |
50 | GetVehicleModels(*reinterpret_cast<int*>(address - 0xF) + address - 0xB); |