Facebook
From FAT, 3 Years ago, written in C++.
This paste is a reply to c++ from Cygan - view diff
Embed
Download Paste or View Raw
Hits: 214
  1.  
  2.  
  3. #include <iostream>
  4. #include <windows.h>
  5. #include <TlHelp32.h>
  6.  
  7.  
  8. DWORD GetProcId(const wchar_t* procName)
  9. {
  10.     DWORD procId = 0;
  11.     HANDLE hproc = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  12.  
  13.     if (hproc != INVALID_HANDLE_VALUE)
  14.     {
  15.         PROCESSENTRY32 procEntry;
  16.         procEntry.dwSize = sizeof(procEntry);
  17.  
  18.         if (Process32First(hproc, &procEntry))
  19.         {
  20.             do
  21.             {
  22.                 if (!_wcsicmp(procEntry.szExeFile, procName))
  23.                 {
  24.                     procId = procEntry.th32ProcessID;
  25.                     break;
  26.                 }
  27.             } while (Process32Next(hproc, &procEntry));
  28.         }
  29.     }
  30.     CloseHandle(hproc);
  31.     return procId;
  32. }
  33.  
  34. uintptr_t GetModuleBaseAddress(DWORD procId, const wchar_t* modName)
  35. {
  36.     uintptr_t modBaseAddr = 0;
  37.     HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procId);
  38.     if (hSnap != INVALID_HANDLE_VALUE)
  39.     {
  40.         MODULEENTRY32 modEntry;
  41.         modEntry.dwSize = sizeof(modEntry);
  42.         if (Module32First(hSnap, &modEntry))
  43.         {
  44.             do
  45.             {
  46.                 if (!_wcsicmp(modEntry.szModule, modName))
  47.                 {
  48.                     modBaseAddr = (uintptr_t)modEntry.modBaseAddr;
  49.                     break;
  50.                 }
  51.             } while (Module32Next(hSnap, &modEntry));
  52.         }
  53.     }
  54.     CloseHandle(hSnap);
  55.     return modBaseAddr;
  56. }
  57.  
  58.  
  59. //Function that writes memory
  60. void WriteMem(char* dst, char* src, int size)
  61. {
  62.     HANDLE hSnap = OpenProcess(PROCESS_ALL_ACCESS, NULL, GetProcId(L"PRBF2.exe"));
  63.     DWORD oldprotect;
  64.     VirtualProtectEx(hSnap, dst, size, PAGE_EXECUTE_READWRITE, &oldprotect);
  65.     WriteProcessMemory(hSnap, dst, src, size, NULL);
  66.     VirtualProtectEx(hSnap, dst, size, oldprotect, &oldprotect);
  67. }
  68.  
  69.  
  70. /*
  71.  
  72.                           CHEATS START HERE!
  73.  
  74. */
  75.  
  76. //===============================================================================================MAPHACK===============================================================================================
  77. void MapHackOn(uintptr_t PRBF2Base) {
  78.  
  79.     WriteMem((char*)(PRBF2Base + 0x3786D7), (char*)"\x39\xDB", 2); //mm1
  80.     WriteMem((char*)(PRBF2Base + 0x3786FD), (char*)"\x39\xF6", 2); //mm2
  81.     //PatchEx((char*)(PRBF2Base + 0x378723), (char*)"\x39\xDB", 2); //mm3
  82.     WriteMem((char*)(PRBF2Base + 0x3787B3), (char*)"\x39\xDB", 2); //mm4
  83.     WriteMem((char*)(PRBF2Base + 0x3787D9), (char*)"\x39\xF6", 2); //mm5
  84.     //PatchEx((char*)(PRBF2Base + 0x3787FC), (char*)"\x39\xDB", 2); //mm6
  85.     WriteMem((char*)(PRBF2Base + 0x378816), (char*)"\x85\xD8", 2); //mm7
  86.     WriteMem((char*)(PRBF2Base + 0x3836F7), (char*)"\x39\xDB", 2); //mm8
  87. }
  88.  
  89. void MapHackOff(uintptr_t PRBF2Base) {
  90.  
  91.     WriteMem((char*)(PRBF2Base + 0x3786D7), (char*)"\x3B\xDF", 2); //mm1
  92.     WriteMem((char*)(PRBF2Base + 0x3786FD), (char*)"\x3B\xF0", 2); //mm2
  93.     //PatchEx((char*)(PRBF2Base + 0x378723), (char*)"\x39\xDB", 2); //mm3
  94.     WriteMem((char*)(PRBF2Base + 0x3787B3), (char*)"\x3B\xDF", 2); //mm4
  95.     WriteMem((char*)(PRBF2Base + 0x3787D9), (char*)"\x3B\xF0", 2); //mm5
  96.     //PatchEx((char*)(PRBF2Base + 0x3787FC), (char*)"\x39\xDB", 2); //mm6
  97.     WriteMem((char*)(PRBF2Base + 0x378816), (char*)"\x85\xC0", 2); //mm7
  98.     WriteMem((char*)(PRBF2Base + 0x3836F7), (char*)"\x3B\xC3", 2); //mm8
  99. }
  100.  
  101.  
  102.  
  103.  
  104. //===============================================================================================RENDDX9DLL===============================================================================================
  105.  
  106.  
  107. //UNDERGROWTH
  108. void UndergrowthOff(uintptr_t RendDX9Base)
  109. {
  110.     WriteMem((char*)(RendDX9Base + 0x30C80), (char*)"\x01", 1);
  111.     WriteMem((char*)(RendDX9Base + 0x306B1), (char*)"\x01", 1);
  112. }
  113.  
  114. void UndergrowthOn(uintptr_t RendDX9Base)
  115. {
  116.     WriteMem((char*)(RendDX9Base + 0x30C80), (char*)"\x00", 1);
  117.     WriteMem((char*)(RendDX9Base + 0x306B1), (char*)"\x00", 1);
  118. }
  119.  
  120.  
  121.  
  122.  
  123. //POSTPRODUCTION - Replaced by Shellshock and TV Interference
  124. void PostProductionOff(uintptr_t RendDX9Base)
  125. {
  126.     WriteMem((char*)(RendDX9Base + 0x30731), (char*)"\x01", 1);
  127.     WriteMem((char*)(RendDX9Base + 0x30F09), (char*)"\x01", 1);
  128.     WriteMem((char*)(RendDX9Base + 0x3104F), (char*)"\x01", 1);
  129. }
  130.  
  131. void PostProductionOn(uintptr_t RendDX9Base)
  132. {
  133.     WriteMem((char*)(RendDX9Base + 0x30731), (char*)"\x00", 1);
  134.     WriteMem((char*)(RendDX9Base + 0x30F09), (char*)"\x00", 1);
  135.     WriteMem((char*)(RendDX9Base + 0x3104F), (char*)"\x00", 1);
  136. }
  137.  
  138.  
  139.  
  140.  
  141. //SUNFLARE
  142. void SunFlareOff(uintptr_t RendDX9Base)
  143. {
  144.     WriteMem((char*)(RendDX9Base + 0x30D58), (char*)"\x01", 1);
  145.     WriteMem((char*)(RendDX9Base + 0x30EF0), (char*)"\x01", 1);
  146.     WriteMem((char*)(RendDX9Base + 0x3113A), (char*)"\x01", 1);
  147. }
  148.  
  149. void SunFlareOn(uintptr_t RendDX9Base)
  150. {
  151.     WriteMem((char*)(RendDX9Base + 0x30D58), (char*)"\x00", 1);
  152.     WriteMem((char*)(RendDX9Base + 0x30EF0), (char*)"\x00", 1);
  153.     WriteMem((char*)(RendDX9Base + 0x3113A), (char*)"\x00", 1);
  154. }
  155.  
  156.  
  157.  
  158. //PARTICLES
  159. void DrawParticlesOff(uintptr_t RendDX9Base)
  160. {
  161.     WriteMem((char*)(RendDX9Base + 0x30679), (char*)"\x01", 1);
  162.     WriteMem((char*)(RendDX9Base + 0x3069A), (char*)"\x01", 1);
  163.     WriteMem((char*)(RendDX9Base + 0x306E4), (char*)"\x01", 1);
  164.     WriteMem((char*)(RendDX9Base + 0x307BB), (char*)"\x01", 1);
  165.     WriteMem((char*)(RendDX9Base + 0x30E02), (char*)"\x01", 1);
  166.     WriteMem((char*)(RendDX9Base + 0x30E8F), (char*)"\x01", 1);
  167.     WriteMem((char*)(RendDX9Base + 0x30EC1), (char*)"\x01", 1);
  168.     WriteMem((char*)(RendDX9Base + 0x30ED9), (char*)"\x01", 1);
  169.     //WriteMem((char*)(RendDX9Base + 0x30FA1), (char*)"\x01", 1); //This acuses crashes
  170.     WriteMem((char*)(RendDX9Base + 0x31463), (char*)"\x01", 1);
  171. }
  172.  
  173. void DrawParticlesOn(uintptr_t RendDX9Base)
  174. {
  175.     WriteMem((char*)(RendDX9Base + 0x30679), (char*)"\x00", 1);
  176.     WriteMem((char*)(RendDX9Base + 0x3069A), (char*)"\x00", 1);
  177.     WriteMem((char*)(RendDX9Base + 0x306E4), (char*)"\x00", 1);
  178.     WriteMem((char*)(RendDX9Base + 0x307BB), (char*)"\x00", 1);
  179.     WriteMem((char*)(RendDX9Base + 0x30E02), (char*)"\x00", 1);
  180.     WriteMem((char*)(RendDX9Base + 0x30E8F), (char*)"\x00", 1);
  181.     WriteMem((char*)(RendDX9Base + 0x30EC1), (char*)"\x00", 1);
  182.     WriteMem((char*)(RendDX9Base + 0x30ED9), (char*)"\x00", 1);
  183.     //WriteMem((char*)(RendDX9Base + 0x30FA1), (char*)"\x00", 1); //This acuses crashes
  184.     WriteMem((char*)(RendDX9Base + 0x31463), (char*)"\x00", 1);
  185. }
  186.  
  187.  
  188.  
  189. //SHELLSHOCK
  190. void ShellShockOff(uintptr_t RendDX9Base) {
  191.  
  192.     WriteMem((char*)(RendDX9Base + 0x4F918), (char*)"\x00", 1);
  193. }
  194.  
  195. void ShellShockOn(uintptr_t RendDX9Base) {
  196.  
  197.     WriteMem((char*)(RendDX9Base + 0x4F918), (char*)"\x0D", 1);
  198. }
  199.  
  200.  
  201.  
  202.  
  203. //TV INTERFERENCE
  204. void TVInterferenceOff(uintptr_t RendDX9Base) {
  205.  
  206.     WriteMem((char*)(RendDX9Base + 0x583AA), (char*)"\x90\x90", 2);
  207. }
  208.  
  209. void TVInterferenceOn(uintptr_t RendDX9Base) {
  210.  
  211.     WriteMem((char*)(RendDX9Base + 0x583AA), (char*)"\x8B\x11", 2);
  212. }
  213.  
  214.  
  215.  
  216. //FOG1 - REMOVE
  217. void FOG1Off(uintptr_t RendDX9Base) {
  218.  
  219.     WriteMem((char*)(RendDX9Base + 0x50710), (char*)"\xD9\x45\x06", 3); //last byte to 06
  220. }
  221.  
  222. void FOG1On(uintptr_t RendDX9Base) {
  223.  
  224.     WriteMem((char*)(RendDX9Base + 0x50710), (char*)"\xD9\x45\x08", 3);
  225. }
  226.  
  227.  
  228. //FOG2 - REMOVE
  229. void FOG2Off(uintptr_t RendDX9Base) {
  230.  
  231.     WriteMem((char*)(RendDX9Base + 0x50727), (char*)"\xD9\x45\x06", 3); //last byte to 06
  232. }
  233.  
  234. void FOG2On(uintptr_t RendDX9Base) {
  235.  
  236.     WriteMem((char*)(RendDX9Base + 0x50727), (char*)"\xD9\x45\x08", 3);
  237. }
  238.  
  239.  
  240.  
  241.  
  242. //==========================================================================================INSTRUCTIONS====================================================================================================
  243. void InstructionCout()
  244. {
  245.  
  246.     std::cout << R"(
  247.        
  248.       _       ____  _____   ______  _____  ________  ____  _____  _________                            
  249.      / \     |_   \|_   _|.' ___  ||_   _||_   __  ||_   \|_   _||  _   _  |                          
  250.     / _ \      |   \ | | / .'   \_|  | |    | |_ \_|  |   \ | |  |_/ | | \_|                          
  251.    / ___ \     | |\ \| | | |         | |    |  _| _   | |\ \| |      | |                              
  252.  _/ /   \ \_  _| |_\   |_\ `.___.'\ _| |_  _| |__/ | _| |_\   |_    _| |_                              
  253. |____| |____||_____|\____|`.____ .'|_____||________||_____|\____|  |_____|                            
  254.   ______   _____  _____  ____   ____  ________  _______     ______        _        ______  ___  ____  
  255. .' ____ \ |_   _||_   _||_  _| |_  _||_   __  ||_   __ \   |_   _ \      / \     .' ___  ||_  ||_  _|  
  256. | (___ \_|  | |    | |    \ \   / /    | |_ \_|  | |__) |    | |_) |    / _ \   / .'   \_|  | |_/ /    
  257.  _.____`.   | |    | |   _ \ \ / /     |  _| _   |  __ /     |  __'.   / ___ \  | |         |  __'.    
  258. | \____) | _| |_  _| |__/ | \ ' /     _| |__/ | _| |  \ \_  _| |__) |_/ /   \ \_\ `.___.'\ _| |  \ \_  
  259.  \______.'|_____||________|  \_/     |________||____| |___||_______/|____| |____|`.____ .'|____||____|
  260.                                                                                                        
  261.  
  262.         )";
  263.  
  264.  
  265.     std::cout << R"(
  266.   ___ _  _ ___ _____ ___ _   _  ___ _____ ___ ___  _  _ ___
  267.  |_ _| \| / __|_   _| _ \ | | |/ __|_   _|_ _/ _ \| \| / __|
  268.   | || .` \__ \ | | |   / |_| | (__  | |  | | (_) | .` \__ \
  269.  |___|_|\_|___/ |_| |_|_\\___/ \___| |_| |___\___/|_|\_|___/
  270.                                                            
  271.         )";
  272.  
  273.     std::cout << "\n";
  274.     std::cout << "Pess F9 to toggle Maphack" << std::endl;
  275.     std::cout << "Pess F10 to toggle RendDX9 Tweaks" << std::endl;
  276.     std::cout << "Pess F11 to toggle RendDX9 Tweaks - Particles" << std::endl;
  277.     std::cout << "Pess F12 to toggle FOG1" << std::endl;
  278.     std::cout << "Pess DELETE to toggle FOG2" << std::endl;
  279. }
  280.  
  281.  
  282. //=========================================================================================================MAIN=========================================================================================================
  283. int main()
  284. {
  285.     DWORD PrProcID = GetProcId(L"PRBF2.exe");
  286.     uintptr_t RendDX9BaseAddr = GetModuleBaseAddress(PrProcID, L"RendDX9.dll");
  287.     uintptr_t PRBF2BaseAddr = GetModuleBaseAddress(PrProcID, L"PRBF2.exe");
  288.     bool B_MapHackOn = false;
  289.     bool B_RendDX9TweaksOn = false;
  290.     bool B_NoFogOn = false;
  291.     bool B_RendDX9TweaksOnParticles = false;
  292.  
  293.  
  294.     if (PrProcID == 0)
  295.     {
  296.    
  297.         std::cout << "PR is not open! You need to open it first and then run the program fat.";
  298.    
  299.     }
  300.     else
  301.     {
  302.         std::cout << "PRBF2 Proccess ID: " << PrProcID << std::endl;
  303.     }
  304.  
  305.     InstructionCout();
  306.  
  307.  
  308.     while (true)
  309.     {
  310.  
  311.  
  312.         //Maphack
  313.         if (GetAsyncKeyState(VK_F9) & 1)
  314.         {
  315.             B_MapHackOn = !B_MapHackOn;
  316.             MapHackOff(PRBF2BaseAddr);
  317.         }
  318.  
  319.         if (B_MapHackOn)
  320.         {
  321.             MapHackOn(PRBF2BaseAddr);
  322.         }
  323.  
  324.  
  325.  
  326.         //RendDX9Tweaks
  327.         if (GetAsyncKeyState(VK_F10) & 1)
  328.         {
  329.             B_RendDX9TweaksOn = !B_RendDX9TweaksOn;
  330.             UndergrowthOn(RendDX9BaseAddr);
  331.             ShellShockOn(RendDX9BaseAddr);
  332.             TVInterferenceOn(RendDX9BaseAddr);
  333.         }
  334.  
  335.         if (B_RendDX9TweaksOn)
  336.         {
  337.             UndergrowthOff(RendDX9BaseAddr);
  338.             ShellShockOff(RendDX9BaseAddr);
  339.             TVInterferenceOff(RendDX9BaseAddr);
  340.         }
  341.  
  342.  
  343.  
  344.         //RendDX9Tweaks - Particles
  345.         if (GetAsyncKeyState(VK_F11) & 1)
  346.         {
  347.             B_RendDX9TweaksOnParticles = !B_RendDX9TweaksOnParticles;
  348.             DrawParticlesOn(RendDX9BaseAddr);
  349.         }
  350.  
  351.         if (B_RendDX9TweaksOnParticles)
  352.         {
  353.             DrawParticlesOff(RendDX9BaseAddr);
  354.         }
  355.  
  356.  
  357.  
  358.         //FOG1 - REMOVE
  359.         if (GetAsyncKeyState(VK_F12) & 1)
  360.         {
  361.             B_NoFogOn = !B_NoFogOn;
  362.             FOG1On(RendDX9BaseAddr);
  363.         }
  364.  
  365.         if (B_NoFogOn)
  366.         {
  367.             FOG1Off(RendDX9BaseAddr);
  368.         }
  369.  
  370.  
  371.         //FOG2 - REMOVE
  372.         if (GetAsyncKeyState(VK_DELETE) & 1)
  373.         {
  374.             B_NoFogOn = !B_NoFogOn;
  375.             FOG2On(RendDX9BaseAddr);
  376.         }
  377.  
  378.         if (B_NoFogOn)
  379.         {
  380.             FOG2Off(RendDX9BaseAddr);
  381.         }
  382.  
  383.     }
  384.         Sleep(5);
  385.  
  386.     return 0;
  387. }