Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <string>
- #include <ctime>
- #define F6_KEY 0x75
- using namespace std;
- string GameName = "Cube";
- LPCSTR LGameWindow = "Cube";
- string GameStatus = "";
- HWND hGameWindow = NULL;
- HANDLE hProcHandle = NULL;
- DWORD dwPRocID = NULL;
- bool GameFound = false;
- bool Running = false;
- bool UpdateConsole;
- //Ammo Variables
- DWORD BaseAddr = 0x0036B1C8;
- int XPNum = 0;
- bool XPPressed;
- DWORD XPOffs[] = {0x39C,0x194};
- BYTE ONEHUNDERED[] = {0x4,0x6,0x0,0x0};
- int LVLSAdded;
- bool LVLPressed;
- DWORD LVLOffs[] = {0x39C,0x190};
- BYTE ONE[] = {0x1,0x0,0x0,0x0};
- bool Godmode;
- DWORD HPOffs[] = {0x16C, 0x39C};
- BYTE LEET[] = {0x39,0x5,0x0,0x0};
- DWORD FindDMAAddr(int PtrLvl, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress) //could be (int PtrLvl, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress) but baseaddr is same for all and global
- {
- DWORD ptr = BaseAddress;
- DWORD pTemp;
- DWORD ptrAddr;
- for(int i = 0; i < PtrLvl; i++)
- {
- if(i==0)
- { //v 4
- ReadProcessMemory(hProcHandle,(LPCVOID)ptr,&pTemp,sizeof(DWORD),NULL);
- }
- ptrAddr = pTemp + Offsets[i];
- ReadProcessMemory(hProcHandle,(LPCVOID)ptrAddr,&pTemp,sizeof(DWORD),NULL);
- }
- return ptrAddr;
- }
- void WriteToMemory(HANDLE hProcHandle)
- {
- if(XPPressed)
- {
- DWORD AddrToWrite = FindDMAAddr(2, hProcHandle, XPOffs, BaseAddr);
- int curXP=0;
- ReadProcessMemory(hProcHandle,(BYTE*)AddrToWrite,&curXP,sizeof(int),0);
- curXP += 100;
- WriteProcessMemory(hProcHandle,(BYTE*)AddrToWrite, &ONEHUNDERED, sizeof(ONEHUNDERED),0);
- XPNum++;
- XPPressed = false;
- }
- if(LVLSAdded)
- {
- }
- if(Godmode)
- {
- }
- }
- int main()
- {
- SetConsoleTitle("Foxxy's Cubeworld Trainer");
- int timesinceupdate = clock();
- int GameAvailTMR = clock();
- int PressTMR = clock();
- UpdateConsole = true;
- while(!GetAsyncKeyState(F6_KEY))
- {
- if(clock() - GameAvailTMR > 100)
- {
- GameAvailTMR = clock();
- GameFound = false;
- HWND hGameWindow = FindWindow(NULL, LGameWindow);
- if(hGameWindow)
- {
- GetWindowThreadProcessId(hGameWindow, &dwPRocID);
- if(dwPRocID != 0)
- {
- hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, false, dwPRocID);
- if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
- {
- GameStatus = "Failed to open process for valid handle";
- }
- else
- {
- GameStatus = "Found CubeWorld";
- GameFound = true;
- }
- }
- else
- {
- GameStatus = "Failed to get process ID";
- }
- }
- else
- {
- GameStatus = "Cubeworld not found";
- }
- if(UpdateConsole || clock() - timesinceupdate > 5000)
- {
- system("cls");
- cout << "Foxxy's Cubeworld Trainer, some credit to Fleep's Hacking Tutorials"<<endl;
- std::cout << "Status: " << GameStatus <<endl<<endl;
- cout << "[Numpad 1] Godmode: "<<endl;
- cout << "[Numpad 2] Infinite MP: NYI" <<endl;
- cout << "[Numpad 3] +1 Level: "<<LVLSAdded<<endl;
- cout << "[Numpad +] +100 XP: "<< XPNum*100<<endl;
- cout << "[F6] Exit"<<endl;;
- UpdateConsole = false;
- timesinceupdate = clock();
- }
- if(GameFound)
- {
- WriteToMemory(hProcHandle);
- }
- }
- if(clock() - PressTMR > 250)
- {
- if(GameFound)
- {
- if(GetAsyncKeyState(VK_NUMPAD1))
- {
- PressTMR = clock();
- UpdateConsole = true;
- Godmode = !Godmode;
- }
- if(GetAsyncKeyState(VK_NUMPAD2))
- {
- PressTMR = clock();
- UpdateConsole = true;
- cout << "NYI"<<endl;
- }
- if(GetAsyncKeyState(VK_NUMPAD3))
- {
- PressTMR = clock();
- UpdateConsole = true;
- LVLPressed = true;
- }
- if(GetAsyncKeyState(VK_NUMPAD4))
- {
- PressTMR = clock();
- UpdateConsole = true;
- XPPressed = true;
- }
- }
- }
- }
- CloseHandle(hProcHandle);
- CloseHandle(hGameWindow);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement