diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2023-10-07 21:07:04 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2023-10-07 21:07:04 -0600 |
| commit | dfbf8f15256d929d354b034a9a0db481078b5642 (patch) | |
| tree | 06a05a1f5fa7df00495de3ec5c21fa1a92206442 /src/main.cpp | |
| parent | a38f895f8033841c3d7fbea7bcd604ac49dcd03e (diff) | |
Added a command to pack an mpq from a directory
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 27 |
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 |
