*Saves flashed back to real NAND will now be unescaped the D2X cIOS way

NOTE: Wiiflow can not flash game saves back if illegal FAT characters are escaped out in a different way D2X does. Game saves extracted with Wiiflow are safe to flash back!
This commit is contained in:
overjoy.psm 2012-05-11 00:07:44 +00:00
parent f3ae92cbc7
commit 40266a8909
2 changed files with 29 additions and 5 deletions

View File

@ -451,6 +451,32 @@ void Nand::__FATify(char *ptr, const char *str)
*ptr = '\0';
}
void Nand::__NANDify(char *str)
{
char *src = str;
char *dst = str;
char c;
while((c = *(src++)) != '\0')
{
if(c == '&')
{
if(!strncmp(src, "qt;", 3)) c = '"';
else if (!strncmp(src, "st;", 3)) c = '*';
else if (!strncmp(src, "cl;", 3)) c = ':';
else if (!strncmp(src, "lt;", 3)) c = '<';
else if (!strncmp(src, "gt;", 3)) c = '>';
else if (!strncmp(src, "qm;", 3)) c = '?';
else if (!strncmp(src, "vb;", 3)) c = '|';
if (c != '&')
src += 3;
}
*(dst++) = c;
}
*dst = '\0';
}
s32 Nand::__FlashNandFile(const char *source, const char *dest)
{
s32 ret;
@ -640,7 +666,6 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
{
char nsource[MAX_FAT_PATH];
char ndest[ISFS_MAXPATH];
char tdest[ISFS_MAXPATH];
DIR *dir_iter;
struct dirent *ent;
@ -666,10 +691,9 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
if(ent->d_type == DT_DIR)
{
//__FATify(tdest, ndest);
__NANDify(ndest);
if(!fake)
{
//ISFS_CreateDir(tdest, 0, 3, 3, 3);
ISFS_CreateDir(ndest, 0, 3, 3, 3);
FoldersDone++;
}
@ -677,8 +701,7 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
}
else
{
//__FATify(tdest, ndest);
//__FlashNandFile(nsource, tdest);
__NANDify(ndest);
__FlashNandFile(nsource, ndest);
}
}

View File

@ -99,6 +99,7 @@ class Nand
u32 __configsetbigarray(const char *item, void *val, u32 size);
u32 __configsetsetting(const char *item, const char *val);
bool __FileExists(const char *path, ...);
void __NANDify(char *str);
void __FATify(char *dst, const char *src);
s32 __Unescaped2x(const char *path);
s32 __FlashNandFile(const char *source, const char *dest);