mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
[nstool] implement --partX command for nca.
This commit is contained in:
parent
3cbcba2bde
commit
b69dc62062
|
@ -52,7 +52,6 @@ void UserSettings::showHelp()
|
|||
printf(" nstool [--listfs] [--fsdir <dir>] <file>\n");
|
||||
printf(" --listfs Print file system\n");
|
||||
printf(" --fsdir Extract file system to directory\n");
|
||||
/*
|
||||
printf("\n NCA (Nintendo Content Archive)\n");
|
||||
printf(" nstool [--listfs] [--bodykey <key> --titlekey <key>] [--part0 <dir> ...] <.nca file>\n");
|
||||
printf(" --listfs Print file system in embedded partitions\n");
|
||||
|
@ -62,7 +61,6 @@ void UserSettings::showHelp()
|
|||
printf(" --part1 Extract \"partition 1\" to directory \n");
|
||||
printf(" --part2 Extract \"partition 2\" to directory \n");
|
||||
printf(" --part3 Extract \"partition 3\" to directory \n");
|
||||
*/
|
||||
}
|
||||
|
||||
const std::string UserSettings::getInputPath() const
|
||||
|
@ -115,6 +113,26 @@ const sOptional<std::string>& UserSettings::getFsPath() const
|
|||
return mFsPath;
|
||||
}
|
||||
|
||||
const sOptional<std::string>& UserSettings::getPart0Path() const
|
||||
{
|
||||
return mPart0Path;
|
||||
}
|
||||
|
||||
const sOptional<std::string>& UserSettings::getPart1Path() const
|
||||
{
|
||||
return mPart1Path;
|
||||
}
|
||||
|
||||
const sOptional<std::string>& UserSettings::getPart2Path() const
|
||||
{
|
||||
return mPart2Path;
|
||||
}
|
||||
|
||||
const sOptional<std::string>& UserSettings::getPart3Path() const
|
||||
{
|
||||
return mPart3Path;
|
||||
}
|
||||
|
||||
|
||||
void UserSettings::populateCmdArgs(int argc, char** argv, sCmdArgs& cmd_args)
|
||||
{
|
||||
|
@ -226,10 +244,28 @@ void UserSettings::populateCmdArgs(int argc, char** argv, sCmdArgs& cmd_args)
|
|||
cmd_args.nca_bodykey = args[i+1];
|
||||
}
|
||||
|
||||
else if (args[i] == "-o")
|
||||
else if (args[i] == "--part0")
|
||||
{
|
||||
if (!hasParamter) throw fnd::Exception(kModuleName, args[i] + " requries a parameter.");
|
||||
cmd_args.output_path = args[i+1];
|
||||
cmd_args.part0_path = args[i+1];
|
||||
}
|
||||
|
||||
else if (args[i] == "--part1")
|
||||
{
|
||||
if (!hasParamter) throw fnd::Exception(kModuleName, args[i] + " requries a parameter.");
|
||||
cmd_args.part1_path = args[i+1];
|
||||
}
|
||||
|
||||
else if (args[i] == "--part2")
|
||||
{
|
||||
if (!hasParamter) throw fnd::Exception(kModuleName, args[i] + " requries a parameter.");
|
||||
cmd_args.part2_path = args[i+1];
|
||||
}
|
||||
|
||||
else if (args[i] == "--part3")
|
||||
{
|
||||
if (!hasParamter) throw fnd::Exception(kModuleName, args[i] + " requries a parameter.");
|
||||
cmd_args.part3_path = args[i+1];
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
@ -26,6 +26,10 @@ public:
|
|||
const sOptional<std::string>& getNormalPath() const;
|
||||
const sOptional<std::string>& getSecurePath() const;
|
||||
const sOptional<std::string>& getFsPath() const;
|
||||
const sOptional<std::string>& getPart0Path() const;
|
||||
const sOptional<std::string>& getPart1Path() const;
|
||||
const sOptional<std::string>& getPart2Path() const;
|
||||
const sOptional<std::string>& getPart3Path() const;
|
||||
|
||||
private:
|
||||
const std::string kModuleName = "UserSettings";
|
||||
|
@ -33,7 +37,6 @@ private:
|
|||
struct sCmdArgs
|
||||
{
|
||||
sOptional<std::string> input_path;
|
||||
sOptional<std::string> output_path;
|
||||
sOptional<bool> devkit_keys;
|
||||
sOptional<std::string> keyset_path;
|
||||
sOptional<std::string> file_type;
|
||||
|
@ -47,11 +50,14 @@ private:
|
|||
sOptional<std::string> fs_path;
|
||||
sOptional<std::string> nca_titlekey;
|
||||
sOptional<std::string> nca_bodykey;
|
||||
sOptional<std::string> part0_path;
|
||||
sOptional<std::string> part1_path;
|
||||
sOptional<std::string> part2_path;
|
||||
sOptional<std::string> part3_path;
|
||||
|
||||
void clear()
|
||||
{
|
||||
input_path.isSet = false;
|
||||
output_path.isSet = false;
|
||||
devkit_keys.isSet = false;
|
||||
keyset_path.isSet = false;
|
||||
file_type.isSet = false;
|
||||
|
@ -65,6 +71,10 @@ private:
|
|||
fs_path.isSet = false;
|
||||
nca_titlekey.isSet = false;
|
||||
nca_bodykey.isSet = false;
|
||||
part0_path.isSet = false;
|
||||
part1_path.isSet = false;
|
||||
part2_path.isSet = false;
|
||||
part3_path.isSet = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -80,6 +90,11 @@ private:
|
|||
sOptional<std::string> mSecurePath;
|
||||
sOptional<std::string> mFsPath;
|
||||
|
||||
sOptional<std::string> mPart0Path;
|
||||
sOptional<std::string> mPart1Path;
|
||||
sOptional<std::string> mPart2Path;
|
||||
sOptional<std::string> mPart3Path;
|
||||
|
||||
void populateCmdArgs(int argc, char** argv, sCmdArgs& cmd_args);
|
||||
void populateKeyset(sCmdArgs& args);
|
||||
void populateUserSettings(sCmdArgs& args);
|
||||
|
|
Loading…
Reference in a new issue