From 44888584c4c9d6f18745ac54718d5c1f9c6e0306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= <159546+serprex@users.noreply.github.com> Date: Wed, 10 Jun 2026 01:36:08 +0000 Subject: [PATCH] Fix extended file select info showing random triforce piece counts (#6687) --- soh/soh/SaveManager.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 0772b93ebd..b5d1246b2c 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -551,6 +551,10 @@ void SaveManager::StartupCheckAndInitMeta(int fileNum) { fileMetaInfo[fileNum].gregFound = false; fileMetaInfo[fileNum].filenameLanguage = baseBlock.value("filenameLanguage", 0); fileMetaInfo[fileNum].hasWallet = !isRando; + fileMetaInfo[fileNum].triforcePieces = 0; + fileMetaInfo[fileNum].maxTriforcePieces = 0; + fileMetaInfo[fileNum].hasFishingRod = !isRando; + fileMetaInfo[fileNum].fishingPoleShuffled = false; fileMetaInfo[fileNum].defense = baseBlock["inventory"]["defenseHearts"]; fileMetaInfo[fileNum].health = baseBlock["health"]; @@ -568,6 +572,15 @@ void SaveManager::StartupCheckAndInitMeta(int fileNum) { (int16_t)baseBlock["randomizerInf"][RAND_INF_GREG_FOUND >> 4] & (1 << (RAND_INF_GREG_FOUND & 0xF)); fileMetaInfo[fileNum].hasWallet = (int16_t)baseBlock["randomizerInf"][RAND_INF_HAS_WALLET >> 4] & (1 << (RAND_INF_HAS_WALLET & 0xF)); + fileMetaInfo[fileNum].triforcePieces = randoBlock.value("triforcePiecesCollected", 0); + nlohmann::json& randoSettings = randoBlock["randoSettings"]; + if (randoSettings[RSK_TRIFORCE_HUNT].get() != 0) { + fileMetaInfo[fileNum].maxTriforcePieces = + randoSettings[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].get() + 1; + } + fileMetaInfo[fileNum].hasFishingRod = (int16_t)baseBlock["randomizerInf"][RAND_INF_FISHING_POLE_FOUND >> 4] & + (1 << (RAND_INF_FISHING_POLE_FOUND & 0xF)); + fileMetaInfo[fileNum].fishingPoleShuffled = randoSettings[RSK_SHUFFLE_FISHING_POLE].get() != 0; fileMetaInfo[fileNum].requiresMasterQuest = randoBlock["masterQuestDungeonCount"] > 0; // If the file is not marked as Master Quest, it could still theoretically be a rando save with all 12 MQ // dungeons, in which case we don't actually require a vanilla OTR. @@ -2405,27 +2418,7 @@ void SaveManager::CopyZeldaFile(int from, int to) { #else std::filesystem::copy_file(GetFileName(from), GetFileName(to)); #endif - fileMetaInfo[to].valid = true; - fileMetaInfo[to].deaths = fileMetaInfo[from].deaths; - for (int i = 0; i < ARRAY_COUNT(fileMetaInfo[to].playerName); i++) { - fileMetaInfo[to].playerName[i] = fileMetaInfo[from].playerName[i]; - } - for (int i = 0; i < ARRAY_COUNT(fileMetaInfo[to].seedHash); i++) { - fileMetaInfo[to].seedHash[i] = fileMetaInfo[from].seedHash[i]; - } - fileMetaInfo[to].healthCapacity = fileMetaInfo[from].healthCapacity; - fileMetaInfo[to].questItems = fileMetaInfo[from].questItems; - fileMetaInfo[to].defense = fileMetaInfo[from].defense; - fileMetaInfo[to].health = fileMetaInfo[from].health; - fileMetaInfo[to].randoSave = fileMetaInfo[from].randoSave; - fileMetaInfo[to].requiresMasterQuest = fileMetaInfo[from].requiresMasterQuest; - fileMetaInfo[to].requiresOriginal = fileMetaInfo[from].requiresOriginal; - fileMetaInfo[to].buildVersionMajor = fileMetaInfo[from].buildVersionMajor; - fileMetaInfo[to].buildVersionMinor = fileMetaInfo[from].buildVersionMinor; - fileMetaInfo[to].buildVersionPatch = fileMetaInfo[from].buildVersionPatch; - fileMetaInfo[to].filenameLanguage = fileMetaInfo[from].filenameLanguage; - SohUtils::CopyStringToCharArray(fileMetaInfo[to].buildVersion, fileMetaInfo[from].buildVersion, - ARRAY_COUNT(fileMetaInfo[to].buildVersion)); + fileMetaInfo[to] = fileMetaInfo[from]; } void SaveManager::DeleteZeldaFile(int fileNum) {