nixpkgs/pkgs/games/shipwright/soh-misc-otr-patches.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

120 lines
4.9 KiB
Diff
Raw Normal View History

2023-06-07 23:03:38 +00:00
diff --git a/soh/soh/Extractor/Extract.cpp b/soh/soh/Extractor/Extract.cpp
index a9ddc4f4..f6d45fe2 100644
--- a/soh/soh/Extractor/Extract.cpp
+++ b/soh/soh/Extractor/Extract.cpp
@@ -490,28 +490,27 @@ const char* Extractor::GetZapdVerStr() const {
extern "C" int zapd_main(int argc, char** argv);
-bool Extractor::CallZapd() {
+bool Extractor::CallZapd(std::string &assetPath) {
constexpr int argc = 16;
- char xmlPath[100];
- char confPath[100];
std::array<const char*, argc> argv;
const char* version = GetZapdVerStr();
- snprintf(xmlPath, 100, "assets/extractor/xmls/%s", version);
- snprintf(confPath, 100, "assets/extractor/Config_%s.xml", version);
+ std::string xmlPath = assetPath + "/assets/extractor/xmls/" + version;
+ std::string confPath = assetPath + "/assets/extractor/Config_" + version + ".xml";
+ std::string fileListsPath = assetPath + "/assets/extractor/filelists";
argv[0] = "ZAPD";
argv[1] = "ed";
argv[2] = "-i";
- argv[3] = xmlPath;
+ argv[3] = xmlPath.c_str();
argv[4] = "-b";
argv[5] = mCurrentRomPath.c_str();
argv[6] = "-fl";
- argv[7] = "assets/extractor/filelists";
+ argv[7] = fileListsPath.c_str();
argv[8] = "-gsf";
- argv[9] = "1";
+ argv[9] = "0";
argv[10] = "-rconf";
- argv[11] = confPath;
+ argv[11] = confPath.c_str();
argv[12] = "-se";
argv[13] = "OTR";
argv[14] = "--otrfile";
diff --git a/soh/soh/Extractor/Extract.h b/soh/soh/Extractor/Extract.h
index e4eb2e5b..3c95b025 100644
--- a/soh/soh/Extractor/Extract.h
+++ b/soh/soh/Extractor/Extract.h
@@ -57,7 +57,7 @@ class Extractor {
bool IsMasterQuest() const;
bool Run(RomSearchMode searchMode = RomSearchMode::Both);
- bool CallZapd();
+ bool CallZapd(std::string& assetPath);
const char* GetZapdStr();
};
#endif
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index d192de6a..cc516085 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -201,11 +201,11 @@ const char* constCameraStrings[] = {
OTRGlobals::OTRGlobals() {
std::vector<std::string> OTRFiles;
- std::string mqPath = LUS::Context::GetPathRelativeToAppDirectory("oot-mq.otr");
+ std::string mqPath = LUS::Context::FindFileFromAllAppDirectories("oot-mq.otr");
if (std::filesystem::exists(mqPath)) {
OTRFiles.push_back(mqPath);
}
- std::string ootPath = LUS::Context::GetPathRelativeToAppDirectory("oot.otr");
+ std::string ootPath = LUS::Context::FindFileFromAllAppDirectories("oot.otr");
if (std::filesystem::exists(ootPath)) {
OTRFiles.push_back(ootPath);
}
@@ -213,7 +213,7 @@ OTRGlobals::OTRGlobals() {
if (std::filesystem::exists(sohOtrPath)) {
OTRFiles.push_back(sohOtrPath);
}
- std::string patchesPath = LUS::Context::GetPathRelativeToAppDirectory("mods");
+ std::string patchesPath = LUS::Context::FindFileFromAllAppDirectories("mods");
if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) {
if (std::filesystem::is_directory(patchesPath)) {
for (const auto& p : std::filesystem::recursive_directory_iterator(patchesPath)) {
@@ -709,8 +709,10 @@ extern "C" void OTRExtScanner() {
extern "C" void InitOTR() {
#if not defined (__SWITCH__) && not defined(__WIIU__)
- if (!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("oot-mq.otr")) &&
- !std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("oot.otr"))){
+ if (!std::filesystem::exists(LUS::Context::FindFileFromAllAppDirectories("oot-mq.otr")) &&
+ !std::filesystem::exists(LUS::Context::FindFileFromAllAppDirectories("oot.otr"))){
+ std::string exporterAssetPath = LUS::Context::GetAppBundlePath();
+
bool generatedOtrIsMQ = false;
if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) {
Extractor extract;
@@ -718,7 +720,7 @@ extern "C" void InitOTR() {
Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated. Exiting...");
exit(1);
}
- extract.CallZapd();
+ extract.CallZapd(exporterAssetPath);
generatedOtrIsMQ = extract.IsMasterQuest();
} else {
exit(1);
@@ -728,7 +730,7 @@ extern "C" void InitOTR() {
if (!extract.Run(generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) {
Extractor::ShowErrorBox("Error", "An error occured, an OTR file may have been generated by a different step. Continuing...");
} else {
- extract.CallZapd();
+ extract.CallZapd(exporterAssetPath);
}
}
}
@@ -2018,4 +2020,4 @@ extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* repla
extern "C" void SaveManager_ThreadPoolWait() {
SaveManager::Instance->ThreadPoolWait();
-}
\ No newline at end of file
+}