Advertisement
adamjason

C++CrossHair

Feb 17th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.66 KB | None | 0 0
  1.  
  2. /* Adamjaosn
  3. /*********************************************************/
  4. #include "Headers.h"
  5. #include "Hook.h"
  6. #include "Menu.h"
  7. #include <windows.h>
  8. #include <d3d9.h>
  9. #pragma comment(lib, "d3d9.lib")
  10. #include "detours.h"
  11. #include <d3dx9.h>
  12. #pragma comment(lib, "d3dx9.lib")
  13. #include <time.h>
  14. #include <stdlib.h>
  15. #include <fstream>
  16. #include <vector>
  17. #include <D3dx9tex.h>
  18. #include <stdio.h>
  19. #include <time.h>
  20. #include <tchar.h>
  21. #include <iostream>
  22. #include <tchar.h>
  23. #pragma comment(lib, "detours.lib")
  24. #pragma warning(disable:4996)
  25.  
  26. #include <mmsystem.h>
  27. using namespace std;
  28.  
  29. D3DCOLOR ESPColor;
  30. #define Rouge D3DCOLOR_ARGB(255,255,0,0)
  31. int wRed, wGreen;
  32. char wVal[255];
  33. int ZeroMemory;
  34. int SOLID;
  35. int WIREFRAME;
  36. int POINTCHAMS;
  37. int Ghost;
  38. int OldFPSView;
  39. int Made;
  40. int NewCham;
  41. int fire;
  42. int main;
  43. int CrossColors;
  44.  
  45. //-----------//
  46. bool fCall = true;
  47. IDirect3DPixelShader9 *Front,
  48. *Back;
  49.  
  50. //----------//
  51. IDirect3DPixelShader9* pShader;
  52. IDirect3DPixelShader9* pRed;
  53. IDirect3DPixelShader9* pYellow;
  54. IDirect3DPixelShader9* pGreen;
  55. IDirect3DPixelShader9* pWhite;
  56. IDirect3DPixelShader9* pOrange;
  57. IDirect3DPixelShader9* pBlue;
  58. IDirect3DPixelShader9* pBlack;
  59. IDirect3DPixelShader9* pLightYellow;
  60. IDirect3DPixelShader9* pMagenta;
  61. IDirect3DPixelShader9* pDarkBlue;
  62. IDirect3DPixelShader9* pTBlack;
  63. ///////////////////////////////////
  64.  
  65. INT Fps = 0;
  66. FLOAT LastTickCount = 0.0f;
  67. FLOAT CurrentTickCount;
  68. CHAR FrameRate[50] = "";
  69.  
  70. #define Player_Bodies
  71. #define naziEsp
  72.  
  73. int FullBright;
  74.  
  75. int espfunction;
  76.  
  77. int EspOn;
  78.  
  79.  
  80. int IsAQS;
  81. int IsRapied;
  82.  
  83.  
  84.  
  85. typedef HRESULT(WINAPI* Prototype_DrawIndexedPrimitive)(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
  86. HRESULT WINAPI Hooked_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 Device, D3DPRIMITIVETYPE PrimType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
  87. Prototype_DrawIndexedPrimitive Orginal_DrawIndexedPrimitive;
  88. DWORD FindDevice(DWORD Len)
  89. {
  90. DWORD dwObjBase = 0;
  91.  
  92. dwObjBase = (DWORD)LoadLibrary("d3d9.dll");
  93. while (dwObjBase++ < dwObjBase + Len)
  94. {
  95. if ((*(WORD*)(dwObjBase + 0x00)) == 0x06C7
  96. && (*(WORD*)(dwObjBase + 0x06)) == 0x8689
  97. && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689
  98. ) {
  99. dwObjBase += 2; break;
  100. }
  101. }
  102. return(dwObjBase);
  103. }
  104. void DrawLined(LPD3DXLINE pLine, float x, float y, float x2, float y2, float width, DWORD color) // allways put this voids on top so it might no lead to crashes or errors while building
  105. {
  106. D3DXVECTOR2 vLine[2];
  107. pLine->SetWidth(width);
  108. vLine[0].x = x;
  109. vLine[0].y = y;
  110. vLine[1].x = x2;
  111. vLine[1].y = y2;
  112. pLine->Begin();
  113. pLine->Draw(vLine, 2, color);
  114. pLine->End();
  115. return;
  116. }
  117. void Border(int x, int y, int w, int h, int px, D3DCOLOR BorderColor, LPDIRECT3DDEVICE9 pDevice)
  118. {
  119. FillRGB(x, (y + h - px), w, px, BorderColor, pDevice);
  120. FillRGB(x, y, px, h, BorderColor, pDevice);
  121. FillRGB(x, y, w, px, BorderColor, pDevice);
  122. FillRGB(x + w - px, y, px, h, BorderColor, pDevice);
  123. }
  124.  
  125. void BOX(int x, int y, int w, int h, D3DCOLOR Color, D3DCOLOR BorderColor, LPDIRECT3DDEVICE9 pDevice)
  126. {
  127. FillRGB(x, y, w, h, Color, pDevice);
  128. }
  129. DWORD GetDeviceAddress(int VTableIndex)
  130. {
  131. PDWORD VTable;
  132. *(DWORD*)&VTable = *(DWORD*)FindDevice(0x128000);
  133. return VTable[VTableIndex];
  134. }
  135.  
  136. HRESULT CreateMyShader(IDirect3DPixelShader9 **pShader, IDirect3DDevice9 *Device, float red, float yellow, float blue, float alpha)
  137. {
  138. ID3DXBuffer *MyBuffer = NULL;
  139. char MyShader[256];
  140. sprintf(MyShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", red / 255, yellow / 255, blue / 255, alpha / 255);
  141. D3DXAssembleShader(MyShader, sizeof(MyShader), NULL, NULL, 0, &MyBuffer, NULL);
  142. if (FAILED(Device->CreatePixelShader((const DWORD*)MyBuffer->GetBufferPointer(), pShader)))return E_FAIL;
  143. return S_OK;
  144. }
  145.  
  146.  
  147.  
  148. typedef HRESULT(WINAPI* CreateDevice_Prototype) (LPDIRECT3D9, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
  149. typedef HRESULT(WINAPI* Reset_Prototype) (LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
  150. typedef HRESULT(WINAPI* EndScene_Prototype) (LPDIRECT3DDEVICE9);
  151. typedef HRESULT(WINAPI* DrawIndexedPrimitive_Prototype)(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
  152.  
  153. CreateDevice_Prototype CreateDevice_Pointer = NULL;
  154. Reset_Prototype Reset_Pointer = NULL;
  155. EndScene_Prototype EndScene_Pointer = NULL;
  156. DrawIndexedPrimitive_Prototype DrawIndexedPrimitive_Pointer = NULL;
  157.  
  158. HRESULT WINAPI Direct3DCreate9_VMTable(VOID);
  159. HRESULT WINAPI CreateDevice_Detour(LPDIRECT3D9, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
  160. HRESULT WINAPI Reset_Detour(LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
  161. HRESULT WINAPI EndScene_Detour(LPDIRECT3DDEVICE9);
  162.  
  163.  
  164.  
  165. PDWORD Direct3D_VMTable = NULL;
  166.  
  167. HRESULT WINAPI Direct3DCreate9_VMTable(VOID)
  168. {
  169. LPDIRECT3D9 Direct3D_Object = Direct3DCreate9(D3D_SDK_VERSION);
  170.  
  171. if (Direct3D_Object == NULL)
  172. return D3DERR_INVALIDCALL;
  173.  
  174. Direct3D_VMTable = (PDWORD)*(PDWORD)Direct3D_Object;
  175. Direct3D_Object->Release();
  176.  
  177. DWORD dwProtect;
  178.  
  179. if (VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
  180. {
  181. *(PDWORD)&CreateDevice_Pointer = Direct3D_VMTable[16];
  182. *(PDWORD)&Direct3D_VMTable[16] = (DWORD)CreateDevice_Detour;
  183.  
  184. if (VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
  185. return D3DERR_INVALIDCALL;
  186. }
  187. else
  188. return D3DERR_INVALIDCALL;
  189.  
  190. return D3D_OK;
  191. }
  192.  
  193.  
  194.  
  195. HRESULT WINAPI CreateDevice_Detour(LPDIRECT3D9 Direct3D_Object, UINT Adapter, D3DDEVTYPE DeviceType, HWND FocusWindow,
  196. DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* PresentationParameters,
  197. LPDIRECT3DDEVICE9* Returned_Device_Interface)
  198. {
  199. HRESULT Returned_Result = CreateDevice_Pointer(Direct3D_Object, Adapter, DeviceType, FocusWindow, BehaviorFlags,
  200. PresentationParameters, Returned_Device_Interface);
  201.  
  202. DWORD dwProtect;
  203.  
  204. if (VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
  205. {
  206. *(PDWORD)&Direct3D_VMTable[16] = *(PDWORD)&CreateDevice_Pointer;
  207. CreateDevice_Pointer = NULL;
  208.  
  209. if (VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
  210. return D3DERR_INVALIDCALL;
  211. }
  212. else
  213. return D3DERR_INVALIDCALL;
  214.  
  215. if (Returned_Result == D3D_OK)
  216. {
  217. Direct3D_VMTable = (PDWORD)*(PDWORD)*Returned_Device_Interface;
  218.  
  219. *(PDWORD)&Reset_Pointer = (DWORD)Direct3D_VMTable[16];
  220. *(PDWORD)&EndScene_Pointer = (DWORD)Direct3D_VMTable[42];
  221. *(PDWORD)&DrawIndexedPrimitive_Pointer = (DWORD)Direct3D_VMTable[82];
  222. }
  223.  
  224. return Returned_Result;
  225. }
  226.  
  227.  
  228.  
  229. HRESULT WINAPI Reset_Detour(LPDIRECT3DDEVICE9 Device_Interface, D3DPRESENT_PARAMETERS* PresentationParameters)
  230. {
  231. return Reset_Pointer(Device_Interface, PresentationParameters);
  232. }
  233.  
  234.  
  235.  
  236. HRESULT WINAPI EndScene_Detour(LPDIRECT3DDEVICE9 Device_Interface)
  237. {
  238. return EndScene_Pointer(Device_Interface);
  239. }
  240.  
  241. //base Menu
  242. char * Colors[] = { "[Off]",
  243. "[Red]",
  244. "[Green]",
  245. "[White]",
  246. "Cyan",
  247. "Orange",
  248. "Yellow"
  249. };
  250.  
  251. CHAR *OnOff[] = { "[Off]", "[On]" };
  252. CHAR *OnOff1[] = { "[On]", "Off" };
  253. CHAR *Color[] = { "Off", "Red","Green" };
  254. CHAR *Folder[] = { "[+]", "[-]" };
  255. CHAR *Folder1[] = { "[Red]", "[Green]", "[Blue]" };
  256. CHAR *Text[] = { "", "" };
  257. //Menu
  258. CHAR MenuTitle[MAX_PATH] = {"VIP Privite"}; //Título do menu aqui.
  259. CHAR MenuTitle2[MAX_PATH] = { "Made:10/15/18" }; //Título do menu aqui.
  260. CHAR MenuTitle4[MAX_PATH] = { "[Open/Close HomeKey]" }; //Título do menu aqui
  261. CHAR MenuTitle5[MAX_PATH] = { "MADE BY: CHEAT/HEAD" };
  262. CHAR Timestruct[MAX_PATH] = { "hh':'mm':'ss tt" }; //Estrutura do relógio.
  263. CHAR Timestruct1[MAX_PATH] = { "dd':'mm':'yy tt" }; //Estrutura do relógio.
  264. CHAR TimeString[MAX_PATH];
  265. CHAR DateString[MAX_PATH];
  266. CHAR section[MAX_PATH] = { "Xingcod3/passed" };
  267.  
  268. CHAR MenuTitle8[MAX_PATH] = { "[F6 = Damagex3]" };
  269. CHAR MenuTitle9[MAX_PATH] = { "[F7 = Damagex20]" };
  270. CHAR MenuTitle10[MAX_PATH] = { "[F8 = Damagex800]" };
  271. CHAR MenuTitle11[MAX_PATH] = { "[F9 = Damagex2000]" };
  272. CHAR MenuTitle12[MAX_PATH] = { "[SideMouse = Damagex2]" };
  273. CHAR MenuTitle13[MAX_PATH] = { "[Mid Mouse = Damagex2]" };
  274.  
  275.  
  276.  
  277.  
  278. void DrawRect(IDirect3DDevice9* pD3Ddev, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Color)
  279. {
  280. D3DRECT BarRect = { baseX, baseY, baseX + baseW, baseY + baseH };
  281. pD3Ddev->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0);
  282. }
  283.  
  284.  
  285.  
  286. struct DirectX9VTable
  287. {
  288. DWORD CreateQuery; // 118
  289. };
  290.  
  291. typedef HRESULT(__stdcall* mikeyQuery)(LPDIRECT3DDEVICE9 Device, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
  292. mikeyQuery yourHookz;
  293.  
  294.  
  295.  
  296. HRESULT WINAPI tsunashit(LPDIRECT3DDEVICE9 pDevice, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery)
  297. {
  298.  
  299. if (Type == D3DQUERYTYPE_OCCLUSION)
  300. {
  301.  
  302. Type = D3DQUERYTYPE_TIMESTAMP;
  303. }
  304.  
  305. return yourHookz(pDevice, Type, ppQuery);
  306. }
  307.  
  308.  
  309.  
  310. //Variável da fonte:
  311. BOOL BFont = FALSE;
  312.  
  313. //Variáveis globais:
  314. INT Variable[MAX_PATH];
  315. INT VFolder[MAX_PATH];
  316.  
  317. HRESULT WINAPI Reset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters)
  318. {
  319. PFont->OnLostDevice();
  320. pLine->OnLostDevice();
  321.  
  322. HRESULT hTorna = OReset(pDevice, pPresentationParameters);
  323.  
  324. if (SUCCEEDED(hTorna))
  325. PFont->OnResetDevice();
  326. pLine->OnResetDevice();
  327. return hTorna;
  328. }
  329. HRESULT TehShader(IDirect3DDevice9 *pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b)
  330. {
  331. char szShader[256];
  332. ID3DXBuffer *pShaderBuf = NULL;
  333. sprintf(szShader, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov oC0,c0", r, g, b, 1.0f);
  334. D3DXAssembleShader(szShader, sizeof(szShader), NULL, NULL, 0, &pShaderBuf, NULL);
  335. if (FAILED(pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)))return E_FAIL;
  336. return S_OK;
  337. }
  338. int bshaddinge = true;
  339. void LBox(IDirect3DDevice9* pDevice, int x, int y, int w, int h, D3DCOLOR Outline) //this is the type of esp i draw, the box i use on my releases
  340. {
  341. naziEsp(x, y, w, h, Outline, pDevice);
  342. }
  343. float GetDistance(float Xx, float Yy, float xX, float yY) //our nowts
  344. {
  345. return sqrt((yY - Yy) * (yY - Yy) + (xX - Xx) * (xX - Xx));
  346. }
  347.  
  348. #define Cyan D3DCOLOR_ARGB(255, 000, 255, 255)
  349. #define Green D3DCOLOR_ARGB(255, 000, 255, 000)
  350. bool bFont;
  351.  
  352. int EspHeight = 2;
  353. struct ModelInfo_t //this logs our player so it can draw on X,Y,Z axis
  354. {
  355. float vOutX, vOutY; //our axis to draw on screen (d3d)
  356. INT iTeam; //if you have a team (for both) offset you can add it here)
  357. float CrosshairDistance; //our distance to middle (center) X/2 Y/2
  358. };
  359. std::vector<ModelInfo_t>ModelInfo; // finally this makes our model into a vector (translates) so it can successfully draw, now we make our drawing ESP FUNCTION :D
  360. void AddModel(LPDIRECT3DDEVICE9 pDevice, int iTeam)
  361. {
  362. float xx, yy;
  363. D3DXMATRIX matrix, worldmatrix, m1;
  364. D3DXVECTOR4 position, input;
  365. D3DVIEWPORT9 dip_viewport;
  366. pDevice->GetViewport(&dip_viewport);
  367. pDevice->GetVertexShaderConstantF(36, m1, 4);
  368. pDevice->GetVertexShaderConstantF(0, worldmatrix, 3);
  369.  
  370. input.x = worldmatrix._14;
  371. input.y = worldmatrix._24;
  372. input.z = worldmatrix._34 + (float)EspHeight;
  373.  
  374. D3DXMatrixTranspose(&matrix, &m1);
  375. D3DXVec4Transform(&position, &input, &matrix);
  376.  
  377. position.x = input.x * matrix._11 + input.y * matrix._21 + input.z * matrix._31 + matrix._41; //this is a masterpiece I'm proud of making :D it is world to screen without classes :D
  378. position.y = input.x * matrix._12 + input.y * matrix._22 + input.z * matrix._32 + matrix._42;
  379. position.z = input.x * matrix._13 + input.y * matrix._23 + input.z * matrix._33 + matrix._43;
  380. position.w = input.x * matrix._14 + input.y * matrix._24 + input.z * matrix._34 + matrix._44;
  381.  
  382. xx = ((position.x / position.w) * (dip_viewport.Width / 2.0f)) + dip_viewport.X + (dip_viewport.Width / 2.0f);
  383. yy = dip_viewport.Y + (dip_viewport.Height / 2.0f) - ((position.y / position.w) * (dip_viewport.Height / 2.0f));
  384.  
  385. ModelInfo_t pModelInfo = { static_cast<float>(xx), static_cast<float>(yy), iTeam }; //this calls our model
  386.  
  387. ModelInfo.push_back(pModelInfo); //and repeat (loop) ALWAYS REMEMBER TO CLEAR MEMORY AFTER DRAWING!
  388. }
  389. void InitESP(LPDIRECT3DDEVICE9 Device) //to call a function always add it to your present in this case it will be InitESP(Device) or your device name at the current function being placed
  390. {
  391. D3DVIEWPORT9 VP;
  392. memset(&VP, 0, sizeof(D3DVIEWPORT9));
  393. Device->GetViewport(&VP);
  394. float Vpx = (float)VP.Width / 2;
  395. float Vpy = (float)VP.Height / 2;
  396. D3DVIEWPORT9 Viewport1;
  397. Device->GetViewport(&Viewport1);
  398. DWORD ScreenX = Viewport1.Width / 2;
  399. DWORD ScreenY = Viewport1.Height / 2;
  400. if (ModelInfo.size() != NULL)
  401. {
  402. for (unsigned int i = 0; i < ModelInfo.size(); i++)
  403. {
  404. if (espfunction) // alright now we have it all set to draw in game but first! this function is not being called :O
  405. {
  406. ModelInfo[i].CrosshairDistance = GetDistance(ModelInfo[i].vOutX, ModelInfo[i].vOutY, ScreenX, ScreenY);
  407. if (ModelInfo[i].vOutX > 2 && ModelInfo[i].vOutY > 2)
  408. {
  409. DrawLined(pLine, ScreenX, ScreenY, (int)ModelInfo[i].vOutX - 24, (int)ModelInfo[i].vOutY - 24, 50, Red);//here you will have to mess with vOutX and vOutY to find the perfect cordinate to center your enemy
  410.  
  411.  
  412. }
  413.  
  414. }
  415. }
  416. }
  417. ModelInfo.clear();
  418. }
  419. VOID WINAPI DrawESP(LPDIRECT3DDEVICE9 pDev,
  420. LONG X, LONG Y, LONG Size, BOOL IsVis)
  421. {
  422. if (EspOn)
  423. return;
  424.  
  425. DWORD BoxColor = 1;
  426.  
  427. if (!IsVis)
  428. BoxColor = D3DCOLOR_ARGB(255, 255, 255, 20); // Yellow
  429. else if (IsVis)
  430. BoxColor = D3DCOLOR_ARGB(255, 20, 255, 20); // Green
  431.  
  432. D3DRECT R1 = { X - Size, Y - Size,
  433. X + Size, Y - Size + 1 };
  434.  
  435. pDev->Clear(1, &R1, D3DCLEAR_TARGET, BoxColor, 1.0f, 0);
  436.  
  437. D3DRECT R2 = { X - Size, Y + Size - 1,
  438. X + Size, Y + Size };
  439.  
  440. pDev->Clear(1, &R2, D3DCLEAR_TARGET, BoxColor, 1.0f, 0);
  441.  
  442. D3DRECT R3 = { X - Size, Y - Size,
  443. X - Size + 1, Y + Size };
  444.  
  445. pDev->Clear(1, &R3, D3DCLEAR_TARGET, BoxColor, 1.0f, 0);
  446.  
  447. D3DRECT R4 = { X + Size - 1, Y - Size,
  448. X + Size, Y + Size };
  449.  
  450. pDev->Clear(1, &R4, D3DCLEAR_TARGET, BoxColor, 1.0f, 0);
  451. }
  452.  
  453.  
  454.  
  455. HRESULT WINAPI Present(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
  456. {
  457. InitESP(pDevice); //as in this case it will be pDevice, this calls our function to be looped and remember to clear!
  458. if (PFont)
  459. {
  460. pLine->Release();
  461. pLine = NULL;
  462. PFont->Release();
  463. PFont = NULL;
  464. BFont = FALSE;
  465. }
  466. if (!BFont)
  467. {
  468. D3DXCreateFont(pDevice, 12, 12, 400, 6, 4, 6, 25, 6, 6 | (0 << 3), "Times New Roman", &PFont);
  469. D3DXCreateLine(pDevice, &pLine);
  470. BFont = TRUE;
  471. }
  472.  
  473.  
  474. if (GetAsyncKeyState(VK_HOME) & 1)
  475. menu.ShowMenu = !menu.ShowMenu;
  476.  
  477.  
  478.  
  479.  
  480.  
  481. if (menu.ShowMenu && PFont)
  482. {
  483. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  484. GetTimeFormat(0, 0, 0, 0, Timestruct, 20);//Estrutura do relógio.
  485. GetDateFormat(0, 0, 0, 0, Timestruct1, 30);//Estrutura do relógio.
  486. DrawBox(menu.matrixPos[0] + -10, menu.matrixPos[1] - 75, +300, 150, TBlack, TBlack, pDevice);// Side block
  487. DrawBox(menu.matrixPos[0] + 300, menu.matrixPos[1] - 25, +300, 380, TBlack, TBlack, pDevice);// Main Menu block
  488. DrawBox(menu.matrixPos[0] + 300, menu.matrixPos[1] - 25, +300, 25, LBlack, Black, pDevice);// Top Block
  489. DrawBox(menu.matrixPos[0] + 790, menu.matrixPos[1] - 10, +300, 50, MENU, Black, pDevice);//
  490. DrawBox(menu.matrixPos[0] + 300, menu.matrixPos[1] + 340, +300, 25, LBlack, Black, pDevice);//bottem Block
  491. WriteText(menu.matrixPos[0] + 330, menu.matrixPos[1] - 20, Green, MenuTitle);
  492. WriteText(menu.matrixPos[0] + 330, menu.matrixPos[1] - 19, Black, MenuTitle);
  493. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 50, White, MenuTitle8);
  494. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 49, Black, MenuTitle8);
  495. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 40, White, MenuTitle9);
  496. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 39, Black, MenuTitle9);
  497. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 30, White, MenuTitle10);
  498. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 29, Black, MenuTitle10);
  499. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 20, White, MenuTitle11);
  500. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 19, Black, MenuTitle11);
  501. WriteText(menu.matrixPos[0], menu.matrixPos[1] + 5, White, MenuTitle12);
  502. WriteText(menu.matrixPos[0], menu.matrixPos[1] + 6, Black, MenuTitle12);
  503. WriteText(menu.matrixPos[0], menu.matrixPos[1] + 20, White, MenuTitle13);
  504. WriteText(menu.matrixPos[0], menu.matrixPos[1] + 21, Black, MenuTitle13);
  505. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 100, GREEN, MenuTitle4);
  506. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 70, Green, section);
  507. WriteText(menu.matrixPos[0], menu.matrixPos[1] - 69, Black, section);
  508. sprintf_s(TimeString, "%s", Timestruct);//Buffer do relógio.
  509. sprintf_s(DateString, "%s", Timestruct1);//Buffer do relógio.
  510. WriteText(menu.matrixPos[0] + 800, menu.matrixPos[+1] + 10, Green, TimeString);//Texto do relógio.
  511. WriteText(menu.matrixPos[0] + 800, menu.matrixPos[+1] + 9, Black, TimeString);//Texto do relógio.
  512. WriteText(menu.matrixPos[0] + 800, menu.matrixPos[+1] + 20, Green, DateString);//Texto do relógio.
  513. WriteText(menu.matrixPos[0] + 800, menu.matrixPos[+1] + 19, Black, DateString);//Texto do relógio.
  514. DrawBorder(menu.matrixPos[0] + 300, ((menu.matrixPos[2] + 1) + (menu.MenuSelection * 15)), 300, 12, 1, Red, pDevice); // Selection
  515. DrawBorder(menu.matrixPos[0] + 300, ((menu.matrixPos[2] + 2) + (menu.MenuSelection * 15)), 300, 12, 1, Red, pDevice); // Selection
  516. WriteText(menu.matrixPos[0] + 325, menu.matrixPos[1] + 350, Red, MenuTitle5);
  517. WriteText(menu.matrixPos[0] + 325, menu.matrixPos[1] + 349, Red, MenuTitle5);
  518.  
  519. menu.Current = 1;
  520.  
  521. if (GetAsyncKeyState(VK_UP) & 1)
  522. menu.MenuSelection--;
  523.  
  524. if (GetAsyncKeyState(VK_DOWN) & 1)
  525. menu.MenuSelection++;
  526.  
  527.  
  528. }
  529.  
  530.  
  531. Additem1("[Weapon]", 1, VFolder[0], 1, Folder);
  532. if (VFolder[0])
  533. {
  534. Additem("Ammo", 1, Variable[3], 0, OnOff1);
  535. Additem("Recoil", 1, Variable[5], 0, OnOff1);
  536. Additem("LessRecoil", 1, Variable[8], 0, OnOff);
  537. Additem("QuickScope", 1, IsAQS, 0, OnOff);
  538. Additem("RapidFire", 1, IsRapied, 0, OnOff);
  539.  
  540. }
  541. Additem1("[CrossHair]", 1, VFolder[1], 2, Folder);
  542. if (VFolder[1])
  543. {
  544. Additem("Dot", 2, CrossColors, Variable[100], Colors);
  545. Additem("Circle", 1, Variable[12], 0, OnOff);
  546. Additem("Cross", 1, Variable[67], 0, OnOff);
  547. Additem("Plus", 1, Variable[70], 0, OnOff);
  548. Additem("Rainbow", 1, Variable[68], 0, OnOff);
  549. Additem("500damage", 1, Variable[99], 0, OnOff);
  550.  
  551.  
  552. }
  553.  
  554. Additem1("[Visual]", 1, VFolder[2], 2, Folder);
  555. if (VFolder[2])
  556. {
  557. Additem("Flash", 1, Variable[7], +6, OnOff1);
  558. Additem("Chams0", 1, WIREFRAME, 0, OnOff);
  559. Additem("Chams2", 1, Ghost, 0, OnOff);
  560. Additem("Chams3", 1, POINTCHAMS, 0, OnOff);
  561.  
  562.  
  563.  
  564.  
  565. }
  566.  
  567. Additem1("[Ghost]", 1, VFolder[3], 2, Folder);
  568. if (VFolder[3])
  569. {
  570. Additem("+Start", 1, Variable[4], 0, OnOff);
  571. Additem("-STOP", 1, Variable[6], 0, OnOff);
  572. }
  573.  
  574.  
  575. if (Variable[3]) //inf-ammo
  576. {
  577. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game
  578. SuckThisMemoryByte((void*)(0x00D678A0), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90", 6); //ON
  579. }
  580. else
  581. {
  582. //do you have a memory write function? vamemory? for c++....... no c#
  583. SuckThisMemoryByte((void*)(0x00D678A0), (void *)(PBYTE)"\x8B\x81\x58\x03\x00\x00", 6); //OFF
  584. }
  585.  
  586. if (Variable[3]) //inf=nade
  587. {
  588. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game
  589. SuckThisMemoryByte((void*)(0x00D7D682), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90", 6); //ON
  590. }
  591. else
  592. {
  593.  
  594. //do you have a memory write function? vamemory? for c++....... no c# this has 8 bytes, so 8 is the value
  595. SuckThisMemoryByte((void*)(0x00D7D682), (void *)(PBYTE)"\x8B\x86\x60\x03\x00\x00", 6); //OFF
  596. }
  597.  
  598.  
  599. if (Variable[5]) //no-recoil
  600. {
  601. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  602. SuckThisMemoryByte((void*)(0x00D980BF), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90\x90\x90", 8); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  603. }
  604. else
  605. {
  606.  
  607. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  608. SuckThisMemoryByte((void*)(0x00D980BF), (void *)(PBYTE)"\xF3\x0F\x11\x86\xAC\x0F\x00\x00", 8); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  609. }
  610.  
  611. if (Variable[4]) //ghosting start
  612. {
  613. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  614. SuckThisMemoryByte((void*)(0x00E4E991), (void *)(PBYTE)"\x90\x90\x90\x90", 4); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  615. }
  616. else
  617. {
  618.  
  619. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  620. SuckThisMemoryByte((void*)(0x00E4E991), (void *)(PBYTE)"\xF3\x0F\x59\xC1", 4); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  621. }
  622.  
  623.  
  624. if (Variable[6]) //ghosting stop
  625. {
  626. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  627. SuckThisMemoryByte((void*)(0x00E4E9BD), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90\x90\x90", 8); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  628. }
  629. else
  630. {
  631.  
  632. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  633. SuckThisMemoryByte((void*)(0x00E4E9BD), (void *)(PBYTE)"\xF3\x0F\x11\x86\x1C\x03\x00\x00", 8); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  634. }
  635.  
  636.  
  637.  
  638. if (Variable[7]) //No flash
  639. {
  640. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  641. SuckThisMemoryByte((void*)(0x00D637BA), (void *)(PBYTE)"\xF3\x0F\x59\x44\x24\x08 ", 6); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  642. }
  643. else
  644. {
  645.  
  646. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  647. SuckThisMemoryByte((void*)(0x00D637BA), (void *)(PBYTE)"\xF3\x0F\x5C\x44\x24\x08 ", 6); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  648. }
  649.  
  650. if (Variable[12]) //Fake recoil
  651. {
  652. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  653. SuckThisMemoryByte((void*)(0x00D980A7), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90\x90\x90 ", 8); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  654. }
  655. else
  656. {
  657.  
  658. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  659. SuckThisMemoryByte((void*)(0x00D980A7), (void *)(PBYTE)"\xF3\x0F\x58\x86\xA8\x0F\x00\x00 ", 8); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  660. }
  661. if (Variable[8]) //Low Recoil
  662. {
  663. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  664. SuckThisMemoryByte((void*)(0x00D980A7), (void *)(PBYTE)"\xF3\x0F\x5C\x86\xA8\x0F\x00\x00 ", 8); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  665. }
  666. else
  667. {
  668.  
  669. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  670. SuckThisMemoryByte((void*)(0x00D980A7), (void *)(PBYTE)"\xF3\x0F\x58\x86\xA8\x0F\x00\x00 ", 8); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  671. }
  672. if (Variable[9]) //Less Recoil
  673. {
  674. //do your ON Stuff Here WHAT IS YOUR RECOIL ADDRESS? //test in game how much will this be? 4 correct :)
  675. SuckThisMemoryByte((void*)(0x00D9809F), (void *)(PBYTE)"\x90\x90\x90\x90\x90\x90\x90\x90 ", 8); //ON, not going to do it for you, you are supposed to know... erase it all together? no...... count how many bytes this has:
  676. }
  677. else
  678. {
  679.  
  680. //do you have a memory write function? vamemory? for c++....... no c# done :D ty :)
  681. SuckThisMemoryByte((void*)(0x00D9809F), (void *)(PBYTE)"\xF3\x0F\x10\x83\xF0\x04\x00\x00 ", 8); //OFF this off? yeah ok you are making a massive error..... as for now you must know that the 8 on the code is not supposed to be there .-.
  682. }
  683.  
  684. if (GetAsyncKeyState(VK_XBUTTON1) & 0x8000)
  685. {
  686. *(DWORD*)(
  687. *(DWORD*)(
  688. *(DWORD*)(
  689. *(DWORD*)(
  690. *(DWORD*)(
  691. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  692. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 2;
  693. }
  694. if (GetAsyncKeyState(VK_MBUTTON) & 0x8000)
  695. {
  696. *(DWORD*)(
  697. *(DWORD*)(
  698. *(DWORD*)(
  699. *(DWORD*)(
  700. *(DWORD*)(
  701. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  702. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 2;
  703. }
  704.  
  705. if (GetAsyncKeyState(VK_F6) & 0x8000)
  706. {
  707. *(DWORD*)(
  708. *(DWORD*)(
  709. *(DWORD*)(
  710. *(DWORD*)(
  711. *(DWORD*)(
  712. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  713. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 3;
  714. }
  715.  
  716. if (GetAsyncKeyState(VK_F7) & 0x8000)
  717. {
  718. *(DWORD*)(
  719. *(DWORD*)(
  720. *(DWORD*)(
  721. *(DWORD*)(
  722. *(DWORD*)(
  723. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  724. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 20;
  725. }
  726. if (Variable[99])
  727. {
  728. *(DWORD*)(
  729. *(DWORD*)(
  730. *(DWORD*)(
  731. *(DWORD*)(
  732. *(DWORD*)(
  733. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  734. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 500;
  735. }
  736.  
  737. if (GetAsyncKeyState(VK_F9) & 0x8000)
  738. {
  739. *(DWORD*)(
  740. *(DWORD*)(
  741. *(DWORD*)(
  742. *(DWORD*)(
  743. *(DWORD*)(
  744. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  745. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 2000;
  746. }
  747.  
  748.  
  749.  
  750.  
  751. if (GetAsyncKeyState(VK_F9) & 0x8000)
  752. {
  753. *(DWORD*)(
  754. *(DWORD*)(
  755. *(DWORD*)(
  756. *(DWORD*)(
  757. *(DWORD*)(
  758. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet)
  759. + Sup_OFFSET1) + Sup_OFFSET2) + Sup_OFFSET3) + Sup_OFFSET4) + Sup_OFFSET5) = 1195593728;
  760. }
  761.  
  762. if (GetAsyncKeyState(VK_F11) & 0x8000)
  763. {
  764. *(DWORD*)(
  765. *(DWORD*)(
  766. *(DWORD*)(
  767. *(DWORD*)(
  768. *(DWORD*)(
  769. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + HANDDAM)
  770. + DAM2_OFFSET1) + DAM2_OFFSET2) + DAM2_OFFSET3) + DAM2_OFFSET4) + DAM2_OFFSET5) = 600;
  771. }
  772.  
  773.  
  774.  
  775.  
  776. if (GetAsyncKeyState(VK_F11) & 0x8000)
  777. {
  778. *(DWORD*)(
  779. *(DWORD*)(
  780. *(DWORD*)(
  781. *(DWORD*)(
  782. *(DWORD*)(
  783. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet)
  784. + Sup_OFFSET1) + Sup_OFFSET2) + Sup_OFFSET3) + Sup_OFFSET4) + Sup_OFFSET5) = 1195593728;
  785. }
  786.  
  787.  
  788.  
  789. if (GetAsyncKeyState(VK_F8) & 0x8000)
  790. {
  791. *(DWORD*)(
  792. *(DWORD*)(
  793. *(DWORD*)(
  794. *(DWORD*)(
  795. *(DWORD*)(
  796. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet1)
  797. + Sup1_OFFSET1) + Sup1_OFFSET2) + Sup1_OFFSET3) + Sup1_OFFSET4) + Sup1_OFFSET5) = 1195593728;
  798. }
  799.  
  800. if (GetAsyncKeyState(VK_F9) & 0x8000)
  801. {
  802. *(DWORD*)(
  803. *(DWORD*)(
  804. *(DWORD*)(
  805. *(DWORD*)(
  806. *(DWORD*)(
  807. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet1)
  808. + Sup1_OFFSET1) + Sup1_OFFSET2) + Sup1_OFFSET3) + Sup1_OFFSET4) + Sup1_OFFSET5) = 1195593728;
  809. }
  810.  
  811. if (GetAsyncKeyState(VK_F9) & 0x8000)
  812. {
  813. *(DWORD*)(
  814. *(DWORD*)(
  815. *(DWORD*)(
  816. *(DWORD*)(
  817. *(DWORD*)(
  818. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet)
  819. + Sup_OFFSET1) + Sup_OFFSET2) + Sup_OFFSET3) + Sup_OFFSET4) + Sup_OFFSET5) = 1195593728;
  820. }
  821.  
  822. if (GetAsyncKeyState(VK_F8) & 0x8000)
  823. {
  824. *(DWORD*)(
  825. *(DWORD*)(
  826. *(DWORD*)(
  827. *(DWORD*)(
  828. *(DWORD*)(
  829. *(DWORD*)((int)GetModuleHandleA("sf2.exe") + Sup_Bullet)
  830. + Sup_OFFSET1) + Sup_OFFSET2) + Sup_OFFSET3) + Sup_OFFSET4) + Sup_OFFSET5) = 1195593728;
  831. }
  832.  
  833.  
  834.  
  835. if (IsAQS) //If Our Variable Becomes True Then...
  836. {
  837. if (GetKeyState(VK_RBUTTON) == 1) //If You Press The Right Mouse Button...
  838. {
  839. Sleep(0); //Stops The Current Thread For 100 Ms.
  840. mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); //Right Mouse Down
  841. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //1
  842. mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //2
  843. //1 + 2 = Left Mouse Click
  844. mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); //Right Mouse Up
  845. Sleep(1); //Already Explained...Stops The Current Thread For 100 Ms.
  846. GetKeyState(0x51);
  847. Sleep(1);
  848. GetKeyState(0x51);
  849.  
  850. }
  851. }
  852.  
  853.  
  854.  
  855. if (IsRapied)
  856. {
  857. if (GetKeyState(0x45) == 1)
  858. {
  859. // Push down the L
  860. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
  861. // Lift up L
  862. mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  863. }
  864. if (GetKeyState(VK_F7) == 1);
  865.  
  866. }
  867.  
  868.  
  869.  
  870.  
  871.  
  872. if (menu.MenuSelection >= menu.Current)
  873. menu.MenuSelection = 1;
  874. else if (menu.MenuSelection <= 0)
  875. menu.MenuSelection = (menu.Current - 1);
  876.  
  877.  
  878.  
  879. if (Variable[0])
  880. CrossHair(pDevice, Green);
  881.  
  882. if (Variable[57])
  883. if (EspOn)
  884.  
  885. if (Variable[66])
  886. CrossHair(pDevice, Green);
  887.  
  888. if (Variable[9])
  889. CrossHair21(pDevice, Green);
  890.  
  891. if (CrossColors)
  892. {
  893. CrossHair18(pDevice, Red);
  894.  
  895. }
  896. else
  897. {
  898. if (Variable[100])
  899. CrossHair18(pDevice, Green);
  900. }
  901.  
  902. if (Variable[67])
  903. {
  904. CrossHair77(pDevice, Green);
  905.  
  906. }
  907.  
  908. if (Variable[68])
  909. CrossHair78(pDevice, Green);
  910.  
  911. if (Variable[70])
  912. {
  913.  
  914.  
  915. CrossHair79(pDevice, Green);
  916. }
  917.  
  918.  
  919.  
  920.  
  921. if (Variable[12])
  922. {
  923. DrawCircle(ScreenX + 512, ScreenY + 384, 13, 13, Red); //test? build this is what I use for my crosshair okir
  924. CrossHair18(pDevice, Green);
  925. }
  926.  
  927.  
  928.  
  929.  
  930. return OPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
  931. }
  932.  
  933.  
  934.  
  935. DWORD WINAPI Hook(LPVOID lpArgs)
  936. {
  937. HMODULE D3D9 = 0;
  938.  
  939. while (!D3D9)
  940. {
  941. Sleep(100);
  942. D3D9 = GetModuleHandle("d3d9.dll");
  943. }
  944.  
  945. DWORD VTable[3] = { 0 };
  946. CreateDevice(VTable);
  947. OReset = (TReset)DetourFunction((PBYTE)GetDeviceAddress(16), (PBYTE)Reset);
  948. OPresent = (TPresent)DetourFunction((PBYTE)GetDeviceAddress(17), (PBYTE)Present);
  949. Orginal_DrawIndexedPrimitive = (Prototype_DrawIndexedPrimitive)DetourFunction((PBYTE)GetDeviceAddress(82), (PBYTE)Hooked_DrawIndexedPrimitive);
  950. if (Direct3DCreate9_VMTable() == D3D_OK)
  951. {
  952. return TRUE;
  953. }
  954. DWORD dwVTable[2] = { 0 };
  955. CreateDevice(dwVTable);
  956.  
  957. return TRUE;
  958. }
  959.  
  960. BOOL WINAPI DllMain(HINSTANCE hinstModule, DWORD dwReason, LPVOID lpvReserved)
  961. {
  962. if (dwReason == DLL_PROCESS_ATTACH)
  963. {
  964. DisableThreadLibraryCalls(hinstModule);
  965. CreateThread(0, 0, &Hook, 0, 0, 0);
  966. }
  967.  
  968. return TRUE;
  969. }
  970. //WAIT OK ok
  971.  
  972.  
  973. HRESULT WINAPI Hooked_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 Device, D3DPRIMITIVETYPE PrimType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
  974. {
  975. IDirect3DVertexBuffer9* pStreamData = NULL;
  976. UINT xOffset, Stride;
  977. if (Device->GetStreamSource(0, &pStreamData, &xOffset, &Stride) == D3D_OK)
  978. pStreamData->Release();
  979. UINT pSizeOfData;
  980. if (SUCCEEDED(Device->GetPixelShader(&pShader)))
  981. if (pShader != NULL)
  982. if (SUCCEEDED(pShader->GetFunction(NULL, &pSizeOfData)))
  983. if (pShader != NULL){ pShader->Release(); pShader = NULL; }
  984.  
  985.  
  986. if (bshaddinge)
  987. {
  988. TehShader(Device, &pWhite, 255, 255, 255);
  989. TehShader(Device, &pBlue, 0, 0, 255);
  990. TehShader(Device, &pBlack, 0, 0, 0);
  991. TehShader(Device, &pYellow, 255, 255, 0);
  992. TehShader(Device, &pDarkBlue, 25, 0, 151);
  993. TehShader(Device, &pLightYellow, 255, 255, 51);
  994. TehShader(Device, &pMagenta, 225, 0, 255);
  995. TehShader(Device, &pRed, 255, 0, 0);
  996.  
  997. bshaddinge = false;
  998.  
  999. }
  1000.  
  1001. if (WIREFRAME)
  1002. {
  1003. if (Stride == 32)
  1004. {
  1005.  
  1006. Device->SetRenderState(D3DRS_ZENABLE, false);
  1007. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //lets override these bitches... xd test
  1008. Device->SetRenderState(D3DRS_ZENABLE, true);
  1009.  
  1010.  
  1011. }
  1012. }
  1013.  
  1014.  
  1015. if (SOLID)
  1016. {
  1017. if (Stride == 32 && startIndex == 0)
  1018. {
  1019. Device->SetPixelShader(pBlack);
  1020. Device->SetRenderState(D3DRS_ZENABLE, false);
  1021. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //lets override these bitches... xd test
  1022. Device->SetRenderState(D3DRS_ZENABLE, true);
  1023. Device->SetPixelShader(pWhite);
  1024. Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  1025. }
  1026.  
  1027. }
  1028.  
  1029. if (POINTCHAMS)
  1030. {
  1031. if (Stride == 32)
  1032. {
  1033. Device->SetPixelShader(pBlue);
  1034. Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  1035. Device->SetRenderState(D3DRS_ZENABLE, false);
  1036. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //lets override these bitches... xd test
  1037. Device->SetRenderState(D3DRS_ZENABLE, true);
  1038. Device->SetPixelShader(pRed);
  1039. Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  1040. }
  1041.  
  1042. }
  1043. if (Ghost)
  1044. {
  1045. if (Stride == 32)
  1046. {
  1047. Device->SetPixelShader(pGreen);
  1048. Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  1049. Device->SetRenderState(D3DRS_ZENABLE, false);
  1050. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //lets override these bitches... xd test
  1051. Device->SetRenderState(D3DRS_ZENABLE, true);
  1052. Device->SetPixelShader(pRed);
  1053. Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  1054.  
  1055. }
  1056. }
  1057. if (NewCham)
  1058. {
  1059. if (Stride == 32)
  1060. {
  1061.  
  1062.  
  1063. Device->SetRenderState(D3DRS_ZENABLE, false);
  1064. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  1065. Device->SetRenderState(D3DRS_ZENABLE, true);
  1066.  
  1067. }
  1068. }
  1069.  
  1070. if (Variable[403])
  1071. {
  1072.  
  1073. if (Stride == 32)
  1074. {
  1075. DWORD dwOldZEnable = D3DZB_TRUE;
  1076. Device->SetPixelShader(Front);
  1077. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  1078. Device->SetRenderState(D3DRS_LIGHTING, false);
  1079. Device->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_ARGB(255, 255, 255, 255));
  1080. Device->SetPixelShader(Back);
  1081. }
  1082.  
  1083. }
  1084.  
  1085. return Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  1086. }
  1087.  
  1088. // OLD CODE IN CASE OF ISSUES
  1089. /*Device->SetPixelShader(pRed);
  1090. Device->SetRenderState(D3DRS_ZENABLE, false);
  1091. Orginal_DrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  1092. Device->SetRenderState(D3DRS_ZENABLE, true);
  1093. Device->SetPixelShader(pRed);
  1094. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement