-
Notifications
You must be signed in to change notification settings - Fork 167
Description
The usage info for the tool does not show all supported input file types. So unless the user looks at the sourcecode they might not realise there are other types that are supported. I came across this issue trying to access a save file, but there was no "save" filetype listed in usage so couldnt work out what i was doing wrong until i looked at the sourcecode.
So need to make this usage:
-t, --intype=type Specify input file type [nca, xci, pfs0, romfs, hfs0, npdm, pk11, pk21, ini1, kip1, nax0, keygen]
match these available options
case 't':
if (!strcmp(optarg, "nca")) {
nca_ctx.tool_ctx->file_type = FILETYPE_NCA;
} else if (!strcmp(optarg, "pfs0") || !strcmp(optarg, "exefs")) {
nca_ctx.tool_ctx->file_type = FILETYPE_PFS0;
} else if (!strcmp(optarg, "romfs")) {
nca_ctx.tool_ctx->file_type = FILETYPE_ROMFS;
} else if (!strcmp(optarg, "nca0_romfs") || !strcmp(optarg, "nca0romfs") || !strcmp(optarg, "betaromfs") || !strcmp(optarg, "beta_romfs")) {
nca_ctx.tool_ctx->file_type = FILETYPE_NCA0_ROMFS;
} else if (!strcmp(optarg, "hfs0")) {
nca_ctx.tool_ctx->file_type = FILETYPE_HFS0;
} else if (!strcmp(optarg, "xci") || !strcmp(optarg, "gamecard") || !strcmp(optarg, "gc")) {
nca_ctx.tool_ctx->file_type = FILETYPE_XCI;
} else if (!strcmp(optarg, "npdm") || !strcmp(optarg, "meta")) {
nca_ctx.tool_ctx->file_type = FILETYPE_NPDM;
} else if (!strcmp(optarg, "package1") || !strcmp(optarg, "pk11")) {
nca_ctx.tool_ctx->file_type = FILETYPE_PACKAGE1;
} else if (!strcmp(optarg, "package2") || !strcmp(optarg, "pk21")) {
nca_ctx.tool_ctx->file_type = FILETYPE_PACKAGE2;
} else if (!strcmp(optarg, "ini1")) {
nca_ctx.tool_ctx->file_type = FILETYPE_INI1;
} else if (!strcmp(optarg, "kip1") || !strcmp(optarg, "kip")) {
nca_ctx.tool_ctx->file_type = FILETYPE_KIP1;
} else if (!strcmp(optarg, "nso0") || !strcmp(optarg, "nso")) {
nca_ctx.tool_ctx->file_type = FILETYPE_NSO0;
} else if (!strcmp(optarg, "nax0") || !strcmp(optarg, "nax")) {
nca_ctx.tool_ctx->file_type = FILETYPE_NAX0;
} else if (!strcmp(optarg, "keygen") || !strcmp(optarg, "keys") || !strcmp(optarg, "boot0") || !strcmp(optarg, "boot")) {
nca_ctx.tool_ctx->file_type = FILETYPE_BOOT0;
} else if (!strcmp(optarg, "save")) {
nca_ctx.tool_ctx->file_type = FILETYPE_SAVE;
}
break;
Since there are quite a few options for the intype parameter it might help to list them in usage in alphabetical order? Also group together the different intypes that are equivalent since users may not be aware they are the same thing.
The resulting usage is a lot longer, but since filetype is required to correctly perform any action it seems worthwhile.
So perhaps something like:
" -t, --intype=type Specify input file type\n"
" [hfs0, ini1, keygen/keys/boot0/boot, kip/kip1, nax/nax0,\n"
" nca, nca0romfs/nca0_romfs/betaromfs/beta_romfs, npdm/meta,\n"
" nso/nso0, package1/pk11, package2/pk21, pfs0/exefs, romfs,\n"
" save, xci/gamecard/gc]\n"