-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathunlockAll.cpp
More file actions
348 lines (280 loc) · 8.48 KB
/
unlockAll.cpp
File metadata and controls
348 lines (280 loc) · 8.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#include"unlockAll.h"
#include"globals.h"
BOOL g_running = true;
MoveResponseToInventory_t fpMoveResponseOrig = 0;
MoveResponseToInventory_t manual_call;
namespace unlock {
__int64 base;
__int64 fpGetLootBase;
__int64 fpGetLogonStatus;
__int64 fpMoveResponseToInventory;
__int64 fpFindStringtable;
__int64 fpStringtableGetColumnValueForRow;
__int64 fpGetLootBase2;
__int64 fpGetLogonStatus2;
__int64 fpMoveResponseToInventory2;
__int64 fpFindStringtable2;
__int64 fpStringtableGetColumnValueForRow2;
bool init() {
base = (__int64)GetModuleHandle(NULL);
return true;
}
/*bool find_sigs()
{
MODULEINFO moduleInfo;
if (!GetModuleInformation((HANDLE)-1, GetModuleHandle(NULL), &moduleInfo, sizeof(MODULEINFO)) || !moduleInfo.lpBaseOfDll) {
LOG("Couldnt GetModuleInformation");
return NULL;
}
LOG("Base: 0x%llx", moduleInfo.lpBaseOfDll);
LOG("Size: 0x%llx", moduleInfo.SizeOfImage);
__int64 searchStart = (__int64)moduleInfo.lpBaseOfDll;
__int64 searchEnd = (__int64)moduleInfo.lpBaseOfDll + moduleInfo.SizeOfImage;
bool result = true;
auto resolve_jmp = [](__int64 addr) -> __int64 {
return *(int*)(addr + 1) + addr + 5;
};
auto resolve_lea = [](__int64 addr) -> __int64 {
return *(int*)(addr + 3) + addr + 7;
};
LOG_ADDR(fpGetLogonStatus = resolve_jmp(
find_pattern(searchStart, searchEnd, xorstr("E8 ? ? ? ? 83 F8 02 0F 84 ? ? ? ? 48 89"))));
LOG_ADDR(fpFindStringtable = resolve_jmp(
find_pattern(searchStart, searchEnd, xorstr("E8 ? ? ? ? 48 8B 8C 24 ? ? ? ? E8 ? ? ? ? 44"))));
LOG_ADDR(fpStringtableGetColumnValueForRow = resolve_jmp(
find_pattern(searchStart, searchEnd, xorstr("E8 ? ? ? ? 48 8D 4B 02 FF"))));
LOG_ADDR(fpMoveResponseToInventory =
(find_pattern(searchStart, searchEnd, xorstr("83 7C 24 ? ? 74 1B 83 7C 24 ? ? 0F 84")) - 43));
LOG_ADDR(fpGetLootBase = resolve_jmp(
(find_pattern(searchStart, searchEnd, xorstr("E8 ? ? ? ? 48 89 44 24 ? 41 B9 ? ? ? ? 44 ")))));
return result;
}*/
}
void get_func_ptr()
{
unlock::fpGetLogonStatus = g_data::base + 0x5B485F0;
unlock::fpFindStringtable = g_data::base + 0x3898C00;
unlock::fpStringtableGetColumnValueForRow = g_data::base + 0x3898C40;
unlock::fpMoveResponseToInventory = g_data::base + 0x6309190;
unlock::fpGetLootBase = g_data::base + 0x63036D0;
}
void* GetLootBase()
{
return reinterpret_cast<void* (__cdecl*)()>(unlock::fpGetLootBase)();
}
void FindStringTable(const char* name, StringTable** table)
{
reinterpret_cast<void(__cdecl*)(const char*, StringTable**)>(unlock::fpFindStringtable)(name, table);
}
char* StringTable_GetColumnValueForRow(void* stringTable, int row, int column)
{
std::ofstream test;
test.open("example.csv");
test << stringTable;
test.close();
return reinterpret_cast<char* (__cdecl*)(void*, int, int)>(unlock::fpStringtableGetColumnValueForRow)(stringTable, row, column);
}
inline LPCSTR All_camos[]{
//CW camos
"weapon",
/*"attachment",*/
"operator",
"Operator_skin",
/*"equipment",*/
/*"perk",*/
"reticle",
"playercards",
"emblems",
"gestures",
"executions",
/*"camo",*/
/*"operator_quip",*/
"dlc",
/*"feature",*/
"bundle",
"iw8_ar_t9longburst_camos",
"iw8_ar_t9mobility_camos",
"iw8_ar_t9slowfire_camos",
"iw8_ar_t9damage_camos",
"iw8_ar_t9slowhandling_camos",
"iw8_ar_t9british_camos",
"iw8_ar_t9standard_camos",
"iw8_ar_t9accurate_camos",
"iw8_ar_t9fasthandling_camos",
"iw8_ar_t9fastfire_camos",
"iw8_ar_t9fastburst_camos",
"iw8_sh_t9semiauto_camos",
"iw8_sh_t9fullauto_camos",
"iw8_sh_t9pump_camos",
"iw8_sm_t9standard_camos",
"iw8_sm_t9accurate_camos",
"iw8_sm_t9spray_camos",
"iw8_sm_t9burst_camos",
"iw8_sm_t9semiauto_camos",
"iw8_sm_t9capacity_camos",
"iw8_sm_t9powerburst_camos",
"iw8_sm_t9cqb_camos",
"iw8_sm_t9nailgun_camos",
"iw8_sm_t9fastfire_camos",
"iw8_sm_t9heavy_camos",
"iw8_sm_t9handling_camos",
"iw8_sm_t9standard_camos",
"iw8_sm_t9accurate_camos",
"iw8_sm_t9spray_camos",
"iw8_sm_t9burst_camos",
"iw8_sm_t9semiauto_camos",
"iw8_sm_t9capacity_camos",
"iw8_sm_t9powerburst_camos",
"iw8_sm_t9cqb_camos",
"iw8_sm_t9nailgun_camos",
"iw8_sm_t9fastfire_camos",
"iw8_sm_t9heavy_camos",
"iw8_sm_t9handling_camos",
"iw8_sn_t9cannon_camos",
"iw8_sn_t9accurate_camos",
"iw8_sn_t9crossbow_camos",
"iw8_sn_t9damagesemi_camos",
"iw8_sn_t9powersemi_camos",
"iw8_sn_t9precisionsemi_camos",
"iw8_sn_t9quickscope_camos",
"iw8_sn_t9standard_camos",
"iw8_lm_t9accurate_camos",
"iw8_lm_t9fastfire_camos",
"iw8_lm_t9light_camos",
"iw8_lm_t9slowfire_camos",
"iw8_pi_t9burst_camos",
"iw8_pi_t9fullauto_camos",
"iw8_pi_t9semiauto_camos",
"iw8_pi_t9pistolshot_camos",
"iw8_pi_t9revolver_camos",
//MW camos
"iw8_ar_anovember94_camos",
"iw8_ar_valpha_camos",
"iw8_ar_mike4_camos",
"iw8_ar_akilo47_camos",
"iw8_ar_asierra12_camos",
"iw8_ar_falpha_camos",
"iw8_ar_mcharlie_camos",
"iw8_ar_kilo433_camos",
"iw8_ar_falima_camos",
"iw8_ar_scharlie_camos",
"iw8_ar_tango21_camos",
"iw8_ar_sierra552_camos",
"iw8_ar_galima_camos",
"iw8_sm_smgolf45_camos",
"iw8_sm_mpapa5_camos",
"iw8_sm_charlie9_camos",
"iw8_sm_secho_camos",
"iw8_sm_victor_camos",
"iw8_sm_uzulu_camos",
"iw8_sm_mpapa7_camos",
"iw8_sm_papa90_camos",
"iw8_sm_augolf_camos",
"iw8_sm_beta_camos",
"iw8_sn_sksierra_camos",
"iw8_sn_mike14_camos",
"iw8_sn_crossbow_camos",
"iw8_sn_kilo98_camos",
"iw8_sn_hdromeo_camos",
"iw8_sn_delta_camos",
"iw8_sn_alpha50_camos",
"iw8_sn_sbeta_camos",
"iw8_sn_romeo700_camos",
"iw8_sn_xmike109_camos",
"iw8_sh_aalpha12_camos",
"iw8_sh_dpapa12_camos",
"iw8_sh_oscar12_camos",
"iw8_sh_charlie725_camos",
"iw8_sh_romeo870_camos",
"iw8_sh_mike26_camos",
"iw8_lm_slima_camos",
"iw8_lm_kilo121_camos",
"iw8_lm_pkilo_camos",
"iw8_lm_lima86_camos",
"iw8_lm_mgolf34_camos",
"iw8_lm_mgolf36_camos",
"iw8_lm_mkilo3_camos",
"iw8_lm_sierrax_camos",
"iw8_pi_golf21_camos",
"iw8_pi_papa320_camos",
"iw8_pi_decho_camos",
"iw8_pi_mike1911_camos",
"iw8_pi_cpapa_camos",
"iw8_pi_mike9_camos",
"iw8_pi_mike_camos",
"iw8_la_rpapa7_camos",
"iw8_la_gromeo_camos",
"iw8_la_juliet_camos",
"iw8_la_kgolf_camos",
"iw8_me_riotshield_camos",
"iw8_knife_camos",
"iw8_me_akimboblades_camos",
"iw8_me_akimboblunt_camos",
"gs_save_slot",
};
bool __fastcall MoveResponseToInventory_Hooked(LPVOID a1, int a2) {
std::ofstream test2;
test2.open("MoveResponseToInventory_Hooked.txt");
test2 << a1 << " " << a2 << "\n";
test2.close();
auto ret = fpMoveResponseOrig(a1, a2);
auto pLootBase = GetLootBase();
auto pInventory = (LootItem*)((uintptr_t)pLootBase + 64);
auto pNumItems = (uint32_t*)((uintptr_t)pLootBase + 240064);
int curCount = *pNumItems;
auto updateOrAddItem = [&](int itemId, int quantity)
{
bool bFound = false;
/* for (int i = 0; i < 1; i++) {
if (pInventory[i].m_itemId == itemId && pInventory[i].m_itemQuantity < 1) {
pInventory[i].m_itemQuantity++;
bFound = true;
break;
}
}*/
pInventory[curCount].m_itemId = itemId;
pInventory[curCount].m_itemQuantity = 1;
curCount++;
(*pNumItems)++;
*(BYTE*)((uintptr_t)pLootBase + 240072) = 0;
};
char buf[1024];
for (int i = 0; i < ARRAYSIZE(All_camos); i++) {
sprintf_s(buf, "loot/%s_ids.csv", All_camos[i]);
StringTable* string_table = nullptr;
FindStringTable(buf, &string_table);
if (!string_table)
continue;
std::ofstream myfile;
myfile.open(" string_tablecount.txt");
myfile << string_table->rowCount << "\n";
for (int s = 0; s < string_table->rowCount; s++) {
updateOrAddItem(atoi(StringTable_GetColumnValueForRow(string_table, s, 0)), 1);
}
}
/*if (unlockAll::loop == 1)
{
unlockAll::loop++;
char buf[1024];
for (int i = 0; i < ARRAYSIZE(All_camos2); i++) {
sprintf_s(buf, "loot/%s_ids.csv", All_camos2[i]);
StringTable* string_table = nullptr;
FindStringTable(buf, &string_table);
if (!string_table)
continue;
std::ofstream myfile;
myfile.open(" string_tablecount.txt");
myfile << string_table->rowCount << "\n";
for (int s = 0; s < string_table->rowCount; s++) {
updateOrAddItem(atoi(StringTable_GetColumnValueForRow(string_table, s, 0)), 1);
}
}
}*/
MH_RemoveHook((LPVOID)unlock::fpMoveResponseToInventory);
return ret;
}
void on_attach() {
unlock::init();
//unlock::find_sigs();
get_func_ptr();
}