mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-03 00:39:14 +00:00
ctrtool: added cci ncch selection
This commit is contained in:
+4
-3
@@ -61,7 +61,7 @@ static void usage(const char *argv0)
|
||||
"LZSS options:\n"
|
||||
" --lzssout=file Specify lzss output file\n"
|
||||
"CXI/CCI options:\n"
|
||||
" -n, --ncch=offs Specify offset for NCCH header.\n"
|
||||
" -n, --ncch=index Specify NCCH partition index.\n"
|
||||
" --exefs=file Specify ExeFS file path.\n"
|
||||
" --exefsdir=dir Specify ExeFS directory path.\n"
|
||||
" --romfs=file Specify RomFS file path.\n"
|
||||
@@ -96,7 +96,7 @@ int main(int argc, char* argv[])
|
||||
u8 magic[4];
|
||||
char infname[512];
|
||||
int c;
|
||||
u32 ncchoffset = ~0;
|
||||
u32 ncchindex = 0;
|
||||
char keysetfname[512] = "keys.xml";
|
||||
keyset tmpkeys;
|
||||
unsigned int checkkeysetfile = 0;
|
||||
@@ -180,7 +180,7 @@ int main(int argc, char* argv[])
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
ncchoffset = strtoul(optarg, 0, 0);
|
||||
ncchindex = strtoul(optarg, 0, 0);
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
@@ -331,6 +331,7 @@ int main(int argc, char* argv[])
|
||||
ncsd_init(&ncsdctx);
|
||||
ncsd_set_file(&ncsdctx, ctx.infile);
|
||||
ncsd_set_size(&ncsdctx, ctx.infilesize);
|
||||
ncsd_set_ncch_index(&ncsdctx, ncchindex);
|
||||
ncsd_set_usersettings(&ncsdctx, &ctx.usersettings);
|
||||
ncsd_process(&ncsdctx, ctx.actions);
|
||||
|
||||
|
||||
+13
-2
@@ -28,6 +28,11 @@ void ncsd_set_size(ncsd_context* ctx, u32 size)
|
||||
ctx->size = size;
|
||||
}
|
||||
|
||||
void ncsd_set_ncch_index(ncsd_context* ctx, u32 ncch_index)
|
||||
{
|
||||
ctx->ncch_index = ncch_index;
|
||||
}
|
||||
|
||||
void ncsd_set_usersettings(ncsd_context* ctx, settings* usersettings)
|
||||
{
|
||||
ctx->usersettings = usersettings;
|
||||
@@ -74,9 +79,15 @@ void ncsd_process(ncsd_context* ctx, u32 actions)
|
||||
if (actions & InfoFlag)
|
||||
ncsd_print(ctx);
|
||||
|
||||
if(ctx->ncch_index > 7 || ctx->header.partitiongeometry[ctx->ncch_index].size == 0)
|
||||
{
|
||||
fprintf(stderr," ERROR NCSD partition %d, does not exist\n",ctx->ncch_index);
|
||||
return;
|
||||
}
|
||||
|
||||
ncch_set_file(&ctx->ncch, ctx->file);
|
||||
ncch_set_offset(&ctx->ncch, ctx->header.partitiongeometry[0].offset * ncsd_get_mediaunit_size(ctx));
|
||||
ncch_set_size(&ctx->ncch, ctx->header.partitiongeometry[0].size * ncsd_get_mediaunit_size(ctx));
|
||||
ncch_set_offset(&ctx->ncch, ctx->header.partitiongeometry[ctx->ncch_index].offset * ncsd_get_mediaunit_size(ctx));
|
||||
ncch_set_size(&ctx->ncch, ctx->header.partitiongeometry[ctx->ncch_index].size * ncsd_get_mediaunit_size(ctx));
|
||||
ncch_set_usersettings(&ctx->ncch, ctx->usersettings);
|
||||
ncch_process(&ctx->ncch, actions);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ typedef struct
|
||||
FILE* file;
|
||||
u32 offset;
|
||||
u32 size;
|
||||
u32 ncch_index;
|
||||
ctr_ncsdheader header;
|
||||
settings* usersettings;
|
||||
int headersigcheck;
|
||||
@@ -45,6 +46,7 @@ typedef struct
|
||||
void ncsd_init(ncsd_context* ctx);
|
||||
void ncsd_set_offset(ncsd_context* ctx, u32 offset);
|
||||
void ncsd_set_size(ncsd_context* ctx, u32 size);
|
||||
void ncsd_set_ncch_index(ncsd_context* ctx, u32 ncch_index);
|
||||
void ncsd_set_file(ncsd_context* ctx, FILE* file);
|
||||
void ncsd_set_usersettings(ncsd_context* ctx, settings* usersettings);
|
||||
int ncsd_signature_verify(const void* blob, rsakey2048* key);
|
||||
|
||||
Reference in New Issue
Block a user