Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 27.25 KB | None | 0 0
  1. #include "CMenu.h"
  2. #include "CSound.h"
  3. #include "Main.h"
  4. #include <detours.h>
  5.  
  6. #pragma message("credits :")
  7. #pragma message("HighBrow")
  8. #pragma message("UC")
  9. #pragma message("Seller -> zNova")
  10. #pragma message("Thanks for BUYING")
  11.  
  12. cMenu Menu;
  13. copt opt;
  14. cSound Sound;
  15.  
  16. float ScreenCenterX = 0.0f;
  17. float ScreenCenterY = 0.0f;
  18.  
  19. typedef HRESULT(APIENTRY *SetStreamSource_t)(IDirect3DDevice9*, UINT, IDirect3DVertexBuffer9*, UINT, UINT);
  20. HRESULT APIENTRY SetStreamSource_hook(IDirect3DDevice9*, UINT, IDirect3DVertexBuffer9*, UINT, UINT);
  21. SetStreamSource_t SetStreamSource_orig = 0;
  22.  
  23. typedef HRESULT(APIENTRY *SetTexture_t)(IDirect3DDevice9*, DWORD, IDirect3DBaseTexture9 *);
  24. HRESULT APIENTRY SetTexture_hook(IDirect3DDevice9*, DWORD, IDirect3DBaseTexture9 *);
  25. SetTexture_t SetTexture_orig = 0;
  26.  
  27. typedef HRESULT(APIENTRY* Present_t) (IDirect3DDevice9*, const RECT *, const RECT *, HWND, const RGNDATA *);
  28. HRESULT APIENTRY Present_hook(IDirect3DDevice9*, const RECT *, const RECT *, HWND, const RGNDATA *);
  29. Present_t Present_orig = 0;
  30.  
  31. typedef HRESULT(APIENTRY *DrawIndexedPrimitive_t)(IDirect3DDevice9*, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
  32. HRESULT APIENTRY DrawIndexedPrimitive_hook(IDirect3DDevice9*, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
  33. DrawIndexedPrimitive_t DrawIndexedPrimitive_orig = 0;
  34.  
  35. typedef HRESULT(APIENTRY *SetVertexShaderConstantF_t)(IDirect3DDevice9*, UINT, const float*, UINT);
  36. HRESULT APIENTRY SetVertexShaderConstantF_hook(IDirect3DDevice9*, UINT, const float*, UINT);
  37. SetVertexShaderConstantF_t SetVertexShaderConstantF_orig = 0;
  38.  
  39. typedef HRESULT(APIENTRY *GetRenderTargetData_t)(IDirect3DDevice9*, IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface);
  40. GetRenderTargetData_t oGetRenderTargetData = 0;
  41.  
  42. typedef HRESULT(APIENTRY *CreateOffscreenPlainSurface_t)(IDirect3DDevice9*, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle);
  43. CreateOffscreenPlainSurface_t oCreateOffscreenPlainSurface = 0;
  44. //SAVE THE ENDSCENE FOR FUTURE PLANS ;)
  45. //typedef HRESULT(APIENTRY* EndScene_t) (IDirect3DDevice9*);
  46. //HRESULT APIENTRY EndScene_hook(IDirect3DDevice9*);
  47. //EndScene_t EndScene_orig = 0;
  48.  
  49. typedef HRESULT(APIENTRY *Reset_t)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
  50. HRESULT APIENTRY Reset_hook(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
  51. Reset_t Reset_orig = 0;
  52.  
  53. //==========================================================================================================================
  54.  
  55. HRESULT APIENTRY hkGetRenderTargetData(LPDIRECT3DDEVICE9 pDevice, IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface)
  56. {
  57.     //called
  58.  
  59.     screenshot_taken = true;
  60.  
  61.     //temp disable visuals (it is too late to do this, screens are still dirty)
  62.     opt.d3d.chams = 0;
  63.     opt.d3d.grass = 0;
  64.     opt.misc.fog = 0;
  65.  
  66.     //Log("pRenderTarget == %d && pDestSurface == %d", pRenderTarget, pDestSurface);
  67.  
  68.     return oGetRenderTargetData(pDevice, pRenderTarget, pDestSurface);
  69. }
  70.  
  71. //==========================================================================================================================
  72.  
  73. HRESULT APIENTRY hkCreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle)
  74. {
  75.     //temp disable visuals (it is too late to do this, screens are still dirty)
  76.     opt.d3d.chams = 0;
  77.     opt.d3d.grass = 0;
  78.     opt.misc.fog = 0;
  79.  
  80.     screenshot_taken = true;
  81.  
  82.     //prevent local screenshot (is screenshot still uploaded to gm?)
  83.     Width = 1;
  84.     Height = 1;
  85.  
  86.     //Log("Width == %d && Height == %d && Format == %d && Pool == %d", Width, Height, Format, Pool);
  87.     Log("Screenshot blocked.");
  88.  
  89.     return oCreateOffscreenPlainSurface(pDevice, Width, Height, Format, Pool, ppSurface, pSharedHandle);
  90. }
  91.  
  92. //==========================================================================================================================
  93.  
  94. HRESULT APIENTRY SetStreamSource_hook(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT sStride)
  95. {
  96.     if (StreamNumber == 0)
  97.         Stride = sStride;
  98.  
  99.     return SetStreamSource_orig(pDevice, StreamNumber, pStreamData, OffsetInBytes, sStride);
  100. }
  101.  
  102. HRESULT APIENTRY SetVertexShaderConstantF_hook(LPDIRECT3DDEVICE9 pDevice, UINT StartRegister, const float *pConstantData, UINT Vector4fCount)
  103. {
  104.     if (pConstantData != NULL)
  105.     {
  106.         mStartregister = StartRegister;
  107.         mVectorCount = Vector4fCount;
  108.     }
  109.  
  110.     return SetVertexShaderConstantF_orig(pDevice, StartRegister, pConstantData, Vector4fCount);
  111. }
  112. //==========================================================================================================================
  113.  
  114.  
  115. HRESULT APIENTRY SetTexture_hook(LPDIRECT3DDEVICE9 pDevice, DWORD Sampler, IDirect3DBaseTexture9 *pTexture)
  116. {
  117.     if (InitOnce)
  118.     {
  119.         InitOnce = false;
  120.         pDevice->GetViewport(&Viewport);
  121.         ScreenCX = (float)Viewport.Width / 2.0f;
  122.         ScreenCY = (float)Viewport.Height / 2.0f;
  123.     }
  124.  
  125.     //get vSize
  126.     if (SUCCEEDED(pDevice->GetVertexShader(&vShader)))
  127.         if (vShader != NULL)
  128.             if (SUCCEEDED(vShader->GetFunction(NULL, &vSize)))
  129.                 if (vShader != NULL) { vShader->Release(); vShader = NULL; }
  130.  
  131.  
  132.     //wallhack
  133.     if (opt.d3d.chams > 0)
  134.     {
  135.         pDevice->SetRenderState(D3DRS_DEPTHBIAS, 0);
  136.         if ((vSize == 2356 || vSize == 900 || vSize == 2008 || vSize == 640) || (Stride == 36 && vSize == 1436) || (Stride == 48 && vSize == 1436))
  137.             //if (vSize == 2008|| vSize == 2356|| vSize == 640 || vSize == 1436)
  138.         {
  139.  
  140.             if (opt.d3d.chams == 2 && vSize != 1436)
  141.             {
  142.                 float sColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };//green
  143.                 pDevice->SetPixelShaderConstantF(0, sColor, 1);
  144.                 //SetTexture_orig(pDevice, 0, Red);
  145.                 //SetTexture_orig(pDevice, 1, Red);
  146.             }
  147.             float bias = 1000.0f;
  148.             float bias_float = static_cast<float>(-bias);
  149.             bias_float /= 10000.0f;
  150.             pDevice->SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&bias_float);
  151.         }
  152.     }
  153.     //worldtoscreen weapons in hand
  154.     if (opt.Aimbot.aimbot == 1 || opt.ESP.activate > 0)
  155.     {
  156.         if ((Stride == 48 && vSize > 1328) || (vSize == 2356 || vSize == 2008 || vSize == 1552))//1040crap,1328crap
  157.                                                                                                 //if (Stride == 48 || vSize == 2008 || vSize == 1552)
  158.             AddWeapons(pDevice);
  159.     }
  160.     if (opt.d3d.nograss == 1)
  161.     {
  162.         pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
  163.         if (vSize == 1660 || vSize == 1704)//grass
  164.         {
  165.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
  166.         }
  167.     }
  168.     if (opt.d3d.nofog == 1)
  169.     {
  170.         if (Stride == 48 || vSize == 2008 || vSize == 2356)
  171.         {
  172.             D3DXMATRIX matLegs;
  173.             D3DXMatrixScaling(&matLegs, 0.0f, 0.0f, 0.0f);
  174.             pDevice->SetVertexShaderConstantF(20, matLegs, 1);//legs
  175.  
  176.             D3DXMATRIX matChest;
  177.             D3DXMatrixScaling(&matChest, 0.0f, 0.0f, 0.0f);
  178.             pDevice->SetVertexShaderConstantF(25, matChest, 1);//chest
  179.         }
  180.     }
  181.  
  182.     if (opt.d3d.swireframe == 1)
  183.     {
  184.         if (Stride == 44)
  185.         {
  186.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  187.         }
  188.         if (Stride == 40)
  189.         {
  190.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  191.         }
  192.         if (Stride == 32)
  193.         {
  194.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  195.         }
  196.     }
  197.     if (opt.d3d.swireframe == 2)
  198.     {
  199.         if (Stride == 44)
  200.         {
  201.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
  202.         }
  203.         if (Stride == 40)
  204.         {
  205.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
  206.         }
  207.         if (Stride == 32)
  208.         {
  209.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
  210.         }
  211.     }
  212.     if (!opt.d3d.swireframe)
  213.     {
  214.         if (Stride == 44)
  215.         {
  216.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
  217.         }
  218.         if (Stride == 40)
  219.         {
  220.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
  221.         }
  222.         if (Stride == 32)
  223.         {
  224.             pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
  225.         }
  226.     }
  227.  
  228.     return SetTexture_orig(pDevice, Sampler, pTexture);
  229. }
  230.  
  231. void zNova(void *adress, void *bytes, int size)
  232. {
  233.     DWORD dwProtect;
  234.     VirtualProtect((void*)adress, size, PAGE_EXECUTE_READWRITE, &dwProtect);
  235.     memcpy((void *)adress, (PBYTE)bytes, size);
  236.     VirtualProtect((void*)adress, size, dwProtect, &dwProtect);
  237. }
  238. //Memory Hacks
  239.  
  240. DWORD WINAPI FF(LPVOID param)
  241. {
  242.     DWORD Baser;
  243.     Baser = (DWORD)GetModuleHandleA("ros.exe");
  244.     while(1)
  245.     //nag [atch ba ros ? hindi pa
  246.     {
  247.  
  248.     if (opt.misc.FastFall == 1)
  249.     {
  250.     //ok na w sa fast fall ? auto on nalang cguro sige
  251.        
  252.         if (GetAsyncKeyState(VK_F10) & 1)
  253.             {
  254.             *(float*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(Baser + physics) + 0x0) + 0x40) + 0x4) + 0x10) + 0x4C) = 990.0f;
  255.     }
  256.         if (!opt.misc.FastFall)
  257.         {
  258.             *(float*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(*(DWORD*)(Baser + physics) + 0x0) + 0x40) + 0x4) + 0x10) + 0x4C) = 450.0f;
  259.        
  260.     }
  261.     }
  262.         Sleep(10);
  263.     }
  264.     return 0;
  265. }
  266. void Crap(void)
  267. {
  268.     //messy coding is it ?
  269.     //ti's not global yet this works perfectly and i recommend a simple ingame check ;)
  270.     //ito na yung memory hacks paano i update yung addys?
  271.     //yung addys ako na bahala iuupdate kita lagi awtss
  272.     //walang string to sa olly or ida sa C.E manual reverse wala akong aob nito mga to pero may tool panghanap dito cgeh2x
  273.     //Defines Variables
  274.  
  275.     DWORD Base = (DWORD)GetModuleHandleA("ros.exe");
  276.     const unsigned long Sky = (DWORD)GetModuleHandle(NULL) + 0x5432CA;
  277.     const unsigned long grass = (DWORD)GetModuleHandle(NULL) + 0xC37F80;//grass updated
  278.     const unsigned long ground = (DWORD)GetModuleHandle(NULL) + 0x16E4A28;
  279.     const unsigned long ptw = (DWORD)GetModuleHandle(NULL) + 0x175A6B8;//ptw updated
  280.     const unsigned long fogger = (DWORD)GetModuleHandle(NULL) + 0xC37FFE;//fog updated
  281.     const unsigned long Zoom = (DWORD)GetModuleHandle(NULL) + 0x1716BCC;//updated
  282.     const unsigned long water = (DWORD)GetModuleHandle(NULL) + 0x39665C;//updated
  283.     const unsigned long fly = (DWORD)GetModuleHandle(NULL) + 0x182E5E0;//updated
  284.     const unsigned long G = (DWORD)GetModuleHandle(NULL) + 0x16E9A28;
  285.     const unsigned long B = (DWORD)GetModuleHandle(NULL) + 0x170A70C;
  286.     const unsigned long Foliage = (DWORD)GetModuleHandle(NULL) + 0xBB5A94;
  287.  
  288.     if (!GetModuleHandleA("ros.exe")) return;
  289.     memcpy((void*)(Base + 0x5432A2), "\xB8\xCA\x16\xDB\x42\x56\x8D\x71\x6C\x90\x90", 11);
  290.     if (opt.misc.SuperJump == 0) *(float*)(Base + 0x5432A3) = 109.5445099f;
  291.     if (opt.misc.SuperJump == 1) *(float*)(Base + 0x5432A3) = 150.0f;
  292.     if (opt.misc.SuperJump == 2) *(float*)(Base + 0x5432A3) = 200.0f;
  293.     if (opt.misc.SuperJump == 3) *(float*)(Base + 0x5432A3) = 250.0f;
  294.     if (opt.misc.SuperJump == 4) *(float*)(Base + 0x5432A3) = 300.0f;
  295.     if (opt.misc.SuperJump == 5) *(float*)(Base + 0x5432A3) = 350.0f;
  296.     //End Defines
  297.  
  298.     //BYTES & defaults
  299.     BYTE FogOn[5] = { 0xF3,0x0F,0x11,0x4D,0xE8 };
  300.     BYTE FogOFF[5] = { 0xF3,0x0F,0x11,0x45,0xE8 };
  301.  
  302.     //END BYTES & DEFAULTS
  303.  
  304.     if (opt.misc.ground)
  305.         *(float*)(G) = 1.0f;
  306.     else
  307.         *(float*)(G) = 0.0f;
  308.    
  309.     //START MEMORY HACKS
  310.     if (opt.d3d.playercolor)
  311.     {
  312.         float red, green, blue; //RGB
  313.  
  314.         Chams* pColor = pClassManager.GetChamsColorBase();
  315.         if (!pColor)return;
  316.  
  317.         if (opt.d3d.playercolor == 1) { red = 0;    green = 255; blue = 0; };          //Green
  318.         if (opt.d3d.playercolor == 2) { red = 255; green = 0;    blue = 0; };          //Red
  319.         if (opt.d3d.playercolor == 3) { red = 0;    green = 0;    blue = 255; };          //Blue
  320.         if (opt.d3d.playercolor == 4) { red = 255; green = 255; blue = 0; };        //Yellow
  321.         if (opt.d3d.playercolor == 5) { red = 255; green = 255; blue = 255; };      //White
  322.         if (opt.d3d.playercolor == 6) { red = 255; green = 0;    blue = 255; };        //Purple
  323.         if (opt.d3d.playercolor == 7) { red = 0;    green = 255; blue = 255; };        //Cyan
  324.  
  325.         pColor->ChamGreen = green;
  326.         pColor->ChamRed = red;
  327.         pColor->ChamBlue = blue;
  328.  
  329.     }
  330.     else //Restore Default Player Color
  331.     {
  332.         Chams* pColor = pClassManager.GetChamsColorBase();
  333.         if (!pColor)return;
  334.  
  335.         pColor->ChamGreen = 0.7764999866;
  336.         pColor->ChamRed = 0.8000000119;
  337.         pColor->ChamBlue = 0.7372999787;
  338.     }  
  339.     if (opt.misc.skywalk)
  340.     {
  341.         *(PFLOAT)(Sky) = -1.530092002E-30;
  342.     }
  343.     if (!opt.misc.skywalk)
  344.     {
  345.         *(PFLOAT)(Sky) = -1.554743905E-30;
  346.     }
  347.     if (opt.misc.climb)
  348.     {
  349.         *(BYTE*)(Base + 0x543B10) = 0x4C; //on
  350.     }
  351.     if (!opt.misc.climb)
  352.     {
  353.         *(BYTE*)(Base + 0x543B10) = 0x5C; //off
  354.     }
  355.     if (opt.misc.NFD)
  356.     {
  357.         memcpy((void*)(Base + 0x545CA8), "\xF6\xC2\x06", 3);
  358.  
  359.     }
  360.     if (!opt.misc.NFD)
  361.     {
  362.         memcpy((void*)(Base + 0x545CA8), "\xF6\xC2\x02", 3);
  363.  
  364.     }
  365.     if (opt.misc.grave)
  366.     {
  367.         memcpy((void*)(Base + 0x544578), "\x90\x90\x90\x90\x90\x90\x90\x90", 8);
  368.     }
  369.     if (opt.d3d.nograss)
  370.     {
  371.         *(PFLOAT)(grass) = -243773.5938;
  372.     }
  373.     if (opt.misc.build)
  374.     {
  375.         *(float*)(B) = -1.1f;
  376.     }
  377.     if (!opt.misc.build)
  378.     {
  379.         *(float*)(B) = -1.0f;
  380.     }
  381.     if (opt.misc.fly)
  382.     {
  383.         *(PFLOAT)(fly) = 40.0f;
  384.     }
  385.     if (opt.misc.water)
  386.     {
  387.         *(PFLOAT)(water) = 2.031882773E-43;
  388.     }
  389.     if (opt.misc.zoom == 1)
  390.     {
  391.         *(PFLOAT)(Zoom) = 0.00545329228;
  392.     }
  393.     if (opt.misc.zoom == 2)
  394.     {
  395.         *(PFLOAT)(Zoom) = 0.004f;
  396.     }
  397.     if (opt.misc.WTW)
  398.     {
  399.         *(PFLOAT)(ptw) = -0.89999998f;
  400.     }
  401.     if (opt.misc.fog)
  402.     {
  403.         zNova((void*)(fogger), (void*)FogOn, 5);
  404.     }
  405.  
  406.     if (opt.misc.speed == 1)
  407.     {
  408.         *(float*)(Base + 0x1763A30) = 90.0f;
  409.     }
  410.     if (opt.misc.speed == 2)
  411.     {
  412.         *(float*)(Base + 0x1763A30) = 100.0f;
  413.     }
  414.     if (opt.misc.speed == 3)
  415.     {
  416.         *(float*)(Base + 0x1763A30) = 110.0f;
  417.     }
  418.     if (opt.misc.speed == 4)
  419.     {
  420.         *(float*)(Base + 0x1763A30) = 120.0f;
  421.     }
  422.     if (opt.misc.speed == 5)
  423.     {
  424.         *(float*)(Base + 0x1763A30) = 130.0f;
  425.     }
  426.     if (opt.misc.speed == 6)
  427.     {
  428.         *(float*)(Base + 0x1763A30) = 140.0f;
  429.     }
  430.     if (opt.misc.speed == 7)
  431.     {
  432.         *(float*)(Base + 0x1763A30) = 150.0f;
  433.     }
  434.     //default values
  435.     //grass default
  436.     //foliage default
  437.  
  438.     if (opt.misc.Fol)
  439.     {
  440.         *(float*)(Foliage) = -243773.5938;
  441.     }
  442.     if (!opt.misc.Fol)
  443.     {
  444.         *(float*)(Foliage) = -3.719689846;
  445.     }
  446.  
  447.     if (!opt.misc.grave)
  448.     {
  449.         memcpy((void*)(Base + 0x544578), "\xF3\x0F\x11\x87\xE0\x00\x00\x00", 8);
  450.     }
  451.     if (!opt.d3d.nograss)
  452.     {
  453.         *(PFLOAT)(grass) = -3.407189846;
  454.     }
  455.  
  456.     // remove water default
  457.     if (!opt.misc.water)
  458.     {
  459.         *(PFLOAT)(water) = 2.017869789E-43;
  460.     }
  461.     // speed hack default
  462.     if (!opt.misc.speed)
  463.     {
  464.         *(float*)(Base + 0x1763A30) = 60.0f;
  465.     }
  466.     //no fog default
  467.     if (!opt.misc.fog)
  468.     {
  469.         zNova((void*)(fogger), (void*)FogOFF, 5);
  470.     }
  471.     //zoom hack default
  472.     if (!opt.misc.zoom)
  473.     {
  474.         *(PFLOAT)(Zoom) = 0.0174532924;
  475.     }
  476.     //fly hack default
  477.     if (!opt.misc.fly)
  478.     {
  479.         *(PFLOAT)(fly) = 0.0f;
  480.     }
  481.     //wtw default
  482.     if (!opt.misc.WTW)
  483.     {
  484.         *(PFLOAT)(ptw) = -0.500f;
  485.     }
  486. }
  487.  
  488. void PreReset( LPDIRECT3DDEVICE9 pDevice )
  489. {
  490.     Menu.PreReset();
  491.     return;
  492. }
  493.  
  494. void PostReset( LPDIRECT3DDEVICE9 pDevice )
  495. {
  496.     Menu.PostReset(pDevice);
  497.     return;
  498. }
  499. bool WorldToScreen(D3DXVECTOR3 pos, D3DXVECTOR3 &screen, D3DXMATRIX matrix, int windowWidth, int windowHeight)
  500. {
  501.     D3DXVECTOR4 clipCoords;
  502.     clipCoords.x = pos.x*matrix[0] + pos.y*matrix[4] + pos.z*matrix[8] + matrix[12];
  503.     clipCoords.y = pos.x*matrix[1] + pos.y*matrix[5] + pos.z*matrix[9] + matrix[13];
  504.     clipCoords.z = pos.x*matrix[2] + pos.y*matrix[6] + pos.z*matrix[10] + matrix[14];
  505.     clipCoords.w = pos.x*matrix[3] + pos.y*matrix[7] + pos.z*matrix[11] + matrix[15];
  506.  
  507.     if (clipCoords.w < 0.1f)
  508.         return false;
  509.  
  510.     D3DXVECTOR3 NDC;
  511.     NDC.x = clipCoords.x / clipCoords.w;
  512.     NDC.y = clipCoords.y / clipCoords.w;
  513.     NDC.z = clipCoords.z / clipCoords.w;
  514.  
  515.     screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2);
  516.     screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2);
  517.     return true;
  518. }
  519.  
  520. HRESULT CreateMyShader(IDirect3DPixelShader9 **pShader, IDirect3DDevice9 *Device, float red, float green, float blue, float alpha)
  521. {
  522.     ID3DXBuffer *MyBuffer = NULL;
  523.     char MyShader[256];
  524.     sprintf(MyShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", red / 255, green / 255, blue / 255, alpha / 255);
  525.     D3DXAssembleShader(MyShader, sizeof(MyShader), NULL, NULL, 0, &MyBuffer, NULL);
  526.     if (FAILED(Device->CreatePixelShader((const DWORD*)MyBuffer->GetBufferPointer(), pShader)))return E_FAIL;
  527.     return S_OK;
  528. }
  529. //==========================================================================================================================
  530.  
  531. HRESULT APIENTRY Present_hook(IDirect3DDevice9* pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion)
  532. {
  533.     pDevice->GetViewport(&Viewport);
  534.     ScreenCX = (float)Viewport.Width / 2.0f;
  535.     ScreenCY = (float)Viewport.Height / 2.0f;
  536.     /*
  537.     if(!Direct3DInitialize)
  538.     {
  539.         Direct3DInitialize = true;
  540.  
  541.         CreateMyShader(&Front, pDevice, 255, 0, 0, 255);
  542.         CreateMyShader(&Back, pDevice, 255, 255, 0, 255);
  543.     }*/
  544.     _asm pushad;
  545.  
  546.     if (!Tools.Init)
  547.     {
  548.         D3DXCreateLine(pDevice, &Tools.pLine);
  549.         Tools.Init = TRUE;
  550.     }
  551.     PostReset(pDevice);
  552.     Menu.ShowMenu(pDevice);
  553.     PreReset(pDevice);
  554.  
  555.     pDevice->GetViewport(&Tools.g_ViewPort);
  556.     ScreenCenterX = (float)Tools.g_ViewPort.Width / 2;
  557.     ScreenCenterY = (float)Tools.g_ViewPort.Height / 2;
  558.  
  559.     if (opt.d3d.cross)
  560.     {
  561.         Tools.FillRGB(ScreenCenterX - 14, ScreenCenterY, 10, 1, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), pDevice);//Left line
  562.         Tools.FillRGB(ScreenCenterX + 5, ScreenCenterY, 10, 1, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), pDevice);//Right line
  563.         Tools.FillRGB(ScreenCenterX, ScreenCenterY - 14, 1, 10, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), pDevice);//Top line
  564.         Tools.FillRGB(ScreenCenterX, ScreenCenterY + 5, 1, 10, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), pDevice);//Bottom line
  565.         Tools.DrawCircle(D3DXVECTOR2(ScreenCenterX, ScreenCenterY), 8, 60, D3DXCOLOR(1.0, 0.0, 0.0, 1.0));//Circle
  566.         Tools.DrawPoint(ScreenCenterX, ScreenCenterY, 1, 1, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), pDevice);//Point
  567.     }
  568.     _asm popad;
  569.  
  570.     if (Font == NULL)
  571.         D3DXCreateFont(pDevice, 14, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Italic"), &Font);
  572.     if (screenshot_taken && Font)
  573.     {
  574.         DrawCenteredString(Font, (int)Viewport.Width / 2, (int)Viewport.Height / 2, D3DCOLOR_ARGB(255, 255, 255, 255), "Someone reported you. Screenshot blocked. (gmcomplaint.jpg)");
  575.  
  576.         static DWORD lastTime = timeGetTime();
  577.         DWORD timePassed = timeGetTime() - lastTime;
  578.         if (timePassed>2000)
  579.         {
  580.             screenshot_taken = false;
  581.             lastTime = timeGetTime();
  582.         }
  583.     }
  584.     //Shift|RMouse|LMouse|Ctrl|Alt|Space|X|C
  585.     if (opt.Aimbot.key == 0) Daimkey = 0;
  586.     if (opt.Aimbot.key == 1) Daimkey = VK_SHIFT;
  587.     if (opt.Aimbot.key == 2) Daimkey = VK_RBUTTON;
  588.     if (opt.Aimbot.key == 3) Daimkey = VK_LBUTTON;
  589.     if (opt.Aimbot.key == 4) Daimkey = VK_CONTROL;
  590.     if (opt.Aimbot.key == 5) Daimkey = VK_MENU;
  591.     if (opt.Aimbot.key == 6) Daimkey = VK_SPACE;
  592.     if (opt.Aimbot.key == 7) Daimkey = 0x58; //X
  593.     if (opt.Aimbot.key == 8) Daimkey = 0x43; //C
  594.  
  595.     if (opt.ESP.activate > 0 && WeaponEspInfo.size() != NULL)
  596.     {
  597.         for (unsigned int i = 0; i < WeaponEspInfo.size(); i++)
  598.         {
  599.             //box esp
  600.             if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].RealDistance > 4.0f)
  601.                 DrawCornerBox(pDevice, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY + 20, 20, 30, 1, D3DCOLOR_ARGB(255, 255, 255, 255));
  602.  
  603.             //line esp
  604.             if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].RealDistance > 4.0f)//&& (float)WeaponEspInfo[i].vSizeod == 2008)//long range weapon
  605.                 DrawLine(pDevice, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY, ScreenCX, ScreenCY * ((float)opt.ESP.activate * 0.2f), 20, D3DCOLOR_ARGB(255, 255, 255, 255), 1);//0.1up, 1.0middle, 2.0down
  606.                                                                                                                                                                                 //else if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].RealDistance > 4.0f && (float)WeaponEspInfo[i].vSizeod != 2008)//short/mid range weapon
  607.                                                                                                                                                                                 //DrawLine(pDevice, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY, ScreenCX, ScreenCY * ((float)esp * 0.2f), 20, D3DCOLOR_ARGB(255, 0, 255, 0), 1);//0.1up, 1.0middle, 2.0down
  608.  
  609.                                                                                                                                                                                 //distance esp
  610.             if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].RealDistance > 200.0f)
  611.                 DrawCenteredString(Font, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY - 20.0f, D3DCOLOR_ARGB(255, 255, 255, 255), "%.f", (float)WeaponEspInfo[i].RealDistance);
  612.             else if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].RealDistance > 4.0f && (float)WeaponEspInfo[i].RealDistance <= 200.0f)
  613.                 DrawCenteredString(Font, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY - 20.0f, D3DCOLOR_ARGB(255, 255, 255, 0), "%.f", (float)WeaponEspInfo[i].RealDistance);
  614.  
  615.             //text esp
  616.             //if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY > 1.0f && (float)WeaponEspInfo[i].distance > 4.0f)
  617.             //DrawString(Font, (int)WeaponEspInfo[i].pOutX, (int)WeaponEspInfo[i].pOutY, D3DCOLOR_ARGB(255, 255, 255, 255), "o");
  618.         }
  619.     }
  620.     //ito na yun try mo cgwh2x
  621.     if (opt.Aimbot.aimbot == 1 && WeaponEspInfo.size() != NULL)
  622.     {
  623.         UINT BestTarget = -1;
  624.         DOUBLE fClosestPos = 99999;
  625.  
  626.         for (unsigned int i = 0; i < WeaponEspInfo.size(); i++)
  627.         {
  628.             //aimfov
  629.             float radiusx = (opt.Aimbot.fov*5.0f) * (ScreenCX / 100.0f);
  630.             float radiusy = (opt.Aimbot.fov*5.0f) * (ScreenCY / 100.0f);
  631.  
  632.             if (opt.Aimbot.fov == 0)
  633.             {
  634.                 radiusx = 5.0f * (ScreenCX / 100.0f);
  635.                 radiusy = 5.0f * (ScreenCY / 100.0f);
  636.             }
  637.  
  638.             //get crosshairdistance
  639.             WeaponEspInfo[i].CrosshairDistance = GetDistance(WeaponEspInfo[i].pOutX, WeaponEspInfo[i].pOutY, ScreenCX, ScreenCY);
  640.  
  641.             //if in fov
  642.             if (WeaponEspInfo[i].pOutX >= ScreenCX - radiusx && WeaponEspInfo[i].pOutX <= ScreenCX + radiusx && WeaponEspInfo[i].pOutY >= ScreenCY - radiusy && WeaponEspInfo[i].pOutY <= ScreenCY + radiusy)
  643.  
  644.                 //get closest/nearest target to crosshair
  645.                 if (WeaponEspInfo[i].CrosshairDistance < fClosestPos)
  646.                 {
  647.                     fClosestPos = WeaponEspInfo[i].CrosshairDistance;
  648.                     BestTarget = i;
  649.                 }
  650.         }
  651.  
  652.  
  653.         //if nearest target to crosshair
  654.         if (BestTarget != -1 && WeaponEspInfo[BestTarget].RealDistance > 4.0f)//do not aim at self
  655.         {
  656.             double DistX = WeaponEspInfo[BestTarget].pOutX - ScreenCX;
  657.             double DistY = WeaponEspInfo[BestTarget].pOutY - ScreenCY;
  658.  
  659.             DistX /= (0.5f + (float)opt.Aimbot.sens*0.5f);
  660.             DistY /= (0.5f + (float)opt.Aimbot.sens*0.5f);
  661.  
  662.             //aim
  663.             if (GetAsyncKeyState(Daimkey) & 0x8000)
  664.                 mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
  665.  
  666.             //autoshoot on
  667.             if ((!GetAsyncKeyState(VK_LBUTTON) && (opt.Aimbot.autoshoot == 1) && (GetAsyncKeyState(Daimkey) & 0x8000))) //
  668.             {
  669.                 if (opt.Aimbot.autoshoot == 1 && !IsPressed)
  670.                 {
  671.                     IsPressed = true;
  672.                     mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
  673.                 }
  674.             }
  675.         }
  676.     }
  677.     WeaponEspInfo.clear();
  678.     //autoshoot off
  679.     if (opt.Aimbot.autoshoot == 1 && IsPressed)
  680.     {
  681.         if (timeGetTime() - astime >= asdelay)
  682.         {
  683.             IsPressed = false;
  684.             mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  685.             astime = timeGetTime();
  686.         }
  687.     }
  688.     DWORD ROS = (DWORD)GetModuleHandleA("ros.exe");
  689.     int inGame = *(int*)(isInBattleGround + ROS);
  690.     if(inGame == 1)
  691.     Crap();//ito ok lang ba sa loob lang ng laro gagana mga memory hacks ? oo
  692.     return Present_orig(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
  693. }
  694.  
  695. typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );
  696. oReset pReset;
  697.  
  698. //==========================================================================================================================
  699.  
  700. HRESULT APIENTRY Reset_hook(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters)
  701. {
  702.  
  703.     _asm pushad;
  704.  
  705.     if (Tools.pLine)
  706.         Tools.pLine->OnLostDevice();
  707.  
  708.     HRESULT ResetReturn = Reset_orig(pDevice, pPresentationParameters);
  709.  
  710.     if (SUCCEEDED(ResetReturn))
  711.     {
  712.         if (Tools.pLine)
  713.             Tools.pLine->OnResetDevice();
  714.     }
  715.     _asm popad;
  716.     return ResetReturn;
  717. }
  718.  
  719. typedef HRESULT ( WINAPI* oEndScene )( LPDIRECT3DDEVICE9 pDevice );
  720. oEndScene pEndScene;
  721.  
  722. //==========================================================================================================================
  723.  
  724. HANDLE(WINAPI *Real_CreateFile)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) = CreateFileW;
  725. HANDLE WINAPI Routed_CreateFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
  726. {
  727.     char buffer[500];
  728.     wcstombs(buffer, lpFileName, 500);
  729.     if (strcmp(buffer + strlen(buffer) - 4, ".jpg") == 0)//find gm_complaint_x.jpg
  730.     {
  731.         Log("buffer == %s", buffer);//log jpg
  732.     }
  733.     return Real_CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
  734. }
  735.  
  736. DWORD WINAPI RosD3D(__in LPVOID lpParameter)
  737. {
  738.     HMODULE dDll = NULL;
  739.     while (!dDll)
  740.     {
  741.         dDll = GetModuleHandleA("d3d9.dll");
  742.         Sleep(100);
  743.     }
  744.     CloseHandle(dDll);
  745.  
  746.     IDirect3D9* d3d = NULL;
  747.     IDirect3DDevice9* d3ddev = NULL;
  748.  
  749.     HWND tmpWnd = CreateWindowA("BUTTON", "RosD3D", WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, NULL, NULL, Hand, NULL);
  750.     if (tmpWnd == NULL)
  751.     {
  752.  
  753.         return 0;
  754.     }
  755.  
  756.     d3d = Direct3DCreate9(D3D_SDK_VERSION);
  757.     if (d3d == NULL)
  758.     {
  759.         DestroyWindow(tmpWnd);
  760.  
  761.         return 0;
  762.     }
  763.  
  764.     D3DPRESENT_PARAMETERS d3dpp;
  765.     ZeroMemory(&d3dpp, sizeof(d3dpp));
  766.     d3dpp.Windowed = TRUE;
  767.     d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  768.     d3dpp.hDeviceWindow = tmpWnd;
  769.     d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  770.  
  771.     HRESULT result = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, tmpWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev);
  772.     if (result != D3D_OK)
  773.     {
  774.         d3d->Release();
  775.         DestroyWindow(tmpWnd);
  776.  
  777.         return 0;
  778.     }
  779.  
  780.  
  781. #if defined _M_X64
  782.     DWORD64* dVtable = (DWORD64*)d3ddev;
  783.     dVtable = (DWORD64*)dVtable[0];
  784. #elif defined _M_IX86
  785.     DWORD* dVtable = (DWORD*)d3ddev;
  786.     dVtable = (DWORD*)dVtable[0];
  787. #endif
  788.     SetStreamSource_orig = (SetStreamSource_t)dVtable[100];
  789.     SetVertexShaderConstantF_orig = (SetVertexShaderConstantF_t)dVtable[94];
  790.     SetTexture_orig = (SetTexture_t)dVtable[65];
  791.     Reset_orig = (Reset_t)dVtable[16];
  792.     Present_orig = (Present_t)dVtable[17];
  793.  
  794.     Present_orig = (Present_t)DetourFunction((PBYTE)Present_orig, (PBYTE)Present_hook);
  795.     SetStreamSource_orig = (SetStreamSource_t)DetourFunction((PBYTE)SetStreamSource_orig, (PBYTE)SetStreamSource_hook);
  796.     SetTexture_orig = (SetTexture_t)DetourFunction((PBYTE)SetTexture_orig, (PBYTE)SetTexture_hook);
  797.     SetVertexShaderConstantF_orig = (SetVertexShaderConstantF_t)DetourFunction((PBYTE)SetVertexShaderConstantF_orig, (PBYTE)SetVertexShaderConstantF_hook);
  798.     Reset_orig = (Reset_t)DetourFunction((PBYTE)Reset_orig, (PBYTE)Reset_hook);
  799.  
  800.     /*HMODULE mod = LoadLibrary(TEXT("Kernel32.dll"));
  801.     void* ptr = GetProcAddress(mod, "CreateFileW");*/
  802.  
  803.     Sleep(1000);
  804.     return 0;
  805. }
  806.  
  807. BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
  808. {
  809.     switch(dwReason)
  810.     {
  811.         case DLL_PROCESS_ATTACH:
  812.             Hand = hDll;
  813.             DisableThreadLibraryCalls(hDll); // disable unwanted thread notifications to reduce overhead
  814.             //CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)DIRECT3D, hDll, NULL, NULL);
  815.  
  816.             GetModuleFileNameA( hDll, dlldir, 512 );
  817.             for(int i = ( int )strlen( dlldir ); i > 0; i--)
  818.             {
  819.                 if(dlldir[i] == '\\')
  820.                 {
  821.                     dlldir[i+1] = 0;
  822.                     break;
  823.                 }
  824.             }
  825.             CreateThread(0, 0, RosD3D, 0, 0, 0); //init our hooks
  826.             CreateThread(0, 0, FF, 0, 0, 0);//call our FastFall
  827.         break;
  828.  
  829.         case DLL_PROCESS_DETACH:
  830.         break;
  831.     }
  832.     return TRUE;
  833. }  
  834.  
  835. //THANKS FOR BUYING
  836. //STILL UNDETECTED 4/20/2018
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement