From c71203ad06da8883cba28af0f6b81090ac046a56 Mon Sep 17 00:00:00 2001 From: Mark Eldridge <8285554+meldridge@users.noreply.github.com> Date: Thu, 23 Jul 2026 15:02:32 +0930 Subject: Respect the Better Save Menu enable toggle (#6970) RegisterBetterSave registered its VB_LOAD_SAVE_MENU and VB_DRAW_SAVE_MENU hooks unconditionally, and hardcoded the save/continue text overrides to `true`, so the feature applied regardless of the enable checkbox and toggling it off did nothing. CVAR_BETTERSAVE_VALUE was defined but never read. Gate all five hooks on CVAR_BETTERSAVE_VALUE (COND_VB_SHOULD for the two vanilla-behavior hooks, the condition arg for the three OnOpenText hooks). RegisterShipInitFunc already re-runs RegisterBetterSave when CVAR_BETTERSAVE changes, so the COND_* macros unregister the hooks when it is off and re-register them when it is on. Co-authored-by: Claude Opus 4.8 --- soh/soh/Enhancements/QoL/BetterSaveMenu.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/soh/soh/Enhancements/QoL/BetterSaveMenu.cpp b/soh/soh/Enhancements/QoL/BetterSaveMenu.cpp index 894caac79..99dabd598 100644 --- a/soh/soh/Enhancements/QoL/BetterSaveMenu.cpp +++ b/soh/soh/Enhancements/QoL/BetterSaveMenu.cpp @@ -191,30 +191,32 @@ void RegisterBetterSave() { continueOverworldMsg.Format(); continueDungeonMsg.Format(); - REGISTER_VB_SHOULD(VB_LOAD_SAVE_MENU, { + COND_VB_SHOULD(VB_LOAD_SAVE_MENU, CVAR_BETTERSAVE_VALUE, { PlayState* play = va_arg(args, PlayState*); HandleSaveMenu(should, play); }); - REGISTER_VB_SHOULD(VB_DRAW_SAVE_MENU, { *should = false; }); + COND_VB_SHOULD(VB_DRAW_SAVE_MENU, CVAR_BETTERSAVE_VALUE, { *should = false; }); - COND_ID_HOOK(OnOpenText, TEXT_SAVE_MSG, true, [](uint16_t* textId, bool* loadFromMessageTable) { + COND_ID_HOOK(OnOpenText, TEXT_SAVE_MSG, CVAR_BETTERSAVE_VALUE, [](uint16_t* textId, bool* loadFromMessageTable) { saveMsg.LoadIntoFont(); *loadFromMessageTable = false; return; }); - COND_ID_HOOK(OnOpenText, TEXT_CONTINUE_DUNGEON_MSG, true, [](uint16_t* textId, bool* loadFromMessageTable) { - continueDungeonMsg.LoadIntoFont(); - *loadFromMessageTable = false; - return; - }); + COND_ID_HOOK(OnOpenText, TEXT_CONTINUE_DUNGEON_MSG, CVAR_BETTERSAVE_VALUE, + [](uint16_t* textId, bool* loadFromMessageTable) { + continueDungeonMsg.LoadIntoFont(); + *loadFromMessageTable = false; + return; + }); - COND_ID_HOOK(OnOpenText, TEXT_CONTINUE_OVERWORLD_MSG, true, [](uint16_t* textId, bool* loadFromMessageTable) { - continueOverworldMsg.LoadIntoFont(); - *loadFromMessageTable = false; - return; - }); + COND_ID_HOOK(OnOpenText, TEXT_CONTINUE_OVERWORLD_MSG, CVAR_BETTERSAVE_VALUE, + [](uint16_t* textId, bool* loadFromMessageTable) { + continueOverworldMsg.LoadIntoFont(); + *loadFromMessageTable = false; + return; + }); } static RegisterShipInitFunc initFunc(RegisterBetterSave, { CVAR_BETTERSAVE }); -- cgit v1.2.3