URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Hack Community
  HTML https://roshacks.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Codes
       *****************************************************
       #Post#: 67--------------------------------------------------
       [Source Code] ROS |AIMBOT|MENU|ESP|CHAMS|LINES|NOGRASS|NOFOG|
       By: pipo1337 Date: April 2, 2018, 2:11 am
       ---------------------------------------------------------
       Ros-D3D
       Credit: n7seven
       Coded in C++
       You must do this in project: project -> properties ->
       configuration properties -> general -> character set -> change
       to "not set
       MAIN.CPP
       [code]/*
       * Ros D3D 0.9 by n7
       How to compile:
       - compile with visual studio community 2017 (..\Microsoft Visual
       Studio\2017\Community\Common7\IDE\devenv.exe)
       - select Release x86
       - click: project -> properties -> configuration properties ->
       general -> character set -> change to "not set"
       - compile with CTRL + Shift + B
       Optional: remove dependecy on vs runtime:
       - click: project -> properties -> configuration properties ->
       C/C++ -> code generation -> runtime library: Multi-threaded
       (/MT)
       */
       #include "main.h" //less important stuff & helper funcs here
       typedef HRESULT(APIENTRY *SetStreamSource_t)(IDirect3DDevice9*,
       UINT, IDirect3DVertexBuffer9*, UINT, UINT);
       HRESULT APIENTRY SetStreamSource_hook(IDirect3DDevice9*, UINT,
       IDirect3DVertexBuffer9*, UINT, UINT);
       SetStreamSource_t SetStreamSource_orig = 0;
       typedef HRESULT(APIENTRY *SetTexture_t)(IDirect3DDevice9*,
       DWORD, IDirect3DBaseTexture9 *);
       HRESULT APIENTRY SetTexture_hook(IDirect3DDevice9*, DWORD,
       IDirect3DBaseTexture9 *);
       SetTexture_t SetTexture_orig = 0;
       typedef HRESULT(APIENTRY* Present_t) (IDirect3DDevice9*, const
       RECT *, const RECT *, HWND, const RGNDATA *);
       HRESULT APIENTRY Present_hook(IDirect3DDevice9*, const RECT *,
       const RECT *, HWND, const RGNDATA *);
       Present_t Present_orig = 0;
       typedef HRESULT(APIENTRY* EndScene_t) (IDirect3DDevice9*);
       HRESULT APIENTRY EndScene_hook(IDirect3DDevice9*);
       EndScene_t EndScene_orig = 0;
       typedef HRESULT(APIENTRY *Reset_t)(IDirect3DDevice9*,
       D3DPRESENT_PARAMETERS*);
       HRESULT APIENTRY Reset_hook(IDirect3DDevice9*,
       D3DPRESENT_PARAMETERS*);
       Reset_t Reset_orig = 0;
       //==============================================================
       ============================================================
       HRESULT APIENTRY SetStreamSource_hook(LPDIRECT3DDEVICE9 pDevice,
       UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT
       OffsetInBytes, UINT sStride)
       {
       if (StreamNumber == 0)
       Stride = sStride;
       return SetStreamSource_orig(pDevice, StreamNumber, pStreamData,
       OffsetInBytes, sStride);
       }
       //==============================================================
       ============================================================
       HRESULT APIENTRY SetTexture_hook(LPDIRECT3DDEVICE9 pDevice,
       DWORD Sampler, IDirect3DBaseTexture9 *pTexture)
       {
       if (InitOnce)
       {
       InitOnce = false;
       //get viewport
       pDevice->GetViewport(&Viewport);
       ScreenCX = (float)Viewport.Width / 2.0f;
       ScreenCY = (float)Viewport.Height / 2.0f;
       GenerateTexture(pDevice, &Red, D3DCOLOR_ARGB(255, 255, 0, 0));
       GenerateTexture(pDevice, &Green, D3DCOLOR_RGBA(0, 255, 0,
       255));
       GenerateTexture(pDevice, &Blue, D3DCOLOR_ARGB(255, 0, 0,
       255));
       GenerateTexture(pDevice, &Yellow, D3DCOLOR_ARGB(255, 255, 255,
       0));
       LoadCfg();
       }
       //get vSize
       if (SUCCEEDED(pDevice->GetVertexShader(&vShader)))
       if (vShader != NULL)
       if (SUCCEEDED(vShader->GetFunction(NULL, &vSize)))
       if (vShader != NULL) { vShader->Release(); vShader = NULL; }
       //model rec sample
       //Stride == 36 && pSize == 1724 && vSize == 1952 //legs
       //Stride == 36 && pSize == 1848 && vSize == 2300 //chest
       //Stride == 44 && pSize == 2272 && vSize == 2300 //hair
       //Stride == 36 && numElements == 5 && decl->Type == 2 && pSize
       == 412 && vSize == 1436 //weapons on ground
       //Stride == 24 && numElements == 6 && decl->Type == 2 && vSize
       == 1436 //stupid door1
       //Stride == 36 && numElements == 5 && decl->Type == 2 && vSize
       == 1436 //stupid door2
       if (wallhack>0)
       {
       pDevice->SetRenderState(D3DRS_DEPTHBIAS, 0);
       if ((vSize == 2300 || vSize == 900 ||
       vSize == 1952 || vSize == 640) || (Stride == 36 && vSize ==
       1436))
       {
       if (wallhack == 2 && vSize != 1436)
       {
       float sColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };//green
       pDevice->SetPixelShaderConstantF(0, sColor, 1);
       //SetTexture_orig(pDevice, 0, Red);
       //SetTexture_orig(pDevice, 1, Red);
       }
       //if (wallhack == 2 && Stride == 36 && vSize ==
       1436)//weapons on ground
       //{
       //float sColorr[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
       //pDevice->SetPixelShaderConstantF(0, sColorr, 4);
       //}
       float bias = 1000.0f;
       float bias_float = static_cast<float>(-bias);
       bias_float /= 10000.0f;
       pDevice->SetRenderState(D3DRS_DEPTHBIAS,
       *(DWORD*)&bias_float);
       }
       }
       //worldtoscreen weapons in hand
       if (aimbot == 1 || esp > 0)
       {
       if (Stride == 48 || vSize == 2300 || vSize == 900 ||
       vSize == 1952 || vSize == 640)
       AddWeapons(pDevice);
       }
       //no grass by mtsagossi
       if (nograss == 1)
       {
       pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
       if (vSize == 1660 || vSize == 1704)
       {
       pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
       }
       }
       if (nofog == 1)
       {
       //if (Stride != 44)//buggy
       //{
       //D3DXMATRIX matWorld;
       //D3DXMatrixScaling(&matWorld, 0.0f, 0.0f, 0.0f);
       //pDevice->SetVertexShaderConstantF(5, matWorld, 1);//World
       //}
       if (vSize == 2300 || vSize == 1952)
       {
       D3DXMATRIX matLegs;
       D3DXMatrixScaling(&matLegs, 0.0f, 0.0f, 0.0f);
       pDevice->SetVertexShaderConstantF(20, matLegs, 1);//legs
       D3DXMATRIX matChest;
       D3DXMatrixScaling(&matChest, 0.0f, 0.0f, 0.0f);
       pDevice->SetVertexShaderConstantF(25, matChest, 1);//chest
       //D3DXMATRIX matChestt;
       //D3DXMatrixScaling(&matChestt, 0.0f, 0.0f, 0.0f);
       //pDevice->SetVertexShaderConstantF(countnum, matChestt,
       1);//
       }
       }
       /*
       //logger
       if (GetAsyncKeyState('O') & 1) //-
       countnum--;
       if (GetAsyncKeyState('P') & 1) //+
       countnum++;
       if (countnum == Stride|| countnum == vSize / 100)
       if (GetAsyncKeyState('I') & 1) //log
       Log("Stride == %d && vSize == %d", Stride, vSize);
       if (countnum == Stride || countnum == vSize / 100)
       {
       //return D3D_OK; //delete texture
       //pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_POINT);
       }
       */
       return SetTexture_orig(pDevice, Sampler, pTexture);
       }
       //==============================================================
       ============================================================
       HRESULT APIENTRY Present_hook(IDirect3DDevice9* pDevice, const
       RECT *pSourceRect, const RECT *pDestRect, HWND
       hDestWindowOverride, const RGNDATA *pDirtyRegion)
       {
       if (GetAsyncKeyState(VK_ESCAPE) &
       1||GetAsyncKeyState(VK_INSERT))
       {
       //get viewport
       pDevice->GetViewport(&Viewport);
       ScreenCX = (float)Viewport.Width / 2.0f;
       ScreenCY = (float)Viewport.Height / 2.0f;
       }
       /*
       static DWORD lastTime = timeGetTime();
       DWORD timePassed = timeGetTime() - lastTime;
       if (timePassed>30000)
       {
       //get viewport
       pDevice->GetViewport(&Viewport);
       ScreenCX = (float)Viewport.Width / 2.0f;
       ScreenCY = (float)Viewport.Height / 2.0f;
       lastTime = timeGetTime();
       }
       */
       //create font
       if (Font == NULL)
       D3DXCreateFont(pDevice, 14, 0, FW_BOLD, 0, FALSE,
       DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
       DEFAULT_PITCH | FF_DONTCARE, TEXT("Italic"), &Font);
       if (ShowMenu)
       //draw background
       DrawBox(pDevice, 71.0f, 86.0f, 200.0f, 160.0f,
       D3DCOLOR_ARGB(120, 30, 200, 200));//180 = up/down, 200 =
       left/right
       if (Font)
       DrawMenu(pDevice);
       if (screenshot_taken)
       {
       DrawString(Font, ScreenCX - 20.0f, ScreenCY - 20.0f,
       D3DCOLOR_ARGB(255, 255, 255, 255), "Screenshot Taken
       (gm_complaint)");
       if (timeGetTime() - screen_pause >= 299)
       {
       screenshot_taken = false;
       screen_pause = timeGetTime();
       }
       }
       //Shift|RMouse|LMouse|Ctrl|Alt|Space|X|C
       if (aimkey == 0) Daimkey = 0;
       if (aimkey == 1) Daimkey = VK_SHIFT;
       if (aimkey == 2) Daimkey = VK_RBUTTON;
       if (aimkey == 3) Daimkey = VK_LBUTTON;
       if (aimkey == 4) Daimkey = VK_CONTROL;
       if (aimkey == 5) Daimkey = VK_MENU;
       if (aimkey == 6) Daimkey = VK_SPACE;
       if (aimkey == 7) Daimkey = 0x58; //X
       if (aimkey == 8) Daimkey = 0x43; //C
       //do esp
       if (esp > 0 && WeaponEspInfo.size() != NULL)
       {
       for (unsigned int i = 0; i < WeaponEspInfo.size(); i++)
       {
       //box esp
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance > 40.0f &&
       (float)WeaponEspInfo[i].distance < 1000.0f)
       DrawBox(pDevice, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY - 20.0f, 12.0f, 12.0f,
       D3DCOLOR_ARGB(12, 30, 200, 200));//25, 18, 12
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance >= 1000.0f &&
       (float)WeaponEspInfo[i].distance < 10000.0f)
       DrawBox(pDevice, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY - 20.0f, 18.0f, 12.0f,
       D3DCOLOR_ARGB(12, 30, 200, 200));//25, 18, 12
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance >= 10000.0f &&
       (float)WeaponEspInfo[i].distance < 90000.0f)
       DrawBox(pDevice, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY - 20.0f, 24.0f, 12.0f,
       D3DCOLOR_ARGB(12, 30, 200, 200));//25, 18, 12
       //line esp
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance > 40.0f)
       DrawLine(pDevice, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY, ScreenCX, ScreenCY * ((float)esp *
       0.2f), 20, D3DCOLOR_ARGB(255, 255, 255, 255));//0.1up,
       1.0middle, 2.0down
       //distance esp
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance > 2000.0f)
       DrawString(Font, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY - 20.0f, D3DCOLOR_ARGB(255, 255,
       255, 255), "%.f", (float)WeaponEspInfo[i].distance / 10.0f);
       if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY >
       1.0f && (float)WeaponEspInfo[i].distance > 40.0f &&
       (float)WeaponEspInfo[i].distance <= 2000.0f)
       DrawString(Font, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY - 20.0f, D3DCOLOR_ARGB(255, 255,
       255, 0), "%.f", (float)WeaponEspInfo[i].distance / 10.0f);
       //text esp
       //if (WeaponEspInfo[i].pOutX > 1.0f && WeaponEspInfo[i].pOutY
       > 1.0f && (float)WeaponEspInfo[i].distance > 40.0f)
       //DrawString(Font, (int)WeaponEspInfo[i].pOutX,
       (int)WeaponEspInfo[i].pOutY, D3DCOLOR_ARGB(255, 255, 255, 255),
       "o");
       }
       }
       //do aim
       if (aimbot == 1 && WeaponEspInfo.size() != NULL)
       {
       UINT BestTarget = -1;
       DOUBLE fClosestPos = 99999;
       for (unsigned int i = 0; i < WeaponEspInfo.size(); i++)
       {
       //aimfov
       float radiusx = (aimfov*5.0f) * (ScreenCX / 100.0f);
       float radiusy = (aimfov*5.0f) * (ScreenCY / 100.0f);
       if (aimfov == 0)
       {
       radiusx = 5.0f * (ScreenCX / 100.0f);
       radiusy = 5.0f * (ScreenCY / 100.0f);
       }
       //get crosshairdistance
       WeaponEspInfo[i].CrosshairDistance =
       GetDistance(WeaponEspInfo[i].pOutX, WeaponEspInfo[i].pOutY,
       ScreenCX, ScreenCY);
       //if in fov
       if (WeaponEspInfo[i].pOutX >= ScreenCX - radiusx &&
       WeaponEspInfo[i].pOutX <= ScreenCX + radiusx &&
       WeaponEspInfo[i].pOutY >= ScreenCY - radiusy &&
       WeaponEspInfo[i].pOutY <= ScreenCY + radiusy)
       //get closest/nearest target to crosshair
       if (WeaponEspInfo[i].CrosshairDistance < fClosestPos)
       {
       fClosestPos = WeaponEspInfo[i].CrosshairDistance;
       BestTarget = i;
       }
       }
       //if nearest target to crosshair
       if (BestTarget != -1 && WeaponEspInfo[BestTarget].distance >
       40.0f)
       {
       double DistX = WeaponEspInfo[BestTarget].pOutX - ScreenCX;
       double DistY = WeaponEspInfo[BestTarget].pOutY - ScreenCY;
       DistX /= (0.5f + (float)aimsens*0.5f);
       DistY /= (0.5f + (float)aimsens*0.5f);
       //aim
       if (GetAsyncKeyState(Daimkey) & 0x8000)
       mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0,
       NULL);
       //autoshoot on
       if ((!GetAsyncKeyState(VK_LBUTTON) && (autoshoot == 1) &&
       (GetAsyncKeyState(Daimkey) & 0x8000))) //
       {
       if (autoshoot == 1 && !IsPressed)
       {
       IsPressed = true;
       mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
       }
       }
       }
       }
       WeaponEspInfo.clear();
       //autoshoot off
       if (autoshoot == 1 && IsPressed)
       {
       if (timeGetTime() - astime >= asdelay)
       {
       IsPressed = false;
       mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
       astime = timeGetTime();
       }
       }
       /*
       //draw logger
       if (Font && countnum != 0)
       {
       char szString[255];
       sprintf_s(szString, "countnum = %d", countnum);
       DrawString(Font, 219, 99, D3DCOLOR_ARGB(255, 0, 0, 0),
       (char*)&szString[0]);
       DrawString(Font, 221, 101, D3DCOLOR_ARGB(255, 0, 0, 0),
       (char*)&szString[0]);
       DrawString(Font, 220, 100, D3DCOLOR_ARGB(255, 255, 255, 255),
       (char*)&szString[0]);
       DrawString(Font, 220, 110, D3DCOLOR_ARGB(255, 255, 255, 255),
       "hold P to +");
       DrawString(Font, 220, 120, D3DCOLOR_ARGB(255, 255, 255, 255),
       "hold O to -");
       }
       */
       return Present_orig(pDevice, pSourceRect, pDestRect,
       hDestWindowOverride, pDirtyRegion);
       }
       //==============================================================
       ============================================================
       HRESULT APIENTRY EndScene_hook(IDirect3DDevice9* pDevice)
       {
       if (Font)
       DrawMenu(pDevice);
       return EndScene_orig(pDevice);
       }
       //==============================================================
       ============================================================
       HRESULT APIENTRY Reset_hook(IDirect3DDevice9* pDevice,
       D3DPRESENT_PARAMETERS *pPresentationParameters)
       {
       if (Font)
       Font->OnLostDevice();
       HRESULT ResetReturn = Reset_orig(pDevice,
       pPresentationParameters);
       if (SUCCEEDED(ResetReturn))
       {
       if (Font)
       Font->OnResetDevice();
       InitOnce = true;
       }
       return ResetReturn;
       }
       //==============================================================
       ============================================================
       HANDLE(WINAPI * Real_CreateFile) (
       LPCWSTR lpFileName,
       DWORD dwDesiredAccess,
       DWORD dwShareMode,
       LPSECURITY_ATTRIBUTES lpSecurityAttributes,
       DWORD dwCreationDisposition,
       DWORD dwFlagsAndAttributes,
       HANDLE hTemplateFile) = CreateFileW;
       HANDLE WINAPI Routed_CreateFile(LPCWSTR lpFileName, DWORD
       dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES
       lpSecurityAttributes, DWORD dwCreationDisposition, DWORD
       dwFlagsAndAttributes, HANDLE hTemplateFile)
       {
       char buffer[500];
       wcstombs(buffer, lpFileName, 500);
       if (strcmp(buffer + strlen(buffer) - 4, ".jpg") == 0)//find
       gm_complaint_x.jpg
       {
       if (screenshot_taken == false)
       {
       //wallhack = 0; //too late
       Log("buffer == %s", buffer);//log jpg
       screenshot_taken = true;
       }
       }
       return Real_CreateFile(lpFileName, dwDesiredAccess,
       dwShareMode, lpSecurityAttributes, dwCreationDisposition,
       dwFlagsAndAttributes, hTemplateFile);
       }
       //==============================================================
       ============================================================
       DWORD WINAPI RosD3D(__in LPVOID lpParameter)
       {
       HMODULE dDll = NULL;
       while (!dDll)
       {
       dDll = GetModuleHandleA("d3d9.dll");
       Sleep(100);
       }
       CloseHandle(dDll);
       IDirect3D9* d3d = NULL;
       IDirect3DDevice9* d3ddev = NULL;
       HWND tmpWnd = CreateWindowA("BUTTON", "RosD3D", WS_SYSMENU |
       WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, NULL,
       NULL, Hand, NULL);
       if (tmpWnd == NULL)
       {
       //Log("[DirectX] Failed to create temp window");
       return 0;
       }
       d3d = Direct3DCreate9(D3D_SDK_VERSION);
       if (d3d == NULL)
       {
       DestroyWindow(tmpWnd);
       //Log("[DirectX] Failed to create temp Direct3D interface");
       return 0;
       }
       D3DPRESENT_PARAMETERS d3dpp;
       ZeroMemory(&d3dpp, sizeof(d3dpp));
       d3dpp.Windowed = TRUE;
       d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
       d3dpp.hDeviceWindow = tmpWnd;
       d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
       HRESULT result = d3d->CreateDevice(D3DADAPTER_DEFAULT,
       D3DDEVTYPE_HAL, tmpWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
       &d3dpp, &d3ddev);
       if (result != D3D_OK)
       {
       d3d->Release();
       DestroyWindow(tmpWnd);
       //Log("[DirectX] Failed to create temp Direct3D device");
       return 0;
       }
       // We have the device, so walk the vtable to get the address of
       all the dx functions in d3d9.dll
       #if defined _M_X64
       DWORD64* dVtable = (DWORD64*)d3ddev;
       dVtable = (DWORD64*)dVtable[0];
       #elif defined _M_IX86
       DWORD* dVtable = (DWORD*)d3ddev;
       dVtable = (DWORD*)dVtable[0]; // == *d3ddev
       #endif
       //Log("[DirectX] dVtable: %x", dVtable);
       //for(int i = 0; i < 95; i++)
       //{
       //Log("[DirectX] vtable[%i]: %x, pointer at %x", i,
       dVtable[i], &dVtable[i]);
       //}
       // Detour functions x86 & x64
       if (MH_Initialize() != MH_OK) { return 1; }
       if (MH_CreateHook((DWORD_PTR*)dVtable[17], &Present_hook,
       reinterpret_cast<void**>(&Present_orig)) != MH_OK) { return 1; }
       if (MH_EnableHook((DWORD_PTR*)dVtable[17]) != MH_OK) { return
       1; }
       if (MH_CreateHook((DWORD_PTR*)dVtable[42], &EndScene_hook,
       reinterpret_cast<void**>(&EndScene_orig)) != MH_OK) { return 1;
       }
       if (MH_EnableHook((DWORD_PTR*)dVtable[42]) != MH_OK) { return
       1; }
       if (MH_CreateHook((DWORD_PTR*)dVtable[100],
       &SetStreamSource_hook,
       reinterpret_cast<void**>(&SetStreamSource_orig)) != MH_OK) {
       return 1; }
       if (MH_EnableHook((DWORD_PTR*)dVtable[100]) != MH_OK) { return
       1; }
       if (MH_CreateHook((DWORD_PTR*)dVtable[65], &SetTexture_hook,
       reinterpret_cast<void**>(&SetTexture_orig)) != MH_OK) { return
       1; }
       if (MH_EnableHook((DWORD_PTR*)dVtable[65]) != MH_OK) { return
       1; }
       if (MH_CreateHook((DWORD_PTR*)dVtable[16], &Reset_hook,
       reinterpret_cast<void**>(&Reset_orig)) != MH_OK) { return 1; }
       if (MH_EnableHook((DWORD_PTR*)dVtable[16]) != MH_OK) { return
       1; }
       HMODULE mod = LoadLibrary(TEXT("Kernel32.dll"));
       void* ptr = GetProcAddress(mod, "CreateFileW");
       MH_CreateHook(ptr, Routed_CreateFile,
       reinterpret_cast<void**>(&Real_CreateFile));
       MH_EnableHook(ptr);
       //Log("[Detours] Detours attached\n");
       d3ddev->Release();
       d3d->Release();
       DestroyWindow(tmpWnd);
       return 1;
       }
       //==============================================================
       ============================================================
       BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
       LPVOID lpReserved)
       {
       switch (ul_reason_for_call)
       {
       case DLL_PROCESS_ATTACH:
       Hand = hModule;
       DisableThreadLibraryCalls(hModule); //disable unwanted thread
       notifications to reduce overhead
       CreateThread(0, 0, RosD3D, 0, 0, 0); //init our hooks
       break;
       case DLL_PROCESS_DETACH:
       break;
       case DLL_THREAD_ATTACH:
       case DLL_THREAD_DETACH:
       break;
       }
       return TRUE;
       }[/code]
       MAIN.H
       [code]#include <windows.h>
       #include <fstream>
       #include <string>
       #include <vector>
       #include <d3d9.h>
       #pragma comment(lib, "d3d9.lib")
       #pragma comment(lib, "winmm.lib")
       //dx sdk
       #include "DXSDK\d3dx9.h"
       #if defined _M_X64
       #pragma comment(lib, "DXSDK/x64/d3dx9.lib")
       #elif defined _M_IX86
       #pragma comment(lib, "DXSDK/x86/d3dx9.lib")
       #endif
       //DX Includes
       //#include <DirectXMath.h>
       //using namespace DirectX;
       #include "MinHook/include/MinHook.h" //detour
       using namespace std;
       #pragma warning (disable: 4244) //
       //==============================================================
       ============================================================
       HMODULE Hand;
       LPDIRECT3DDEVICE9 pDevice;
       UINT Stride;
       D3DVIEWPORT9 Viewport; //use this Viewport
       float ScreenCX;
       float ScreenCY;
       LPD3DXFONT Font; //font
       IDirect3DVertexShader9* vShader;
       UINT vSize;
       bool InitOnce = true;
       LPDIRECT3DTEXTURE9 Red, Green, Blue, Yellow;
       int countnum = 0;
       //==============================================================
       ============================================================
       //features
       //visuals
       int wallhack = 1;
       int esp = 10;
       int nograss = 1;
       int nofog = 1;
       //aimbot settings
       int aimbot = 1;
       int aimkey = 2;
       DWORD Daimkey = VK_RBUTTON;
       int aimsens = 1;
       int aimfov = 3;
       int aimheight = 3;
       //autoshoot settings
       int autoshoot = 0;
       unsigned int asdelay = 49;
       looks more legit)
       bool IsPressed = false;
       DWORD astime = timeGetTime();
       bool screenshot_taken = false;
       DWORD screen_pause = timeGetTime();
       //==============================================================
       ============================================================
       // getdir & log
       char dlldir[320];
       char* GetDirFile(char *name)
       {
       static char pldir[320];
       strcpy_s(pldir, dlldir);
       strcat_s(pldir, name);
       return pldir;
       }
       void Log(const char *fmt, ...)
       {
       if (!fmt)
       char
       va_list
       va_start(ap, fmt);
       vsprintf_s(text, fmt, ap);
       va_end(ap);
       ofstream logfile(GetDirFile("log.txt"), ios::app);
       if (logfile.is_open() && text)
       logfile.close();
       }
       //==============================================================
       ============================================================
       /*
       VOID CAMERA2D::ZoomIn(FLOAT const& MouseX, FLOAT const& MouseY)
       {
       // Get the setting of the current view port.
       D3DVIEWPORT9 ViewPort;
       this->Direct3DDevice->GetViewport(&ViewPort);
       // Convert the screen coordinates of the mouse to world space
       coordinates.
       D3DXVECTOR3 VectorOne;
       D3DXVECTOR3 VectorTwo;
       D3DXVec3Unproject(&VectorOne, &D3DXVECTOR3(MouseX, MouseY,
       0.0f), &ViewPort,
       &this->ProjectionMatrix, &this->ViewMatrix, &WorldMatrix);
       D3DXVec3Unproject(&VectorTwo, &D3DXVECTOR3(MouseX, MouseY,
       1.0f), &ViewPort,
       &this->ProjectionMatrix, &this->ViewMatrix, &WorldMatrix);
       // Calculate the resulting vector components.
       float WorldZ = 0.0f;
       float WorldX = ((WorldZ - VectorOne.z) * (VectorTwo.x -
       VectorOne.x)) /
       (VectorTwo.z - VectorOne.z) + VectorOne.x;
       float WorldY = ((WorldZ - VectorOne.z) * (VectorTwo.y -
       VectorOne.y)) /
       (VectorTwo.z - VectorOne.z) + VectorOne.y;
       // Move the camera into the screen.
       this->Position.z = this->Position.z * 0.9f;
       D3DXMatrixLookAtLH(&this->ViewMatrix, &this->Position,
       &this->Target, &this->UpDirection);
       // Calculate the world space vector again based on the new view
       matrix,
       D3DXVec3Unproject(&VectorOne, &D3DXVECTOR3(MouseX, MouseY,
       0.0f), &ViewPort,
       &this->ProjectionMatrix, &this->ViewMatrix, &WorldMatrix);
       D3DXVec3Unproject(&VectorTwo, &D3DXVECTOR3(MouseX, MouseY,
       1.0f), &ViewPort,
       &this->ProjectionMatrix, &this->ViewMatrix, &WorldMatrix);
       // Calculate the resulting vector components.
       float WorldZ2 = 0.0f;
       float WorldX2 = ((WorldZ2 - VectorOne.z) * (VectorTwo.x -
       VectorOne.x)) /
       (VectorTwo.z - VectorOne.z) + VectorOne.x;
       float WorldY2 = ((WorldZ2 - VectorOne.z) * (VectorTwo.y -
       VectorOne.y)) /
       (VectorTwo.z - VectorOne.z) + VectorOne.y;
       // Create a temporary translation matrix for calculating the
       origin offset.
       D3DXMATRIX TranslationMatrix;
       D3DXMatrixIdentity(&TranslationMatrix);
       // Calculate the origin offset.
       D3DXMatrixTranslation(&TranslationMatrix, WorldX2 - WorldX,
       WorldY2 - WorldY, 0.0f);
       // At the offset to the cameras world matrix.
       this->WorldMatrix = this->WorldMatrix * TranslationMatrix;
       }
       */
       // Parameters:
       //
       //   float4 CameraPos;
       //   float4 FogInfo;
       //   float4 PointLightAttr[5];
       //   float4 ShadowLightAttr[5];
       //   row_major float4x4 texTrans0;
       //   row_major float4x4 world;
       //   row_major float4x4 wvp;
       //
       //
       // Registers:
       //
       //   Name            Reg   Size
       //   --------------- ----- ----
       //   PointLightAttr  c0       5
       //   world           c5       4
       //   ShadowLightAttr c9       4
       //   wvp             c13      4
       //   texTrans0       c17      3
       //   FogInfo         c20      1
       //   CameraPos       c21      1
       //calc distance
       float GetDistance(float Xx, float Yy, float xX, float yY)
       {
       return sqrt((yY - Yy) * (yY - Yy) + (xX - Xx) * (xX - Xx));
       }
       struct WeaponEspInfo_t
       {
       float pOutX, pOutY, distance;
       float CrosshairDistance;
       };
       std::vector<WeaponEspInfo_t>WeaponEspInfo;
       //w2s for weapons
       void AddWeapons(LPDIRECT3DDEVICE9 Device)
       {
       D3DXMATRIX matrix;
       Device->GetVertexShaderConstantF(13, matrix, 4);
       D3DXVECTOR3 pOut, pIn(0, (float)aimheight, 0);
       float distance = pIn.x * matrix._14 + pIn.y * matrix._24 +
       pIn.z * matrix._34 + matrix._44;
       D3DXVec3TransformCoord(&pOut, &pIn, &matrix);
       pOut.x = Viewport.X + (1.0f + pOut.x) *Viewport.Width / 2.0f;
       pOut.y = Viewport.Y + (1.0f - pOut.y) *Viewport.Height / 2.0f;
       WeaponEspInfo_t pWeaponEspInfo = { static_cast<float>(pOut.x),
       static_cast<float>(pOut.y), static_cast<float>(distance) };
       WeaponEspInfo.push_back(pWeaponEspInfo);
       }
       //==============================================================
       ============================================================
       IDirect3DPixelShader9* oldsShader;
       void DrawBox(IDirect3DDevice9 *pDevice, float x, float y, float
       w, float h, D3DCOLOR Color)
       {
       struct Vertex
       {
       float x, y, z, ht;
       DWORD Color;
       }
       V[4] = { { x, y + h, 0.0f, 0.0f, Color },{ x, y, 0.0f, 0.01f,
       Color },
       { x + w, y + h, 0.0f, 0.0f, Color },{ x + w, y, 0.0f, 0.0f,
       Color } };
       pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
       pDevice->GetPixelShader(&oldsShader);
       pDevice->SetTexture(0, Blue);
       pDevice->SetPixelShader(0);
       // mix texture color
       pDevice->SetTextureStageState(0, D3DTSS_COLOROP,
       D3DTOP_MODULATE);
       pDevice->SetTextureStageState(0, D3DTSS_COLORARG1,
       D3DTA_TEXTURE);
       pDevice->SetTextureStageState(0, D3DTSS_COLORARG2,
       D3DTA_DIFFUSE);
       // mix texture alpha
       pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP,
       D3DTOP_MODULATE);
       pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1,
       D3DTA_TEXTURE);
       pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2,
       D3DTA_DIFFUSE);
       //pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
       //pDevice->SetRenderState(D3DRS_DESTBLEND,
       D3DBLEND_INVSRCALPHA);
       //pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
       pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
       pDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
       pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V,
       sizeof(Vertex));
       pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
       pDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
       pDevice->SetPixelShader(oldsShader);
       }
       HRESULT DrawString(LPD3DXFONT Font, INT X, INT Y, DWORD dColor,
       CONST PCHAR cString, ...)
       {
       HRESULT hRet;
       CHAR buf[512] = { NULL };
       va_list ArgumentList;
       va_start(ArgumentList, cString);
       _vsnprintf_s(buf, sizeof(buf), sizeof(buf) - strlen(buf),
       cString, ArgumentList);
       va_end(ArgumentList);
       RECT rc[2];
       SetRect(&rc[0], X, Y, X, 0);
       SetRect(&rc[1], X, Y, X + 50, 50);
       hRet = D3D_OK;
       if (SUCCEEDED(hRet))
       {
       Font->DrawTextA(NULL, buf, -1, &rc[0], DT_NOCLIP, 0xFF000000);
       hRet = Font->DrawTextA(NULL, buf, -1, &rc[1], DT_NOCLIP,
       dColor);
       }
       return hRet;
       }
       HRESULT GenerateTexture(IDirect3DDevice9 *pDevice,
       IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
       {
       if (FAILED(pDevice->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4,
       D3DPOOL_MANAGED, ppD3Dtex, NULL)))
       return E_FAIL;
       WORD colour16 = ((WORD)((colour32 >> 28) & 0xF) << 12)
       | (WORD)(((colour32 >> 20) & 0xF) << 8)
       | (WORD)(((colour32 >> 12) & 0xF) << 4)
       | (WORD)(((colour32 >> 4) & 0xF) << 0);
       D3DLOCKED_RECT d3dlr;
       (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
       WORD *pDst16 = (WORD*)d3dlr.pBits;
       for (int xy = 0; xy < 8 * 8; xy++)
       *pDst16++ = colour16;
       (*ppD3Dtex)->UnlockRect(0);
       return S_OK;
       }
       class D3DTLVERTEX
       {
       public:
       FLOAT X, Y, X2, Y2;
       DWORD Color;
       };
       IDirect3DPixelShader9* oldlShader;
       void DrawLine(IDirect3DDevice9* pDevice, float X, float Y, float
       X2, float Y2, float Width, D3DCOLOR Color)
       {
       D3DTLVERTEX qV[2] = {
       { (float)X , (float)Y, 0.0f, 1.0f, Color },
       { (float)X2 , (float)Y2 , 0.0f, 1.0f, Color },
       };
       const DWORD D3DFVF_TL = D3DFVF_XYZRHW | D3DFVF_DIFFUSE |
       D3DFVF_TEX1;
       pDevice->SetFVF(D3DFVF_TL);
       pDevice->GetPixelShader(&oldlShader);
       //pDevice->SetTexture(0, Yellow);
       pDevice->SetTexture(0, NULL);
       pDevice->SetPixelShader(0);
       pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
       pDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
       pDevice->DrawPrimitiveUP(D3DPT_LINELIST, 2, qV,
       sizeof(D3DTLVERTEX));
       pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
       pDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
       pDevice->SetPixelShader(oldlShader);
       }
       //==============================================================
       ============================================================
       void SaveCfg()
       {
       ofstream fout;
       fout.open(GetDirFile("rosd3d.ini"), ios::trunc);
       fout << "wallhack " << wallhack << endl;
       fout << "esp " << esp << endl;
       fout << "aimbot " << aimbot << endl;
       fout << "aimkey " << aimkey << endl;
       fout << "aimsens " << aimsens << endl;
       fout << "aimfov " << aimfov << endl;
       fout << "aimheight " << aimheight << endl;
       fout << "autoshoot " << autoshoot << endl;
       fout << "nograss " << nograss << endl;
       fout << "nofog " << nofog << endl;
       fout.close();
       }
       void LoadCfg()
       {
       ifstream fin;
       string Word = "";
       fin.open(GetDirFile("rosd3d.ini"), ifstream::in);
       fin >> Word >> wallhack;
       fin >> Word >> esp;
       fin >> Word >> aimbot;
       fin >> Word >> aimkey;
       fin >> Word >> aimsens;
       fin >> Word >> aimfov;
       fin >> Word >> aimheight;
       fin >> Word >> autoshoot;
       fin >> Word >> nograss;
       fin >> Word >> nofog;
       fin.close();
       }
       //==============================================================
       ============================================================
       // menu stuff
       int menuselect = 0;
       int Current = true;
       int PosX = 30;
       int PosY = 27;
       int ShowMenu = false; //off by default
       POINT Pos;
       //LPD3DXFONT Font; //font
       int CheckTab(int x, int y, int w, int h)
       {
       if (ShowMenu)
       {
       GetCursorPos(&Pos);
       ScreenToClient(GetForegroundWindow(), &Pos);
       if (Pos.x > x && Pos.x < x + w && Pos.y > y && Pos.y < y + h)
       {
       if (GetAsyncKeyState(VK_LBUTTON) & 1)
       {
       //return 1; //disabled mouse selection in menu
       }
       return 2;
       }
       }
       return 0;
       }
       void WriteText(int x, int y, DWORD color, char *text)
       {
       RECT rect;
       SetRect(&rect, x, y, x, y);
       Font->DrawText(0, text, -1, &rect, DT_NOCLIP | DT_LEFT, color);
       }
       void lWriteText(int x, int y, DWORD color, char *text)
       {
       RECT rect;
       SetRect(&rect, x, y, x, y);
       Font->DrawText(0, text, -1, &rect, DT_NOCLIP | DT_RIGHT,
       color);
       }
       //void FillRGB(LPDIRECT3DDEVICE9 pDevice, int x, int y, int w,
       int h, D3DCOLOR color)
       //{
       //D3DRECT rec = { x, y, x + w, y + h };
       //pDevice->Clear(1, &rec, D3DCLEAR_TARGET, color, 0, 0);
       //}
       void Category(LPDIRECT3DDEVICE9 pDevice, char *text)
       {
       if (ShowMenu)
       {
       int Check = CheckTab(PosX + 44, (PosY + 51) + (Current * 15),
       190, 10);
       DWORD ColorText;
       ColorText = D3DCOLOR_ARGB(255, 255, 0, 255);
       if (Check == 2)
       ColorText = D3DCOLOR_ARGB(255, 255, 255, 255);
       if (menuselect == Current)
       ColorText = D3DCOLOR_ARGB(255, 255, 255, 255);
       WriteText(PosX + 44, PosY + 50 + (Current * 15) - 1,
       ColorText, text);
       lWriteText(PosX + 236, PosY + 50 + (Current * 15) - 1,
       ColorText, "[-]");
       Current++;
       }
       }
       void AddItem(LPDIRECT3DDEVICE9 pDevice, char *text, int &var,
       char **opt, int MaxValue)
       {
       if (ShowMenu)
       {
       int Check = CheckTab(PosX + 44, (PosY + 51) + (Current * 15),
       190, 10);
       DWORD ColorText;
       if (var)
       {
       //DrawBox(pDevice, PosX+44, PosY+51 + (Current * 15), 10, 10,
       Green);
       ColorText = D3DCOLOR_ARGB(255, 0, 255, 0);
       }
       if (var == 0)
       {
       //DrawBox(pDevice, PosX+44, PosY+51 + (Current * 15), 10, 10,
       Red);
       ColorText = D3DCOLOR_ARGB(255, 255, 0, 0);
       }
       if (Check == 1)
       {
       var++;
       if (var > MaxValue)
       var = 0;
       }
       if (Check == 2)
       ColorText = D3DCOLOR_ARGB(255, 255, 255, 255);
       if (menuselect == Current)
       {
       if (GetAsyncKeyState(VK_RIGHT) & 1)
       {
       var++;
       if (var > MaxValue)
       var = 0;
       }
       else if (GetAsyncKeyState(VK_LEFT) & 1)
       {
       var--;
       if (var < 0)
       var = MaxValue;
       }
       }
       if (menuselect == Current)
       ColorText = D3DCOLOR_ARGB(255, 255, 255, 255);
       WriteText(PosX + 44, PosY + 50 + (Current * 15) - 1,
       D3DCOLOR_ARGB(255, 50, 50, 50), text);
       WriteText(PosX + 45, PosY + 51 + (Current * 15) - 1,
       ColorText, text);
       lWriteText(PosX + 236, PosY + 50 + (Current * 15) - 1,
       D3DCOLOR_ARGB(255, 100, 100, 100), opt[var]);
       lWriteText(PosX + 237, PosY + 51 + (Current * 15) - 1,
       ColorText, opt[var]);
       Current++;
       }
       }
       //==============================================================
       ============================================================
       // menu part
       char *opt_OnOff&#91;] = { "[OFF]", "[On]" };
       char *opt_WhChams&#91;] = { "[OFF]", "[On]", "[Color]" };
       char *opt_ZeroTen&#91;] = { "[0]", "[1]", "[2]", "[3]", "[4]",
       "[5]", "[6]", "[7]", "[8]", "[9]", "[10]" };
       char *opt_Keys&#91;] = { "[OFF]", "[Shift]", "[RMouse]",
       "[LMouse]", "[Ctrl]", "[Alt]", "[Space]", "[X]", "[C]" };
       char *opt_aimfov&#91;] = { "[0]", "[5%]", "[10%]", "[15%]",
       "[20%]", "[25%]", "[30%]", "[35%]", "[40%]", "[45%]" };
       char *opt_autoshoot&#91;] = { "[OFF]", "[OnKeyDown]" };
       void DrawMenu(LPDIRECT3DDEVICE9 pDevice)
       {
       if (GetAsyncKeyState(VK_INSERT) & 1)
       {
       ShowMenu = !ShowMenu;
       //save settings
       SaveCfg();
       }
       if (ShowMenu)
       {
       if (GetAsyncKeyState(VK_UP) & 1)
       menuselect--;
       if (GetAsyncKeyState(VK_DOWN) & 1)
       menuselect++;
       Current = 1;
       AddItem(pDevice, " Wallhack", wallhack, opt_WhChams, 2);
       AddItem(pDevice, " Esp", esp, opt_ZeroTen, 10);
       AddItem(pDevice, " Aimbot", aimbot, opt_OnOff, 1);
       AddItem(pDevice, " Aimkey", aimkey, opt_Keys, 8);
       AddItem(pDevice, " Aimsens", aimsens, opt_ZeroTen, 10);
       AddItem(pDevice, " Aimfov", aimfov, opt_aimfov, 9);
       AddItem(pDevice, " Aimheight", aimheight, opt_ZeroTen, 5);
       AddItem(pDevice, " Autoshoot", autoshoot, opt_autoshoot, 1);
       AddItem(pDevice, " No Grass", nograss, opt_OnOff, 1);
       AddItem(pDevice, " No Fog", nofog, opt_OnOff, 1);
       if (menuselect >= Current)
       menuselect = 1;
       if (menuselect < 1)
       menuselect = 10;//Current;
       }
       }
       //==============================================================
       =======================================================[/code]
       #Post#: 84--------------------------------------------------
       Re: [Source Code] ROS |AIMBOT|MENU|ESP|CHAMS|LINES|NOGRASS|NOFOG
       |
       By: jmnana Date: April 7, 2018, 2:07 am
       ---------------------------------------------------------
       thank you <3
       #Post#: 85--------------------------------------------------
       Re: [Source Code] ROS |AIMBOT|MENU|ESP|CHAMS|LINES|NOGRASS|NOFOG
       |
       By: pipo1337 Date: April 7, 2018, 5:38 am
       ---------------------------------------------------------
       [quote author=jmnana link=topic=29.msg84#msg84 date=1523084872]
       thank you <3
       [/quote]
       No problem we are here to help each other
       #Post#: 688--------------------------------------------------
       Re: [Source Code] ROS |AIMBOT|MENU|ESP|CHAMS|LINES|NOGRASS|NOFOG
       |
       By: luziferk Date: June 1, 2018, 6:27 pm
       ---------------------------------------------------------
       Sorry about my stupid questions and my bad english.I'm newbie.
       I'm try to use visual basic.I want to know if Ros update.
       Where is
       OFFSET_CLIENT OFFSET_RENDERER OFFSET_VIEWMATRIX
       OFFSET_LOCALPLAYER OFFSET_PYGAME in this code or I must create
       new header for this ??
       and if new update I must to change only these or anything els ?
       Simple offset such as nofall speed I can change but I can't find
       off set client and etc in this code.
       #Post#: 703--------------------------------------------------
       Re: [Source Code] ROS |AIMBOT|MENU|ESP|CHAMS|LINES|NOGRASS|NOFOG
       |
       By: DafidS Date: June 3, 2018, 3:03 pm
       ---------------------------------------------------------
       error when i trying build by c++ 2010
       *****************************************************