mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Added a command to pack an mpq from a directory
This commit is contained in:
+23
-4
@@ -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
|
||||
Reference in New Issue
Block a user