Skip to content

Commit

Permalink
Fix 'common' save backup/restore for 'this user'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryuzaki-MrL committed Apr 9, 2017
1 parent 135cd56 commit 3a2b432
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/savemng.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,15 @@ void backupSavedata(Title* title, u8 slot, bool allusers, bool common) {
if (!allusers && !isWii) {
char usrPath[16];
getUserID(usrPath);
sprintf(dstPath + strlen(dstPath), "/%s", usrPath);
u32 offset = strlen(srcPath);
u32 srcOffset = strlen(srcPath);
u32 dstOffset = strlen(dstPath);
if (common) {
strcpy(srcPath + offset, "/common");
strcpy(srcPath + srcOffset, "/common");
strcpy(dstPath + dstOffset, "/common");
if (DumpDir(srcPath, dstPath)!=0) promptError("Common save not found.");
}
sprintf(srcPath + offset, "/%s", usrPath);
sprintf(srcPath + srcOffset, "/%s", usrPath);
sprintf(dstPath + dstOffset, "/%s", usrPath);
}
if (DumpDir(srcPath, dstPath)!=0) promptError("Backup failed. DO NOT restore from this slot.");

Expand All @@ -366,13 +368,15 @@ void restoreSavedata(Title* title, u8 slot, bool allusers, bool common) {
if (!allusers && !isWii) {
char usrPath[16];
getUserID(usrPath);
sprintf(dstPath + strlen(dstPath), "/%s", usrPath);
u32 offset = strlen(srcPath);
u32 srcOffset = strlen(srcPath);
u32 dstOffset = strlen(dstPath);
if (common) {
strcpy(srcPath + offset, "/common");
strcpy(srcPath + srcOffset, "/common");
strcpy(dstPath + dstOffset, "/common");
if (DumpDir(srcPath, dstPath)!=0) promptError("Common save not found.");
}
sprintf(srcPath + offset, "/%s", usrPath);
sprintf(srcPath + srcOffset, "/%s", usrPath);
sprintf(dstPath + dstOffset, "/%s", usrPath);
}
if (DumpDir(srcPath, dstPath)!=0) promptError("Restore failed.");

Expand Down

0 comments on commit 3a2b432

Please sign in to comment.