Skip to content

Commit

Permalink
Optimization and bug fix
Browse files Browse the repository at this point in the history
Code simplification. Change pPlayer variable type from DWORD to size_t.
  • Loading branch information
danielkrupinski committed Dec 17, 2017
1 parent 2fe8465 commit 89a36a6
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions curiumcheat-cuphead.cpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
HANDLE handle = NULL;

while (handle == NULL)
{
printf("Searching for game process");
Sleep(900);
printf(".");
Sleep(900);
printf(".");
Sleep(900);
printf(".");
Sleep(900);
HWND hwnd = FindWindowA(0, ("Cuphead"));
DWORD processID;
GetWindowThreadProcessId(hwnd, &processID);
handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID);
system("cls");
Sleep(1);
}

system("cls");
printf("Process found!");

DWORD pPlayer = 0;
BYTE invictible = 1;
BYTE invincibility = 1;
size_t pPlayer = 0;

for (;;)
{
ReadProcessMemory(handle, (LPVOID)(0x1020A13C), &pPlayer, sizeof(pPlayer), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x740), &pPlayer, sizeof(pPlayer), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x34), &pPlayer, sizeof(pPlayer), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x8), &pPlayer, sizeof(pPlayer), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x18), &pPlayer, sizeof(pPlayer), 0);
WriteProcessMemory(handle, (LPVOID)(pPlayer + 0x6C), &invictible, sizeof(invictible), 0);
Sleep(5000);
ReadProcessMemory(handle, (LPVOID)(0x1020A13C), &pPlayer, sizeof(int), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x740), &pPlayer, sizeof(int), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x34), &pPlayer, sizeof(int), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x8), &pPlayer, sizeof(int), 0);
ReadProcessMemory(handle, (LPVOID)(pPlayer + 0x18), &pPlayer, sizeof(int), 0);
WriteProcessMemory(handle, (LPVOID)(pPlayer + 0x6C), &invincibility, sizeof(invincibility), 0);
Sleep(1);
}
return 0;
}

0 comments on commit 89a36a6

Please sign in to comment.