diff --git a/changelog.txt b/changelog.txt index ffabfa1f..7fa9e708 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,5 @@ ---version 2.0.4 yet to be released--- +24-dec-2008 - adelikat - auto-save fixes, prevent loading an auto-save from previous session. Win32 - added flags for enabling auto-save menu item. 24-dec-2008 - adelikat - added undo/redo savestate hotkey. Win32 - made undo/redo default key mapping Ctrl+Z 24-dec-2008 - adelikat - win32 - added Last ROM used context menu item when no game loaded 24-dec-2008 - shinydoofy - sdl - added option to mute FCEUX for avi capturing, check the docs for more detail diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 1ee6a3ca..da16cb65 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -87,7 +87,7 @@ extern bool frameAdvanceLagSkip; extern bool turbo; extern int luaRunning; extern bool movie_readonly; - +extern bool AutoSS; //flag for whether an auto-save has been made // Extern functions char *md5_asciistr(uint8 digest[16]); @@ -439,6 +439,12 @@ void UpdateContextMenuItems(HMENU context, int whichContext) ChangeContextMenuItemText(FCEUX_CONTEXT_UNDOSAVESTATE, redoSavestate, context); else ChangeContextMenuItemText(FCEUX_CONTEXT_UNDOSAVESTATE, undoSavestate, context); + + //Rewind to last auto-save + if(EnableAutosave && AutoSS) + EnableMenuItem(context,FCEUX_CONTEXT_REWINDTOLASTAUTO,MF_BYCOMMAND | MF_ENABLED); + else + EnableMenuItem(context,FCEUX_CONTEXT_REWINDTOLASTAUTO,MF_BYCOMMAND | MF_GRAYED); } /// Updates recent files / recent directories menu diff --git a/src/fceu.cpp b/src/fceu.cpp index 76612b9e..83d10d48 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -72,7 +72,7 @@ using namespace std; int AFon = 1, AFoff = 1, AutoFireOffset = 0; //For keeping track of autofire settings bool justLagged = false; bool frameAdvanceLagSkip = false; //If this is true, frame advance will skip over lag frame (i.e. it will emulate 2 frames instead of 1) - +bool AutoSS = false; //Flagged true when the first auto-savestate is made while a game is loaded, flagged false on game close bool movieSubtitles = true; //Toggle for displaying movie subtitles FCEUGI::FCEUGI() @@ -125,12 +125,14 @@ static void CloseGame(void) delete GameInfo; GameInfo = 0; + //Reset flags for Undo/Redo/Auto Savestating lastSavestateMade[0] = 0; undoSS = false; redoSS = false; lastLoadstateMade[0] = 0; undoLS = false; redoLS = false; + AutoSS = false; } } @@ -886,6 +888,7 @@ void UpdateAutosave(void) AutosaveIndex = (AutosaveIndex + 1) % 4; f = strdup(FCEU_MakeFName(FCEUMKF_AUTOSTATE,AutosaveIndex,0).c_str()); FCEUSS_Save(f); + AutoSS = true; //Flag that an auto-savestate was made free(f); AutosaveStatus[AutosaveIndex] = 1; } @@ -893,7 +896,7 @@ void UpdateAutosave(void) void FCEUI_Autosave(void) { - if(!EnableAutosave) + if(!EnableAutosave || !AutoSS) return; if(AutosaveStatus[AutosaveIndex] == 1)