diff --git a/arm9/source/godmode.c b/arm9/source/godmode.c index 545910f..aff62a6 100644 --- a/arm9/source/godmode.c +++ b/arm9/source/godmode.c @@ -2396,7 +2396,8 @@ u32 GodMode(int entrypoint) { int srch_t = ((strncmp(curr_entry->path + 1, ":/title", 7) == 0) || (*tpath && PathExist(tpath))) ? ++n_opt : -1; int srch_f = ++n_opt; - int fixcmac = (!*current_path && (strspn(curr_entry->path, "14AB") == 1)) ? ++n_opt : -1; + int fixcmac = (!*current_path && ((strspn(curr_entry->path, "14AB") == 1) || + ((GetMountState() == IMG_NAND) && (*(curr_entry->path) == '7')))) ? ++n_opt : -1; int dirnfo = ++n_opt; int stdcpy = (*current_path && strncmp(current_path, OUTPUT_PATH, 256) != 0) ? ++n_opt : -1; if (srch_t > 0) optionstr[srch_t-1] = "Search for titles"; diff --git a/arm9/source/utils/nandcmac.c b/arm9/source/utils/nandcmac.c index e3ae4fa..5794e86 100644 --- a/arm9/source/utils/nandcmac.c +++ b/arm9/source/utils/nandcmac.c @@ -23,7 +23,7 @@ #define CMAC_AGBSAVE 10 #define CMAC_AGBSAVE_SD 11 #define CMAC_CMD_SD 12 -#define CMAC_CMD_TWLN 13 // unsupported +#define CMAC_CMD_TWLN 13 // see: https://www.3dbrew.org/wiki/Savegames#AES_CMAC_header #define CMAC_SAVETYPE NULL, "CTR-EXT0", "CTR-EXT0", "CTR-SYS0", "CTR-NOR0", "CTR-SAV0", "CTR-SIGN", "CTR-9DB0", "CTR-9DB0", NULL, NULL, NULL @@ -186,9 +186,9 @@ u32 CalculateFileCmac(const char* path, u8* cmac) { } else if (sscanf(path, "%c:/data/%016llx%016llx/sysdata/%08lx/%08lx", &drv, &id0_high, &id0_low, &fid_low, &fid_high) == 5) cmac_type = CMAC_SAVEDATA_SYS; } else if ((drv == '2') || (drv == '5') || (drv == '8')) { // data on TWLN - if ((sscanf(path, "%c:/title/%08lx/%08lx/content/cmd/%08lx.cmd", &drv, &tid_high, &tid_low, &sid) == 4) && + if ((sscanf(path, "%c:/title/00030004/%08lx/content/cmd/%08lx.cmd", &drv, &tid_low, &sid) == 3) && ext && (strncasecmp(ext, "cmd", 4) == 0)) { - cmac_type = CMAC_CMD_TWLN; // this is not supported (yet), it's in here just for detection + cmac_type = CMAC_CMD_TWLN; } }