From 641ef74d28f7b3e239a6f67f79f570f5390c62ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1zaro=20Vieira?= Date: Wed, 19 Apr 2017 05:10:49 -0300 Subject: [PATCH] Minor stuff --- src/savemng.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/savemng.c b/src/savemng.c index fcb5bb9..f2bc663 100644 --- a/src/savemng.c +++ b/src/savemng.c @@ -2,7 +2,7 @@ #define BUFFER_SIZE 0x80000 -void console_print_pos(int x, int y, const char* format, ...) { +void console_print_pos(int x, int y, const char* format, ...) { // Source: ftpiiu char* tmp = NULL; @@ -55,8 +55,7 @@ void promptError(const char* message) { } } -// Source: ft2sd -int DumpFile(char* pPath, const char* output_path) { +int DumpFile(char* pPath, const char* output_path) { // Source: ft2sd unsigned char* dataBuf = (unsigned char*)memalign(0x40, BUFFER_SIZE); if (!dataBuf) { @@ -99,8 +98,7 @@ int DumpFile(char* pPath, const char* output_path) { } -// Source: ft2sd -int DumpDir(char* pPath, const char* target_path) { +int DumpDir(char* pPath, const char* target_path) { // Source: ft2sd struct dirent* dirent = NULL; DIR* dir = NULL; @@ -203,8 +201,7 @@ int DeleteDir(char* pPath) { } -// Source: loadiine_gx2 -void getUserID(char* out) { +void getUserID(char* out) { // Source: loadiine_gx2 /* get persistent ID - thanks to Maschell */ unsigned int nn_act_handle; @@ -424,9 +421,9 @@ void importFromLoadiine(Title* title, bool common, int version) { sprintf(dstPath, "storage_%s:/usr/save/%08x/%08x/user", isUSB ? "usb" : "mlc", highID, lowID); u32 dstOffset = strlen(dstPath); sprintf(dstPath + dstOffset, "/%s", usrPath); - DumpDir(srcPath, dstPath); - strcpy(srcPath + srcOffset, "/c"); - strcpy(dstPath + dstOffset, "/common"); + if (DumpDir(srcPath, dstPath)!=0) promptError("Failed to import savedata from loadiine."); + strcpy(srcPath + srcOffset, "/c\0"); + strcpy(dstPath + dstOffset, "/common\0"); if (DumpDir(srcPath, dstPath)!=0) promptError("Common save not found."); } @@ -447,9 +444,9 @@ void exportToLoadiine(Title* title, bool common, int version) { sprintf(srcPath, "storage_%s:/usr/save/%08x/%08x/user", isUSB ? "usb" : "mlc", highID, lowID); u32 srcOffset = strlen(srcPath); sprintf(srcPath + srcOffset, "/%s", usrPath); - DumpDir(srcPath, dstPath); - strcpy(dstPath + dstOffset, "/c"); - strcpy(srcPath + srcOffset, "/common"); + if (DumpDir(srcPath, dstPath)!=0) promptError("Failed to export savedata to loadiine."); + strcpy(dstPath + dstOffset, "/c\0"); + strcpy(srcPath + srcOffset, "/common\0"); if (DumpDir(srcPath, dstPath)!=0) promptError("Common save not found."); }