From 5dd3b39a8301a0a204288eba0f0d4d183e6a92f0 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 19 Nov 2024 15:39:30 -0700 Subject: [PATCH 1/6] Fix Plando Window Crash on new installs (#4557) * Add check for Randomizer folder existing, and creating it if not, to plando window. * Changed seed list population to just bail if the Randomizer folder doesn't exist. Added button disabling to prevent crashes loading or saving empty structures. --- soh/soh/Enhancements/randomizer/Plandomizer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index 732ef700b..fcec76887 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -361,9 +361,11 @@ void PlandomizerPopulateSeedList() { existingSeedList.clear(); auto spoilerPath = Ship::Context::GetPathRelativeToAppDirectory("Randomizer"); - for (const auto& entry : std::filesystem::directory_iterator(spoilerPath)) { - if (entry.is_regular_file() && entry.path().extension() == ".json") { - existingSeedList.push_back(entry.path().stem().string()); + if (std::filesystem::exists(spoilerPath)) { + for (const auto& entry : std::filesystem::directory_iterator(spoilerPath)) { + if (entry.is_regular_file() && entry.path().extension() == ".json") { + existingSeedList.push_back(entry.path().stem().string()); + } } } } @@ -875,15 +877,18 @@ void PlandomizerDrawOptions() { } else { ImGui::Text("No Spoiler Logs found."); } - + ImGui::BeginDisabled(existingSeedList.empty()); if (ImGui::Button("Load")) { logTemp = existingSeedList[selectedList].c_str(); PlandomizerLoadSpoilerLog(logTemp.c_str()); } + ImGui::EndDisabled(); + ImGui::BeginDisabled(spoilerLogData.empty()); ImGui::SameLine(); if (ImGui::Button("Save")) { PlandomizerSaveSpoilerLog(); } + ImGui::EndDisabled(); ImGui::TableNextColumn(); ImGui::SeparatorText("Current Seed Hash"); From 48500419432a7a56f1a42c0ce1e658fe9b3fc389 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 19 Nov 2024 15:39:42 -0700 Subject: [PATCH 2/6] Fix Gift from Sages not showing in tracker (it's a valid shuffle now!). (#4556) Bit of tracker code cleanup. --- .../Enhancements/randomizer/3drando/hints.cpp | 2 +- .../randomizer/randomizer_check_tracker.cpp | 34 ------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 9831c2d2b..ee6a638f5 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -757,7 +757,7 @@ void CreateStaticHintFromData(RandomizerHint hint, StaticHintInfo staticData){ //If we get to here then it means a location got through with no area assignment, which means something went wrong elsewhere. SPDLOG_DEBUG("Attempted to hint location with no areas: "); SPDLOG_DEBUG(Rando::StaticData::GetLocation(loc)->GetName()); - assert(false); + //assert(false); areas.push_back(RA_NONE); } else { areas.push_back(ctx->GetItemLocation(loc)->GetRandomArea()); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 4cd6fc844..2add45f1d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -34,8 +34,6 @@ extern std::vector dungeonRewardMedallions; extern std::vector songItems; extern std::vector equipmentItems; -#define RCO_RAORU { RC_GIFT_FROM_SAGES, RCVORMQ_BOTH, RCTYPE_DUNGEON_REWARD, RCAREA_MARKET, ACTOR_ID_MAX, SCENE_ID_MAX, 0x00, GI_NONE, false, "Gift from Raoru", "Gift from Raoru", true }; - using json = nlohmann::json; namespace CheckTracker { @@ -218,34 +216,6 @@ static ImGuiTextFilter checkSearch; std::array filterAreasHidden = { 0 }; std::array filterChecksHidden = { 0 }; -void SongFromImpa() { - if (IS_RANDO) { - if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_CHILD_ZELDA) == RO_GENERIC_ON && IS_RANDO) { - //if (gSaveContext.checkTrackerData[RC_SONG_FROM_IMPA].status != RCSHOW_SAVED) { - // gSaveContext.checkTrackerData[RC_SONG_FROM_IMPA].status = RCSHOW_SAVED; - //} - } - } -} - -void GiftFromSages() { - if (!IS_RANDO) { - //DefaultCheckData(RC_GIFT_FROM_SAGES); - } -} - -std::vector checks; -// Function for adding Link's Pocket check -void LinksPocket() { - /*if (IS_RANDO) { - if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LINKS_POCKET) != RO_LINKS_POCKET_NOTHING || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_DUNGEON_REWARDS) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) { - DefaultCheckData(RC_LINKS_POCKET); - gSaveContext.checkTrackerData[RC_LINKS_POCKET].status = RCSHOW_SAVED; - } - }*/ -} - void TrySetAreas() { if (checksByArea.empty()) { for (int i = RCAREA_KOKIRI_FOREST; i < RCAREA_INVALID; i++) { @@ -509,9 +479,6 @@ void CheckTrackerLoadGame(int32_t fileNum) { showVOrMQ = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_RANDOM_NUMBER || (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_SET_NUMBER && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) < 12)); - LinksPocket(); - SongFromImpa(); - GiftFromSages(); initialized = true; UpdateAllOrdering(); UpdateInventoryChecks(); @@ -1256,7 +1223,6 @@ bool IsCheckShuffled(RandomizerCheck rc) { (loc->GetRCType() != RCTYPE_SHOP || (showShops && OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1).enGirlAShopItem == 50)) && (rc != RC_TRIFORCE_COMPLETED || !hideTriforceCompleted) && - (rc != RC_GIFT_FROM_SAGES || !IS_RANDO) && (loc->GetRCType() != RCTYPE_SCRUB || showScrubs || (showMajorScrubs && (rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized From 3f2d8ddc012ff319b8d392dfcebc33d1191082b0 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 19 Nov 2024 15:40:23 -0700 Subject: [PATCH 3/6] Fix infinite freeze in rando on GS pickup. (#4555) --- soh/soh/Enhancements/randomizer/hook_handlers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index c4e0639c9..17b0107e8 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1399,6 +1399,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } break; } + case VB_FREEZE_ON_SKULL_TOKEN: case VB_TRADE_TIMER_ODD_MUSHROOM: case VB_TRADE_TIMER_EYEDROPS: case VB_TRADE_TIMER_FROG: From 53b72a2507172f9160bf482658ec694682921079 Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 19 Nov 2024 18:18:18 -0500 Subject: [PATCH 4/6] Update PR artifacts actions and exclude soh.otr (#4558) * update pr artifacts actions and exclude soh.otr * remove deprecated save-always for windows cache --- .github/workflows/generate-builds.yml | 1 - .github/workflows/pr-artifacts.yml | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generate-builds.yml b/.github/workflows/generate-builds.yml index 29cd94c8a..85eeaf4d9 100644 --- a/.github/workflows/generate-builds.yml +++ b/.github/workflows/generate-builds.yml @@ -244,7 +244,6 @@ jobs: - name: Cache build folder uses: actions/cache@v4 with: - save-always: true key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-build-${{ github.ref }} diff --git a/.github/workflows/pr-artifacts.yml b/.github/workflows/pr-artifacts.yml index 43b985b5d..85db7de59 100644 --- a/.github/workflows/pr-artifacts.yml +++ b/.github/workflows/pr-artifacts.yml @@ -12,7 +12,7 @@ jobs: if: ${{ github.event.workflow_run.event == 'pull_request' }} steps: - id: 'pr-number' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: result-encoding: string script: | @@ -20,8 +20,9 @@ jobs: const pullHeadSHA = '${{github.event.workflow_run.head_sha}}'; const pullUserId = ${{github.event.sender.id}}; const prNumber = await (async () => { - const pulls = await github.rest.pulls.list({owner, repo}); - for await (const {data} of github.paginate.iterator(pulls)) { + for await (const { data } of github.paginate.iterator( + github.rest.pulls.list, { owner, repo } + )) { for (const pull of data) { if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) { return pull.number; @@ -36,7 +37,7 @@ jobs: return prNumber; - id: 'artifacts-text' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: result-encoding: string script: | @@ -47,13 +48,13 @@ jobs: }); return allArtifacts.data.artifacts.reduce((acc, item) => { - if (item.name === "assets") return acc; + if (item.name === "soh.otr") return acc; acc += ` - [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip)`; return acc; }, '### Build Artifacts'); - id: 'add-to-pr' - uses: garrettjoecox/pr-section@3.1.0 + uses: garrettjoecox/pr-section@4.0.0 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' pr-number: ${{ steps.pr-number.outputs.result }} From 3e313bd0632cdced509e49d56695476a21aabe69 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:22:54 +0000 Subject: [PATCH 5/6] Enhacment presets no longer reimport randomiser settings (#4561) * Enhacment presets no longer reimport randomiser settings * make the change only apply to the Randomiser button instead --- soh/soh/Enhancements/presets.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/presets.cpp b/soh/soh/Enhancements/presets.cpp index c98f64eda..8c7126e42 100644 --- a/soh/soh/Enhancements/presets.cpp +++ b/soh/soh/Enhancements/presets.cpp @@ -74,7 +74,9 @@ void DrawPresetSelector(PresetType presetTypeId) { applyPreset(selectedPresetDef.entries); } Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - Rando::Context::GetInstance()->GetSettings()->ReloadOptions(); + if (presetTypeId == PRESET_TYPE_RANDOMIZER){ + Rando::Context::GetInstance()->GetSettings()->ReloadOptions(); + } } ImGui::PopStyleVar(1); } From 01719283b346e13cb8ec82a1e44b32585098de3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 19 Nov 2024 23:29:15 +0000 Subject: [PATCH 6/6] typo: incorrect variable assignment (#4560) --- soh/soh/Enhancements/randomizer/hook_handlers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 17b0107e8..35badbce6 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -2196,7 +2196,7 @@ void RandomizerRegisterHooks() { onGameFrameUpdateHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnGameFrameUpdateHandler); onSceneSpawnActorsHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnSceneSpawnActorsHandler); onPlayDestroyHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnPlayDestroyHandler); - onPlayDestroyHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnExitGameHandler); + onExitGameHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnExitGameHandler); onKaleidoUpdateHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnKaleidoscopeUpdateHandler); if (RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF) {