From 276db580e83371f098f214ffcb657a7fb552e812 Mon Sep 17 00:00:00 2001 From: Archez Date: Thu, 5 Dec 2024 11:00:39 -0500 Subject: [PATCH 01/10] Fix display list offset values and unhandled opcodes (#4618) * Fix display list offset values and unhandled opcodes * fix unknown opcodes on custom chest textures --- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 3 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 30 +++++++++++++++++++ .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 3 +- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index 574685b04..98904f138 100644 --- a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -179,7 +179,8 @@ void func_808BA2CC(BgTokiHikari* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10); + // SOH [Port] Index adjust 11 -> 14 (for LUS marker and gsSPVertex) to account for our extraction size changes + gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10 + 2 + 1); Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index f3c7e86ff..9a52fa615 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -737,6 +737,8 @@ void EnBox_CreateExtraChestTextures() { gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasGreenTreasureChestSideAndTopTex), }; + Gfx gNoOp[] = { gsDPNoOp() }; + Gfx* frontCmd = ResourceMgr_LoadGfxByName(gTreasureChestChestFrontDL); int frontIndex = 0; while (frontCmd->words.w0 >> 24 != G_ENDDL) { @@ -745,6 +747,20 @@ void EnBox_CreateExtraChestTextures() { gKeyTreasureChestChestFrontDL[frontIndex] = *frontCmd; gChristmasRedTreasureChestChestFrontDL[frontIndex] = *frontCmd; gChristmasGreenTreasureChestChestFrontDL[frontIndex] = *frontCmd; + + // Set the second instruction of img OTR hash opcode to noop, since we will replace it with the + // OTR filepath opcode below + if (frontCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) { + frontIndex++; + ++frontCmd; + + gSkullTreasureChestChestFrontDL[frontIndex] = gNoOp[0]; + gGoldTreasureChestChestFrontDL[frontIndex] = gNoOp[0]; + gKeyTreasureChestChestFrontDL[frontIndex] = gNoOp[0]; + gChristmasRedTreasureChestChestFrontDL[frontIndex] = gNoOp[0]; + gChristmasGreenTreasureChestChestFrontDL[frontIndex] = gNoOp[0]; + } + frontIndex++; ++frontCmd; } @@ -783,6 +799,20 @@ void EnBox_CreateExtraChestTextures() { gKeyTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd; gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd; gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd; + + // Set the second instruction of img OTR hash opcode to noop, since we will replace it with the + // OTR filepath opcode below + if (sideCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) { + sideIndex++; + ++sideCmd; + + gSkullTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0]; + gGoldTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0]; + gKeyTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0]; + gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0]; + gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0]; + } + sideIndex++; ++sideCmd; } diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 5a1cb54ce..6067ed361 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -108,7 +108,8 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, sMaterial2DL); gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1, scroll * (-1), scroll, 32, 32)); - gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11); + // SOH [Port] Index adjust 11 -> 14 (for LUS marker and load texture) to account for our extraction size changes + gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11 + 2 + 1); CLOSE_DISPS(play->state.gfxCtx); } From 09f297392f8744e5ea939eb65e49c109a67a32ca Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 5 Dec 2024 21:35:27 -0700 Subject: [PATCH 02/10] Fix GetItemObtainabilityFromRandomizerGet check for sticks and nuts not accounting for not shuffling stick or nut bags and also not starting with related ammo. (#4633) --- soh/soh/Enhancements/randomizer/randomizer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 12f52516a..030902026 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -478,7 +478,8 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGe (CUR_UPG_VALUE(UPG_STICKS) < 3 ? CAN_OBTAIN : CANT_OBTAIN_ALREADY_HAVE); case RG_DEKU_STICK_1: case RG_BUY_DEKU_STICK_1: - return CUR_UPG_VALUE(UPG_STICKS) ? CAN_OBTAIN : CANT_OBTAIN_NEED_UPGRADE; + return CUR_UPG_VALUE(UPG_STICKS) || !OTRGlobals::Instance->gRandoContext->GetOption(RSK_SHUFFLE_DEKU_STICK_BAG).GetContextOptionIndex() + ? CAN_OBTAIN : CANT_OBTAIN_NEED_UPGRADE; case RG_PROGRESSIVE_NUT_UPGRADE: return infiniteUpgrades != RO_INF_UPGRADES_OFF ? (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_NUT_UPGRADE) ? CANT_OBTAIN_ALREADY_HAVE : CAN_OBTAIN) : @@ -487,7 +488,8 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGe case RG_DEKU_NUTS_10: case RG_BUY_DEKU_NUTS_5: case RG_BUY_DEKU_NUTS_10: - return CUR_UPG_VALUE(UPG_NUTS) ? CAN_OBTAIN : CANT_OBTAIN_NEED_UPGRADE; + return CUR_UPG_VALUE(UPG_NUTS) || !OTRGlobals::Instance->gRandoContext->GetOption(RSK_SHUFFLE_DEKU_NUT_BAG).GetContextOptionIndex() + ? CAN_OBTAIN : CANT_OBTAIN_NEED_UPGRADE; case RG_PROGRESSIVE_BOMB_BAG: return infiniteUpgrades != RO_INF_UPGRADES_OFF ? (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMB_BAG) ? CANT_OBTAIN_ALREADY_HAVE : CAN_OBTAIN) : From bccd96966fa9339f3d85dad39c7fbc00a34a2246 Mon Sep 17 00:00:00 2001 From: Archez Date: Fri, 6 Dec 2024 10:36:38 -0500 Subject: [PATCH 03/10] Fix crash when toggling alt assets while paused (#4621) --- soh/src/code/z_play.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 219b3a448..df1314e71 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -12,6 +12,7 @@ #include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/OTRGlobals.h" +#include "soh/ResourceManagerHelpers.h" #include "soh/SaveManager.h" #include "soh/framebuffer_effects.h" @@ -1327,15 +1328,16 @@ void Play_Draw(PlayState* play) { // Track render size when paused and that a copy was performed static u32 lastPauseWidth; static u32 lastPauseHeight; - static u8 hasCapturedPauseBuffer; - u8 recapturePauseBuffer = false; + static bool lastAltAssets; + static bool hasCapturedPauseBuffer; + bool recapturePauseBuffer = false; - // If the size has changed or dropped frames leading to the buffer not being copied, + // If the size has changed, alt assets toggled, or dropped frames leading to the buffer not being copied, // set the prerender state back to setup to copy a new frame. - // This requires not rendering kaleido during this copy to avoid kaleido being copied + // This requires not rendering kaleido during this copy to avoid kaleido itself being copied too. if ((R_PAUSE_MENU_MODE == 2 || R_PAUSE_MENU_MODE == 3) && (lastPauseWidth != OTRGetGameRenderWidth() || lastPauseHeight != OTRGetGameRenderHeight() || - !hasCapturedPauseBuffer)) { + lastAltAssets != ResourceMgr_IsAltAssetsEnabled() || !hasCapturedPauseBuffer)) { R_PAUSE_MENU_MODE = 1; recapturePauseBuffer = true; } @@ -1594,6 +1596,7 @@ void Play_Draw(PlayState* play) { // #region SOH [Port] Custom handling for pause prerender background capture lastPauseWidth = OTRGetGameRenderWidth(); lastPauseHeight = OTRGetGameRenderHeight(); + lastAltAssets = ResourceMgr_IsAltAssetsEnabled(); hasCapturedPauseBuffer = false; FB_CopyToFramebuffer(&gfxP, 0, gPauseFrameBuffer, false, &hasCapturedPauseBuffer); From 732b8c10f7bdee92a53a8e5d8df970d9c806b6e5 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:46:31 -0500 Subject: [PATCH 04/10] bump LUS (#4638) * bump LUS * bump OTRExporter --- OTRExporter | 2 +- libultraship | 2 +- .../Enhancements/audio/AudioCollection.cpp | 4 +- soh/soh/Enhancements/audio/AudioEditor.cpp | 30 +++++------ .../controls/SohInputEditorWindow.cpp | 10 ++-- .../cosmetics/CosmeticsEditor.cpp | 52 +++++++++---------- soh/soh/Enhancements/debugconsole.cpp | 2 +- .../GameInteractor_RawAction.cpp | 2 +- soh/soh/Enhancements/presets.cpp | 2 +- .../randomizer/3drando/rando_main.cpp | 2 +- soh/soh/Enhancements/randomizer/option.cpp | 10 ++-- .../Enhancements/randomizer/randomizer.cpp | 18 +++---- .../randomizer/randomizer_item_tracker.cpp | 2 +- .../Enhancements/timesplits/TimeSplits.cpp | 4 +- soh/soh/Enhancements/tts/tts.cpp | 8 +-- soh/soh/Network/CrowdControl/CrowdControl.cpp | 8 +-- soh/soh/Network/Sail/Sail.cpp | 8 +-- soh/soh/OTRGlobals.cpp | 6 +-- soh/soh/SohMenuBar.cpp | 16 +++--- soh/soh/UIWidgets.cpp | 22 ++++---- 20 files changed, 105 insertions(+), 105 deletions(-) diff --git a/OTRExporter b/OTRExporter index 467f36589..c872b1ff1 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 467f36589b0d6fe6c7f9d248945650a459bce768 +Subproject commit c872b1ff18b793a97385ccf1c864c3fc04051cc7 diff --git a/libultraship b/libultraship index 0302eab05..d252cc241 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 0302eab051a7e0e5a8dc208aca5b00899a91808c +Subproject commit d252cc241e0ff2270a289abba274ed43bd0b1792 diff --git a/soh/soh/Enhancements/audio/AudioCollection.cpp b/soh/soh/Enhancements/audio/AudioCollection.cpp index 5b0165637..28e8d3d99 100644 --- a/soh/soh/Enhancements/audio/AudioCollection.cpp +++ b/soh/soh/Enhancements/audio/AudioCollection.cpp @@ -389,7 +389,7 @@ void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) { excludedSequences.insert(seqInfo); includedSequences.erase(seqInfo); CVarSetInteger(cvarKey.c_str(), 1); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { @@ -397,7 +397,7 @@ void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { includedSequences.insert(seqInfo); excludedSequences.erase(seqInfo); CVarClear(cvarKey.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } void AudioCollection::InitializeShufflePool() { diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 954baa681..d56c8269c 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -204,7 +204,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); ResetGroup(map, type); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -215,7 +215,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); RandomizeGroup(type); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -226,7 +226,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); LockGroup(map, type); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -237,7 +237,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); UnlockGroup(map, type); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -282,7 +282,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (ImGui::Selectable(seqData.label.c_str())) { CVarSetInteger(cvarKey.c_str(), value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); UpdateCurrentBGM(defaultValue, type); } @@ -302,7 +302,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (ImGui::Button(resetButton.c_str())) { CVarClear(cvarKey.c_str()); CVarClear(cvarLockKey.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); UpdateCurrentBGM(defaultValue, seqData.category); } UIWidgets::Tooltip("Reset to default"); @@ -323,7 +323,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (locked) { CVarClear(cvarLockKey.c_str()); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); UpdateCurrentBGM(defaultValue, type); } } @@ -336,7 +336,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { } else { CVarSetInteger(cvarLockKey.c_str(), 1); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } UIWidgets::Tooltip(locked ? "Sound locked" : "Sound unlocked"); } @@ -516,7 +516,7 @@ void AudioEditor::DrawElement() { const std::string resetButton = "Reset##linkVoiceFreqMultiplier"; if (ImGui::Button(resetButton.c_str())) { CVarSetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0f); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::NewLine(); @@ -704,14 +704,14 @@ void AudioEditor_RandomizeAll() { RandomizeGroup(type); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ReplayCurrentBGM(); } void AudioEditor_RandomizeGroup(SeqType group) { RandomizeGroup(group); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ReplayCurrentBGM(); } @@ -720,14 +720,14 @@ void AudioEditor_ResetAll() { ResetGroup(AudioCollection::Instance->GetAllSequences(), type); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ReplayCurrentBGM(); } void AudioEditor_ResetGroup(SeqType group) { ResetGroup(AudioCollection::Instance->GetAllSequences(), group); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ReplayCurrentBGM(); } @@ -736,7 +736,7 @@ void AudioEditor_LockAll() { LockGroup(AudioCollection::Instance->GetAllSequences(), type); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } void AudioEditor_UnlockAll() { @@ -744,5 +744,5 @@ void AudioEditor_UnlockAll() { UnlockGroup(AudioCollection::Instance->GetAllSequences(), type); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 14c891424..2a555f560 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -84,7 +84,7 @@ void SohInputEditorWindow::UpdateElement() { } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockImGuiGamepadNavigation(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockGamepadNavigation(); } else { if (mGameInputBlockTimer != INT32_MAX) { mGameInputBlockTimer--; @@ -95,13 +95,13 @@ void SohInputEditorWindow::UpdateElement() { } } - if (Ship::Context::GetInstance()->GetWindow()->GetGui()->ImGuiGamepadNavigationEnabled()) { + if (Ship::Context::GetInstance()->GetWindow()->GetGui()->GamepadNavigationEnabled()) { mMappingInputBlockTimer = ImGui::GetIO().Framerate / 3; } else { mMappingInputBlockTimer = INT32_MAX; } - Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockImGuiGamepadNavigation(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockGamepadNavigation(); } } @@ -1109,7 +1109,7 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) { color.b = colorVec.z * 255.0; CVarSetColor24(CVAR_SETTING("LEDPort1Color"), color); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::Text("Custom Color"); @@ -1525,7 +1525,7 @@ void SohInputEditorWindow::DrawMapping(CustomButtonMap& mapping, float labelWidt } if (ImGui::Selectable(i->second, i->first == currentButton)) { CVarSetInteger(mapping.cVarName, i->first); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } ImGui::EndCombo(); diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 30b725094..47d98488b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -123,7 +123,7 @@ Color_RGBA8 ColorRGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { # Silly Options Lets get this one out of the way, probably the only thing that will be consistent between silly options is how they are rendered on the ImGui tab. So when adding one just make sure it follows the same general pattern as the rest. Notably: - - Make sure to SaveConsoleVariablesOnNextTick(), forgetting this will not persist your changes + - Make sure to SaveConsoleVariablesNextFrame(), forgetting this will not persist your changes - Make sure reset properly resets the value - Depending on your use case you may or may not have to split the cvar into two values (cvar.Changed & cvar.Value) @@ -1418,7 +1418,7 @@ void Draw_Placements(){ if (ImGui::Button("Reset##EnemyHealthBarWidth")) { CVarClear(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Value")); CVarClear(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Changed")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::NewLine(); ImGui::EndTable(); @@ -1430,7 +1430,7 @@ void Reset_Option_Single(const char* Button_Title, const char* name) { ImGui::SameLine(); if (ImGui::Button(Button_Title)) { CVarClear(name); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } @@ -1439,7 +1439,7 @@ void Reset_Option_Double(const char* Button_Title, const char* name) { if (ImGui::Button(Button_Title)) { CVarClear((std::string(name) + ".Value").c_str()); CVarClear((std::string(name) + ".Changed").c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } @@ -1447,7 +1447,7 @@ void DrawSillyTab() { ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { if (UIWidgets::EnhancementCheckbox("Let It Snow", CVAR_GENERAL("LetItSnow"))) { - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %.3fx", "##Link_BodyScale", CVAR_COSMETIC("Link.BodyScale.Value"), 0.001f, 0.025f, "", 0.01f, true)) { @@ -1457,7 +1457,7 @@ void DrawSillyTab() { if (ImGui::Button("Reset##Link_BodyScale")) { CVarClear(CVAR_COSMETIC("Link.BodyScale.Value")); CVarClear(CVAR_COSMETIC("Link.BodyScale.Changed")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); if (gPlayState != nullptr) { static Player* player = GET_PLAYER(gPlayState); player->actor.scale.x = 0.01f; @@ -1712,7 +1712,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.changedCvar), 1); ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::Text("%s", cosmeticOption.label.c_str()); @@ -1721,7 +1721,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) { RandomizeColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (cosmeticOption.supportsRainbow) { ImGui::SameLine(); @@ -1731,21 +1731,21 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.changedCvar), 1); ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } ImGui::SameLine(); bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0); if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) { CVarSetInteger((cosmeticOption.lockedCvar), isLocked); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (CVarGetInteger((cosmeticOption.changedCvar), 0)) { ImGui::SameLine(); if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) { ResetColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } } @@ -1762,7 +1762,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { } } ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button(("Reset##" + label).c_str())) { @@ -1772,7 +1772,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { } } ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } for (auto& [id, cosmeticOption] : cosmeticOptions) { if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0))) { @@ -1802,7 +1802,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1811,7 +1811,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } UIWidgets::EnhancementCheckbox("Sync Rainbow colors", CVAR_COSMETIC("RainbowSync")); @@ -1830,7 +1830,7 @@ void CosmeticsEditorWindow::DrawElement() { } } ApplyOrResetCustomGfxPatches(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { @@ -1839,7 +1839,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1848,7 +1848,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (ImGui::Button("Rainbow All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { @@ -1863,7 +1863,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.rainbowCvar, 1); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button("Un-Rainbow All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1878,7 +1878,7 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.rainbowCvar, 0); } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { @@ -1903,7 +1903,7 @@ void CosmeticsEditorWindow::DrawElement() { if (ImGui::Button("Reset##Trails_Duration")) { CVarClear(CVAR_COSMETIC("Trails.Duration.Value")); CVarClear(CVAR_COSMETIC("Trails.Duration.Changed")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::EndTabItem(); } @@ -1975,7 +1975,7 @@ void CosmeticsEditorWindow::InitElement() { cosmeticOption.currentColor.z = cvarColor.b / 255.0f; cosmeticOption.currentColor.w = cvarColor.a / 255.0f; } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); ApplyAuthenticGfxPatches(); @@ -1992,7 +1992,7 @@ void CosmeticsEditor_RandomizeAll() { } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); } @@ -2005,7 +2005,7 @@ void CosmeticsEditor_RandomizeGroup(CosmeticGroup group) { } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); } @@ -2016,7 +2016,7 @@ void CosmeticsEditor_ResetAll() { } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); } @@ -2027,6 +2027,6 @@ void CosmeticsEditor_ResetGroup(CosmeticGroup group) { } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); } diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 829d1161e..f2e7733a2 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -1596,5 +1596,5 @@ void DebugConsole_Init(void) { {"group_name", Ship::ArgumentType::TEXT, true}, }}); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 24e38d9b4..bb04e72b8 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -477,7 +477,7 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint break; } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ApplyOrResetCustomGfxPatches(); } diff --git a/soh/soh/Enhancements/presets.cpp b/soh/soh/Enhancements/presets.cpp index 8c7126e42..a823844f6 100644 --- a/soh/soh/Enhancements/presets.cpp +++ b/soh/soh/Enhancements/presets.cpp @@ -73,7 +73,7 @@ void DrawPresetSelector(PresetType presetTypeId) { if (selectedPresetId != 0) { applyPreset(selectedPresetDef.entries); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); if (presetTypeId == PRESET_TYPE_RANDOMIZER){ Rando::Context::GetInstance()->GetSettings()->ReloadOptions(); } diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index 0558b26e1..9a0ba20b4 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -19,6 +19,6 @@ void RandoMain::GenerateRando(std::set excludedLocations, std:: Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString)); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Rando::Context::GetInstance()->SetPlandoLoaded(false); } diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index 2729bef6e..08195276d 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -208,7 +208,7 @@ bool Option::RenderCheckbox() { if (CustomCheckbox(name.c_str(), &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName.c_str(), val); changed = true; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (!description.empty()) { UIWidgets::InsertHelpHoverText(description.c_str()); @@ -228,7 +228,7 @@ bool Option::RenderTristateCheckbox() { if (CustomCheckboxTristate(name.c_str(), &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName.c_str(), val); changed = true; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (!description.empty()) { UIWidgets::InsertHelpHoverText(description.c_str()); @@ -250,7 +250,7 @@ bool Option::RenderCombobox() { selected = options.size(); CVarSetInteger(cvarName.c_str(), selected); changed = true; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (!description.empty()) { UIWidgets::InsertHelpHoverText(description.c_str()); @@ -263,7 +263,7 @@ bool Option::RenderCombobox() { CVarSetInteger(cvarName.c_str(), static_cast(i)); changed = true; selected = i; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } } @@ -328,7 +328,7 @@ bool Option::RenderSlider() { if (changed) { CVarSetInteger(cvarName.c_str(), val); SetFromCVar(); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } return changed; } diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 030902026..3fc35487e 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1341,7 +1341,7 @@ void GenerateRandomizerImgui(std::string seed = "") { RandoMain::GenerateRando(excludedLocations, enabledTricks, seed); CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); generated = 1; } @@ -1513,7 +1513,7 @@ void RandomizerSettingsWindow::DrawElement() { excludedLocationString += ","; } CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); @@ -1558,7 +1558,7 @@ void RandomizerSettingsWindow::DrawElement() { } else { CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str()); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); @@ -1728,7 +1728,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += ","; } CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button("Enable All")) { @@ -1743,7 +1743,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += ","; } CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { @@ -1798,7 +1798,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += ","; } CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -1833,7 +1833,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += ","; } CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } Rando::Tricks::DrawTagChips(option.GetTags()); ImGui::SameLine(); @@ -1889,7 +1889,7 @@ void RandomizerSettingsWindow::DrawElement() { } else { CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -1928,7 +1928,7 @@ void RandomizerSettingsWindow::DrawElement() { } else { CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } Rando::Tricks::DrawTagChips(option.GetTags()); ImGui::SameLine(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 3657cd2f1..7f80edfeb 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1376,7 +1376,7 @@ void ItemTrackerSettingsWindow::DrawElement() { CVarSetFloat(CVAR_TRACKER_ITEM("BgColorG"), ChromaKeyBackground.y); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorB"), ChromaKeyBackground.z); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorA"), ChromaKeyBackground.w); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::PopItemWidth(); diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.cpp b/soh/soh/Enhancements/timesplits/TimeSplits.cpp index 330e39989..c9c45a86b 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.cpp +++ b/soh/soh/Enhancements/timesplits/TimeSplits.cpp @@ -774,13 +774,13 @@ void TimeSplitsDrawOptionsMenu() { color.b = windowColor.z * 255.0; color.a = windowColor.w * 255.0; CVarSetColor("TimeSplits.WindowColor", color); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); if (ImGui::Button("Reset")) { windowColor = { 0.0f, 0.0f, 0.0f, 1.0f }; CVarSetColor("TimeSplits.WindowColor", {0, 0, 0, 1}); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (UIWidgets::PaddedEnhancementSliderFloat("Window Size: %.1fx", "##windowSize", diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 9d58e2d62..ced1a7acf 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -1045,16 +1045,16 @@ void InitTTSBank() { initData->ResourceVersion = 0; sceneMap = std::static_pointer_cast( - Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, true, initData))->Data; + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, 0, true, initData))->Data; miscMap = std::static_pointer_cast( - Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, true, initData))->Data; + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, 0, true, initData))->Data; kaleidoMap = std::static_pointer_cast( - Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, true, initData))->Data; + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, 0, true, initData))->Data; fileChooseMap = std::static_pointer_cast( - Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, true, initData))->Data; + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, 0, true, initData))->Data; } void RegisterOnSetGameLanguageHook() { diff --git a/soh/soh/Network/CrowdControl/CrowdControl.cpp b/soh/soh/Network/CrowdControl/CrowdControl.cpp index bc8055140..184d6cad2 100644 --- a/soh/soh/Network/CrowdControl/CrowdControl.cpp +++ b/soh/soh/Network/CrowdControl/CrowdControl.cpp @@ -788,14 +788,14 @@ void CrowdControl::DrawMenu() { ImGui::Text("Host & Port"); if (UIWidgets::InputString("##Host", &host)) { CVarSetString(CVAR_REMOTE_CROWD_CONTROL("Host"), host.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::PushItemWidth(ImGui::GetFontSize() * 5); if (ImGui::InputScalar("##Port", ImGuiDataType_U16, &port)) { CVarSetInteger(CVAR_REMOTE_CROWD_CONTROL("Port"), port); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::PopItemWidth(); ImGui::EndDisabled(); @@ -807,11 +807,11 @@ void CrowdControl::DrawMenu() { if (ImGui::Button(buttonLabel, ImVec2(-1.0f, 0.0f))) { if (isEnabled) { CVarClear(CVAR_REMOTE_CROWD_CONTROL("Enabled")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Disable(); } else { CVarSetInteger(CVAR_REMOTE_CROWD_CONTROL("Enabled"), 1); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Enable(); } } diff --git a/soh/soh/Network/Sail/Sail.cpp b/soh/soh/Network/Sail/Sail.cpp index bf856c8f0..1c27e1d72 100644 --- a/soh/soh/Network/Sail/Sail.cpp +++ b/soh/soh/Network/Sail/Sail.cpp @@ -514,14 +514,14 @@ void Sail::DrawMenu() { ImGui::Text("Host & Port"); if (UIWidgets::InputString("##Host", &host)) { CVarSetString(CVAR_REMOTE_SAIL("Host"), host.c_str()); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::SameLine(); ImGui::PushItemWidth(ImGui::GetFontSize() * 5); if (ImGui::InputScalar("##Port", ImGuiDataType_U16, &port)) { CVarSetInteger(CVAR_REMOTE_SAIL("Port"), port); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } ImGui::PopItemWidth(); ImGui::EndDisabled(); @@ -533,11 +533,11 @@ void Sail::DrawMenu() { if (ImGui::Button(buttonLabel, ImVec2(-1.0f, 0.0f))) { if (isEnabled) { CVarClear(CVAR_REMOTE_SAIL("Enabled")); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Disable(); } else { CVarSetInteger(CVAR_REMOTE_SAIL("Enabled"), 1); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Enable(); } } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 009bf76ad..ee41d7231 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -348,8 +348,8 @@ OTRGlobals::OTRGlobals() { context->InitWindow({ sohInputEditorWindow }); auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay(); - overlay->LoadFont("Press Start 2P", "fonts/PressStart2P-Regular.ttf", 12.0f); - overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f); + overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf"); + overlay->LoadFont("Fipps", 32.0f, "fonts/Fipps-Regular.otf"); overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P")); context->InitAudio({ .SampleRate = 44100, .SampleLength = 1024, .DesiredBuffered = 2480 }); @@ -2445,7 +2445,7 @@ void SoH_ProcessDroppedFiles(std::string filePath) { gui->GetGuiWindow("Stats")->Hide(); std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings(); - gui->SaveConsoleVariablesOnNextTick(); + gui->SaveConsoleVariablesNextFrame(); uint32_t finalHash = boost::hash_32{}(configJson.dump()); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Configuration Loaded. Hash: %d", finalHash); diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index a6cbd2d81..b362dfb2b 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -253,7 +253,7 @@ void DrawSettingsMenu() { }; ImGui::Text("Audio API (Needs reload)"); - auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend(); + auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend(); if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); @@ -262,7 +262,7 @@ void DrawSettingsMenu() { for (uint8_t i = 0; i < Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { auto backend = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) { - Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(backend); + Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(backend); } } ImGui::EndCombo(); @@ -434,7 +434,7 @@ void DrawSettingsMenu() { currentFps = 60; } CVarSetInteger(CVAR_SETTING("InterpolationFPS"), currentFps); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); #else bool matchingRefreshRate = CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::FAST3D_DXGI_DX11; @@ -463,7 +463,7 @@ void DrawSettingsMenu() { int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); if (hz >= 20 && hz <= 360) { CVarSetInteger(CVAR_SETTING("InterpolationFPS"), hz); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } } else { @@ -671,7 +671,7 @@ void DrawEnhancementsMenu() { CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), newValue); CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), newValue); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } g->CurrentItemFlags = backup_item_flags; UIWidgets::PaddedEnhancementCheckbox("Skip Intro", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); @@ -912,7 +912,7 @@ void DrawEnhancementsMenu() { std::for_each(itemCountMessageCVars, itemCountMessageCVars + numOptions, [newValue](const char* cvar) { CVarSetInteger(cvar, newValue); }); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } g->CurrentItemFlags = backup_item_flags; @@ -1848,7 +1848,7 @@ void DrawCheatsMenu() { if (UIWidgets::PaddedEnhancementCheckbox("I promise I have read the warning", CVAR_CHEAT("SaveStatePromise"), true, false)) { CVarSetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (CVarGetInteger(CVAR_CHEAT("SaveStatePromise"), 0) == 1) { UIWidgets::PaddedEnhancementCheckbox("I understand, enable save states", CVAR_CHEAT("SaveStatesEnabled"), true, @@ -1943,7 +1943,7 @@ void DrawCheatsMenu() { CVarSetInteger(CVAR_CHEAT("BetaQuestWorld"), betaQuestWorld); std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } if (!isBetaQuestEnabled) { diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index a371ef52b..23af9f613 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -238,7 +238,7 @@ namespace UIWidgets { bool val = (bool)CVarGetInteger(cvarName, defaultValue); if (CustomCheckbox(text, &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName, val); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } @@ -257,7 +257,7 @@ namespace UIWidgets { int val = CVarGetInteger(cvarName, defaultValue); if (CustomCheckboxTristate(text, &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName, val); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } @@ -297,7 +297,7 @@ namespace UIWidgets { CVarSetInteger(cvarName, i); selected = i; changed = true; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } } @@ -310,7 +310,7 @@ namespace UIWidgets { if (disabledValue >= 0 && selected != disabledValue) { CVarSetInteger(cvarName, disabledValue); changed = true; - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } @@ -400,7 +400,7 @@ namespace UIWidgets { if (changed && (oldVal != val)) { CVarSetInteger(cvarName, val); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } else { changed = false; } @@ -501,7 +501,7 @@ namespace UIWidgets { ss << std::setprecision(ticks + 1) << std::setiosflags(std::ios_base::fixed) << val; val = std::stof(ss.str()); CVarSetFloat(cvarName, val); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } else { changed = false; } @@ -550,7 +550,7 @@ namespace UIWidgets { int val = CVarGetInteger(cvarName, 0); if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVarSetInteger(cvarName, id); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ret = true; } ImGui::SameLine(); @@ -577,7 +577,7 @@ namespace UIWidgets { CVarSetColor(cvarName, colorsRGBA); CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color"); @@ -602,7 +602,7 @@ namespace UIWidgets { NewColors.b = fmin(fmax(colors->z * 255, 0), 255); CVarSetColor(cvarName, NewColors); CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode. - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } Tooltip("Chooses a random color\nOverwrites previously chosen color"); @@ -663,7 +663,7 @@ namespace UIWidgets { colors.a = 255.0; CVarSetColor(cvarName, colors); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } } @@ -679,7 +679,7 @@ namespace UIWidgets { colors.a = ColorRGBA.w * 255.0; CVarSetColor(cvarName, colors); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } } From d8d9119de97952c939365faa32344876f9d52af4 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:13:08 -0500 Subject: [PATCH 05/10] Rename Kakariko Well water level function (decomp) (#4656) --- .../actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index 1a4e21e4a..b287a5da6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -14,7 +14,7 @@ void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play); void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play); void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play); -void func_808ABB84(BgSpot01Idomizu* this, PlayState* play); +void BgSpot01Idomizu_UpdateWaterLevel(BgSpot01Idomizu* this, PlayState* play); const ActorInit Bg_Spot01_Idomizu_InitVars = { ACTOR_BG_SPOT01_IDOMIZU, @@ -42,14 +42,14 @@ void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play) { } else { this->waterHeight = 52.0f; } - this->actionFunc = func_808ABB84; + this->actionFunc = BgSpot01Idomizu_UpdateWaterLevel; this->actor.world.pos.y = this->waterHeight; } void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play) { } -void func_808ABB84(BgSpot01Idomizu* this, PlayState* play) { +void BgSpot01Idomizu_UpdateWaterLevel(BgSpot01Idomizu* this, PlayState* play) { if (Flags_GetEventChkInf(EVENTCHKINF_DRAINED_WELL_IN_KAKARIKO)) { this->waterHeight = -550.0f; } From 2d37098379211028e9008ed3564511a60cc30f66 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:13:18 -0500 Subject: [PATCH 06/10] Rename Sleeping Waterfall state machine function (decomp) (#4655) --- soh/soh/Enhancements/timesaver_hook_handlers.cpp | 4 ++-- .../overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index d9c13ed92..9fd658bc3 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -35,7 +35,7 @@ extern SaveContext gSaveContext; extern PlayState* gPlayState; extern int32_t D_8011D3AC; -extern void func_808ADEF0(BgSpot03Taki* bgSpot03Taki, PlayState* play); +extern void BgSpot03Taki_HandleWaterfallState(BgSpot03Taki* bgSpot03Taki, PlayState* play); extern void BgSpot03Taki_ApplyOpeningAlpha(BgSpot03Taki* bgSpot03Taki, s32 bufferIndex); extern void func_80AF36EC(EnRu2* enRu2, PlayState* play); @@ -814,7 +814,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { } BgSpot03Taki* bgSpot03 = static_cast(innerActorRef); - if (bgSpot03->actionFunc == func_808ADEF0) { + if (bgSpot03->actionFunc == BgSpot03Taki_HandleWaterfallState) { bgSpot03->actionFunc = BgSpot03Taki_KeepOpen; bgSpot03->state = WATERFALL_OPENED; bgSpot03->openingAlpha = 0.0f; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index 28c2769f4..979a0eb0d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -15,7 +15,7 @@ void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play); void BgSpot03Taki_Update(Actor* thisx, PlayState* play); void BgSpot03Taki_Draw(Actor* thisx, PlayState* play); -void func_808ADEF0(BgSpot03Taki* this, PlayState* play); +void BgSpot03Taki_HandleWaterfallState(BgSpot03Taki* this, PlayState* play); const ActorInit Bg_Spot03_Taki_InitVars = { ACTOR_BG_SPOT03_TAKI, @@ -60,7 +60,7 @@ void BgSpot03Taki_Init(Actor* thisx, PlayState* play) { this->openingAlpha = 255.0f; BgSpot03Taki_ApplyOpeningAlpha(this, 0); BgSpot03Taki_ApplyOpeningAlpha(this, 1); - this->actionFunc = func_808ADEF0; + this->actionFunc = BgSpot03Taki_HandleWaterfallState; } void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) { @@ -69,7 +69,7 @@ void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808ADEF0(BgSpot03Taki* this, PlayState* play) { +void BgSpot03Taki_HandleWaterfallState(BgSpot03Taki* this, PlayState* play) { if (this->state == WATERFALL_CLOSED) { if (Flags_GetSwitch(play, this->switchFlag)) { this->state = WATERFALL_OPENING_ANIMATED; From 4010229de5482cdd756bf2aaf1c7499e333730f7 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:13:28 -0500 Subject: [PATCH 07/10] Rename bomb flower fuse setting field (decomp) (#4653) --- soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 10 +++++----- soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index f83aaf76b..44c8e745b 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -91,7 +91,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) { EnBombf* this = (EnBombf*)thisx; Actor_SetScale(thisx, 0.01f); - this->unk_200 = 1; + this->isFuseEnabled = 1; Collider_InitCylinder(play, &this->bombCollider); Collider_InitJntSph(play, &this->explosionCollider); Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); @@ -174,7 +174,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0, true); if (bombFlower != NULL) { - bombFlower->unk_200 = 1; + bombFlower->isFuseEnabled = 1; bombFlower->timer = 0; this->timer = 180; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; @@ -323,7 +323,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { s32 pad[2]; EnBombf* this = (EnBombf*)thisx; - if ((this->unk_200 != 0) && (this->timer != 0)) { + if ((this->isFuseEnabled != 0) && (this->timer != 0)) { this->timer--; } @@ -367,7 +367,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) && (this->bombCollider.base.oc->category == ACTORCAT_ENEMY))) { - this->unk_200 = 1; + this->isFuseEnabled = 1; this->timer = 0; } else { // if a lit stick touches the bomb, set timer to 100 @@ -376,7 +376,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { } } - if (this->unk_200 != 0) { + if (this->isFuseEnabled != 0) { dustAccel.y = 0.2f; effPos = thisx->world.pos; effPos.y += 25.0f; diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index 33b6f3cc3..fe780742c 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -15,7 +15,7 @@ typedef struct EnBombf { /* 0x01B8 */ ColliderJntSphElement explosionColliderItems[1]; /* 0x01F8 */ s16 timer; /* 0x01FC */ EnBombfActionFunc actionFunc; - /* 0x0200 */ s32 unk_200; + /* 0x0200 */ s32 isFuseEnabled; /* 0x0204 */ u8 bumpOn; /* 0x0206 */ s16 flashSpeedScale; /* 0x0208 */ f32 flashIntensity; From d0bfa6860b554a73cc1aeb4d025be4f26ee84b01 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:13:45 -0500 Subject: [PATCH 08/10] Skip the Mweep cutscene (#4646) * Skip the Mweep cutscene * Fix bug: Ruto's letter was not removed from bottle --- .../game-interactor/GameInteractor.h | 2 ++ .../Enhancements/timesaver_hook_handlers.cpp | 8 +++++ soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c | 30 ++++++++++++------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index e73120501..8aa37a580 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -309,6 +309,8 @@ typedef enum { // Vanilla condition: !EVENTCHKINF_PULLED_MASTER_SWORD_FROM_PEDESTAL VB_PLAY_PULL_MASTER_SWORD_CS, VB_PLAY_DROP_FISH_FOR_JABU_CS, + // Opt: *EnKz + VB_PLAY_MWEEP_CS, // Vanilla condition: player->getItemId == GI_GAUNTLETS_SILVER VB_PLAY_NABOORU_CAPTURED_CS, VB_PLAY_ZELDAS_LULLABY_CS, diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 9fd658bc3..64ce4cfb5 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -404,6 +404,14 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } break; } + case VB_PLAY_MWEEP_CS: { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 0)) { + *should = false; + Inventory_ReplaceItem(gPlayState, ITEM_LETTER_RUTO, ITEM_BOTTLE); + Flags_SetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED); + } + break; + } case VB_PLAY_EYEDROP_CREATION_ANIM: case VB_PLAY_EYEDROPS_CS: case VB_PLAY_DROP_FISH_FOR_JABU_CS: diff --git a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c index d5f14c959..79b719734 100644 --- a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -437,17 +437,23 @@ void EnKz_SetupMweep(EnKz* this, PlayState* play) { Vec3f pos; Vec3f initPos; - this->cutsceneCamera = Play_CreateSubCamera(play); - this->gameplayCamera = play->activeCamera; - Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE); + bool shouldPlayCutscene = GameInteractor_Should(VB_PLAY_MWEEP_CS, true); + + if (shouldPlayCutscene) { + this->cutsceneCamera = Play_CreateSubCamera(play); + this->gameplayCamera = play->activeCamera; + Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE); + } pos = this->actor.world.pos; initPos = this->actor.home.pos; pos.y += 60.0f; initPos.y += -100.0f; initPos.z += 260.0f; - Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); - Player_SetCsActionWithHaltedActors(play, &this->actor, 8); + if (shouldPlayCutscene) { + Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); + Player_SetCsActionWithHaltedActors(play, &this->actor, 8); + } this->actor.speedXZ = 0.1f * CVarGetFloat(CVAR_ENHANCEMENT("MweepSpeed"), 1.0f); this->actionFunc = EnKz_Mweep; } @@ -462,7 +468,9 @@ void EnKz_Mweep(EnKz* this, PlayState* play) { pos.y += 60.0f; initPos.y += -100.0f; initPos.z += 260.0f; - Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); + if (GameInteractor_Should(VB_PLAY_MWEEP_CS, true)) { + Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); + } if ((EnKz_FollowPath(this, play) == 1) && (this->waypoint == 0)) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1); Inventory_ReplaceItem(play, ITEM_LETTER_RUTO, ITEM_BOTTLE); @@ -477,9 +485,11 @@ void EnKz_Mweep(EnKz* this, PlayState* play) { } void EnKz_StopMweep(EnKz* this, PlayState* play) { - Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE); - Play_ClearCamera(play, this->cutsceneCamera); - Player_SetCsActionWithHaltedActors(play, &this->actor, 7); + if (GameInteractor_Should(VB_PLAY_MWEEP_CS, true)) { + Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->cutsceneCamera); + Player_SetCsActionWithHaltedActors(play, &this->actor, 7); + } this->actionFunc = EnKz_Wait; } From 23dc4257a76467ad5bcc110ad2402cef7f300d55 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:14:01 -0500 Subject: [PATCH 09/10] Skip one-point cutscene of Amy's blocks falling (#4645) --- soh/soh/Enhancements/timesaver_hook_handlers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 64ce4cfb5..07fbe91b3 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -212,6 +212,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li s16* csId = va_arg(args, s16*); BgSpot03Taki* taki = NULL; switch (*csId) { + case 3150: case 4180: case 4100: *should = false; From de6f5d8b65db2149eec50db7db158570a31f0cde Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 9 Dec 2024 11:14:47 -0500 Subject: [PATCH 10/10] Skip Water Temple portcullis opening cutscene (#4641) --- soh/soh/Enhancements/timesaver_hook_handlers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 07fbe91b3..c78c3f19c 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -307,6 +307,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li case ACTOR_BG_YDAN_MARUTA: case ACTOR_BG_SPOT18_SHUTTER: case ACTOR_BG_SPOT05_SOKO: + case ACTOR_BG_SPOT06_OBJECTS: case ACTOR_BG_SPOT18_BASKET: case ACTOR_BG_HIDAN_CURTAIN: case ACTOR_BG_MORI_HINERI: