aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-18 03:50:41 -0500
committerNebuleon Fumika2013-01-18 03:50:41 -0500
commit8ae4ee4d511d5c6eddbc45215aef61398eeca76d (patch)
tree91c3eb22f07ebee8804809a0064f86a162f81e72 /source
parent76e5f4b57105d9799a30c792f64edeee220d8243 (diff)
downloadsnes9x2005-8ae4ee4d511d5c6eddbc45215aef61398eeca76d.tar.gz
snes9x2005-8ae4ee4d511d5c6eddbc45215aef61398eeca76d.tar.bz2
snes9x2005-8ae4ee4d511d5c6eddbc45215aef61398eeca76d.zip
Fix a bug whereby "state #0" is selected as the default saved state in the saved states menu if there were no saved states before. Electing to load #0 messed with the game; electing to save #0 erased the game-specific configuration.
Diffstat (limited to 'source')
-rw-r--r--source/nds/gui.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/nds/gui.c b/source/nds/gui.c
index a7cd357..85b087a 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -79,8 +79,8 @@ EMU_CONFIG emu_config;
GAME_CONFIG game_config;
//save state file map
-static u32 savestate_index; // current selection in the saved states menu
-static u32 latest_save; // Slot number of the latest (in time) save for this game
+static uint32 savestate_index; // current selection in the saved states menu
+static int32 latest_save; // Slot number of the latest (in time) save for this game, or -1 if none
static bool8 SavedStateExistenceCached [SAVE_STATE_SLOT_NUM]; // [I] == TRUE if Cache[I] is meaningful
static bool8 SavedStateExistenceCache [SAVE_STATE_SLOT_NUM];
@@ -4298,8 +4298,10 @@ static void get_savestate_filelist(void)
SavedStateExistenceCached [i] = TRUE;
}
- savestate_index= latest_save;
- if(savestate_index < 0) savestate_index = 0;
+ if(latest_save < 0)
+ savestate_index = 0;
+ else
+ savestate_index = latest_save;
}
static void get_savestate_filename(u32 slot, char *name_buffer)