-
Notifications
You must be signed in to change notification settings - Fork 4
/
dllmain.cpp
364 lines (317 loc) · 12 KB
/
dllmain.cpp
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
// dllmain.cpp: îïðåäåëÿåò òî÷êó âõîäà äëÿ ïðèëîæåíèÿ DLL.
#include "includes.h"
#include "PatternScan.h"
#include "hook2.h"
#include "PolynomialSolver.h"
#include "Menu.h"
#include "classes.h"
#include "Aim.h"
#include "ESP.h"
using namespace std;
//#define DEBUG
//typedef __int64(__fastcall *FUNC_GetPlayerFromIndex)(__int64 a1, int a2);
//typedef __m128i(*__fastcall *FUNC_ConvertVec3) (Vec3 a1, Vec3 a2, int color);
DWORD g_threadID2;
bool g_isInitialized = 0;
bool Draw = 0;
__int64 *logic;
bool Menu = 0;
void CreateConsole()
{
AllocConsole();
SetConsoleTitle("pisos");
freopen("CONOUT$", "w", stdout);
freopen("CONIN$", "r", stdin);
printf("Ez 4rtz\n");
}
DWORD WINAPI HelpThread(LPVOID)
{
char first;
cout << "Manual launch? [y/n] "; cin >> first; cout << "\n";
if (first == 'y')
{
UINT64 base = (UINT64)GetModuleHandle(0);
std::cout << std::hex << "offset CGameLogic 0x"; cin>>hex >> Offsets::CGAMELOGIC_ADDR; Offsets::CGAMELOGIC_ADDR += base;
cout << "\noffset EntityList 0x"; cin >> Offsets::ENTITYLIST_ADDR; Offsets::ENTITYLIST_ADDR += base;
cout << "\noffset EntityContainer 0x"; cin >> Offsets::ENTITYCONTAINER_ADDR; Offsets::ENTITYCONTAINER_ADDR += base;
cout << "\noffset Aimer 0x"; cin >> Offsets::AIMER_ADDR; Offsets::AIMER_ADDR += base;
cout << "\noffset CRender 0x"; cin >> Offsets::CRENDER_ADDR; Offsets::CRENDER_ADDR += base;
cout << "\noffset LocalCamera 0x"; cin >> Offsets::LOCALCAMERA; Offsets::LOCALCAMERA += base;
//<< "FUNC_DrawDebugLine 0x" << Offsets::FUNC_DrawDebugLine << "\n"
cout << "\noffset FUNC_GETBONE 0x"; cin >> Offsets::FUNC_GETBONE; Offsets::FUNC_GETBONE += base;
cout << "\noffset FUNC_GetPlayerFromIndex 0x"; cin >> Offsets::FUNC_GetPlayerFromIndex; Offsets::FUNC_GetPlayerFromIndex += base; cin >> dec;
}
else
{
Offsets::CGAMELOGIC_ADDR = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\x7B\x58\xFF", "xxx????x????xxxx"), 0);
Offsets::ENTITYLIST_ADDR = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8B\x0D\x00\x00\x00\x00\x74\x22", "xxx????xx"), 0);
//Offsets::ENTITYLIST_ADDR = (UINT64)GetModuleHandle(0) + 0x1156848;// Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8B\x0D\x00\x00\x00\x00\x48\x8B\xD3\xE8\x00\x00\x00\x00\x48\x8B\x03\x48\x8B\xCB\xFF\x90\x00\x00\x00\x00\x48\x8B\xCB", "xxx????xxxx????xxxxxxxx????xxx"), 0);
Offsets::ENTITYCONTAINER_ADDR = Resolve(FindPattern("Crossout.exe", (byte*)"\x44\x39\x35\x00\x00\x00\x00\x74\x01\xCC\x4C\x8D\x2D\x00\x00\x00\x00", "xxx????xxxxxx????"), 0);
Offsets::AIMER_ADDR = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x89\x3D\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x0F\x57\xF6", "xxx????xxx????xxx"), 0);
Offsets::CRENDER_ADDR = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8B\x0D\x00\x00\x00\x00\x0F\xB6\xF0", "xxx????xxx"), 0);
Offsets::LOCALCAMERA = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8B\x15\x00\x00\x00\x00\x48\x85\xD2\x75\x63", "xxx????xxxxx"), 0);
//std::cout << FindPattern("Crossout.exe", (byte*)"\x8B\x05\x00\x00\x00\x00\x85\xC0\x74\x2F\x48\x8B\xDE", "xx????xxxxxxx") << "\n";
//Offsets::FUNC_DrawDebugLine = FindPattern("Crossout.exe", (byte*)"\x48\x89\x5C\x24\x00\x48\x89\x6C\x24\x00\x56\x57\x41\x56\x48\x83\xEC\x40\x49\x8B\xF8", "xxxx?xxxx?xxxxxxxxxxx");
Offsets::FUNC_GETBONE = FindPattern("Crossout.exe", (byte*)"\x48\x89\x6C\x24\x00\x56\x48\x83\xEC\x70\x8B\xEA", "xxxx?xxxxxxx");
Offsets::FUNC_GetPlayerFromIndex = FindPattern("Crossout.exe", (byte*)"\x48\x63\xC2\x48\x69\xD0\x00\x00\x00\x00\x44\x8B\x8C\x0A\x00\x00\x00\x00", "xxxxxx????xxxx????");
Offsets::CVARARRAY = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8D\x3D\x00\x00\x00\x00\x8B\xC0", "xxx????xx"),0);
}
std::cout << std::hex
<<"CGameLogic 0x" << Offsets::CGAMELOGIC_ADDR<<"\n"
<< "EntityList 0x" << Offsets::ENTITYLIST_ADDR << "\n"
<< "EntityContainer 0x" << Offsets::ENTITYCONTAINER_ADDR << "\n"
<< "Aimer 0x" << Offsets::AIMER_ADDR << "\n"
<< "CRender 0x" << Offsets::CRENDER_ADDR << "\n"
<< "LocalCamera 0x" << Offsets::LOCALCAMERA << "\n"
//<< "FUNC_DrawDebugLine 0x" << Offsets::FUNC_DrawDebugLine << "\n"
<< "FUNC_GETBONE 0x" << Offsets::FUNC_GETBONE << "\n"
<< "CVARARRAY 0x" << Offsets::CVARARRAY << "\n"
<< "FUNC_GetPlayerFromIndex 0x" << Offsets::FUNC_GetPlayerFromIndex << "\n";
//f=fopen("suka.txt", "w");
//_DrawDebugLine = (FUNC_DrawDebugLine)(0x7FF76E7BEB80);
#ifdef DEBUG
UINT64 base = (UINT64)GetModuleHandle(0);
std::cout << std::hex
<< "offset CGameLogic 0x" << Offsets::CGAMELOGIC_ADDR-base << "\n"
<< "offset EntityList 0x" << Offsets::ENTITYLIST_ADDR-base << "\n"
<< "offset EntityContainer 0x" << Offsets::ENTITYCONTAINER_ADDR-base << "\n"
<< "offset Aimer 0x" << Offsets::AIMER_ADDR-base << "\n"
<< "offset CRender 0x" << Offsets::CRENDER_ADDR-base << "\n"
<< "offset LocalCamera 0x" << Offsets::LOCALCAMERA-base << "\n"
//<< "FUNC_DrawDebugLine 0x" << Offsets::FUNC_DrawDebugLine << "\n"
<< "offset FUNC_GETBONE 0x" << Offsets::FUNC_GETBONE-base << "\n"
<< "offset FUNC_GetPlayerFromIndex 0x" << Offsets::FUNC_GetPlayerFromIndex-base << "\n";
#endif // DEBUG
if (Offsets::CGAMELOGIC_ADDR && Offsets::AIMER_ADDR && Offsets::ENTITYCONTAINER_ADDR && Offsets::ENTITYLIST_ADDR
&& Offsets::FUNC_GETBONE && Offsets::FUNC_GetPlayerFromIndex && Offsets::LOCALCAMERA && Offsets::CRENDER_ADDR)
{
std::cout << "Sigscan succed...\n";
CreateThread(NULL, 0, InitializeHook, NULL, 0, NULL);
while (1)
{
if (GetAsyncKeyState(VK_F1))
{
Features::ESP = !Features::ESP;
Sleep(200);
}
else if (GetAsyncKeyState(VK_F2))
{
Menu = !Menu;
Sleep(200);
}
/*if (GetAsyncKeyState(VK_NUMPAD0))
{
std::cout << GetModuleHandle(0)<<"\n";
Vec3 suka(0, 0, 0);
Vec3 suka2 = suka;
bool gabe=WorldToScreen(suka, suka2);
std::cout << suka2.x << " " << suka2.y << " " << suka2.z <<" "<<gabe << "\n";
Sleep(100);
//DrawDebugLine(f,g,0xFF00FF);
}
if (GetAsyncKeyState(VK_NUMPAD1))
{
uintptr_t f = Resolve(FindPattern("Crossout.exe", (byte*)"\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\x7B\x58\xFF", "xxx????x????xxxx"), 0);
std::cout <<std::hex<< f <<std::dec<< "\n";
Sleep(100);
//DrawDebugLine(f,g,0xFF00FF);
}*/
/*if (GetAsyncKeyState(VK_NUMPAD0))
{
CGameLogic* pGameLogic = CGameLogic::GetInstance();//(CGameLogic*)(GetModuleHandle(0)+0x1856B40);
if (IsValidPtr(pGameLogic))
{
BaseEntity* pLocalPlayer = pGameLogic->GetLocalPlayer();
if (IsValidPtr(pLocalPlayer))
{
for (int a = 0; a < pLocalPlayer->CarPartsCount(); a++)
{
BaseEntity* CarPart = pLocalPlayer->GetCarParts(a);
if (IsValidPtr(CarPart))
{
if (IsValidPtr(CarPart->pType) && IsValidPtr(CarPart->pPartName) && IsValidPtr(CarPart->GetBoneByID(0)))
{
std::cout << "--------" << a << "---------\nType: " << CarPart->pType->TypeName << "\nName: " << CarPart->pPartName->Name << "\n-------------\n";
}
}
}
}
}
Sleep(100);
//DrawDebugLine(f,g,0xFF00FF);
}*/
/*if (GetAsyncKeyState(VK_NUMPAD5))
{
CGameLogic* pGameLogic = CGameLogic::GetInstance();//(CGameLogic*)(GetModuleHandle(0)+0x1856B40);
if (IsValidPtr(pGameLogic))
{
BaseEntity* pLocalPlayer = pGameLogic->GetLocalPlayer();
if (IsValidPtr(pLocalPlayer))
{
EntityContainer* pEntityCont = EntityContainer::GetInstance();
if (IsValidPtr(pEntityCont))
{
if (IsValidPtr(pEntityCont->BaseEntitysArray))
{
for (int Counter = 0; Counter < pEntityCont->EntityCount; Counter++)
{
BaseEntity* pEntity = pEntityCont->BaseEntitysArray[Counter];
if (IsValidPtr(pEntity))
{
std::cout<<pEntity->Name<<" : "<<&pEntity->pBone->pSpeed->Velocity<<"\n";
}
}
}
}
}
}
Sleep(100);
//DrawDebugLine(f,g,0xFF00FF);
}*/
else if (GetAsyncKeyState(VK_RIGHT))
{
Features::PredictSpeed++;
Sleep(20);
//DrawDebugLine(f,g,0xFF00FF);
}
else if (GetAsyncKeyState(VK_LEFT))
{
Features::PredictSpeed--;
Sleep(20);
//DrawDebugLine(f,g,0xFF00FF);
}
else if (GetAsyncKeyState(VK_UP))
{
Features::GravityLevel += 0.1;
Sleep(20);
//DrawDebugLine(f,g,0xFF00FF);
}
else if (GetAsyncKeyState(VK_DOWN))
{
Features::GravityLevel -= 0.1;
Sleep(20);
//DrawDebugLine(f,g,0xFF00FF);
}
/*else if (GetAsyncKeyState(VK_NUMPAD8))
{
CvarArray* Array = CvarArray::GetInstance();
cout << Array << " ssss\n";
if (IsValidPtr(Array))
{
HelpArray* help = Array->ToCvars;
if (IsValidPtr(help))
{
Cvar cvar1 = help->FirstMember;
Cvar* tonext = cvar1.NextCvar;
cout << "-----first-----\n1 " << cvar1.CvarName << "\n";
int a = 2;
while (IsValidPtr(tonext))
{
cout << a << " " << tonext->CvarName << "\n";
tonext = tonext->NextCvar;
a++;
}
}
}
//Features::GravityLevel -= 0.1;
Sleep(20);
//DrawDebugLine(f,g,0xFF00FF);
}*/
Sleep(10);
}
}
else
{
std::cout << "Sigscan failed...\nManual launch? [y/n] ";
char agr;
cin >> agr;
if (agr == 'y')
{
UINT64 base = (UINT64)GetModuleHandle(0);
std::cout << std::hex << "offset CGameLogic 0x"; cin >>hex>> Offsets::CGAMELOGIC_ADDR; Offsets::CGAMELOGIC_ADDR += base;
cout << "\noffset EntityList 0x"; cin >> Offsets::ENTITYLIST_ADDR; Offsets::ENTITYLIST_ADDR += base;
cout << "\noffset EntityContainer 0x"; cin >> Offsets::ENTITYCONTAINER_ADDR; Offsets::ENTITYCONTAINER_ADDR += base;
cout << "\noffset Aimer 0x"; cin >> Offsets::AIMER_ADDR; Offsets::AIMER_ADDR += base;
cout << "\noffset CRender 0x"; cin >> Offsets::CRENDER_ADDR; Offsets::CRENDER_ADDR += base;
cout << "\noffset LocalCamera 0x"; cin >> Offsets::LOCALCAMERA; Offsets::LOCALCAMERA += base;
//<< "FUNC_DrawDebugLine 0x" << Offsets::FUNC_DrawDebugLine << "\n"
cout << "\noffset FUNC_GETBONE 0x"; cin >> Offsets::FUNC_GETBONE; Offsets::FUNC_GETBONE += base;
cout << "\noffset FUNC_GetPlayerFromIndex 0x"; cin >> Offsets::FUNC_GetPlayerFromIndex; Offsets::FUNC_GetPlayerFromIndex += base; cin >> dec;
}
}
return 0;
}
char mylogo[] = "Q`wsfwv2pk2A{vwh";
char logo2[] = "Vgptapq5wl5F|qpo";
HRESULT __stdcall PresentHook(IDXGISwapChain* pSwapChain, UINT syncInterval, UINT flags)
{
//std::cout << &logo2<<"\n";
if (strcmp(Crypt2(logo2, 789), Crypt2(mylogo, 786)))
{
Vec3 *suka = (Vec3*)0x012312a;
suka->x = 500;
}
Crypt2(logo2, 789);Crypt2(mylogo, 786);
if (!g_isInitialized)
{
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void **)&pDevice)))
{
pSwapChain->GetDevice(__uuidof(pDevice), (void**)&pDevice);
pDevice->GetImmediateContext(&pContext);
}
std::cout << "injected\n";
HWND hWindow = GetForegroundWindow();//FindWindow(NULL, "STAR WARS Battlefront II");
char buff[100];
GetWindowText(hWindow, buff, 100);
std::cout <<"Got Window: " <<buff << "\n";
if (!hWindow)
{
MessageBox(NULL, "ff", "ff", MB_OK);
}
IHooks::Initialize("STAR WARS Battlefront II");
ImGui_ImplDX11_Init(hWindow, pDevice, pContext);
ImGui_ImplDX11_CreateDeviceObjects();
g_isInitialized = true;
}
ImGui_ImplDX11_NewFrame();
bool show_app_about = 1;
bool show_app_help = 1;
ImGui::Begin("noname", &show_app_about);
DrawTextIm(Features::ScreenX-200, 100, Features::TextColorMy, Crypt2(mylogo,786));
//ESP();
ImGui::End();
Crypt2(mylogo, 786);
if (Menu)
{
DrawMenu();
}
if (Features::ESP)
{
//fprintf(f, "in\n"); fflush(f);
ImGui::Begin("About ImGui", &show_app_about);
ESP();
ImGui::End();
//fprintf(f, "out\n"); fflush(f);
}
ImGui::Render();
return phookD3D11Present(pSwapChain, syncInterval, flags);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
CreateConsole();
CreateThread(NULL, NULL, &HelpThread, NULL, NULL, &g_threadID2);
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}