Skip to content

Instantly share code, notes, and snippets.

@barisusakli
Created August 11, 2016 23:18
Show Gist options
  • Save barisusakli/c6d03000f1892cf81d66298738397deb to your computer and use it in GitHub Desktop.
Save barisusakli/c6d03000f1892cf81d66298738397deb to your computer and use it in GitHub Desktop.
Hidden and Dangerous save game hack
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void doTheHack()
{
FILE *pFile;
FILE *pOut;
char *buffer;
long fileSize;
pFile = fopen("CAM_quick.sav","rb");
if(!pFile)
return;
pOut = fopen("CAM_quick_hacked.sav","wb");
if(!pOut)
return;
fseek(pFile,0,SEEK_END);
fileSize = ftell(pFile);
fseek(pFile,0,SEEK_SET);
buffer = new char[17610];
int hack = 0;
fread(buffer,sizeof(char),17610,pFile);
fwrite(buffer,sizeof(char),17610,pOut);
fwrite(&hack,sizeof(int),1,pOut);
delete []buffer;
long lastPart = fileSize-17610-4;
buffer = new char[lastPart];
fseek(pFile,4,SEEK_CUR);
fread(buffer,sizeof(char),lastPart,pFile);
fwrite(buffer,sizeof(char),lastPart,pOut);
delete []buffer;
//17610
fclose(pFile);
fclose(pOut);
}
void readTheHack()
{
FILE *pFile;
int hack = -1;
pFile = fopen("CAM_quick_hacked.sav","rb");
if(pFile)
return;
fseek(pFile,17610,SEEK_SET);
fread(&hack,sizeof(int),1,pFile);
fclose(pFile);
}
void main()
{
doTheHack();
//readTheHack();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment