diff --git a/programs/nstool/source/UserSettings.cpp b/programs/nstool/source/UserSettings.cpp index d95993d..e447efc 100644 --- a/programs/nstool/source/UserSettings.cpp +++ b/programs/nstool/source/UserSettings.cpp @@ -52,7 +52,6 @@ void UserSettings::showHelp() printf(" nstool [--listfs] [--fsdir ] \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 --titlekey ] [--part0 ...] <.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& UserSettings::getFsPath() const return mFsPath; } +const sOptional& UserSettings::getPart0Path() const +{ + return mPart0Path; +} + +const sOptional& UserSettings::getPart1Path() const +{ + return mPart1Path; +} + +const sOptional& UserSettings::getPart2Path() const +{ + return mPart2Path; +} + +const sOptional& 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 diff --git a/programs/nstool/source/UserSettings.h b/programs/nstool/source/UserSettings.h index fbd1afe..030d6d5 100644 --- a/programs/nstool/source/UserSettings.h +++ b/programs/nstool/source/UserSettings.h @@ -26,6 +26,10 @@ public: const sOptional& getNormalPath() const; const sOptional& getSecurePath() const; const sOptional& getFsPath() const; + const sOptional& getPart0Path() const; + const sOptional& getPart1Path() const; + const sOptional& getPart2Path() const; + const sOptional& getPart3Path() const; private: const std::string kModuleName = "UserSettings"; @@ -33,7 +37,6 @@ private: struct sCmdArgs { sOptional input_path; - sOptional output_path; sOptional devkit_keys; sOptional keyset_path; sOptional file_type; @@ -47,11 +50,14 @@ private: sOptional fs_path; sOptional nca_titlekey; sOptional nca_bodykey; + sOptional part0_path; + sOptional part1_path; + sOptional part2_path; + sOptional 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 mSecurePath; sOptional mFsPath; + sOptional mPart0Path; + sOptional mPart1Path; + sOptional mPart2Path; + sOptional mPart3Path; + void populateCmdArgs(int argc, char** argv, sCmdArgs& cmd_args); void populateKeyset(sCmdArgs& args); void populateUserSettings(sCmdArgs& args);