summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3149b66..9001fcb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,11 +5,32 @@
#ifdef STANDALONE
Companion* Companion::Instance;
+void BindOTRMode(CLI::App& app){
+ auto otr = app.add_subcommand("otr", "Extracts the rom to a folder");
+ std::string filename;
+ otr->add_option("rom", filename, "sm64 us rom")->required()->check(CLI::ExistingFile);
+ otr->parse_complete_callback([&]() {
+ auto instance = Companion::Instance = new Companion(filename);
+ instance->Init();
+ });
+}
+
+void BindPackMode(CLI::App& app){
+ auto pack = app.add_subcommand("pack", "Packs the rom from a folder");
+ std::string folder;
+ pack->add_option("folder", folder, "Folder")->required()->check(CLI::ExistingDirectory);
+ std::string output;
+ pack->add_option("output", output, "MPQ Output")->required();
+ pack->parse_complete_callback([&]() {
+ Companion::Pack(folder, output);
+ });
+}
+
int main(int argc, char *argv[]) {
CLI::App app{"CubeOS - Rom extractor"};
- std::string filename;
- app.add_option("path", filename, "sm64 us rom")->required()->check(CLI::ExistingFile);
+ BindOTRMode(app);
+ BindPackMode(app);
try {
app.parse(argc, argv);
@@ -17,8 +38,6 @@ int main(int argc, char *argv[]) {
return app.exit(e);
}
- Companion::Instance = new Companion(filename);
- Companion::Instance->Init();
return 0;
}
#endif \ No newline at end of file