made backup savestates togglable. Win32 - enable a menu item to toggle backup savestates. For SDL to have a similar feature it simply needs to toggle the variable bool backupSavestate in the core state.cpp.

This commit is contained in:
adelikat 2009-11-13 04:21:24 +00:00
parent 05ea4d2881
commit 4a3369186b
6 changed files with 23 additions and 15 deletions

View File

@ -39,6 +39,8 @@
#include "ramwatch.h"
#include "debugger.h"
#include "../../state.h" //adelikat: For bool backupSavestates
extern CFGSTRUCT NetplayConfig[];
extern CFGSTRUCT InputConfig[];
extern CFGSTRUCT HotkeyConfig[];
@ -296,6 +298,8 @@ static CFGSTRUCT fceuconfig[] = {
AC(ramw_x),
AC(ramw_y),
AC(backupSavestates),
ENDCFGSTRUCT
};

View File

@ -7,8 +7,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -111,6 +110,7 @@ BEGIN
MENUITEM "&Background Input", MENU_BACKGROUND_INPUT
MENUITEM "&Auto-savestates", MENU_ENABLE_AUTOSAVE
MENUITEM "&Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP
MENUITEM "Backup Savestates", ID_ENABLE_BACKUPSAVESTATES
END
POPUP "&Display"
BEGIN
@ -417,7 +417,7 @@ BEGIN
END
END
LUAWINDOW_MENU MENU
LUAWINDOW_MENU MENU
BEGIN
POPUP "Console"
BEGIN
@ -1284,7 +1284,6 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,11,324,364
PUSHBUTTON "Truncate",IDC_HACKY1,338,46,51,16
//PUSHBUTTON "Commit",IDC_HACKY2,404,46,51,16,WS_DISABLED
LTEXT "Any number of these icon buttons are pressed",IDC_STATIC,395,84,47,34
PUSHBUTTON "<",TASEDIT_REWIND,367,25,26,14
PUSHBUTTON ">",TASEDIT_FOWARD,391,25,26,14
@ -1934,8 +1933,7 @@ IDB_TE_ARROW BITMAP "res/te_arrow.bmp"
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -766,6 +766,7 @@
#define ID_RAM_WATCH 40377
#define RW_MENU_FIRST_RECENT_FILE 40380
#define RW_MENU_LAST_RECENT_FILE 40400
#define ID_ENABLE_BACKUPSAVESTATES 40401
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -775,7 +776,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 160
#define _APS_NEXT_COMMAND_VALUE 40401
#define _APS_NEXT_COMMAND_VALUE 40402
#define _APS_NEXT_CONTROL_VALUE 1256
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -102,15 +102,12 @@ extern bool turbo;
extern bool movie_readonly;
extern bool AutoSS; //flag for whether an auto-save has been made
extern int newppu;
// Extern functions
char *md5_asciistr(uint8 digest[16]);
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
void MapInput(void);
extern BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); //Metadata dialog
extern bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
//AutoFire-----------------------------------------------
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
void MapInput(void);
void SetAutoFirePattern(int onframes, int offframes);
void SetAutoFireOffset(int offset);
static int CheckedAutoFirePattern = MENU_AUTOFIRE_PATTERN_1;
@ -119,7 +116,7 @@ int GetCheckedAutoFirePattern();
int GetCheckedAutoFireOffset();
//Internal variables-------------------------------------
char *md5_asciistr(uint8 digest[16]);
static int winwidth, winheight;
static volatile int nofocus = 0;
static int tog = 0; //Toggle for Hide Menu
@ -389,6 +386,7 @@ void UpdateCheckedMenuItems()
CheckMenuItem(fceumenu, MENU_ENABLE_AUTOSAVE, EnableAutosave ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, MENU_DISPLAY_FA_LAGSKIP, frameAdvanceLagSkip?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, MENU_CONFIG_BINDSAVES, bindSavestate?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_ENABLE_BACKUPSAVESTATES, backupSavestates?MF_CHECKED : MF_UNCHECKED);
//Config - Display SubMenu
CheckMenuItem(fceumenu, MENU_DISPLAY_LAGCOUNTER, lagCounterDisplay?MF_CHECKED : MF_UNCHECKED);
@ -1619,6 +1617,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
frameAdvanceLagSkip ^= 1;
UpdateCheckedMenuItems();
break;
case ID_ENABLE_BACKUPSAVESTATES:
backupSavestates ^=1;
UpdateCheckedMenuItems();
break;
//Display submenu
case MENU_INPUTDISPLAY_0: //Input display off

View File

@ -80,6 +80,8 @@ bool redoLS = false; //This will be true if a backupstate was loaded, meaning
bool internalSaveLoad = false;
bool backupSavestates = true;
#define SFMDATA_SIZE (64)
static SFORMAT SFMDATA[SFMDATA_SIZE];
static int SFEXINDEX;
@ -460,7 +462,7 @@ void FCEUSS_Save(const char *fname)
strcpy(fn, FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0).c_str());
//backup existing savestate first
if (CheckFileExists(fn))
if (CheckFileExists(fn) && backupSavestates) //adelikat: If the files exists and we are allowed to make backup savestates
{
CreateBackupSaveState(fn); //Make a backup of previous savestate before overwriting it
strcpy(lastSavestateMade,fn); //Remember what the last savestate filename was (for undoing later)
@ -892,7 +894,7 @@ void FCEUI_LoadState(const char *fname)
information expected in newer save states, desynchronization won't occur(at least not
from this ;)).
*/
BackupLoadState(); //Backup the current state before loading a new one
if (backupSavestates) BackupLoadState(); //If allowed, backup the current state before loading a new one
if (!movie_readonly && autoMovieBackup && freshMovie) //If auto-backup is on, movie has not been altered this session and the movie is in read+write mode
{

View File

@ -73,4 +73,5 @@ extern bool redoSS; //redo savestate flag
extern char lastLoadstateMade[2048]; //Filename of last state loaded
extern bool undoLS; //undo loadstate flag
extern bool redoLS; //redo savestate flag
extern bool backupSavestates; //Whether or not to make backups, true by default
bool CheckBackupSaveStateExist(); //Checks if backupsavestate exists