Skip to content

Instantly share code, notes, and snippets.

@tarmolehtpuu
Created March 22, 2011 23:43
Show Gist options
  • Save tarmolehtpuu/882346 to your computer and use it in GitHub Desktop.
Save tarmolehtpuu/882346 to your computer and use it in GitHub Desktop.
Plants Vs Zombies: Add 655k gold
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#define PVSZ_HOME "Library/Application Support/PopCap/PlantsVsZombiesMac/userdata"
char pvsz_home[999];
void add_moneyz(char *file)
{
FILE *fp;
fp = fopen(file, "rb+");
fseek(fp, 8, SEEK_SET);
fputc(0xFF, fp);
fseek(fp, 9, SEEK_SET);
fputc(0xFF, fp);
fclose(fp);
printf("[OK]: %s\n", file);
}
int main(void)
{
strcat(pvsz_home, getenv("HOME"));
strcat(pvsz_home, "/");
strcat(pvsz_home, PVSZ_HOME);
DIR *dir;
struct dirent *entry;
dir = opendir(pvsz_home);
if (dir != NULL) {
while((entry = readdir(dir)) != NULL){
if(strcmp(entry->d_name, "users.dat") == 0){
continue;
}
if(strstr(entry->d_name, "user") != NULL){
char pvsz_file[999];
memset(pvsz_file, '\0', 999);
strcat(pvsz_file, pvsz_home);
strcat(pvsz_file, "/");
strcat(pvsz_file, entry->d_name);
add_moneyz(pvsz_file);
}
}
closedir(dir);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment