Skip to content

Commit

Permalink
Support Gundam Breaker 3 Asia version
Browse files Browse the repository at this point in the history
This game's TITLE_ID is PCSH00208,
But in params.sfo & database, this game TITLE_ID set PCSG00760.
So if not match two value, we use `ux0:/data/00/savedata/{TITLE_ID}`
instead `savedata0:`

Resolve #3
  • Loading branch information
d3m3vilurr committed Sep 17, 2016
1 parent 18dec6e commit ebb279e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
21 changes: 13 additions & 8 deletions appdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ static int get_applist_callback(void *data, int argc, char **argv, char **cols)
}
list->count += 1;
strcpy(info->title_id, argv[0]);
strcpy(info->title, argv[1]);
strcpy(info->eboot, argv[2]);
strcpy(info->dev, argv[3]);
strcpy(info->real_id, argv[1]);
strcpy(info->title, argv[2]);
strcpy(info->eboot, argv[3]);
strcpy(info->dev, argv[4]);
for (int i = 0; i < 256; i++) {
if (info->title_id[i] == '\n') {
info->title_id[i] = ' ';
Expand All @@ -33,19 +34,23 @@ static int get_applist_callback(void *data, int argc, char **argv, char **cols)
}

int get_applist(applist *list) {
char *query = "select a.titleid, b.title, c.ebootbin,"
" rtrim(substr(c.ebootbin, 0, 5), ':') as dev"
char *query = "select a.titleid, b.realid, c.title, d.ebootbin,"
" rtrim(substr(d.ebootbin, 0, 5), ':') as dev"
" from (select titleid"
" from tbl_appinfo"
" where key = 566916785"
" and titleid like 'PCS%'"
" order by titleid) a,"
" tbl_appinfo_icon b,"
" (select titleid, val as realid"
" from tbl_appinfo"
" where key = 278217076) b,"
" tbl_appinfo_icon c,"
" (select titleid, val as ebootbin"
" from tbl_appinfo"
" where key = 3022202214) c"
" where key = 3022202214) d"
" where a.titleid = b.titleid"
" and a.titleid = c.titleid";
" and a.titleid = c.titleid"
" and a.titleid = d.titleid";

sqlite3 *db;
int ret = sqlite3_open(APP_DB, &db);
Expand Down
1 change: 1 addition & 0 deletions appdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

typedef struct appinfo {
char title_id[16];
char real_id[16];
char title[256];
char eboot[256];
char dev[5];
Expand Down
42 changes: 33 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,20 @@ int launch(const char *titleid) {
return 0;
}

int cleanupPrevInject(applist *list) {
int fetch_realid_from_temp(char *buf) {
int fd = sceIoOpen(TEMP_FILE, SCE_O_RDONLY, 0777);
if (fd <= 0) {
return -1;
}

sceIoLseek(fd, 16, SCE_SEEK_SET);
sceIoRead(fd, buf, 16);
sceIoClose(fd);

return 0;
}

int cleanup_prev_inject(applist *list) {
int fd = sceIoOpen(TEMP_FILE, SCE_O_RDONLY, 0777);
if (fd <= 0) {
return 0;
Expand Down Expand Up @@ -245,7 +258,7 @@ int injector_main() {

int state = INJECTOR_MAIN;

cleanupPrevInject(&list);
cleanup_prev_inject(&list);

while (1) {
vita2d_start_drawing();
Expand Down Expand Up @@ -352,6 +365,7 @@ int injector_main() {
// backup for next cleanup
int fd = sceIoOpen(TEMP_FILE, SCE_O_WRONLY | SCE_O_CREAT,0777);
sceIoWrite(fd, curr->title_id, 16);
sceIoWrite(fd, curr->real_id, 16);
sceIoClose(fd);

drawText(8, "DO NOT CLOSE APPLICATION MANUALLY", red);
Expand Down Expand Up @@ -380,16 +394,26 @@ int injector_main() {
int dumper_main() {
int state = DUMPER_MAIN;

char titleid[16], title[256];
char titleid[16], realid[16], title[256];
sceAppMgrAppParamGetString(0, 9, title , 256);
sceAppMgrAppParamGetString(0, 12, titleid , 256);

sceIoMkdir("ux0:/data/rinCheat", 0777);
sceIoMkdir("ux0:/data/savemgr", 0777);

if (fetch_realid_from_temp(realid) < 0) {
strcpy(realid, titleid);
}

char buf[256];
char path[256];
sprintf(path,"ux0:/data/rinCheat/%s_SAVEDATA", titleid);
char from[256];
char to[256];
if (strcmp(titleid, realid) == 0) {
sprintf(from, "savedata0:");
} else {
sprintf(from, "ux0:/user/00/savedata/%s", realid);
}
sprintf(to, "ux0:/data/rinCheat/%s_SAVEDATA", titleid);

while (1) {
vita2d_start_drawing();
Expand All @@ -414,9 +438,9 @@ int dumper_main() {
drawText(0, "Vita Save Dumper 0.3", white);
drawText(2, "DO NOT CLOSE APPLICATION MANUALLY", red);

snprintf(buf, 256, "export to %s ...", path);
snprintf(buf, 256, "export to %s ...", to);
drawText(4, buf, white);
dumpSavedataDir("savedata0:", path);
dumpSavedataDir(from, to);
drawText(5, "done", white);

drawText(7, "please press circle", green);
Expand All @@ -427,9 +451,9 @@ int dumper_main() {
drawText(0, "Vita Save Dumper 0.3", white);
drawText(2, "DO NOT CLOSE APPLICATION MANUALLY", red);

snprintf(buf, 256, "import from %s ...", path);
snprintf(buf, 256, "import to %s ...", from);
drawText(4, buf, white);
restoreSavedataDir(path, NULL);
restoreSavedataDir(to, from);
drawText(5, "done", white);

drawText(7, "please press circle", green);
Expand Down

0 comments on commit ebb279e

Please sign in to comment.