mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-02 16:59:03 +00:00
@@ -26,6 +26,7 @@ typedef enum
|
||||
FILETYPE_LZSS,
|
||||
FILETYPE_FIRM,
|
||||
FILETYPE_CWAV,
|
||||
FILETYPE_EXEFS,
|
||||
FILETYPE_ROMFS
|
||||
} ctr_filetypes;
|
||||
|
||||
|
||||
+3
-1
@@ -129,7 +129,7 @@ void exefs_save(exefs_context* ctx, u32 index, u32 flags)
|
||||
ctr_init_counter(&ctx->aes, ctx->key, ctx->counter);
|
||||
ctr_add_counter(&ctx->aes, offset / 0x10);
|
||||
|
||||
if (index == 0 && ctx->compressedflag && ((flags & RawFlag) == 0))
|
||||
if (index == 0 && (ctx->compressedflag || (flags & DecompressCodeFlag)) && ((flags & RawFlag) == 0))
|
||||
{
|
||||
fprintf(stdout, "Decompressing section %s to %s...\n", name, outfname);
|
||||
|
||||
@@ -200,6 +200,8 @@ void exefs_save(exefs_context* ctx, u32 index, u32 flags)
|
||||
}
|
||||
|
||||
clean:
|
||||
if (fout)
|
||||
fclose(fout);
|
||||
free(compressedbuffer);
|
||||
free(decompressedbuffer);
|
||||
return;
|
||||
|
||||
+21
-1
@@ -57,7 +57,7 @@ static void usage(const char *argv0)
|
||||
" --ncchsyskey=key Set ncch fixed system key.\n"
|
||||
" --showkeys Show the keys being used.\n"
|
||||
" -t, --intype=type Specify input file type [ncsd, ncch, exheader, cia, tmd, lzss,\n"
|
||||
" firm, cwav, romfs]\n"
|
||||
" firm, cwav, exefs, romfs]\n"
|
||||
"LZSS options:\n"
|
||||
" --lzssout=file Specify lzss output file\n"
|
||||
"CXI/CCI options:\n"
|
||||
@@ -78,6 +78,9 @@ static void usage(const char *argv0)
|
||||
"CWAV options:\n"
|
||||
" --wav=file Specify wav output file.\n"
|
||||
" --wavloops=count Specify wav loop count, default 0.\n"
|
||||
"EXEFS options:\n"
|
||||
" --decompresscode Decompress .code section\n"
|
||||
" (only needed when using raw EXEFS file)\n"
|
||||
"ROMFS options:\n"
|
||||
" --romfsdir=dir Specify RomFS directory path.\n"
|
||||
" --listromfs List files in RomFS.\n"
|
||||
@@ -142,6 +145,7 @@ int main(int argc, char* argv[])
|
||||
{"listromfs", 0, NULL, 18},
|
||||
{"wavloops", 1, NULL, 19},
|
||||
{"logo", 1, NULL, 20},
|
||||
{"decompresscode", 0, NULL, 21},
|
||||
{NULL},
|
||||
};
|
||||
|
||||
@@ -201,6 +205,8 @@ int main(int argc, char* argv[])
|
||||
ctx.filetype = FILETYPE_FIRM;
|
||||
else if (!strcmp(optarg, "cwav"))
|
||||
ctx.filetype = FILETYPE_CWAV;
|
||||
else if (!strcmp(optarg, "exefs"))
|
||||
ctx.filetype = FILETYPE_EXEFS;
|
||||
else if (!strcmp(optarg, "romfs"))
|
||||
ctx.filetype = FILETYPE_ROMFS;
|
||||
break;
|
||||
@@ -226,6 +232,7 @@ int main(int argc, char* argv[])
|
||||
case 18: settings_set_list_romfs_files(&ctx.usersettings, 1); break;
|
||||
case 19: settings_set_cwav_loopcount(&ctx.usersettings, strtoul(optarg, 0, 0)); break;
|
||||
case 20: settings_set_logo_path(&ctx.usersettings, optarg); break;
|
||||
case 21: ctx.actions |= DecompressCodeFlag; break;
|
||||
|
||||
default:
|
||||
usage(argv[0]);
|
||||
@@ -424,6 +431,19 @@ int main(int argc, char* argv[])
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_EXEFS:
|
||||
{
|
||||
exefs_context exefsctx;
|
||||
|
||||
exefs_init(&exefsctx);
|
||||
exefs_set_file(&exefsctx, ctx.infile);
|
||||
exefs_set_size(&exefsctx, ctx.infilesize);
|
||||
exefs_set_usersettings(&exefsctx, &ctx.usersettings);
|
||||
exefs_process(&exefsctx, ctx.actions);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_ROMFS:
|
||||
{
|
||||
|
||||
+2
-1
@@ -21,7 +21,8 @@ enum flags
|
||||
VerboseFlag = (1<<3),
|
||||
VerifyFlag = (1<<4),
|
||||
RawFlag = (1<<5),
|
||||
ShowKeysFlag = (1<<6)
|
||||
ShowKeysFlag = (1<<6),
|
||||
DecompressCodeFlag = (1<<7)
|
||||
};
|
||||
|
||||
enum validstate
|
||||
|
||||
Reference in New Issue
Block a user