From 8ae4ee4d511d5c6eddbc45215aef61398eeca76d Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Fri, 18 Jan 2013 03:50:41 -0500 Subject: 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. --- source/nds/gui.c | 10 ++++++---- 1 file 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) -- cgit v1.2.3