summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-03-03 21:35:08 -0500
committerGitHub <noreply@github.com>2024-03-03 21:35:08 -0500
commita406a7d4310c26f6e7aeece3bb4475cd8fd2d9e3 (patch)
tree33fcb24d233f2e729ec6df841a6db0a2bda4f8de
parent01ed7e87f2b4b8145d8b0af8c8d8912b86f4b908 (diff)
Bring over exporter arg and scene changes (#19) (#9)
-rw-r--r--ZAPD/Globals.h2
-rw-r--r--ZAPD/Main.cpp34
-rw-r--r--ZAPD/ZResource.cpp12
3 files changed, 30 insertions, 18 deletions
diff --git a/ZAPD/Globals.h b/ZAPD/Globals.h
index 4cd8fe1..95c22c2 100644
--- a/ZAPD/Globals.h
+++ b/ZAPD/Globals.h
@@ -42,7 +42,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 4536683..811f499 100644
--- a/ZAPD/Main.cpp
+++ b/ZAPD/Main.cpp
@@ -175,14 +175,26 @@ extern "C" int zapd_main(int argc, char* argv[])
// 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 = ParseFileMode(buildMode, exporterSet);
@@ -197,14 +209,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);
@@ -585,7 +589,7 @@ void Arg_SetBuildRawTexture([[maybe_unused]] int& i, [[maybe_unused]] char* argv
void Arg_SetNoRomMode([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
{
- Globals::Instance->onlyGenSohOtr = true;
+ Globals::Instance->onlyGenCustomOtr = true;
}
int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet)
diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp
index 0e8324d..768a066 100644
--- a/ZAPD/ZResource.cpp
+++ b/ZAPD/ZResource.cpp
@@ -335,8 +335,16 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
if (StringHelper::Contains(outName, "_room_") ||
StringHelper::Contains(outName, "_scene") ||
(StringHelper::Contains(parent->GetXmlFilePath().string(), "/scenes/") ||
- StringHelper::Contains(parent->GetXmlFilePath().string(), "\\scenes\\")))
- prefix = "scenes/nonmq";
+ StringHelper::Contains(parent->GetXmlFilePath().string(), "\\scenes\\"))) {
+ prefix = "scenes/shared";
+
+ // Regex for xml paths that are dungeons with unique MQ variants (only the main dungeon, not boss rooms)
+ std::regex dungeonsWithMQ(R"(((ydan)|(ddan)|(bdan)|(Bmori1)|(HIDAN)|(MIZUsin)|(jyasinzou)|(HAKAdan)|(HAKAdanCH)|(ice_doukutu)|(men)|(ganontika))\.xml)");
+
+ if (StringHelper::Contains(xmlPath, "dungeons/") && std::regex_search(xmlPath, dungeonsWithMQ)) {
+ prefix = "scenes/nonmq";
+ }
+ }
else if (StringHelper::Contains(xmlPath, "objects/"))
prefix = "objects";
else if (StringHelper::Contains(xmlPath, "textures/"))