diff options
| author | Adam Bird <Archez@users.noreply.github.com> | 2023-10-24 20:21:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-24 23:21:23 -0400 |
| commit | 9b8e224dac83aa8e47a688884ad48725f18fc293 (patch) | |
| tree | f418e27e400da9c2612c82b7953c3686ab8208e5 | |
| parent | e6b0764799309b96c46f4c77e3ea2aa670f15e89 (diff) | |
move exporter arg parsing higher and rename to custom otr (#14)
| -rw-r--r-- | ZAPD/Globals.h | 2 | ||||
| -rw-r--r-- | ZAPD/Main.cpp | 36 |
2 files changed, 20 insertions, 18 deletions
diff --git a/ZAPD/Globals.h b/ZAPD/Globals.h index 0fe8e05..50c04a8 100644 --- a/ZAPD/Globals.h +++ b/ZAPD/Globals.h @@ -68,7 +68,7 @@ public: bool forceUnaccountedStatic = false; bool otrMode = true; bool buildRawTexture = false; - bool onlyGenSohOtr = false; + bool onlyGenCustomOtr = false; ZRom* rom = nullptr; std::vector<ZFile*> files; diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp index a2030aa..4e28315 100644 --- a/ZAPD/Main.cpp +++ b/ZAPD/Main.cpp @@ -222,21 +222,32 @@ extern "C" int zapd_main(int argc, char* argv[]) } else if (arg == "--norom") { - Globals::Instance->onlyGenSohOtr = true; + Globals::Instance->onlyGenCustomOtr = true; } } - // Parse File Mode ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); - - if(Globals::Instance->onlyGenSohOtr) { - exporterSet->endProgramFunc(); - delete g; - return 0; + // We've parsed through our commands once. If an exporter exists, it's been set by now. + // Now we'll parse through them again but pass them on to our exporter if one is available. + if (exporterSet != nullptr && exporterSet->parseArgsFunc != nullptr) { + for (int32_t i = 2; i < argc; i++) { + exporterSet->parseArgsFunc(argc, argv, i); + } } - + + if (Globals::Instance->onlyGenCustomOtr) { + if (exporterSet != nullptr) { + exporterSet->endProgramFunc(); + } else { + printf("Error: No exporter set, unable to make custom otr.\n"); + } + + delete g; + return 0; + } + std::string buildMode = argv[1]; ZFileMode fileMode = ZFileMode::Invalid; @@ -266,15 +277,6 @@ extern "C" int zapd_main(int argc, char* argv[]) if (fileMode == ZFileMode::ExtractDirectory) Globals::Instance->rom = new ZRom(Globals::Instance->baseRomPath.string()); - // We've parsed through our commands once. If an exporter exists, it's been set by now. - // Now we'll parse through them again but pass them on to our exporter if one is available. - - if (exporterSet != nullptr && exporterSet->parseArgsFunc != nullptr) - { - for (int32_t i = 2; i < argc; i++) - exporterSet->parseArgsFunc(argc, argv, i); - } - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) printf("ZAPD: Zelda Asset Processor For Decomp: %s\n", gBuildHash); |
