From 91bd693ff6f9809f97f1b5416ef96d51ae5f0d05 Mon Sep 17 00:00:00 2001 From: Kenix3 Date: Sun, 7 May 2023 20:18:54 -0400 Subject: [PATCH] Bump LUS version (#2849) * Bump LUS version * Removes the "now" boolean from the LUS resource bridge functions. * Bump LUS * More LUS bump * Update soh/soh/resource/importer/AudioSampleFactory.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- OTRExporter/OTRExporter/AudioExporter.cpp | 10 +- .../OTRExporter/DisplayListExporter.cpp | 8 +- OTRExporter/OTRExporter/Exporter.cpp | 2 +- OTRExporter/OTRExporter/Exporter.h | 3 +- OTRExporter/OTRExporter/Main.cpp | 18 ++-- OTRExporter/OTRExporter/RoomExporter.cpp | 2 +- OTRExporter/OTRExporter/VersionInfo.h | 2 - ZAPDTR/ExporterTest/RoomExporter.cpp | 4 +- ZAPDTR/ZAPD/GameConfig.cpp | 8 +- ZAPDTR/ZAPD/Globals.cpp | 10 +- ZAPDTR/ZAPD/Main.cpp | 6 +- ZAPDTR/ZAPD/Overlays/ZOverlay.cpp | 4 +- ZAPDTR/ZAPD/ZAnimation.cpp | 2 +- ZAPDTR/ZAPD/ZAudio.cpp | 2 +- ZAPDTR/ZAPD/ZBackground.cpp | 6 +- ZAPDTR/ZAPD/ZBlob.cpp | 6 +- ZAPDTR/ZAPD/ZDisplayList.cpp | 2 +- ZAPDTR/ZAPD/ZFile.cpp | 14 +-- ZAPDTR/ZAPD/ZRom.cpp | 8 +- ZAPDTR/ZAPD/ZRoom/ZRoom.cpp | 2 +- ZAPDTR/ZAPD/ZScalar.cpp | 2 +- ZAPDTR/ZAPD/ZString.cpp | 2 +- ZAPDTR/ZAPD/ZText.cpp | 2 +- ZAPDTR/ZAPD/ZTexture.cpp | 4 +- ZAPDTR/ZAPD/ZVector.cpp | 2 +- libultraship | 2 +- soh/soh/Enhancements/debugconsole.cpp | 3 +- soh/soh/Enhancements/debugger/dlViewer.cpp | 4 +- .../randomizer/3drando/rando_main.cpp | 4 +- .../randomizer/3drando/spoiler_log.cpp | 8 +- soh/soh/Enhancements/tts/tts.cpp | 8 +- soh/soh/GameMenuBar.cpp | 8 +- soh/soh/OTRGlobals.cpp | 97 +++++++++---------- soh/soh/OTRGlobals.h | 2 +- soh/soh/SaveManager.cpp | 12 +-- .../resource/importer/AudioSampleFactory.cpp | 2 +- .../importer/AudioSequenceFactory.cpp | 2 +- .../importer/AudioSoundFontFactory.cpp | 19 ++-- .../importer/CollisionHeaderFactory.cpp | 6 +- soh/soh/resource/importer/SkeletonFactory.cpp | 14 +-- .../resource/importer/SkeletonLimbFactory.cpp | 35 ++++--- soh/soh/resource/importer/TextFactory.cpp | 4 +- .../SetAlternateHeadersFactory.cpp | 4 +- .../SetCollisionHeaderFactory.cpp | 4 +- .../scenecommand/SetCutscenesFactory.cpp | 4 +- .../importer/scenecommand/SetMeshFactory.cpp | 26 +++-- .../scenecommand/SetPathwaysFactory.cpp | 4 +- soh/soh/resource/type/Skeleton.cpp | 2 +- soh/soh/z_message_OTR.cpp | 6 +- soh/soh/z_play_otr.cpp | 6 +- soh/soh/z_scene_otr.cpp | 4 +- soh/src/code/main.c | 1 + soh/src/code/z_map_exp.c | 5 +- soh/src/code/z_player_lib.c | 4 +- soh/src/code/z_room.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 10 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 2 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 2 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 4 +- 59 files changed, 233 insertions(+), 218 deletions(-) diff --git a/OTRExporter/OTRExporter/AudioExporter.cpp b/OTRExporter/OTRExporter/AudioExporter.cpp index f2fc75928..974e9d020 100644 --- a/OTRExporter/OTRExporter/AudioExporter.cpp +++ b/OTRExporter/OTRExporter/AudioExporter.cpp @@ -2,7 +2,7 @@ #include "Main.h" #include #include -#include +#include #include "DisplayListExporter.h" void OTRExporter_Audio::WriteSampleEntryReference(ZAudio* audio, SampleEntry* entry, std::map samples, BinaryWriter* writer) @@ -29,7 +29,7 @@ void OTRExporter_Audio::WriteSampleEntryReference(ZAudio* audio, SampleEntry* en void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer) { - WriteHeader(nullptr, "", writer, Ship::ResourceType::SOH_AudioSample, Ship::Version::Rachael); + WriteHeader(nullptr, "", writer, Ship::ResourceType::SOH_AudioSample, 2); writer->Write(entry->codec); writer->Write(entry->medium); @@ -81,7 +81,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit { ZAudio* audio = (ZAudio*)res; - WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Audio, Ship::Version::Rachael); + WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Audio, 2); // Write Samples as individual files for (auto pair : audio->samples) @@ -114,7 +114,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit MemoryStream* fntStream = new MemoryStream(); BinaryWriter fntWriter = BinaryWriter(fntStream); - WriteHeader(nullptr, "", &fntWriter, Ship::ResourceType::SOH_AudioSoundFont, Ship::Version::Rachael); + WriteHeader(nullptr, "", &fntWriter, Ship::ResourceType::SOH_AudioSoundFont, 2); fntWriter.Write((uint32_t)i); fntWriter.Write(audio->soundFontTable[i].medium); @@ -173,7 +173,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit MemoryStream* seqStream = new MemoryStream(); BinaryWriter seqWriter = BinaryWriter(seqStream); - WriteHeader(nullptr, "", &seqWriter, Ship::ResourceType::SOH_AudioSequence, Ship::Version::Rachael); + WriteHeader(nullptr, "", &seqWriter, Ship::ResourceType::SOH_AudioSequence, 2); seqWriter.Write((uint32_t)seq.size()); seqWriter.Write(seq.data(), seq.size()); diff --git a/OTRExporter/OTRExporter/DisplayListExporter.cpp b/OTRExporter/OTRExporter/DisplayListExporter.cpp index 3a77cba8f..82d45891e 100644 --- a/OTRExporter/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/OTRExporter/DisplayListExporter.cpp @@ -10,7 +10,7 @@ #include #include #include "MtxExporter.h" -#include +#include #include "VersionInfo.h" #define GFX_SIZE 8 @@ -356,7 +356,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina //std::string fName = StringHelper::Sprintf("%s\\%s", GetParentFolderName(res).c_str(), dListDecl2->varName.c_str()); std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->varName.c_str()); - if (files.find(fName) == files.end() && !File::Exists("Extract/" + fName)) + if (files.find(fName) == files.end() && !DiskFile::Exists("Extract/" + fName)) { MemoryStream* dlStream = new MemoryStream(); BinaryWriter dlWriter = BinaryWriter(dlStream); @@ -442,7 +442,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina //std::string fName = StringHelper::Sprintf("%s\\%s", GetParentFolderName(res).c_str(), dListDecl2->varName.c_str()); std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->varName.c_str()); - if (files.find(fName) == files.end() && !File::Exists("Extract/" + fName)) + if (files.find(fName) == files.end() && !DiskFile::Exists("Extract/" + fName)) { MemoryStream* dlStream = new MemoryStream(); BinaryWriter dlWriter = BinaryWriter(dlStream); @@ -767,7 +767,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina word0 = hash >> 32; word1 = hash & 0xFFFFFFFF; - if (files.find(fName) == files.end() && !File::Exists("Extract/" + fName)) + if (files.find(fName) == files.end() && !DiskFile::Exists("Extract/" + fName)) { // Write vertices to file MemoryStream* vtxStream = new MemoryStream(); diff --git a/OTRExporter/OTRExporter/Exporter.cpp b/OTRExporter/OTRExporter/Exporter.cpp index f2daa4279..bf04e2355 100644 --- a/OTRExporter/OTRExporter/Exporter.cpp +++ b/OTRExporter/OTRExporter/Exporter.cpp @@ -1,7 +1,7 @@ #include "Exporter.h" #include "VersionInfo.h" -void OTRExporter::WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType, Ship::Version resVersion) +void OTRExporter::WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType, int32_t resVersion) { writer->Write((uint8_t)Endianness::Little); // 0x00 writer->Write((uint8_t)0); // 0x01 diff --git a/OTRExporter/OTRExporter/Exporter.h b/OTRExporter/OTRExporter/Exporter.h index 2f6f23916..853c1b544 100644 --- a/OTRExporter/OTRExporter/Exporter.h +++ b/OTRExporter/OTRExporter/Exporter.h @@ -1,6 +1,7 @@ #pragma once #include "ZResource.h" #include "ZArray.h" +#include "stdint.h" //#include "OTRExporter.h" #include #include @@ -9,5 +10,5 @@ class OTRExporter : public ZResourceExporter { protected: - static void WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType, Ship::Version resVersion = MAJOR_VERSION); + static void WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType, int32_t resVersion = 0); }; \ No newline at end of file diff --git a/OTRExporter/OTRExporter/Main.cpp b/OTRExporter/OTRExporter/Main.cpp index 7895fe759..a7303bbc2 100644 --- a/OTRExporter/OTRExporter/Main.cpp +++ b/OTRExporter/OTRExporter/Main.cpp @@ -18,7 +18,7 @@ #include "MtxExporter.h" #include "AudioExporter.h" #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ static void ExporterParseFileMode(const std::string& buildMode, ZFileMode& fileM printf("BOTR: Generating OTR Archive...\n"); - if (File::Exists(otrFileName)) + if (DiskFile::Exists(otrFileName)) otrArchive = std::shared_ptr(new Ship::Archive(otrFileName, true)); else otrArchive = Ship::Archive::CreateArchive(otrFileName, 40000); @@ -56,7 +56,7 @@ static void ExporterParseFileMode(const std::string& buildMode, ZFileMode& fileM for (auto item : lst) { - auto fileData = File::ReadAllBytes(item); + auto fileData = DiskFile::ReadAllBytes(item); otrArchive->AddFile(StringHelper::Split(item, "Extract/")[1], (uintptr_t)fileData.data(), fileData.size()); } } @@ -70,7 +70,7 @@ static void ExporterProgramEnd() if (Globals::Instance->fileMode == ZFileMode::ExtractDirectory) { std::string romPath = Globals::Instance->baseRomPath.string(); - const std::vector& romData = File::ReadAllBytes(romPath); + const std::vector& romData = DiskFile::ReadAllBytes(romPath); crc = BitConverter::ToUInt32BE(romData, 0x10); printf("Creating version file...\n"); @@ -111,7 +111,7 @@ static void ExporterProgramEnd() files.clear(); // Add any additional files that need to be manually copied... - if (File::Exists("soh.otr")) { + if (DiskFile::Exists("soh.otr")) { return; } const auto& lst = Directory::ListFiles("Extract"); @@ -158,14 +158,14 @@ static void ExporterProgramEnd() splitPath.pop_back(); if (extension == "json") { - const auto &fileData = File::ReadAllBytes(item); + const auto &fileData = DiskFile::ReadAllBytes(item); printf("Adding accessibility texts %s\n", StringHelper::Split(item, "texts/")[1].c_str()); sohOtr->AddFile(StringHelper::Split(item, "Extract/assets/")[1], (uintptr_t)fileData.data(), fileData.size()); } continue; } - const auto& fileData = File::ReadAllBytes(item); + const auto& fileData = DiskFile::ReadAllBytes(item); printf("sohOtr->AddFile(%s)\n", StringHelper::Split(item, "Extract/")[1].c_str()); sohOtr->AddFile(StringHelper::Split(item, item.find("Extract/assets/") != std::string::npos ? "Extract/assets/" : "Extract/")[1], (uintptr_t)fileData.data(), fileData.size()); } @@ -249,7 +249,7 @@ static void ExporterResourceEnd(ZResource* res, BinaryWriter& writer) files[fName] = strem->ToVector(); } else - File::WriteAllBytes("Extract/" + fName, strem->ToVector()); + DiskFile::WriteAllBytes("Extract/" + fName, strem->ToVector()); } auto end = std::chrono::steady_clock::now(); @@ -275,7 +275,7 @@ static void ExporterXMLEnd() void AddFile(std::string fName, std::vector data) { if (Globals::Instance->fileMode != ZFileMode::ExtractDirectory) - File::WriteAllBytes("Extract/" + fName, data); + DiskFile::WriteAllBytes("Extract/" + fName, data); else { std::unique_lock Lock(fileMutex); diff --git a/OTRExporter/OTRExporter/RoomExporter.cpp b/OTRExporter/OTRExporter/RoomExporter.cpp index 00650aa33..b34f49697 100644 --- a/OTRExporter/OTRExporter/RoomExporter.cpp +++ b/OTRExporter/OTRExporter/RoomExporter.cpp @@ -1,7 +1,7 @@ #include "RoomExporter.h" #include "Utils/BinaryWriter.h" #include "Utils/MemoryStream.h" -#include "Utils/File.h" +#include #include #include #include diff --git a/OTRExporter/OTRExporter/VersionInfo.h b/OTRExporter/OTRExporter/VersionInfo.h index 240fc032a..d1b67c7a5 100644 --- a/OTRExporter/OTRExporter/VersionInfo.h +++ b/OTRExporter/OTRExporter/VersionInfo.h @@ -4,6 +4,4 @@ #include #include "src/resource/Resource.h" -#define MAJOR_VERSION Ship::Version::Deckard - extern std::map resourceVersions; \ No newline at end of file diff --git a/ZAPDTR/ExporterTest/RoomExporter.cpp b/ZAPDTR/ExporterTest/RoomExporter.cpp index df5290f0e..e77f26485 100644 --- a/ZAPDTR/ExporterTest/RoomExporter.cpp +++ b/ZAPDTR/ExporterTest/RoomExporter.cpp @@ -1,7 +1,7 @@ #include "RoomExporter.h" #include "CollisionExporter.h" #include "Utils/BinaryWriter.h" -#include "Utils/File.h" +#include #include "Utils/MemoryStream.h" #include "ZRoom/Commands/SetCameraSettings.h" #include "ZRoom/Commands/SetCollisionHeader.h" @@ -367,6 +367,6 @@ void ExporterExample_Room::Save(ZResource* res, const fs::path& outPath, BinaryW } // writer->Close(); - // File::WriteAllBytes(StringHelper::Sprintf("%s", res->GetName().c_str()), + // DiskFile::WriteAllBytes(StringHelper::Sprintf("%s", res->GetName().c_str()), // memStream->ToVector()); } diff --git a/ZAPDTR/ZAPD/GameConfig.cpp b/ZAPDTR/ZAPD/GameConfig.cpp index ba402a80b..cbc21702a 100644 --- a/ZAPDTR/ZAPD/GameConfig.cpp +++ b/ZAPDTR/ZAPD/GameConfig.cpp @@ -5,7 +5,7 @@ #include #include "Utils/Directory.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "ZFile.h" #include "tinyxml2.h" @@ -57,7 +57,7 @@ void GameConfig::ReadTexturePool(const fs::path& texturePoolXmlPath) void GameConfig::GenSymbolMap(const fs::path& symbolMapPath) { - auto symbolLines = File::ReadAllLines(symbolMapPath); + auto symbolLines = DiskFile::ReadAllLines(symbolMapPath); for (std::string& symbolLine : symbolLines) { @@ -79,7 +79,7 @@ void GameConfig::ConfigFunc_ActorList(const tinyxml2::XMLElement& element) { std::string fileName = element.Attribute("File"); std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); + DiskFile::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); for (auto& line : lines) actorList.emplace_back(std::move(line)); @@ -89,7 +89,7 @@ void GameConfig::ConfigFunc_ObjectList(const tinyxml2::XMLElement& element) { std::string fileName = element.Attribute("File"); std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); + DiskFile::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); for (auto& line : lines) objectList.emplace_back(std::move(line)); diff --git a/ZAPDTR/ZAPD/Globals.cpp b/ZAPDTR/ZAPD/Globals.cpp index 8443e4d07..a6b22cfa2 100644 --- a/ZAPDTR/ZAPD/Globals.cpp +++ b/ZAPDTR/ZAPD/Globals.cpp @@ -3,7 +3,7 @@ #include #include -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "WarningHandler.h" #include "tinyxml2.h" @@ -134,12 +134,12 @@ void Globals::BuildAssetTexture(const fs::path& pngFilePath, TextureType texType tex.FromPNG(pngFilePath.string(), texType); std::string cfgPath = StringHelper::Split(pngFilePath.string(), ".")[0] + ".cfg"; - if (File::Exists(cfgPath)) - name = File::ReadAllText(cfgPath); + if (DiskFile::Exists(cfgPath)) + name = DiskFile::ReadAllText(cfgPath); std::string src = tex.GetBodySourceCode(); - File::WriteAllBytes(outPath.string(), src.c_str(), src.size()); + DiskFile::WriteAllBytes(outPath.string(), src.c_str(), src.size()); } std::map& Globals::GetExporterMap() @@ -186,7 +186,7 @@ std::vector Globals::GetBaseromFile(std::string fileName) } else - return File::ReadAllBytes(fileName); + return DiskFile::ReadAllBytes(fileName); } bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, diff --git a/ZAPDTR/ZAPD/Main.cpp b/ZAPDTR/ZAPD/Main.cpp index 4303cdc46..a2030aaa4 100644 --- a/ZAPDTR/ZAPD/Main.cpp +++ b/ZAPDTR/ZAPD/Main.cpp @@ -1,6 +1,6 @@ #include "Globals.h" #include "Utils/Directory.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "WarningHandler.h" @@ -578,7 +578,7 @@ void BuildAssetBackground(const fs::path& imageFilePath, const fs::path& outPath ZBackground background(nullptr); background.ParseBinaryFile(imageFilePath.string(), false); - File::WriteAllText(outPath.string(), background.GetBodySourceCode()); + DiskFile::WriteAllText(outPath.string(), background.GetBodySourceCode()); } void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath) @@ -588,7 +588,7 @@ void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath) std::string src = blob->GetBodySourceCode(); - File::WriteAllText(outPath.string(), src); + DiskFile::WriteAllText(outPath.string(), src); delete blob; } diff --git a/ZAPDTR/ZAPD/Overlays/ZOverlay.cpp b/ZAPDTR/ZAPD/Overlays/ZOverlay.cpp index c3e7c68c7..168ed2374 100644 --- a/ZAPDTR/ZAPD/Overlays/ZOverlay.cpp +++ b/ZAPDTR/ZAPD/Overlays/ZOverlay.cpp @@ -5,7 +5,7 @@ #include #include "Globals.h" #include "Utils/Directory.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "WarningHandler.h" @@ -76,7 +76,7 @@ static const std::unordered_set sSections = { ZOverlay* ZOverlay::FromBuild(fs::path buildPath, fs::path cfgFolderPath) { - std::string cfgText = File::ReadAllText(cfgFolderPath / "overlay.cfg"); + std::string cfgText = DiskFile::ReadAllText(cfgFolderPath / "overlay.cfg"); std::vector cfgLines = StringHelper::Split(cfgText, "\n"); ZOverlay* ovl = new ZOverlay(StringHelper::Strip(cfgLines[0], "\r")); diff --git a/ZAPDTR/ZAPD/ZAnimation.cpp b/ZAPDTR/ZAPD/ZAnimation.cpp index e1a422ab2..199851415 100644 --- a/ZAPDTR/ZAPD/ZAnimation.cpp +++ b/ZAPDTR/ZAPD/ZAnimation.cpp @@ -4,7 +4,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/StringHelper.h" #include "WarningHandler.h" #include "ZFile.h" diff --git a/ZAPDTR/ZAPD/ZAudio.cpp b/ZAPDTR/ZAPD/ZAudio.cpp index 50bb181f2..9f2059271 100644 --- a/ZAPDTR/ZAPD/ZAudio.cpp +++ b/ZAPDTR/ZAPD/ZAudio.cpp @@ -2,7 +2,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "ZFile.h" diff --git a/ZAPDTR/ZAPD/ZBackground.cpp b/ZAPDTR/ZAPD/ZBackground.cpp index 94efe06e9..026002da1 100644 --- a/ZAPDTR/ZAPD/ZBackground.cpp +++ b/ZAPDTR/ZAPD/ZBackground.cpp @@ -2,7 +2,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "WarningHandler.h" @@ -46,7 +46,7 @@ void ZBackground::ParseBinaryFile(const std::string& inFolder, bool appendOutNam if (appendOutName) filepath = filepath / (outName + "." + GetExternalExtension()); - data = File::ReadAllBytes(filepath.string()); + data = DiskFile::ReadAllBytes(filepath.string()); // Add padding. data.insert(data.end(), GetRawDataSize() - data.size(), 0x00); @@ -153,7 +153,7 @@ void ZBackground::Save(const fs::path& outFolder) if (!Globals::Instance->otrMode) { fs::path filepath = outFolder / (outName + "." + GetExternalExtension()); - File::WriteAllBytes(filepath.string(), data); + DiskFile::WriteAllBytes(filepath.string(), data); } } diff --git a/ZAPDTR/ZAPD/ZBlob.cpp b/ZAPDTR/ZAPD/ZBlob.cpp index 759dbbc62..0965d7e4e 100644 --- a/ZAPDTR/ZAPD/ZBlob.cpp +++ b/ZAPDTR/ZAPD/ZBlob.cpp @@ -2,7 +2,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "ZFile.h" @@ -19,7 +19,7 @@ ZBlob* ZBlob::FromFile(const std::string& filePath) { ZBlob* blob = new ZBlob(nullptr); blob->name = StringHelper::Split(Path::GetFileNameWithoutExtension(filePath), ".")[0]; - blob->blobData = File::ReadAllBytes(filePath); + blob->blobData = DiskFile::ReadAllBytes(filePath); return blob; } @@ -87,7 +87,7 @@ std::string ZBlob::GetBodySourceCode() const void ZBlob::Save(const fs::path& outFolder) { if (!Globals::Instance->otrMode) - File::WriteAllBytes((outFolder / (name + ".bin")).string(), blobData); + DiskFile::WriteAllBytes((outFolder / (name + ".bin")).string(), blobData); } bool ZBlob::IsExternalResource() const diff --git a/ZAPDTR/ZAPD/ZDisplayList.cpp b/ZAPDTR/ZAPD/ZDisplayList.cpp index 6ece8f6db..9a43a2a22 100644 --- a/ZAPDTR/ZAPD/ZDisplayList.cpp +++ b/ZAPDTR/ZAPD/ZDisplayList.cpp @@ -9,7 +9,7 @@ #include "Globals.h" #include "OutputFormatter.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "WarningHandler.h" diff --git a/ZAPDTR/ZAPD/ZFile.cpp b/ZAPDTR/ZAPD/ZFile.cpp index 024ba6298..d04f3b7e3 100644 --- a/ZAPDTR/ZAPD/ZFile.cpp +++ b/ZAPDTR/ZAPD/ZFile.cpp @@ -10,7 +10,7 @@ #include "Utils/BinaryWriter.h" #include "Utils/BitConverter.h" #include "Utils/Directory.h" -#include "Utils/File.h" +#include #include "Utils/MemoryStream.h" #include "Utils/Path.h" #include "Utils/StringHelper.h" @@ -190,7 +190,7 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) { if (Globals::Instance->fileMode != ZFileMode::ExtractDirectory) { - if (!File::Exists((basePath / name).string())) + if (!DiskFile::Exists((basePath / name).string())) { std::string errorHeader = StringHelper::Sprintf("binary file '%s' does not exist.", (basePath / name).c_str()); @@ -421,7 +421,7 @@ void ZFile::ExtractResources() if (memStreamFile->GetLength() > 0) { - File::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", + DiskFile::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", Globals::Instance->outputPath.string().c_str(), GetName().c_str()), memStreamFile->ToVector()); @@ -802,7 +802,7 @@ void ZFile::GenerateSourceFiles() OutputFormatter formatter; formatter.Write(sourceOutput); - File::WriteAllText(outPath, formatter.GetOutput()); + DiskFile::WriteAllText(outPath, formatter.GetOutput()); } GenerateSourceHeaderFiles(); @@ -850,7 +850,7 @@ void ZFile::GenerateSourceHeaderFiles() output.pop_back(); if (Globals::Instance->fileMode != ZFileMode::ExtractDirectory) - File::WriteAllText(headerFilename, output); + DiskFile::WriteAllText(headerFilename, output); else if (Globals::Instance->sourceOutputPath != "") { std::string xmlPath = xmlFilePath.string(); @@ -875,7 +875,7 @@ void ZFile::GenerateSourceHeaderFiles() outPath += "/"; } - File::WriteAllText(outPath, output); + DiskFile::WriteAllText(outPath, output); } } @@ -1121,7 +1121,7 @@ std::string ZFile::ProcessDeclarations() extType = "vtx"; auto filepath = outputPath / item.second->varName; - File::WriteAllText( + DiskFile::WriteAllText( StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), extType.c_str()), item.second->text); } diff --git a/ZAPDTR/ZAPD/ZRom.cpp b/ZAPDTR/ZAPD/ZRom.cpp index 5dfad57ae..abce2bf0a 100644 --- a/ZAPDTR/ZAPD/ZRom.cpp +++ b/ZAPDTR/ZAPD/ZRom.cpp @@ -1,6 +1,6 @@ #include "ZRom.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Directory.h" #include "yaz0/yaz0.h" @@ -95,7 +95,7 @@ bool ZRom::IsMQ() { ZRom::ZRom(std::string romPath) { RomVersion version; - romData = File::ReadAllBytes(romPath); + romData = DiskFile::ReadAllBytes(romPath); version.crc = BitConverter::ToInt32BE(romData, 0x10); @@ -189,7 +189,7 @@ ZRom::ZRom(std::string romPath) } auto path = StringHelper::Sprintf("%s/%s", Globals::Instance->fileListPath.string().c_str(), version.listPath.c_str()); - auto txt = File::ReadAllText(path); + auto txt = DiskFile::ReadAllText(path); std::vector lines = StringHelper::Split(txt, "\n"); std::vector decompressedData(1); @@ -222,7 +222,7 @@ ZRom::ZRom(std::string romPath) else files[lines[i]] = outData; - //File::WriteAllBytes(StringHelper::Sprintf("baserom/%s", lines[i].c_str()), files[lines[i]]); + //DiskFile::WriteAllBytes(StringHelper::Sprintf("baserom/%s", lines[i].c_str()), files[lines[i]]); } } diff --git a/ZAPDTR/ZAPD/ZRoom/ZRoom.cpp b/ZAPDTR/ZAPD/ZRoom/ZRoom.cpp index 5831eaa56..11dd70687 100644 --- a/ZAPDTR/ZAPD/ZRoom/ZRoom.cpp +++ b/ZAPDTR/ZAPD/ZRoom/ZRoom.cpp @@ -39,7 +39,7 @@ #include "Commands/Unused1D.h" #include "Commands/ZRoomCommandUnk.h" #include "Globals.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "WarningHandler.h" diff --git a/ZAPDTR/ZAPD/ZScalar.cpp b/ZAPDTR/ZAPD/ZScalar.cpp index 7e4be4d57..6c4cf121a 100644 --- a/ZAPDTR/ZAPD/ZScalar.cpp +++ b/ZAPDTR/ZAPD/ZScalar.cpp @@ -2,7 +2,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/StringHelper.h" #include "WarningHandler.h" #include "ZFile.h" diff --git a/ZAPDTR/ZAPD/ZString.cpp b/ZAPDTR/ZAPD/ZString.cpp index 2a0c1eaf8..4a9069496 100644 --- a/ZAPDTR/ZAPD/ZString.cpp +++ b/ZAPDTR/ZAPD/ZString.cpp @@ -1,6 +1,6 @@ #include "ZString.h" -#include "Utils/File.h" +#include #include "Utils/StringHelper.h" #include "ZFile.h" diff --git a/ZAPDTR/ZAPD/ZText.cpp b/ZAPDTR/ZAPD/ZText.cpp index b024920ba..95e4b5236 100644 --- a/ZAPDTR/ZAPD/ZText.cpp +++ b/ZAPDTR/ZAPD/ZText.cpp @@ -2,7 +2,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "Utils/StringHelper.h" #include "ZFile.h" diff --git a/ZAPDTR/ZAPD/ZTexture.cpp b/ZAPDTR/ZAPD/ZTexture.cpp index 94f4ebd4d..e0a91f082 100644 --- a/ZAPDTR/ZAPD/ZTexture.cpp +++ b/ZAPDTR/ZAPD/ZTexture.cpp @@ -6,7 +6,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" #include "Utils/Directory.h" -#include "Utils/File.h" +#include #include "Utils/Path.h" #include "WarningHandler.h" @@ -727,7 +727,7 @@ void ZTexture::Save(const fs::path& outFolder) // process for generating the Texture Pool XML. if (Globals::Instance->outputCrc) { - File::WriteAllText((Globals::Instance->outputPath / (outName + ".txt")).string(), + DiskFile::WriteAllText((Globals::Instance->outputPath / (outName + ".txt")).string(), StringHelper::Sprintf("%08lX", hash)); } diff --git a/ZAPDTR/ZAPD/ZVector.cpp b/ZAPDTR/ZAPD/ZVector.cpp index 607aac86d..092b876d2 100644 --- a/ZAPDTR/ZAPD/ZVector.cpp +++ b/ZAPDTR/ZAPD/ZVector.cpp @@ -4,7 +4,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include #include "Utils/StringHelper.h" #include "WarningHandler.h" #include "ZFile.h" diff --git a/libultraship b/libultraship index f9e554dc2..19958ec56 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit f9e554dc214c2f23cfc74a26348ef9fd3055451b +Subproject commit 19958ec56fc9966e5a55e4701606f37f2cd8c903 diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index cf11dde1d..1ee0a8830 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #undef PATH_HACK #undef Path @@ -483,7 +484,7 @@ static bool FileSelectHandler(std::shared_ptr Console, const std: } static bool QuitHandler(std::shared_ptr Console, const std::vector& args) { - Ship::Window::GetInstance()->Close(); + Ship::Context::GetInstance()->GetWindow()->Close(); return CMD_SUCCESS; } diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index e19e395e0..e5c704526 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include extern "C" { #include @@ -64,7 +64,7 @@ void DrawDLViewer(bool& open) { ImGui::EndCombo(); } if (activeDisplayList != nullptr) { - auto res = std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(activeDisplayList)); + auto res = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList)); for (int i = 0; i < res->Instructions.size(); i++) { std::string id = "##CMD" + std::to_string(i); Gfx* gfx = (Gfx*)&res->Instructions[i]; diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index b57ac9774..281cf9ece 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -6,7 +6,7 @@ #include "rando_main.hpp" // #include #include -#include +#include #include #define TICKS_PER_SEC 268123480.0 @@ -20,7 +20,7 @@ void RandoMain::GenerateRando(std::unordered_map cvarS // std::string settingsFileName = "./randomizer/latest_settings.json"; // CVarSetString("gLoadedPreset", settingsFileName.c_str()); - std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, seedString).c_str()); + std::string fileName = Ship::Context::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, seedString).c_str()); CVarSetString("gSpoilerLog", fileName.c_str()); CVarSave(); diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 6618fba8c..f47cb482c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include using json = nlohmann::json; @@ -807,8 +807,8 @@ const char* SpoilerLog_Write(int language) { WriteShuffledEntrances(); WriteAllLocations(language); - if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"))) { - std::filesystem::create_directory(Ship::Window::GetPathRelativeToAppDirectory("Randomizer")); + if (!std::filesystem::exists(Ship::Context::GetPathRelativeToAppDirectory("Randomizer"))) { + std::filesystem::create_directory(Ship::Context::GetPathRelativeToAppDirectory("Randomizer")); } std::string jsonString = jsonData.dump(4); @@ -823,7 +823,7 @@ const char* SpoilerLog_Write(int language) { fileNameStream << std::to_string(Settings::hashIconIndexes[i]); } std::string fileName = fileNameStream.str(); - std::ofstream jsonFile(Ship::Window::GetPathRelativeToAppDirectory( + std::ofstream jsonFile(Ship::Context::GetPathRelativeToAppDirectory( (std::string("Randomizer/") + fileName + std::string(".json")).c_str())); jsonFile << std::setw(4) << jsonString << std::endl; jsonFile.close(); diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 7c7ae3ff7..df424f372 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -681,22 +681,22 @@ void InitTTSBank() { break; } - auto sceneFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/scenes" + languageSuffix); + auto sceneFile = Ship::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/scenes" + languageSuffix); if (sceneFile != nullptr) { sceneMap = nlohmann::json::parse(sceneFile->Buffer, nullptr, true, true); } - auto miscFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/misc" + languageSuffix); + auto miscFile = Ship::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/misc" + languageSuffix); if (miscFile != nullptr) { miscMap = nlohmann::json::parse(miscFile->Buffer, nullptr, true, true); } - auto kaleidoFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/kaleidoscope" + languageSuffix); + auto kaleidoFile = Ship::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/kaleidoscope" + languageSuffix); if (kaleidoFile != nullptr) { kaleidoMap = nlohmann::json::parse(kaleidoFile->Buffer, nullptr, true, true); } - auto fileChooseFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/filechoose" + languageSuffix); + auto fileChooseFile = Ship::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/filechoose" + languageSuffix); if (fileChooseFile != nullptr) { fileChooseMap = nlohmann::json::parse(fileChooseFile->Buffer, nullptr, true, true); } diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 01dfd388e..274dbb20a 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -12,7 +12,7 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include #include -#include +#include #include #include #include @@ -204,7 +204,7 @@ namespace GameMenuBar { if (Ship::WindowBackend() == Ship::Backend::DX11) { maxFps = 360; } else { - maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate(); + maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); } int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps); #ifdef __WIIU__ @@ -289,7 +289,7 @@ namespace GameMenuBar { if (Ship::WindowBackend() == Ship::Backend::DX11) { UIWidgets::Spacer(0); if (ImGui::Button("Match Refresh Rate")) { - int hz = Ship::Window::GetInstance()->GetCurrentRefreshRate(); + int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); if (hz >= 20 && hz <= 360) { CVarSetInteger("gInterpolationFPS", hz); Ship::RequestCvarSaveOnNextTick(); @@ -328,7 +328,7 @@ namespace GameMenuBar { UIWidgets::ReEnableComponent(""); } - if (Ship::Window::GetInstance()->CanDisableVerticalSync()) { + if (Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index cfbe95a02..1380515e7 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -201,19 +201,19 @@ const char* constCameraStrings[] = { OTRGlobals::OTRGlobals() { std::vector OTRFiles; - std::string mqPath = Ship::Window::GetPathRelativeToAppDirectory("oot-mq.otr"); + std::string mqPath = Ship::Context::GetPathRelativeToAppDirectory("oot-mq.otr"); if (std::filesystem::exists(mqPath)) { OTRFiles.push_back(mqPath); } - std::string ootPath = Ship::Window::GetPathRelativeToAppDirectory("oot.otr"); + std::string ootPath = Ship::Context::GetPathRelativeToAppDirectory("oot.otr"); if (std::filesystem::exists(ootPath)) { OTRFiles.push_back(ootPath); } - std::string sohOtrPath = Ship::Window::GetPathRelativeToAppBundle("soh.otr"); + std::string sohOtrPath = Ship::Context::GetPathRelativeToAppBundle("soh.otr"); if (std::filesystem::exists(sohOtrPath)) { OTRFiles.push_back(sohOtrPath); } - std::string patchesPath = Ship::Window::GetPathRelativeToAppDirectory("mods"); + std::string patchesPath = Ship::Context::GetPathRelativeToAppDirectory("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)) { @@ -240,7 +240,7 @@ OTRGlobals::OTRGlobals() { OOT_PAL_GC_DBG1, OOT_PAL_GC_DBG2 }; - context = Ship::Window::CreateInstance("Ship of Harkinian", "soh", OTRFiles); + context = Ship::Context::CreateInstance("Ship of Harkinian", "soh", OTRFiles); context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Animation, "Animation", std::make_shared()); context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared()); @@ -329,10 +329,10 @@ uint32_t OTRGlobals::GetInterpolationFPS() { } if (CVarGetInteger("gMatchRefreshRate", 0)) { - return Ship::Window::GetInstance()->GetCurrentRefreshRate(); + return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); } - return std::min(Ship::Window::GetInstance()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20)); + return std::min(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20)); } struct ExtensionEntry { @@ -694,7 +694,7 @@ extern "C" uint32_t GetGIID(uint32_t itemID) { } extern "C" void OTRExtScanner() { - auto lst = *OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles("*").get(); + auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles("*").get(); for (auto& rPath : lst) { std::vector raw = StringHelper::Split(rPath, "."); @@ -708,8 +708,8 @@ extern "C" void OTRExtScanner() { extern "C" void InitOTR() { #if not defined (__SWITCH__) && not defined(__WIIU__) - if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("oot-mq.otr")) && - !std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("oot.otr"))){ + if (!std::filesystem::exists(Ship::Context::GetPathRelativeToAppDirectory("oot-mq.otr")) && + !std::filesystem::exists(Ship::Context::GetPathRelativeToAppDirectory("oot.otr"))){ if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) { Extractor extract; if (!extract.Run()) { @@ -791,9 +791,6 @@ extern "C" void InitOTR() { extern "C" void DeinitOTR() { OTRAudio_Exit(); -#if defined(_WIN32) || defined(__APPLE__) - SpeechSynthesizerUninitialize(); -#endif #ifdef ENABLE_CROWD_CONTROL CrowdControl::Instance->Disable(); CrowdControl::Instance->Shutdown(); @@ -833,7 +830,7 @@ extern "C" uint64_t GetPerfCounter() { // C->C++ Bridge extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) { - OTRGlobals::Instance->context->MainLoop(run_one_game_iter); + OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter); } extern bool ShouldClearTextureCacheAtEndOfFrame; @@ -841,8 +838,8 @@ extern bool ShouldClearTextureCacheAtEndOfFrame; extern "C" void Graph_StartFrame() { #ifndef __WIIU__ using Ship::KbScancode; - int32_t dwScancode = OTRGlobals::Instance->context->GetLastScancode(); - OTRGlobals::Instance->context->SetLastScancode(-1); + int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode(); + OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1); switch (dwScancode) { case KbScancode::LUS_KB_F5: { @@ -911,7 +908,7 @@ extern "C" void Graph_StartFrame() { } } #endif - OTRGlobals::Instance->context->StartFrame(); + OTRGlobals::Instance->context->GetWindow()->StartFrame(); } void RunCommands(Gfx* Commands, const std::vector>& mtx_replacements) { @@ -959,10 +956,10 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { time -= fps; - OTRGlobals::Instance->context->SetTargetFps(fps); + OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps); int threshold = CVarGetInteger("gExtraLatencyThreshold", 80); - OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); + OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); RunCommands(commands, mtx_replacements); @@ -991,19 +988,19 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { float divisor_num = 0.0f; extern "C" void OTRGetPixelDepthPrepare(float x, float y) { - OTRGlobals::Instance->context->GetPixelDepthPrepare(x, y); + OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, y); } extern "C" uint16_t OTRGetPixelDepth(float x, float y) { - return OTRGlobals::Instance->context->GetPixelDepth(x, y); + return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, y); } extern "C" uint32_t ResourceMgr_GetNumGameVersions() { - return OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->GetGameVersions().size(); + return Ship::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions().size(); } extern "C" uint32_t ResourceMgr_GetGameVersion(int index) { - return OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + return Ship::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; } uint32_t IsSceneMasterQuest(s16 sceneNum) { @@ -1048,16 +1045,16 @@ extern "C" uint32_t ResourceMgr_IsGameMasterQuest() { } extern "C" void ResourceMgr_LoadDirectory(const char* resName) { - OTRGlobals::Instance->context->GetResourceManager()->LoadDirectory(resName); + Ship::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName); } extern "C" void ResourceMgr_DirtyDirectory(const char* resName) { - OTRGlobals::Instance->context->GetResourceManager()->DirtyDirectory(resName); + Ship::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName); } // OTRTODO: There is probably a more elegant way to go about this... // Kenix: This is definitely leaking memory when it's called. extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) { - auto lst = OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles(searchMask); + auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles(searchMask); char** result = (char**)malloc(lst->size() * sizeof(char*)); for (size_t i = 0; i < lst->size(); i++) { @@ -1081,7 +1078,7 @@ extern "C" uint8_t ResourceMgr_FileExists(const char* filePath) { } extern "C" void ResourceMgr_LoadFile(const char* resName) { - OTRGlobals::Instance->context->GetResourceManager()->LoadResource(resName); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(resName); } std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { @@ -1092,7 +1089,7 @@ std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { Path.replace(pos, 7, "/mq/"); } } - return OTRGlobals::Instance->context->GetResourceManager()->LoadResource(Path.c_str()); + return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str()); } extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) { @@ -1219,7 +1216,7 @@ std::unordered_map> origi // instead (When that is available). Index can be found using the commented out section below. extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) { auto res = std::static_pointer_cast( - OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path)); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path)); // Leaving this here for people attempting to find the correct Dlist index to patch /*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) { @@ -1254,7 +1251,7 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) { if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) { auto res = std::static_pointer_cast( - OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path)); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path)); Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index]; *gfx = originalGfx[path][patchName].instruction; @@ -1292,15 +1289,15 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) { } extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) { - return (CollisionHeader*)GetResourceDataByName(path, false); + return (CollisionHeader*) GetResourceDataByName(path); } extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) { - return (Vtx*)GetResourceDataByName(path, false); + return (Vtx*) GetResourceDataByName(path); } extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) { - SequenceData* sequence = (SequenceData*)GetResourceDataByName(path, false); + SequenceData* sequence = (SequenceData*) GetResourceDataByName(path); return *sequence; } @@ -1314,7 +1311,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { ExtensionEntry entry = ExtensionCache[path]; - auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path); + auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint8_t* strem2 = (uint8_t*)strem; @@ -1365,11 +1362,11 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { } extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) { - return (SoundFontSample*)GetResourceDataByName(path, false); + return (SoundFontSample*) GetResourceDataByName(path); } extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) { - return (SoundFont*)GetResourceDataByName(path, false); + return (SoundFont*) GetResourceDataByName(path); } extern "C" int ResourceMgr_OTRSigCheck(char* imgData) @@ -1391,7 +1388,7 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData) } extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) { - return (AnimationHeaderCommon*)GetResourceDataByName(path, false); + return (AnimationHeaderCommon*) GetResourceDataByName(path); } extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) { @@ -1408,11 +1405,11 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel pathStr = Ship::Resource::gAltAssetPrefix + pathStr; } - SkeletonHeader* skelHeader = (SkeletonHeader*)GetResourceDataByName(pathStr.c_str(), false); + SkeletonHeader* skelHeader = (SkeletonHeader*) GetResourceDataByName(pathStr.c_str()); // If there isn't an alternate model, load the regular one if (isAlt && skelHeader == NULL) { - skelHeader = (SkeletonHeader*)GetResourceDataByName(path, false); + skelHeader = (SkeletonHeader*) GetResourceDataByName(path); } // This function is only called when a skeleton is initialized. @@ -1440,7 +1437,7 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) { } std::filesystem::path GetSaveFile(std::shared_ptr Conf) { - const std::string fileName = Conf->getString("Game.SaveName", Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav")); + const std::string fileName = Conf->getString("Game.SaveName", Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav")); std::filesystem::path saveFile = std::filesystem::absolute(fileName); if (!exists(saveFile.parent_path())) { @@ -1571,30 +1568,30 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo } extern "C" uint32_t OTRGetCurrentWidth() { - return OTRGlobals::Instance->context->GetCurrentWidth(); + return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth(); } extern "C" uint32_t OTRGetCurrentHeight() { - return OTRGlobals::Instance->context->GetCurrentHeight(); + return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight(); } extern "C" void OTRControllerCallback(uint8_t rumble, uint8_t ledColor) { - auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); + auto controlDeck = Ship::Context::GetInstance()->GetControlDeck(); for (int i = 0; i < controlDeck->GetNumConnectedPorts(); ++i) { auto physicalDevice = controlDeck->GetDeviceFromPortIndex(i); switch (ledColor) { case 0: - physicalDevice->SetLed(i, 255, 0, 0); + physicalDevice->SetLedColor(i, {255, 0, 0}); break; case 1: - physicalDevice->SetLed(i, 0x1E, 0x69, 0x1B); + physicalDevice->SetLedColor(i, {0x1E, 0x69, 0x1B}); break; case 2: - physicalDevice->SetLed(i, 0x64, 0x14, 0x00); + physicalDevice->SetLedColor(i, {0x64, 0x14, 0x00}); break; case 3: - physicalDevice->SetLed(i, 0x00, 0x3C, 0x64); + physicalDevice->SetLedColor(i, {0x00, 0x3C, 0x64}); break; } @@ -1642,7 +1639,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { } extern "C" int Controller_ShouldRumble(size_t slot) { - auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); + auto controlDeck = Ship::Context::GetInstance()->GetControlDeck(); if (slot < controlDeck->GetNumConnectedPorts()) { auto physicalDevice = controlDeck->GetDeviceFromPortIndex(slot); @@ -1656,13 +1653,13 @@ extern "C" int Controller_ShouldRumble(size_t slot) { } extern "C" void Controller_BlockGameInput() { - auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); + auto controlDeck = Ship::Context::GetInstance()->GetControlDeck(); controlDeck->BlockGameInput(); } extern "C" void Controller_UnblockGameInput() { - auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); + auto controlDeck = Ship::Context::GetInstance()->GetControlDeck(); controlDeck->UnblockGameInput(); } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 2ce6d3f48..41c0ed364 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -19,7 +19,7 @@ class OTRGlobals public: static OTRGlobals* Instance; - std::shared_ptr context; + std::shared_ptr context; std::shared_ptr gSaveStateMgr; std::shared_ptr gRandomizer; diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 466e9a7b3..8138d07e7 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -7,7 +7,7 @@ #include "macros.h" #include #include -#include +#include #define NOGDI // avoid various windows defines that conflict with things in z64.h #include @@ -41,7 +41,7 @@ void SaveManager::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, v } std::filesystem::path SaveManager::GetFileName(int fileNum) { - const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav"); } @@ -342,10 +342,10 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext) { } void SaveManager::Init() { - const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); - auto sOldSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav"); - auto sOldBackupSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.bak"); + auto sOldSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav"); + auto sOldBackupSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.bak"); Ship::RegisterHook([this]() { ThreadPoolWait(); }); GameInteractor::Instance->RegisterGameHook([this](uint32_t fileNum) { ThreadPoolWait(); }); @@ -771,7 +771,7 @@ void SaveManager::SaveGlobal() { globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting; globalBlock["language"] = gSaveContext.language; - const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); std::ofstream output(sGlobalPath); diff --git a/soh/soh/resource/importer/AudioSampleFactory.cpp b/soh/soh/resource/importer/AudioSampleFactory.cpp index 80b00c21a..ac338df11 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.cpp +++ b/soh/soh/resource/importer/AudioSampleFactory.cpp @@ -90,7 +90,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { ExtensionEntry entry = ExtensionCache[path]; - auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path); + auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint8_t* strem2 = (uint8_t*)strem; diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index 40f9d420f..02edb1805 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -18,7 +18,7 @@ std::shared_ptr AudioSequenceFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); - return nullptr; + return nullptr; } factory->ParseFileBinary(reader, resource); diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.cpp b/soh/soh/resource/importer/AudioSoundFontFactory.cpp index cb5cdcb2d..7ad588417 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.cpp +++ b/soh/soh/resource/importer/AudioSoundFontFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/AudioSoundFontFactory.h" #include "soh/resource/type/AudioSoundFont.h" #include "spdlog/spdlog.h" -#include "libultraship/bridge.h" +#include "libultraship/libultraship.h" namespace Ship { std::shared_ptr AudioSoundFontFactory::ReadResource(std::shared_ptr resourceMgr, @@ -19,7 +19,7 @@ std::shared_ptr AudioSoundFontFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); - return nullptr; + return nullptr; } factory->ParseFileBinary(reader, resource); @@ -87,7 +87,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr(GetResourceDataByName(sampleFileName.c_str(), true)); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + drum.sound.sample = static_cast(res ? res->GetPointer() : nullptr); } audioSoundFont->drums.push_back(drum); @@ -130,7 +131,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptrReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.lowNotesSound.tuning = reader->ReadFloat(); - instrument.lowNotesSound.sample = static_cast(GetResourceDataByName(sampleFileName.c_str(), true)); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + instrument.lowNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); } else { instrument.lowNotesSound.sample = nullptr; instrument.lowNotesSound.tuning = 0; @@ -141,7 +143,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptrReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.normalNotesSound.tuning = reader->ReadFloat(); - instrument.normalNotesSound.sample = static_cast(GetResourceDataByName(sampleFileName.c_str(), true)); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + instrument.normalNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); } else { instrument.normalNotesSound.sample = nullptr; instrument.normalNotesSound.tuning = 0; @@ -152,7 +155,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptrReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.highNotesSound.tuning = reader->ReadFloat(); - instrument.highNotesSound.sample = static_cast(GetResourceDataByName(sampleFileName.c_str(), true)); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + instrument.highNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); } else { instrument.highNotesSound.sample = nullptr; instrument.highNotesSound.tuning = 0; @@ -176,7 +180,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptrReadInt8(); std::string sampleFileName = reader->ReadString(); soundEffect.tuning = reader->ReadFloat(); - soundEffect.sample = static_cast(GetResourceDataByName(sampleFileName.c_str(), true)); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + soundEffect.sample = static_cast(res ? res->GetPointer() : nullptr); } audioSoundFont->soundEffects.push_back(soundEffect); diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index 16018d01d..dbf1390df 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -11,13 +11,13 @@ std::shared_ptr CollisionHeaderFactory::ReadResource(std::shared_ptrInitData->ResourceVersion) { case 0: - factory = std::make_shared(); - break; + factory = std::make_shared(); + break; } if (factory == nullptr) { SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion); - return nullptr; + return nullptr; } factory->ParseFileBinary(reader, resource); diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 24faaecaf..2431e262a 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/SkeletonFactory.h" #include "soh/resource/type/Skeleton.h" #include -#include +#include namespace Ship { std::shared_ptr SkeletonFactory::ReadResource(std::shared_ptr resourceMgr, @@ -32,8 +32,8 @@ std::shared_ptr SkeletonFactory::ReadResourceXML(std::shared_ptr(resourceMgr, initData); std::shared_ptr factory = nullptr; - switch ((Version)resource->InitData->ResourceVersion) { - case Version::Deckard: + switch (resource->InitData->ResourceVersion) { + case 0: factory = std::make_shared(); break; } @@ -85,8 +85,8 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, for (size_t i = 0; i < skeleton->limbTable.size(); i++) { std::string limbStr = skeleton->limbTable[i]; - auto limb = GetResourceDataByName(limbStr.c_str(), true); - skeleton->skeletonHeaderSegments.push_back(limb); + auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str()); + skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr); } if (skeleton->type == Ship::SkeletonType::Normal) { @@ -142,8 +142,8 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p std::string limbName = child->Attribute("Path"); skel->limbTable.push_back(limbName); - auto limb = GetResourceDataByName(limbName.c_str(), true); - skel->skeletonHeaderSegments.push_back(limb); + auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str()); + skel->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr); } child = child->NextSiblingElement(); diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index 9401708d8..6b901963c 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/SkeletonLimbFactory.h" #include "soh/resource/type/SkeletonLimb.h" #include "spdlog/spdlog.h" -#include "libultraship/bridge.h" +#include "libultraship/libultraship.h" namespace Ship { std::shared_ptr SkeletonLimbFactory::ReadResource(std::shared_ptr resourceMgr, @@ -32,8 +32,8 @@ std::shared_ptr SkeletonLimbFactory::ReadResourceXML(std::shared_ptr(resourceMgr, initData); std::shared_ptr factory = nullptr; - switch ((Version)resource->InitData->ResourceVersion) { - case Version::Deckard: + switch (resource->InitData->ResourceVersion) { + case 0: factory = std::make_shared(); break; } @@ -134,15 +134,15 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr skeletonLimb->limbData.lodLimb.sibling = skeletonLimb->siblingIndex; if (skeletonLimb->dListPtr != "") { - auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true); - skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)dList; + auto dList = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); + skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr); } else { skeletonLimb->limbData.lodLimb.dLists[0] = nullptr; } if (skeletonLimb->dList2Ptr != "") { - auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true); - skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)dList; + auto dList = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str()); + skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr); } else { skeletonLimb->limbData.lodLimb.dLists[1] = nullptr; } @@ -155,8 +155,8 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr skeletonLimb->limbData.standardLimb.dList = nullptr; if (!skeletonLimb->dListPtr.empty()) { - const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true); - skeletonLimb->limbData.standardLimb.dList = (Gfx*)dList; + const auto dList = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); + skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetPointer() : nullptr); } } else if (skeletonLimb->limbType == Ship::LimbType::Curve) { skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex; @@ -165,13 +165,13 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr skeletonLimb->limbData.skelCurveLimb.dList[1] = nullptr; if (!skeletonLimb->dListPtr.empty()) { - const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true); - skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)dList; + const auto dList = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); + skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr); } if (!skeletonLimb->dList2Ptr.empty()) { - const auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true); - skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)dList; + const auto dList = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str()); + skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr); } } else if (skeletonLimb->limbType == Ship::LimbType::Skin) { skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX; @@ -191,12 +191,14 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr } if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList) { - skeletonLimb->limbData.skinLimb.segment = GetResourceDataByName(skeletonLimb->skinDList.c_str(), true); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str()); + skeletonLimb->limbData.skinLimb.segment = res ? res->GetPointer() : nullptr; } else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) { skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt; skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount; skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data(); - skeletonLimb->skinAnimLimbData.dlist = (Gfx*)GetResourceDataByName(skeletonLimb->skinDList2.c_str(), true); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str()); + skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetPointer() : nullptr); for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) { skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size(); @@ -254,7 +256,8 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar limbData.lodLimb.jointPos.z = skelLimb->transZ; if (skelLimb->dListPtr != "") { - limbData.lodLimb.dLists[0] = (Gfx*)GetResourceDataByName((const char*)skelLimb->dListPtr.c_str(), true); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str()); + limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetPointer() : nullptr); } else { limbData.lodLimb.dLists[0] = nullptr; } diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index fe66d6309..ca71f8ec6 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -34,8 +34,8 @@ std::shared_ptr TextFactory::ReadResourceXML(std::shared_ptr(resourceMgr, initData); std::shared_ptr factory = nullptr; - switch ((Version)resource->InitData->ResourceVersion) { - case Version::Deckard: + switch (resource->InitData->ResourceVersion) { + case 0: factory = std::make_shared(); break; } diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index 6b7cfb355..f61e08917 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h" #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" #include "spdlog/spdlog.h" -#include "libultraship/bridge.h" +#include "libultraship/libultraship.h" namespace Ship { std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr resourceMgr, @@ -40,7 +40,7 @@ void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptrnumHeaders; i++) { auto headerName = reader->ReadString(); if (!headerName.empty()) { - setAlternateHeaders->headers.push_back(std::static_pointer_cast(LoadResource(headerName.c_str(), true))); + setAlternateHeaders->headers.push_back(std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); } else { setAlternateHeaders->headers.push_back(nullptr); } diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index 0c60750c2..9c6fb333e 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -1,6 +1,6 @@ #include "soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h" #include "soh/resource/type/scenecommand/SetCollisionHeader.h" -#include "libultraship/bridge.h" +#include "libultraship/libultraship.h" #include "spdlog/spdlog.h" namespace Ship { @@ -34,7 +34,7 @@ void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptrfileName = reader->ReadString(); - setCollisionHeader->collisionHeader = std::static_pointer_cast(LoadResource(setCollisionHeader->fileName.c_str(), true)); + setCollisionHeader->collisionHeader = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); } } // namespace Ship diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index 2441af6f1..dd6336eba 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -1,6 +1,6 @@ #include "soh/resource/importer/scenecommand/SetCutscenesFactory.h" #include "soh/resource/type/scenecommand/SetCutscenes.h" -#include +#include #include "spdlog/spdlog.h" namespace Ship { @@ -35,7 +35,7 @@ void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr ReadCommandId(setCutscenes, reader); setCutscenes->fileName = reader->ReadString(); - setCutscenes->cutscene = std::static_pointer_cast(LoadResource(setCutscenes->fileName.c_str(), true)); + setCutscenes->cutscene = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); } } // namespace Ship diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index f50393b21..132319b8b 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/scenecommand/SetMeshFactory.h" #include "soh/resource/type/scenecommand/SetMesh.h" #include "spdlog/spdlog.h" -#include "libultraship/bridge.h" +#include "libultraship/libultraship.h" namespace Ship { std::shared_ptr SetMeshFactory::ReadResource(std::shared_ptr resourceMgr, @@ -65,8 +65,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reade std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - dlist.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0; - dlist.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0; + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; setMesh->dlists.push_back(dlist); } else if (setMesh->meshHeader.base.type == 1) { @@ -76,8 +78,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reade std::string imgOpa = reader->ReadString(); std::string imgXlu = reader->ReadString(); - pType.opa = imgOpa != "" ? (Gfx*)GetResourceDataByName(imgOpa.c_str(), true) : 0; - pType.xlu = imgXlu != "" ? (Gfx*)GetResourceDataByName(imgXlu.c_str(), true) : 0; + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str()); + pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; + pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; int32_t bgImageCount = reader->ReadUInt32(); setMesh->images.reserve(bgImageCount); @@ -122,8 +126,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reade std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - pType.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0; - pType.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0; + opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; + pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; setMesh->dlists.push_back(pType); } else if (setMesh->meshHeader.base.type == 2) { @@ -138,8 +144,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reade std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - dlist.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0; - dlist.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0; + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; setMesh->dlists2.push_back(dlist); } else { diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 8e0c858da..2e1be596a 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -1,7 +1,7 @@ #include "soh/resource/importer/scenecommand/SetPathwaysFactory.h" #include "soh/resource/type/scenecommand/SetPathways.h" #include "spdlog/spdlog.h" -#include +#include namespace Ship { std::shared_ptr SetPathwaysFactory::ReadResource(std::shared_ptr resourceMgr, @@ -37,7 +37,7 @@ void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr r setPathways->paths.reserve(setPathways->numPaths); for (uint32_t i = 0; i < setPathways->numPaths; i++) { std::string pathFileName = reader->ReadString(); - setPathways->paths.push_back(std::static_pointer_cast(LoadResource(pathFileName.c_str(), true))); + setPathways->paths.push_back(std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()))); } } diff --git a/soh/soh/resource/type/Skeleton.cpp b/soh/soh/resource/type/Skeleton.cpp index 785b02c78..11b36ec70 100644 --- a/soh/soh/resource/type/Skeleton.cpp +++ b/soh/soh/resource/type/Skeleton.cpp @@ -69,7 +69,7 @@ void SkeletonPatcher::UpdateSkeletons() { for (auto skel : skeletons) { Skeleton* newSkel = - (Skeleton*)OTRGlobals::Instance->context->GetResourceManager() + (Skeleton*)Ship::Context::GetInstance()->GetResourceManager() ->LoadResource((isHD ? Ship::Resource::gAltAssetPrefix : "") + skel.vanillaSkeletonPath, true) .get(); diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index 9e06424b9..0c1298caa 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -1,5 +1,5 @@ #include "OTRGlobals.h" -#include +#include #include "soh/resource/type/Scene.h" #include #include "global.h" @@ -16,7 +16,7 @@ extern "C" MessageTableEntry* sStaffMessageEntryTablePtr; //extern "C" MessageTableEntry* _message_0xFFFC_nes; MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) { - auto file = std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath)); + auto file = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); if (file == nullptr) return nullptr; @@ -92,7 +92,7 @@ extern "C" void OTRMessage_Init() if (sStaffMessageEntryTablePtr == NULL) { auto file2 = - std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource( + std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource( "text/staff_message_data_static/staff_message_data_static")); // OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already null. sStaffMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size()); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 5827e4555..9489fa306 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -1,5 +1,5 @@ #include "OTRGlobals.h" -#include +#include #include "soh/resource/type/Scene.h" #include #include "soh/Enhancements/game-interactor/GameInteractor.h" @@ -15,7 +15,7 @@ s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* scene); //Ship::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) { Ship::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName) { - auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(fileName); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fileName); return res.get(); } @@ -76,7 +76,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) { gSaveContext.worldMapArea = 0; OTRScene_ExecuteCommands(play, (Ship::Scene*)play->sceneSegment); Play_InitEnvironment(play, play->skyboxId); - /* auto data = static_cast(Ship::Window::GetInstance() + /* auto data = static_cast(Ship::Context::GetInstance() ->GetResourceManager() ->LoadResource("object_link_child\\object_link_childVtx_01FE08") .get()); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index a53e409f9..7412e48e2 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -1,5 +1,5 @@ #include "OTRGlobals.h" -#include +#include #include "soh/resource/type/Scene.h" #include #include "global.h" @@ -46,7 +46,7 @@ std::shared_ptr ResourceMgr_LoadFile(const char* path) { Path.replace(pos, 7, "/mq/"); } } - return OTRGlobals::Instance->context->GetResourceManager()->LoadFile(Path.c_str()); + return Ship::Context::GetInstance()->GetResourceManager()->LoadFile(Path.c_str()); } // Forward Declaration of function declared in OTRGlobals.cpp diff --git a/soh/src/code/main.c b/soh/src/code/main.c index 7ecff0b63..b59a825c1 100644 --- a/soh/src/code/main.c +++ b/soh/src/code/main.c @@ -4,6 +4,7 @@ #include "global.h" #include "vt.h" +#include "stdio.h" #include #include "soh/OTRGlobals.h" diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index af1c1784d..0c267af62 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -413,7 +413,7 @@ void Map_InitData(PlayState* play, s16 room) { //gMapData->owMinimapTexSize[mapIndex], __FILE__, __LINE__); if (sEntranceIconMapIndex < 24) { - play->interfaceCtx.mapSegment[0] = GetResourceDataByName(minimapTableOW[sEntranceIconMapIndex], true); + play->interfaceCtx.mapSegment[0] = GetResourceDataByName(minimapTableOW[sEntranceIconMapIndex]); play->interfaceCtx.mapSegmentName[0] = minimapTableOW[sEntranceIconMapIndex]; } @@ -447,7 +447,8 @@ void Map_InitData(PlayState* play, s16 room) { //((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0), //0xFF0, __FILE__, __LINE__); - play->interfaceCtx.mapSegment[0] = GetResourceDataByName(minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room], true); + play->interfaceCtx.mapSegment[0] = GetResourceDataByName( + minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]); play->interfaceCtx.mapSegmentName[0] = minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]; R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room]; R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room]; diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 01d5e0409..d556fcc30 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -332,8 +332,8 @@ void Player_SetBootData(PlayState* play, Player* this) { // Custom method used to determine if we're using a custom model for link uint8_t Player_IsCustomLinkModel() { - return (LINK_IS_ADULT && GetResourceIsCustomByName(gLinkAdultSkel, true)) || - (LINK_IS_CHILD && GetResourceIsCustomByName(gLinkChildSkel, true)); + return (LINK_IS_ADULT && GetResourceIsCustomByName(gLinkAdultSkel)) || + (LINK_IS_CHILD && GetResourceIsCustomByName(gLinkChildSkel)); } s32 Player_InBlockingCsMode(PlayState* play, Player* this) { diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index f30bb5b03..3d5acfe40 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -273,7 +273,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h bg->b.imageFlip = 0; if (ResourceMgr_ResourceIsBackground((char*) source)) { - char* blob = (char*) GetResourceDataByName((char*) source, true); + char* blob = (char*) GetResourceDataByName((char *) source); swapAndConvertJPEG(blob); bg->b.imagePtr = (uintptr_t) blob; } diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 2ae04e344..5b52ca92d 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -87,7 +87,7 @@ void func_808C12C4(u8* arg1, s16 arg2) { void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) { arg0 = GetResourceDataByNameHandlingMQ(arg0); - floorTex = GetResourceDataByName(floorTex, false); + floorTex = GetResourceDataByName(floorTex); u16* temp_s3 = SEGMENTED_TO_VIRTUAL(arg0); u16* temp_s1 = SEGMENTED_TO_VIRTUAL(floorTex); @@ -186,8 +186,8 @@ void BossDodongo_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead - u16* LavaFloorTex = GetResourceDataByName(gDodongosCavernBossLavaFloorTex, false); - u16* LavaFloorRockTex = GetResourceDataByName(sLavaFloorRockTex, false); + u16* LavaFloorTex = GetResourceDataByName(gDodongosCavernBossLavaFloorTex); + u16* LavaFloorRockTex = GetResourceDataByName(sLavaFloorRockTex); temp_s1_3 = SEGMENTED_TO_VIRTUAL(LavaFloorTex); temp_s2 = SEGMENTED_TO_VIRTUAL(LavaFloorRockTex); Actor_Kill(&this->actor); @@ -1018,8 +1018,8 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { } if (this->unk_1C6 != 0) { - u16* ptr1 = GetResourceDataByName(sLavaFloorLavaTex, false); - u16* ptr2 = GetResourceDataByName(sLavaFloorRockTex, false); + u16* ptr1 = GetResourceDataByName(sLavaFloorLavaTex); + u16* ptr2 = GetResourceDataByName(sLavaFloorRockTex); s16 i2; for (i2 = 0; i2 < 20; i2++) { diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index ec59ae35b..f27915f39 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -1220,7 +1220,7 @@ void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { void BossGanon_ShatterWindows(u8 windowShatterState) { s16 i; - u8* templateTex = GetResourceDataByName(SEGMENTED_TO_VIRTUAL(gGanondorfWindowShatterTemplateTex), false); + u8* templateTex = GetResourceDataByName(SEGMENTED_TO_VIRTUAL(gGanondorfWindowShatterTemplateTex)); for (i = 0; i < ARRAY_COUNT(sWindowShatterTex); i++) { if ((sWindowShatterTex[i] != 1) && (Rand_ZeroOne() < 0.03f)) { diff --git a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 60c51c036..e17edf9e1 100644 --- a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -397,7 +397,7 @@ void EnJsjutan_Draw(Actor* thisx, PlayState* play2) { if (this->unk_164) { this->unk_164 = false; - u8* carpTex = GetResourceDataByName(sCarpetTex, false); + u8* carpTex = GetResourceDataByName(sCarpetTex); u8* shadTex = sShadowTex; for (i = 0; i < ARRAY_COUNT(sShadowTex); i++) { if (((u16*)carpTex)[i] != 0) { // Hack to bypass ZAPD exporting textures as u64. diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 48ec05600..56afb768f 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -3173,8 +3173,8 @@ void KaleidoScope_LoadDungeonMap(PlayState* play) { interfaceCtx->mapSegmentName[0] = sDungeonMapTexs[R_MAP_TEX_INDEX]; interfaceCtx->mapSegmentName[1] = sDungeonMapTexs[R_MAP_TEX_INDEX + 1]; - interfaceCtx->mapSegment[0] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX], true); - interfaceCtx->mapSegment[1] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX + 1], true); + interfaceCtx->mapSegment[0] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX]); + interfaceCtx->mapSegment[1] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX + 1]); } void KaleidoScope_UpdateDungeonMap(PlayState* play) {