summaryrefslogtreecommitdiff
path: root/mm/2s2h/Enhancements/Saving/FileSlot3.cpp
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2026-07-31 23:47:26 -0500
committerGitHub <noreply@github.com>2026-07-31 23:47:26 -0500
commitf740fe0506483200142108b64fb2abf2eb2f735e (patch)
tree97e9cf92e1f05fa5abbb55c7bc3146412e329605 /mm/2s2h/Enhancements/Saving/FileSlot3.cpp
parent901fde33b6509403bea0ade78150837108ddb233 (diff)
Add new file setup screen, for selecting preset, rando/vanilla and seed (#1829)
Diffstat (limited to 'mm/2s2h/Enhancements/Saving/FileSlot3.cpp')
-rw-r--r--mm/2s2h/Enhancements/Saving/FileSlot3.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/mm/2s2h/Enhancements/Saving/FileSlot3.cpp b/mm/2s2h/Enhancements/Saving/FileSlot3.cpp
index 14a92acf2..82f753c6b 100644
--- a/mm/2s2h/Enhancements/Saving/FileSlot3.cpp
+++ b/mm/2s2h/Enhancements/Saving/FileSlot3.cpp
@@ -11,8 +11,15 @@ extern FileSelectState* gFileSelectState;
#define CVAR CVarGetInteger(CVAR_NAME, true)
void RegisterFileSlot3() {
- // Reset the file select state to reload the save metadata
- if (gFileSelectState != NULL) {
+ static int lastValue = -1;
+ int value = CVAR;
+ bool changed = (lastValue != -1) && (lastValue != value);
+ lastValue = value;
+
+ // When we're adding the third file slot we need to refresh the entire file select state. We're only wanting
+ // to do this when the value changes, as this hook gets run when a preset is applied, and the user might
+ // have been in the middle of a file creation when they applied the preset.
+ if (changed && gFileSelectState != NULL) {
STOP_GAMESTATE(&gFileSelectState->state);
SET_NEXT_GAMESTATE(&gFileSelectState->state, FileSelect_Init, sizeof(FileSelectState));
}