Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.70 KB | None | 0 0
  1. // dllmain.cpp : Definiert den Einstiegspunkt fr die DLL-Anwendung.
  2. #include "stdafx.h"
  3. #include "arma.h"
  4. #include <stdio.h>
  5. #include <Subauth.h>
  6. #include <time.h> /* time */
  7. #include "detours.h"
  8. #pragma comment (lib, "detours.lib")
  9. #include <iostream>
  10. #include <string>
  11. #include <cstdio>
  12.  
  13. HRESULT __stdcall EndScene(LPDIRECT3DDEVICE9 pDevice);
  14. typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
  15. typedef HRESULT (WINAPI* oEndScene) (LPDIRECT3DDEVICE9 pDev);
  16. typedef int (WINAPI *Present_t)(LPDIRECT3DDEVICE9 pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion);
  17. Present_t oPresent;
  18. EndScene_t pEndScene;
  19.  
  20.  
  21. LPD3DXFONT m_pFont;
  22. ID3DXLine* m_rectLine;
  23. DWORD dwModBase;
  24. char hurennigger[5012];
  25. D3DXVECTOR3 localPlayer; // pos
  26. DWORD* dwpVTableStart = NULL; // d3d9.dll device vtable
  27. bool Init = 0;
  28.  
  29. // W 2 S stuff
  30. D3DXVECTOR3 InvViewRight;
  31. D3DXVECTOR3 InvViewUp;
  32. D3DXVECTOR3 InvViewForward;
  33. D3DXVECTOR3 InvViewTranslation;
  34. D3DXVECTOR3 ViewPortMatrix;
  35. D3DXVECTOR3 ProjD1;
  36. D3DXVECTOR3 ProjD2;
  37. // end
  38.  
  39. // colors
  40. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grn, Blau
  41. const D3DCOLOR txtGreen = D3DCOLOR_ARGB(255, 20, 222, 20);
  42. const D3DCOLOR txtBlue = D3DCOLOR_ARGB(255, 20, 22, 222);
  43. const D3DCOLOR txtRed = D3DCOLOR_ARGB(255, 255, 0, 0);
  44. const D3DCOLOR txtGrey = D3DCOLOR_ARGB(255, 222, 222, 222);
  45. const D3DCOLOR txtDarkGrey = D3DCOLOR_ARGB(255, 142, 142, 182);
  46. // colors end
  47.  
  48. /* Menu options */
  49. float *distLimit = new float(1000);
  50. float *distLimit2 = new float(1000);
  51. float *noFatigue = new float(0);
  52. float *emptyVeh = new float(0);
  53. float *objects = new float(0);
  54. float *allObjects = new float(0);
  55. float *unlockVehicles = new float(0);
  56. float *listItems = new float(0);
  57. float *bulletDamage = NULL;
  58.  
  59. struct itemEntry
  60. {
  61. char name[64];
  62. BYTE type;
  63. void* item;
  64. itemEntry* last;
  65. itemEntry* next;
  66. bool show;
  67. itemEntry(char * n, BYTE t,void *i)
  68. {
  69. strcpy_s(name,n);
  70. type = t;
  71. item = i;
  72. show = 1;
  73. next = NULL;
  74. }
  75. };
  76.  
  77. struct itemPicker
  78. {
  79. itemEntry* first;
  80. itemEntry* last;
  81. itemEntry* selected;
  82. itemPicker()
  83. {
  84. itemEntry *f = new itemEntry("...",0,0);
  85. selected = last = first = f;
  86. f->last = NULL;
  87. }
  88. void add(itemEntry* nm)
  89. {
  90. last->next = nm;
  91. nm->last = last;
  92. last = nm;
  93. }
  94. void update(char* t)
  95. {
  96.  
  97. }
  98. };
  99.  
  100. bool drawMenu;
  101.  
  102. struct playerEntry
  103. {
  104. char name[32];
  105. int ID;
  106. playerEntry* last;
  107. playerEntry* next;
  108. playerEntry(char * n, int i)
  109. {
  110. strcpy_s(name,n);
  111. next = NULL;
  112. ID = i;
  113. }
  114. };
  115.  
  116. struct playerPicker
  117. {
  118. playerEntry* first;
  119. playerEntry* last;
  120. playerEntry* selected;
  121. playerPicker(playerEntry* f)
  122. {
  123. selected = last = first = f;
  124. f->last = NULL;
  125. }
  126. void add(playerEntry* nm)
  127. {
  128. last->next = nm;
  129. nm->last = last;
  130. last = nm;
  131. }
  132. };
  133.  
  134. struct menuentry
  135. {
  136. menuentry* next;
  137. menuentry* last;
  138. float *value;
  139. float step;
  140. float max;
  141. char name[32];
  142. menuentry(char * n,float* &d,float s, float m)
  143. {
  144. strcpy_s(name,n);
  145. next = NULL;
  146. value = d; step = s; max = m;
  147. }
  148. void right()
  149. {
  150. if(!((*value + step)>max))
  151. {
  152. *value = *value + step;
  153. }
  154. }
  155. void left()
  156. {
  157. if(!((*value - step)<0))
  158. {
  159. *value = *value - step;
  160. }
  161. }
  162. };
  163. menuentry* bd = NULL;
  164.  
  165. struct menu
  166. {
  167. menuentry* first;
  168. menuentry* last;
  169. menuentry* selected;
  170. playerPicker* picker;
  171. itemPicker* iPicker;
  172. menu(menuentry* f)
  173. {
  174. selected = last = first = f;
  175. f->last = NULL;
  176. picker = NULL;
  177. iPicker = NULL;
  178. }
  179.  
  180. void add(menuentry* nm)
  181. {
  182. last->next = nm;
  183. nm->last = last;
  184. last = nm;
  185. }
  186. };
  187.  
  188. menu *mainMenu;
  189. //
  190. typedef struct _PEB_LDR_DATA
  191. {
  192. ULONG Length;
  193. BOOLEAN Initialized;
  194. PVOID SsHandle;
  195. LIST_ENTRY InLoadOrderModuleList;
  196. LIST_ENTRY InMemoryOrderModuleList;
  197. LIST_ENTRY InInitializationOrderModuleList;
  198. } PEB_LDR_DATA, *PPEB_LDR_DATA;
  199.  
  200. typedef struct _LDR_MODULE {
  201.  
  202. LIST_ENTRY InLoadOrderModuleList;
  203. LIST_ENTRY InMemoryOrderModuleList;
  204. LIST_ENTRY InInitializationOrderModuleList;
  205. PVOID BaseAddress;
  206. PVOID EntryPoint;
  207. ULONG SizeOfImage;
  208. UNICODE_STRING FullDllName;
  209. UNICODE_STRING BaseDllName;
  210. ULONG Flags;
  211. SHORT LoadCount;
  212. SHORT TlsIndex;
  213. LIST_ENTRY HashTableEntry;
  214. ULONG TimeDateStamp;
  215.  
  216. } LDR_MODULE, *PLDR_MODULE;
  217.  
  218. inline float Vectorl3(D3DVECTOR v) {
  219. return (sqrt(v.x * v.x + v.y * v.y + v.z * v.z));
  220. }
  221.  
  222. inline float Vectorl2(D3DXVECTOR2 v) {
  223. return (sqrt(v.x * v.x + v.y * v.y));
  224. }
  225.  
  226. VOID* DetourCreate(BYTE *src, const BYTE *dst, const int len)
  227. {
  228. BYTE *jmp = (BYTE*)malloc(len+5);
  229. DWORD dwBack;
  230.  
  231. VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
  232. memcpy(jmp, src, len);
  233. jmp += len;
  234. jmp[0] = 0xE9;
  235. *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
  236. src[0] = 0xE9;
  237. *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
  238. for (int i=5; i<len; i++) src[i]=0x90;
  239. VirtualProtect(src, len, dwBack, &dwBack);
  240. return (jmp-len);
  241. }
  242.  
  243. bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
  244. {
  245. for(;*szMask;++szMask,++pData,++bMask)
  246. if(*szMask=='x' && *pData!=*bMask )
  247. return false;
  248. return (*szMask) == NULL;
  249. }
  250. DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
  251. {
  252. for(DWORD i=0; i < dwLen; i++)
  253. if( bDataCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
  254. return (DWORD)(dwAddress+i);
  255.  
  256. return 0;
  257. }
  258.  
  259. DWORD D3D9VTable()
  260. {
  261. DWORD dwObjBase = (DWORD)LoadLibraryA("D3D9.DLL");
  262. while ( dwObjBase++ < dwObjBase + 0x127850 )
  263. {
  264. if ( (*(WORD*)(dwObjBase + 0x00)) == 0x06C7 && (*(WORD*)(dwObjBase + 0x06)) == 0x8689 && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689 )
  265. {
  266. dwObjBase += 2;
  267. break;
  268. }
  269. }
  270. return ( dwObjBase );
  271. }
  272.  
  273. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
  274. {
  275. D3DRECT rect = {X, Y, X+L, Y+H};
  276. Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); // bei Google gibt’s nהheres
  277. }
  278.  
  279. void DrawLine(ID3DXLine* pLine,float x1, float y1,float x2, float y2, D3DCOLOR color)
  280. {
  281. D3DXVECTOR2 Vector2[2];
  282. Vector2[0].x = x1;
  283. Vector2[0].y = y1;
  284. Vector2[1].x = x2;
  285. Vector2[1].y = y2;
  286. pLine->Draw(Vector2,2,color);
  287. }
  288.  
  289. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...)
  290. {
  291. char buffer[256];
  292. va_list args; // deswegen: #include <cstdio>
  293. va_start (args, format);
  294. vsprintf (buffer,format, args);
  295. RECT FontRect = { X, Y, X + 120, Y + 16 };
  296. m_pFont->DrawText( NULL, buffer, -1, &FontRect, DT_NOCLIP , Color ); // Zeichnen
  297. va_end (args);
  298. }
  299.  
  300. void UpdateView()
  301. {
  302. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grn, Blau
  303. DWORD *dwTransformations = (DWORD*)0xDD32F4;
  304. DWORD *dwTransData = (DWORD*)(*dwTransformations + 0x90);
  305. InvViewRight = *(D3DXVECTOR3*)(*dwTransData+0x4);
  306. InvViewUp = *(D3DXVECTOR3*)(*dwTransData+0x10);
  307. InvViewForward = *(D3DXVECTOR3*)(*dwTransData+0x1C);
  308. InvViewTranslation = *(D3DXVECTOR3*)(*dwTransData+0x28);
  309. ViewPortMatrix = *(D3DXVECTOR3*)(*dwTransData+0x54);
  310. ProjD1 = *(D3DXVECTOR3*)(*dwTransData+0xCC);
  311. ProjD2 = *(D3DXVECTOR3*)(*dwTransData+0xD8);
  312. }
  313.  
  314. D3DXVECTOR3 WorldToScreen(D3DXVECTOR3 in)
  315. {
  316. D3DXVECTOR3 out, temp;
  317.  
  318. D3DXVec3Subtract(&temp, &in, &InvViewTranslation);
  319. float x = D3DXVec3Dot(&temp, &InvViewRight);
  320. float y = D3DXVec3Dot(&temp, &InvViewUp);
  321. float z = D3DXVec3Dot(&temp, &InvViewForward);
  322.  
  323. out.x = ViewPortMatrix.x * (1 + (x / ProjD1.x / z));
  324. out.y = ViewPortMatrix.y * (1 - (y / ProjD2.y / z));
  325. out.z = z;
  326.  
  327. return out;
  328. }
  329.  
  330. /*
  331. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  332. {
  333. if(m_pFont==NULL)
  334. {
  335. D3DXCreateFont(pDevice, 14, 0, 400, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Verdana"), &m_pFont);
  336. }
  337. DrawFont(3,3,txtPink,"DistFilter: (%d)",DistLimit);
  338. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  339. if(pWorld.world->cameraOn->unit)
  340. {
  341. if(pWorld.world->cameraOn->unit->entityVisualState)
  342. localPlayer = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  343. EntityTablePointer* ObjectPtr = (pWorld.world->entityTablePointer);
  344. if(!IsBadReadPtr(ObjectPtr,0x8))
  345. {
  346. DWORD* entTable = *(DWORD**)ObjectPtr;
  347. if(!IsBadReadPtr(entTable,4))
  348. {
  349. for(int i = 0; i<pWorld.world->entityTablePointer->objectTableSize; i++)
  350. {
  351. EntityTable *eTable = *(EntityTable**)((entTable+(13*i)));
  352. if(eTable)
  353. {
  354. Entity *e = eTable->e;
  355. if(e)
  356. {
  357. if(strcmp(e->cfgVehicle->objectType->string,"soldier")==0)
  358. {
  359. bool human = 0;
  360. if(!IsBadReadPtr(eTable->unitInfo,0x34))
  361. {
  362. if(!IsBadReadPtr(eTable->unitInfo->unit,0x1178))
  363. if(eTable->unitInfo->unit->playerID > 1)human = 1;
  364. }
  365. EntityVisualState *vis = e->entityVisualState;
  366. if(vis)
  367. {
  368. UpdateView();
  369. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  370. if(pos.z > 0.01)
  371. DrawFont(pos.x,pos.y,human ? txtPink : txtRed,"%s (%s) %f m",e->cfgVehicle->entityName->string, e->cfgVehicle->objectType->string, (int)(Vectorl(localPlayer - vis->coordinates)));
  372. }
  373. }
  374. }
  375. }
  376. }
  377. }
  378. }
  379. }
  380. /*
  381. if(pWorld.world->cameraOn->unit)
  382. {
  383. if(pWorld.world->cameraOn->unit->entityVisualState)
  384. {
  385. D3DVECTOR pos = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  386. DrawFont(3,3,txtPink,"local pos: %f %f %f",pos.x,pos.y,pos.z);
  387. }
  388. }
  389.  
  390.  
  391. return pEndScene(pDevice);
  392. }
  393. */
  394.  
  395. void UnlinkModule (char *szModule)
  396. {
  397. DWORD dwPEB = 0, dwOffset = 0;
  398. PLIST_ENTRY pUserModuleHead, pUserModule;
  399. PPEB_LDR_DATA pLdrData;
  400. PLDR_MODULE pLdrModule;
  401. PUNICODE_STRING lpModule;
  402. char szModuleName[512];
  403. int i = 0, n = 0;
  404.  
  405. _asm
  406. {
  407. pushad
  408. mov eax, fs: [48]
  409. mov dwPEB, eax
  410. popad
  411. }
  412.  
  413. pLdrData= ( PPEB_LDR_DATA )(PDWORD)(*(PDWORD)(dwPEB + 12));
  414.  
  415. for (; i < 3; i++)
  416. {
  417. switch (i)
  418. {
  419. case 0:
  420. pUserModuleHead = pUserModule = ( PLIST_ENTRY ) ( &( pLdrData->InLoadOrderModuleList ) );
  421. dwOffset = 0;
  422. break;
  423.  
  424. case 1:
  425. pUserModuleHead = pUserModule = ( PLIST_ENTRY ) ( &( pLdrData->InMemoryOrderModuleList ) );
  426. dwOffset = 8;
  427. break;
  428. case 2:
  429. pUserModuleHead = pUserModule = (PLIST_ENTRY) (&(pLdrData->InInitializationOrderModuleList));
  430. dwOffset = 16;
  431. break;
  432. }
  433.  
  434. while (pUserModule->Flink != pUserModuleHead)
  435. {
  436. pUserModule = pUserModule->Flink;
  437. lpModule = (PUNICODE_STRING)(((DWORD)(pUserModule)) + (36-dwOffset));
  438.  
  439. for (n = 0; n < (lpModule->Length)/2 && n < 512; n++)
  440. szModuleName[n] = (CHAR)(* ((lpModule->Buffer)+(n)));
  441.  
  442. szModuleName[n] = '\0';
  443. if (strstr (szModuleName, szModule))
  444. {
  445. pUserModule->Blink->Flink = pUserModule->Flink;
  446. pUserModule->Flink->Blink = pUserModule->Blink;
  447. }
  448. }
  449. }
  450. }
  451.  
  452. void HideModule( HINSTANCE hModule )
  453. {
  454. DWORD dwPEB_LDR_DATA = 0;
  455.  
  456. _asm
  457. {
  458. pushad;
  459. pushfd;
  460. mov eax, fs:[30h] // PEB
  461. mov eax, [eax+0Ch] // PEB->ProcessModuleInfo
  462. mov dwPEB_LDR_DATA, eax // Save ProcessModuleInfo
  463.  
  464. InLoadOrderModuleList:
  465. mov esi, [eax+0Ch] // ProcessModuleInfo->InLoadOrderModuleList[FORWARD]
  466. mov edx, [eax+10h] // ProcessModuleInfo->InLoadOrderModuleList[BACKWARD]
  467.  
  468. LoopInLoadOrderModuleList:
  469. lodsd // Load First Module
  470. mov esi, eax // ESI points to Next Module
  471. mov ecx, [eax+18h] // LDR_MODULE->BaseAddress
  472. cmp ecx, hModule // Is it Our Module ?
  473. jne SkipA // If Not, Next Please (@f jumps to nearest Unamed Lable @@:)
  474. mov ebx, [eax] // [FORWARD] Module
  475. mov ecx, [eax+4] // [BACKWARD] Module
  476. mov [ecx], ebx // Previous Module's [FORWARD] Notation, Points to us, Replace it with, Module++
  477. mov [ebx+4], ecx // Next Modules, [BACKWARD] Notation, Points to us, Replace it with, Module--
  478. jmp InMemoryOrderModuleList // Hidden, so Move onto Next Set
  479. SkipA:
  480. cmp edx, esi // Reached End of Modules ?
  481. jne LoopInLoadOrderModuleList // If Not, Re Loop
  482.  
  483. InMemoryOrderModuleList:
  484. mov eax, dwPEB_LDR_DATA // PEB->ProcessModuleInfo
  485. mov esi, [eax+14h] // ProcessModuleInfo->InMemoryOrderModuleList[START]
  486. mov edx, [eax+18h] // ProcessModuleInfo->InMemoryOrderModuleList[FINISH]
  487.  
  488. LoopInMemoryOrderModuleList:
  489. lodsd
  490. mov esi, eax
  491. mov ecx, [eax+10h]
  492. cmp ecx, hModule
  493. jne SkipB
  494. mov ebx, [eax]
  495. mov ecx, [eax+4]
  496. mov [ecx], ebx
  497. mov [ebx+4], ecx
  498. jmp InInitializationOrderModuleList
  499. SkipB:
  500. cmp edx, esi
  501. jne LoopInMemoryOrderModuleList
  502.  
  503. InInitializationOrderModuleList:
  504. mov eax, dwPEB_LDR_DATA // PEB->ProcessModuleInfo
  505. mov esi, [eax+1Ch] // ProcessModuleInfo->InInitializationOrderModuleList[START]
  506. mov edx, [eax+20h] // ProcessModuleInfo->InInitializationOrderModuleList[FINISH]
  507.  
  508. LoopInInitializationOrderModuleList:
  509. lodsd
  510. mov esi, eax
  511. mov ecx, [eax+08h]
  512. cmp ecx, hModule
  513. jne SkipC
  514. mov ebx, [eax]
  515. mov ecx, [eax+4]
  516. mov [ecx], ebx
  517. mov [ebx+4], ecx
  518. jmp Finished
  519. SkipC:
  520. cmp edx, esi
  521. jne LoopInInitializationOrderModuleList
  522.  
  523. Finished:
  524. popfd;
  525. popad;
  526. }
  527. }
  528.  
  529. void DrawMenu(LPDIRECT3DDEVICE9 pDevice)
  530. {
  531. if(mainMenu)
  532. {
  533. if(mainMenu->first)
  534. {
  535. menuentry* looper = mainMenu->first;
  536. int i = 0;
  537. do
  538. {
  539. if(i)
  540. looper = looper->next;
  541. if(looper->value)
  542. DrawFont(3,(i*13)+3,(looper == mainMenu->selected) ? txtPink : txtBlue,"%s: (%d)",looper->name,(int)*looper->value);
  543. i++;
  544. }
  545. while(looper->next);
  546. }
  547. if(mainMenu->picker)
  548. {
  549. if(mainMenu->picker->first)
  550. {
  551. playerEntry* looper = mainMenu->picker->first;
  552. int i = 0;
  553. do
  554. {
  555. looper = looper->next;
  556. if(looper->ID>1)
  557. {
  558. DrawFont(153,(i*13)+3,(looper == mainMenu->picker->selected) ? txtPink : txtBlue,looper->name);
  559. i++;
  560. }
  561. }
  562. while(looper->next);
  563. }
  564. }
  565. else if(mainMenu->iPicker)
  566. {
  567. if(mainMenu->iPicker->first)
  568. {
  569. itemEntry* looper = mainMenu->iPicker->first;
  570. int i = 0;
  571. while(looper)
  572. {
  573. if(looper->show)
  574. {
  575. DrawFont(153,(i*13)+3,(looper == mainMenu->iPicker->selected) ? txtPink : txtBlue,"%s %x",looper->name,looper->item);
  576. i++;
  577. }
  578. looper = looper->next;
  579. }
  580. }
  581. }
  582. }
  583. }
  584.  
  585. char* getCombi(EntryArray *entry)
  586. {
  587. while(true)
  588. {
  589. if((DWORD)entry>1)
  590. {
  591. if(!IsBadReadPtr(entry->firstEntry,4))
  592. {
  593. varEntry* en = entry->firstEntry;
  594. if(en->vTable == 12644640)
  595. {
  596. if(strcmp(en->name->string,"characterid")==0)
  597. return(en->value->value->string);//DrawFont(250,3+(i*13),txtGreen,"variable: %s n: %f",en->name->string,);
  598. }
  599. else
  600. {
  601. return 0;
  602. }
  603. }
  604. }
  605. entry += 1;
  606. }
  607. }
  608.  
  609. void SlaveLoop(EntityList* table, int size)
  610. {
  611. for(int i = 0; i<size; i++)
  612. {
  613. if((DWORD*)(table+i))
  614. {
  615. Entity *e = *(Entity**)(table+i);
  616. if(e->entityVisualState)
  617. {
  618. if(e->cfgVehicle)
  619. {
  620. if(!IsBadReadPtr(e->cfgVehicle,0x220))
  621. {
  622. float dist = (Vectorl3(localPlayer - e->entityVisualState->coordinates));
  623. if(dist<*distLimit)
  624. {
  625. D3DXVECTOR3 pos = WorldToScreen(e->entityVisualState->coordinates);
  626. if(pos.z > 0.01)
  627. {
  628. if(*allObjects==0)
  629. {
  630. if(strcmp(e->cfgVehicle->entityName->string,"VaultStorageLocked")==0)
  631. {
  632. char *combi = NULL;
  633. DWORD vTable = *(DWORD*)(e);
  634. DWORD func = *(DWORD*)(vTable+0x104);
  635. VarTable* table;
  636. __asm
  637. {
  638. mov ECX, e
  639. call func
  640. mov table, EAX
  641. }
  642. EntryArray *entry = table->eArray;
  643. combi = getCombi(entry);
  644. DrawFont(pos.x,pos.y,txtGreen,"Safe (%s) %dm",combi,(int)dist);
  645. }
  646. else if(strcmp(e->cfgVehicle->entityName->string,"CinderWallDoorLocked_DZ")==0 || strcmp(e->cfgVehicle->entityName->string,"CinderWallDoorSmallLocked_DZ")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_GarageWoodDoorLocked")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_LargeWoodDoorLocked")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_WoodDoorLocked")==0)
  647. {
  648. char *combi = NULL;
  649. DWORD vTable = *(DWORD*)(e);
  650. DWORD func = *(DWORD*)(vTable+0x104);
  651. VarTable* table;
  652. __asm
  653. {
  654. mov ECX, e
  655. call func
  656. mov table, EAX
  657. }
  658. EntryArray *entry = table->eArray;
  659. combi = getCombi(entry);
  660. DrawFont(pos.x,pos.y,txtGreen,"door (%s) %dm",combi,(int)dist);
  661. }
  662. if(strcmp(e->cfgVehicle->entityName->string,"LockboxStorageLocked")==0)
  663. {
  664. char *combi = NULL;
  665. DWORD vTable = *(DWORD*)(e);
  666. DWORD func = *(DWORD*)(vTable+0x104);
  667. VarTable* table;
  668. __asm
  669. {
  670. mov ECX, e
  671. call func
  672. mov table, EAX
  673. }
  674. EntryArray *entry = table->eArray;
  675. combi = getCombi(entry);
  676. DrawFont(pos.x,pos.y,txtGreen,"Lockbox (%s) %dm",combi,(int)dist);
  677. }
  678. else if(strcmp(e->cfgVehicle->entityName->string,"VaultStorage")==0)
  679. DrawFont(pos.x,pos.y,txtGreen,"Safe(open) %dm",(int)dist);
  680. else if(strcmp(e->cfgVehicle->entityName->string,"LockboxStorage")==0)
  681. DrawFont(pos.x,pos.y,txtGreen,"Lockbox(open) %dm",(int)dist);
  682. else if(strstr(e->cfgVehicle->entityName->string,"TentStorage"))
  683. DrawFont(pos.x,pos.y,txtGreen,"Tent %dm",(int)dist);
  684. else if(strstr(e->cfgVehicle->entityName->string,"StorageShed") || strstr(e->cfgVehicle->entityName->string,"WoodShack"))
  685. DrawFont(pos.x,pos.y,txtGreen,"Shed %dm",(int)dist);
  686. else if(strcmp(e->cfgVehicle->entityName->string,"WoodCrate_DZ")==0)
  687. DrawFont(pos.x,pos.y,txtGreen,"Crate %dm",(int)dist);
  688. else if(strstr(e->cfgVehicle->entityName->string,"Grave"))
  689. DrawFont(pos.x,pos.y,txtGrey,"Grave %dm",(int)dist);
  690. else if(strcmp(e->cfgVehicle->entityName->string,"GunRack_DZ")==0)
  691. DrawFont(pos.x,pos.y,txtGreen,"Gunrack %dm",(int)dist);
  692. else if(strcmp(e->cfgVehicle->entityName->string,"Plastic_Pole_EP1_DZ")==0)
  693. DrawFont(pos.x,pos.y,txtGreen,"Pole %dm",(int)dist);
  694. }
  695. else
  696. {
  697. DrawFont(pos.x,pos.y,txtGreen,e->cfgVehicle->entityName->string);
  698. }
  699. }
  700. }
  701. }
  702. }
  703. }
  704. }
  705. }
  706. }
  707.  
  708. void MasterLoop(EntitiesDistributed* table)
  709. {
  710. __try
  711. {
  712. if(table->table1)SlaveLoop(table->table1,table->table1Size);
  713. if(table->table2)SlaveLoop(table->table2,table->table2Size);
  714. if(table->table3)SlaveLoop(table->table3,table->table3Size);
  715. if(table->table4)SlaveLoop(table->table4,table->table4Size);
  716. }
  717. __except(EXCEPTION_EXECUTE_HANDLER)
  718. {
  719.  
  720. }
  721. }
  722.  
  723. int WINAPI HookedPresent(LPDIRECT3DDEVICE9 pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion)
  724. {
  725. if(m_pFont==NULL)
  726. {
  727. D3DXCreateFont(pDevice, 14, 0, 400, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Verdana"), &m_pFont);
  728. }
  729. if(!Init)
  730. {
  731. mainMenu = new menu(new menuentry("Distance",distLimit,1000,15000));
  732. mainMenu->add(new menuentry("Show vehicle distance", distLimit2, 1000, 15000));
  733. mainMenu->add(new menuentry("No Fatigue",noFatigue,1,1));
  734. mainMenu->add(new menuentry("Show empty Vehicles",emptyVeh,1,1));
  735. mainMenu->add(new menuentry("Show Storages",objects,1,1));
  736. mainMenu->add(new menuentry("Show all objects",allObjects,1,1));
  737. mainMenu->add(new menuentry("Item List",listItems,1,1));
  738. mainMenu->add(new menuentry("Unlock Vehicles",unlockVehicles,1,1));
  739. //mainMenu->add(new menuentry("Vehicle locked",vehicleLocked,1,3));
  740. bd = new menuentry("Bulletdamage",bulletDamage,10,50000);
  741. mainMenu->add(bd);
  742. Init = 1;//menuvalue* v1 = selected->current = selected->first = new menuvalue();
  743. if(!m_rectLine)D3DXCreateLine(pDevice,&m_rectLine);
  744. }
  745.  
  746. if (GetAsyncKeyState(VK_END))
  747. drawMenu = !drawMenu;
  748.  
  749. if (drawMenu)
  750. DrawMenu(pDevice);
  751.  
  752. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  753. NetworkManager pNetworkmanager = *(NetworkManager*)0xD99F08;
  754. if(pWorld.world->cameraOn->unit)
  755. {
  756. if(*listItems&&mainMenu->iPicker==NULL)
  757. {
  758. mainMenu->iPicker = new itemPicker();
  759. MagTable *mt = (MagTable*)0xDA81F0;
  760. for(int i = 0;i<mt->count;i++)
  761. {
  762. MagazineType *m = *(MagazineType**)((DWORD)mt->mag+i*4);
  763. //char nigger[64];
  764. //sprintf_s(nigger,"%x",m);
  765. if(m->magazineName)
  766. mainMenu->iPicker->add(new itemEntry(m->magazineName->string,0,m));
  767. }
  768. }
  769. else if(mainMenu->iPicker&&*listItems==0)
  770. {
  771. mainMenu->iPicker = NULL;
  772. }
  773.  
  774. /*
  775. Entity* e = (Entity*)pWorld.world->cameraOn->unit;
  776. DWORD vTable = *(DWORD*)(e);
  777. DWORD func = *(DWORD*)(vTable+0x104);
  778. VarTable* table;
  779. __asm
  780. {
  781. mov ECX, e
  782. call func
  783. mov table, EAX
  784. }
  785. EntryArray *entry = table->eArray;
  786. int i = 0;
  787. DrawFont(250,500,txtGreen,"varTable: %x",table);
  788. while(true)
  789. {
  790. i++;
  791. if((DWORD)entry>1)
  792. {
  793. if(!IsBadReadPtr(entry->firstEntry,4))
  794. {
  795. varEntry* en = entry->firstEntry;
  796. if(en->vTable == 12644640)
  797. {
  798. DrawFont(250,3+(i*13),txtGreen,"variable: %s n: %x",en->name->string,en);
  799. }
  800. else
  801. {
  802. break;
  803. }
  804. }
  805. }
  806. entry += 1;
  807. }
  808. */
  809.  
  810.  
  811. //DrawFont(250,250,txtGreen,"%s",entry->name->string);
  812. if(pWorld.world->cameraOn->unit->playerID>0)
  813. {
  814. if(!pWorld.world->cameraOn->unit->isDead)
  815. {
  816. /*
  817. if(pNetworkmanager.scoreboard)
  818. if(pNetworkmanager.scoreboard->scoreboardTable)
  819. {
  820. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  821. {
  822. DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  823. }
  824. }
  825. */
  826. if(*noFatigue&&pWorld.world->cameraOn->unit->fatigue)
  827. pWorld.world->cameraOn->unit->fatigue = 0;
  828. }
  829. //float* bulletdmg = (float*)(*(DWORD**)(*(DWORD**)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x2)+0x80)+0x50);
  830. //pWorld.world->cameraOn->unit->customRecoilCoef = 0;
  831. //pWorld.world->cameraOn->unit->fatigue = 0;
  832. /*
  833. Weapon *w = (Weapon*)(pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9)+0x1);
  834. if(w)
  835. {
  836. DrawFont(3,42,txtPink,"weapon %x", w);
  837. //w->weaponModeType->dispersion = 0;
  838. if(w->magazine)
  839. {
  840. //w->magazine->magazineType->ammunition->directDamage = 12;
  841. DrawFont(3,29,txtPink,"damage %f speed %f",w->magazine->magazineType->ammunition->directDamage,w->magazine->magazineType->ammunition->typicalSpeed);
  842. }
  843. else
  844. {
  845. DrawFont(3,29,txtPink,"Magazine is null");
  846. }
  847. }
  848. else
  849. {
  850. DrawFont(3,42,txtPink,"no weapon");
  851. }
  852. */
  853. }
  854. if(pWorld.world->cameraOn->unit->entityVisualState)
  855. localPlayer = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  856. EntityTablePointer* ObjectPtr = (pWorld.world->entityTablePointer);
  857. if(!IsBadReadPtr(ObjectPtr,0x8))
  858. {
  859. DWORD* entTable = *(DWORD**)ObjectPtr;
  860. if(!IsBadReadPtr(entTable,4))
  861. {
  862. UpdateView();
  863. for(int i = 0; i<pWorld.world->entityTablePointer->objectTableSize; i++)
  864. {
  865. EntityTable *eTable = *(EntityTable**)((entTable+(13*i)));
  866. if(eTable)
  867. {
  868. Entity *e = eTable->e;
  869. if(e)
  870. {
  871. if(strcmp(e->cfgVehicle->objectType->string,"soldier")==0)
  872. {
  873. if(e != (Entity*)pWorld.world->cameraOn->unit)
  874. {
  875. bool human = 0;
  876. Unit* u = (Unit*)e;
  877. if(u->playerID>1)
  878. human = 1;
  879. EntityVisualState *vis = e->entityVisualState;
  880. if(vis)
  881. {
  882. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  883. if(dist<*distLimit)
  884. {
  885. if(!u->isDead)
  886. {
  887. if(human)
  888. {
  889. char* name = "null";
  890. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  891. if(pos.z > 0.01)
  892. {
  893. if(pNetworkmanager.scoreboard)
  894. {
  895. if(pNetworkmanager.scoreboard->scoreboardTable)
  896. {
  897. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  898. {
  899. if(*(DWORD*)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1) == u->playerID)
  900. {
  901. //DrawFont(200,3+(i*13),txtPink,"%s %d",(char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  902. name = (char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2);
  903. break;//DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  904. }
  905. }
  906. }
  907. }
  908. if(dist<500)
  909. {
  910. D3DXVECTOR3 headpos = WorldToScreen(vis->headCoordinates);
  911. D3DXVECTOR3 bodypos = WorldToScreen(vis->torsoCoordinates);
  912. //D3DXVECTOR2 headpos2D(headpos.x,headpos.y);
  913. //D3DXVECTOR2 boxdir = (headpos - pos);
  914. //float blength = Vectorl2(boxdir);
  915. //D3DXVECTOR2 box90(-boxdir.y, boxdir.x);
  916. //D3DXVECTOR2 norm90;
  917. //D3DXVec2Normalize(&norm90,&box90);
  918. //D3DXVECTOR3 lefttop = headpos2D + (norm90 * 0,2);
  919. //D3DXVECTOR3 righttop = headpos2D - (norm90 * 0,2);
  920. DrawLine(m_rectLine,headpos.x,headpos.y,bodypos.x,bodypos.y,txtRed);
  921. DrawLine(m_rectLine,bodypos.x,bodypos.y,pos.x,pos.y,txtRed);
  922. //DrawLine(m_rectLine,lefttop.x,lefttop.y,righttop.x,righttop.y,txtRed);
  923. }
  924. D3DCOLOR txtCustom = D3DCOLOR_ARGB(255, 255, 0, 0);
  925. wchar_t dispName[256];
  926. //swprintf(dispName,L"%s %dm %d",name, dist,u->playerID);
  927. DrawFont(pos.x,pos.y,txtCustom,"%s %dm",name, dist);
  928. }
  929. }
  930. else
  931. {
  932. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  933. if (pos.z > 0.01)
  934. {
  935. D3DCOLOR txtCow = D3DCOLOR_ARGB(255 - (int)((float)((float)dist / (float)*distLimit) * 255), 255, 255, 0);
  936. DrawFont(pos.x, pos.y, txtCow, "%s (AI) %dm", e->cfgVehicle->entityName->string, dist);
  937. }
  938. }
  939. }
  940. else
  941. {
  942. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  943. if(pos.z > 0.01)
  944. {
  945. DrawFont(pos.x,pos.y,txtDarkGrey,"%s (dead) %dm",e->cfgVehicle->entityName->string, dist);
  946. }
  947. }
  948. }
  949. }
  950. }
  951. }
  952. else if(strcmp(e->cfgVehicle->objectType->string,"helicopter")==0 || strcmp(e->cfgVehicle->objectType->string,"car")==0 || strcmp(e->cfgVehicle->objectType->string,"airplane")==0 || strcmp(e->cfgVehicle->objectType->string,"motorcycle")==0 || strcmp(e->cfgVehicle->objectType->string,"parachute")==0)
  953. {
  954. Vehicle* v = (Vehicle*)e;
  955. /*
  956. DWORD desob = NULL;
  957. DWORD delVeh = 0x450430;
  958. if(*destruction)
  959. {
  960. __asm
  961. {
  962. push v
  963. call delVeh
  964. mov desob, EAX
  965. }
  966.  
  967. if(desob)
  968. {
  969. DWORD vTable = *(DWORD*)desob;
  970. DWORD Adress = *(DWORD*)(vTable + 0x28);
  971. __asm
  972. {
  973. mov ECX, desob
  974. call Adress
  975. }
  976. }
  977.  
  978. }
  979. */
  980. if(*unlockVehicles)
  981. {
  982. Unit *u = (Unit*)v;
  983. u->vehicleLocked = 1;
  984. }
  985. if((Unit*)v != pWorld.world->cameraOn->unit)
  986. {
  987. if(v->driver)
  988. {
  989. if(v->driver->playerID)
  990. {
  991. EntityVisualState *vis = e->entityVisualState;
  992. if(vis)
  993. {
  994. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  995. if(dist<*distLimit)
  996. {
  997. Unit* e = (Unit*)v;
  998. char* name = "null";
  999. if(pNetworkmanager.scoreboard)
  1000. {
  1001. if(pNetworkmanager.scoreboard->scoreboardTable)
  1002. {
  1003. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  1004. {
  1005. if(*(DWORD*)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1) == v->driver->playerID)
  1006. {
  1007. //DrawFont(200,3+(i*13),txtPink,"%s %d",(char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  1008. name = (char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2);
  1009. break;//DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  1010. }
  1011. }
  1012. }
  1013. }
  1014. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  1015. if(pos.z > 0.01)
  1016. {
  1017. DrawFont(pos.x,pos.y,txtPink,"%s %dm (%d) [%s]",e->cfgVehicle->entityName->string, dist,e->vehicleLocked, name);
  1018. }
  1019. }
  1020. }
  1021. }
  1022. }
  1023. else if(*emptyVeh)
  1024. {
  1025. EntityVisualState *vis = e->entityVisualState;
  1026. if(vis)
  1027. {
  1028. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  1029. if(dist<*distLimit2)
  1030. {
  1031. Unit* e = (Unit*)v;
  1032. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  1033. if(pos.z > 0.01)
  1034. {
  1035. DrawFont(pos.x,pos.y,txtGrey,"%s %dm (%x)",e->cfgVehicle->entityName->string, dist,e->vehicleLocked);
  1036. }
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. }
  1045. }
  1046. }
  1047. if(*objects)
  1048. {
  1049. MasterLoop(pWorld.world->table1);
  1050. MasterLoop(pWorld.world->table2);
  1051. MasterLoop(pWorld.world->table3);
  1052. }
  1053. }
  1054. /*
  1055. if(pWorld.world->cameraOn->unit)
  1056. {
  1057. if(pWorld.world->cameraOn->unit->entityVisualState)
  1058. {
  1059. D3DVECTOR pos = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  1060. DrawFont(3,3,txtPink,"local pos: %f %f %f",pos.x,pos.y,pos.z);
  1061. }
  1062. }
  1063. */
  1064.  
  1065.  
  1066. oPresent(pDevice, pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
  1067. return 0;
  1068. }
  1069.  
  1070. template <typename T> T HookVTableFunction(DWORD* dwpTable, int index, DWORD dwNewFunc)
  1071. {
  1072. DWORD dwProt = 0;
  1073. VirtualProtect(&dwpTable[index],4,PAGE_EXECUTE_READWRITE,&dwProt);
  1074. T oFunc = (T)dwpTable[index];
  1075. dwpTable[index] = dwNewFunc;
  1076. VirtualProtect(&dwpTable[index],4,dwProt,0);
  1077. return oFunc;
  1078. }
  1079.  
  1080. DWORD WINAPI HookThread(LPVOID lpParameter)
  1081. {
  1082. HMODULE hModule = GetModuleHandleA("d3d9.dll");
  1083. DWORD dwDeviceVMTPtr(0), *dwpDeviceVMT = NULL;
  1084. dwDeviceVMTPtr = *(DWORD*)(*(DWORD*)(*(DWORD*)0xDA8208+0x4)+0x188c);
  1085. memcpy(&dwpDeviceVMT, (LPVOID)dwDeviceVMTPtr, 4);
  1086. oPresent = HookVTableFunction<Present_t>(dwpDeviceVMT, 17, (DWORD)&HookedPresent);
  1087. while (true)
  1088. {
  1089. HookVTableFunction<Present_t>(dwpDeviceVMT, 17, (DWORD)&HookedPresent);
  1090. Sleep(1000);
  1091. }
  1092. }
  1093.  
  1094. DWORD WINAPI KeyThread(LPVOID lpParameter)
  1095. {
  1096. while(true)
  1097. {
  1098. if(GetAsyncKeyState(VK_DOWN))
  1099. {
  1100. if(!mainMenu->picker&&!mainMenu->iPicker)
  1101. {
  1102. if(mainMenu->selected->next)
  1103. mainMenu->selected = mainMenu->selected->next;
  1104. else
  1105. mainMenu->selected = mainMenu->first;
  1106. }
  1107. else if(!mainMenu->iPicker)
  1108. {
  1109. if(mainMenu->picker->selected->next)
  1110. mainMenu->picker->selected = mainMenu->picker->selected->next;
  1111. else
  1112. mainMenu->picker->selected = mainMenu->picker->first;
  1113. }
  1114. else
  1115. {
  1116. if(mainMenu->iPicker->selected->next)
  1117. mainMenu->iPicker->selected = mainMenu->iPicker->selected->next;
  1118. else
  1119. mainMenu->iPicker->selected = mainMenu->iPicker->first;
  1120. }
  1121. }
  1122. if(GetAsyncKeyState(VK_UP))
  1123. {
  1124. if(!mainMenu->picker&&!mainMenu->iPicker)
  1125. {
  1126. if(mainMenu->selected->last)
  1127. mainMenu->selected = mainMenu->selected->last;
  1128. else
  1129. mainMenu->selected = mainMenu->last;
  1130. }
  1131. else if(!mainMenu->iPicker)
  1132. {
  1133. if(mainMenu->picker->selected->last)
  1134. mainMenu->picker->selected = mainMenu->picker->selected->last;
  1135. else
  1136. mainMenu->picker->selected = mainMenu->picker->last;
  1137. }
  1138. else
  1139. {
  1140. if(mainMenu->iPicker->selected->last)
  1141. mainMenu->iPicker->selected = mainMenu->iPicker->selected->last;
  1142. else
  1143. mainMenu->iPicker->selected = mainMenu->iPicker->last;
  1144. }
  1145. }
  1146. if(GetAsyncKeyState(VK_RIGHT))
  1147. {
  1148. mainMenu->selected->right();
  1149. }
  1150. if(GetAsyncKeyState(VK_LEFT))
  1151. {
  1152. mainMenu->selected->left();
  1153. }
  1154. if(GetAsyncKeyState(VK_PRIOR))
  1155. {
  1156. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1157. //Weapon *w = (Weapon*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9);
  1158. //pWorld.world->cameraOn->unit->weaponTable->weaponModeType->dispersion
  1159. DWORD* dispersion = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x4)+0xB);
  1160. DWORD* garbage1 = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x3);
  1161. DWORD* garbage2 = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x9);
  1162. //pWorld.world->cameraOn->unit->weaponTable->magazine->magazineType->ammunition->directDamage
  1163. *garbage1 = (30^0xBABAC8B6) << 1;
  1164. *garbage2 = (30^0xBABAC8B6) - *garbage1;
  1165. *dispersion = 0;
  1166. //w->magazine->ammo1 = 0xDD5D6454;
  1167. //w->magazine->ammo2 = 0xDD5D6454;
  1168. //w->weaponModeType->dispersion = 0;
  1169. //w->magazine->magazineType->ammunition->directDamage = 22;
  1170. }
  1171. if(GetAsyncKeyState(VK_INSERT))
  1172. {
  1173. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1174. if(strcmp(pWorld.world->cameraOn->unit->cfgVehicle->objectType->string,"soldier")!=0)
  1175. {
  1176. srand (time(NULL));
  1177. Vehicle* v = (Vehicle*)pWorld.world->cameraOn->unit;
  1178. for(int i=0;i<v->damagePartsCount;i++)
  1179. {
  1180. float* part = (float*)(v->damageParts + i);
  1181. *part = (float)((float)(rand()%100)/1000);
  1182. }
  1183. v->coordinates->fuelLevel = v->cfgVehicle->fuelTankCap;
  1184. }
  1185. }
  1186. if(GetAsyncKeyState(VK_RETURN))
  1187. {
  1188. std::cout << "Enter";
  1189. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1190.  
  1191.  
  1192. if(mainMenu->iPicker)
  1193. {
  1194. if(*listItems)
  1195. {
  1196. if(pWorld.world->cameraOn->unit)
  1197. {
  1198. if(mainMenu->iPicker)
  1199. {
  1200. if(mainMenu->iPicker->selected->item)
  1201. {
  1202. if(pWorld.world->cameraOn->unit->inventoryMagTableSize<pWorld.world->cameraOn->unit->inventoryMagTableMaxSize)
  1203. {
  1204. DWORD off_D83398 = 0xD83398;
  1205. DWORD initMag = 0x71E326;
  1206. MagazineType *item = (MagazineType*)mainMenu->iPicker->selected->item;
  1207. Magazine *mag = NULL;
  1208. DWORD test = 0;
  1209. __asm
  1210. {
  1211. mov ecx, [off_D83398]
  1212. mov eax, [ecx]
  1213. mov eax, [eax]
  1214. mov test, eax
  1215. push 30h
  1216. call dword ptr [eax+4]
  1217. push item
  1218. mov ecx, eax
  1219. call initMag
  1220. mov mag, eax
  1221. }
  1222.  
  1223. //pWorld.world->cameraOn->unit->inventoryMagTableMaxSize++;
  1224. mag->ammo1 = (item->magazineCapacity ^ 0xBABAC8B6) << 1;
  1225. mag->ammo2 = (item->magazineCapacity ^ 0xBABAC8B6) - mag->ammo1;
  1226. mag->references = 2;
  1227. DWORD *newmag = (DWORD*)((DWORD)pWorld.world->cameraOn->unit->inventoryMagTable+pWorld.world->cameraOn->unit->inventoryMagTableSize*4);
  1228. pWorld.world->cameraOn->unit->inventoryMagTableSize++;
  1229. *newmag = (DWORD)mag;
  1230. }
  1231. }
  1232. }
  1233. }
  1234. }
  1235. }
  1236. }
  1237. Sleep(200);
  1238. }
  1239. }
  1240.  
  1241. BOOL APIENTRY DllMain( HMODULE hModule,
  1242. DWORD ul_reason_for_call,
  1243. LPVOID lpReserved
  1244. )
  1245. {
  1246. switch (ul_reason_for_call)
  1247. {
  1248. case DLL_PROCESS_ATTACH:
  1249. {
  1250. DisableThreadLibraryCalls(hModule);
  1251. HideModule(hModule);
  1252. UnlinkModule ("Fraps.dll");
  1253.  
  1254. CreateMutex(0, false, "wwdUWdhhnawhf6");
  1255.  
  1256. dwModBase = (DWORD)GetModuleHandle("ArmA2OA.exe");
  1257. CreateThread(0, 0, HookThread, 0, 0, 0);
  1258. CreateThread(0, 0, KeyThread, 0, 0, 0);
  1259. }
  1260. case DLL_THREAD_ATTACH:
  1261. case DLL_THREAD_DETACH:
  1262. case DLL_PROCESS_DETACH:
  1263. break;
  1264. }
  1265. return TRUE;
  1266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement