From b4f4f625534eeb3bc29fb664387cd367a086dddb Mon Sep 17 00:00:00 2001 From: shinydoofy Date: Sun, 12 Apr 2009 16:38:59 +0000 Subject: [PATCH] SDL: implemented FCEUD_SaveStateAs and FCEUD_LoadStateFrom --- changelog.txt | 1 + src/drivers/sdl/input.cpp | 35 +++++++++++++++++++++++++++++++++++ src/drivers/sdl/sdl.cpp | 2 -- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index bf9fc3d8..b57b1f72 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,4 @@ +12-apr-2009 - shinydoofy - sdl - implemented saving/loading a savestate from a specific file on Alt+S/L 11-apr-2009 - shinydoofy - sdl - implemented starting an FM2 movie on Alt+R 11-apr-2009 - adelikat - made default save slot 0 instead of 1, Win32 - remember last slot used 11-apr-2009 - shinydoofy - sdl - added --pauseframe to pause movie playback on frame x diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index c5ea9acf..a1e80118 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -353,6 +353,31 @@ void FCEUD_MovieRecordTo() FCEUI_SaveMovie(fname.c_str(), MOVIE_FLAG_FROM_POWERON, author); } + +/** +* Lets the user save a savestate to a specific file +**/ +void FCEUD_SaveStateAs() +{ + std::string fname = GetFilename("Save savestate as...", true, "Savestates|*.fc0"); + if (!fname.size()) + return; // no filename selected, quit the whole thing + + FCEUI_SaveState(fname.c_str()); +} + +/** +* Lets the user load a savestate from a specific file +*/ +void FCEUD_LoadStateFrom() +{ + std::string fname = GetFilename("Load savestate from...", false, "Savestates|*.fc?"); + if (!fname.size()) + return; // no filename selected, quit the whole thing + + FCEUI_LoadState(fname.c_str()); +} + /** * Parse keyboard commands and execute accordingly. */ @@ -410,6 +435,16 @@ KeyboardCommands() if(keyonly(R) && is_alt) { FCEUD_MovieRecordTo(); } + + // Save a state from a file + if(keyonly(S) && is_alt) { + FCEUD_SaveStateAs(); + } + + // Load a state from a file + if(keyonly(L) && is_alt) { + FCEUD_LoadStateFrom(); + } // Famicom disk-system games if(gametype==GIT_FDS) diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 8227e7a9..62d74a5a 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -713,8 +713,6 @@ void FCEUD_PrintError(const char *errormsg) #define DUMMY(__f) void __f(void) {printf("%s\n", #__f); FCEU_DispMessage("Not implemented.");} DUMMY(FCEUD_HideMenuToggle) -DUMMY(FCEUD_SaveStateAs) -DUMMY(FCEUD_LoadStateFrom) DUMMY(FCEUD_MovieReplayFrom) DUMMY(FCEUD_ToggleStatusIcon) DUMMY(FCEUD_AviRecordTo)