From ed0a6e575313bc01a61de48d1de495fe8e163810 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 19 Oct 2008 14:06:10 +0000 Subject: [PATCH] win32 - added toggle for binding savestates to movies --- changelog.txt | 1 + src/drivers/win/config.cpp | 2 ++ src/drivers/win/res.rc | 1 + src/drivers/win/resource.h | 4 +++- src/drivers/win/window.cpp | 5 +++++ src/file.cpp | 14 ++++++++------ src/file.h | 2 ++ 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index abb62b16..7f979ef6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,5 @@ ---version 2.0.3 yet to be released--- +19-oct-2008 - adelikat - winew - added a toggle for binding savestates to movies 18-oct-2008 - adelikat - Win32 - added -cfg (config file) command line argument 08-oct-2008 - zeromus - SF [ 2073105 ] Laptop Volume Control keys make FCEUX go crazy and crash 08-oct-2008 - zeromus - SF [ 2073113 ] Child windows inside debugging window get invalid sizes diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index 537dbac3..ce152b48 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -33,6 +33,7 @@ #include "video.h" #include "memwatch.h" #include "fceu.h" +#include "file.h" extern CFGSTRUCT NetplayConfig[]; extern CFGSTRUCT InputConfig[]; @@ -200,6 +201,7 @@ static CFGSTRUCT fceuconfig[] = { AC(AutoFireOffset), AC(DesynchAutoFire), AC(lagCounterDisplay), + AC(bindSavestate), //ACS(memwLastfile[2048]), ENDCFGSTRUCT diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index ffd9434a..0244ee0f 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -79,6 +79,7 @@ BEGIN MENUITEM "Enable Background Input", MENU_BACKGROUND_INPUT MENUITEM "Enable Auto-save", MENU_ENABLE_AUTOSAVE MENUITEM "Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP + MENUITEM "Bind savestates to movie", MENU_CONFIG_BINDSAVES POPUP "Display" BEGIN MENUITEM "Movie Status Icon", MENU_SHOW_STATUS_ICON diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index dd3b5faf..4f4d3b6d 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -536,6 +536,8 @@ #define MENU_INPUTDISPLAY_2 40252 #define MENU_INPUTDISPLAY_4 40253 #define ID_DISPLAY_FRAMECOUNTER 40254 +#define ID_CONFIG_BINDSAVESTATESTOMOVIE 40255 +#define MENU_CONFIG_BINDSAVES 40256 #define IDC_DEBUGGER_ICONTRAY 55535 #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426 @@ -545,7 +547,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 124 -#define _APS_NEXT_COMMAND_VALUE 40255 +#define _APS_NEXT_COMMAND_VALUE 40257 #define _APS_NEXT_CONTROL_VALUE 1181 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 134c5130..56c1499b 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -59,6 +59,7 @@ #include "movie.h" #include "fceulua.h" #include "utils/xstring.h" +#include "file.h" #include @@ -300,6 +301,7 @@ void UpdateCheckedMenuItems() { CheckMenuItem(fceumenu, polo2[x], *polo[x] ? MF_CHECKED : MF_UNCHECKED); } + CheckMenuItem(fceumenu, MENU_CONFIG_BINDSAVES, bindSavestate?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, MENU_DISPLAY_FA_LAGSKIP, frameAdvanceLagSkip?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, MENU_DISPLAY_LAGCOUNTER, lagCounterDisplay?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, MENU_DISPLAY_BG, bg?MF_CHECKED:MF_UNCHECKED); @@ -1209,6 +1211,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) case ID_FILE_STOPLUASCRIPT: FCEU_LuaStop(); break; + case MENU_CONFIG_BINDSAVES: + bindSavestate ^= 1; + UpdateCheckedMenuItems(); case MENU_DISPLAY_LAGCOUNTER: lagCounterDisplay ^= 1; UpdateCheckedMenuItems(); diff --git a/src/file.cpp b/src/file.cpp index 8e1d1dc6..dd246b98 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -48,7 +48,7 @@ using namespace std; - +bool bindSavestate = true; //Toggle that determines if a savestate filename will include the movie filename static std::string BaseDirectory; static char FileExt[2048]; //Includes the . character, as in ".nes" char FileBase[2048]; @@ -600,15 +600,17 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1) break; case FCEUMKF_STATE: { - mfnString = GetMfn(); + if (bindSavestate) mfnString = GetMfn(); + else mfnString = ""; if (mfnString.length() < 60) //This caps the movie filename length before adding it to the savestate filename. mfn = mfnString.c_str(); //This helps prevent possible crashes from savestate filenames of excessive length. - else { - std::string mfnStringTemp = mfnString.substr(0,60); - mfn = mfnStringTemp.c_str(); //mfn is the movie filename - } + else + { + std::string mfnStringTemp = mfnString.substr(0,60); + mfn = mfnStringTemp.c_str(); //mfn is the movie filename + } diff --git a/src/file.h b/src/file.h index 44c8e907..b0f05998 100644 --- a/src/file.h +++ b/src/file.h @@ -6,6 +6,8 @@ #include "types.h" #include "utils/memorystream.h" +extern bool bindSavestate; + struct FCEUFILE { //the stream you can use to access the data std::iostream *stream;