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

This commit is contained in:
adelikat 2009-11-13 05:35:32 +00:00
parent 2da84898dc
commit cde73a67dc
7 changed files with 13 additions and 2 deletions

View File

@ -299,6 +299,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(ramw_y), AC(ramw_y),
AC(backupSavestates), AC(backupSavestates),
AC(compressSavestates),
ENDCFGSTRUCT ENDCFGSTRUCT
}; };

View File

@ -111,6 +111,7 @@ BEGIN
MENUITEM "&Auto-savestates", MENU_ENABLE_AUTOSAVE MENUITEM "&Auto-savestates", MENU_ENABLE_AUTOSAVE
MENUITEM "&Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP MENUITEM "&Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP
MENUITEM "Backup Savestates", ID_ENABLE_BACKUPSAVESTATES MENUITEM "Backup Savestates", ID_ENABLE_BACKUPSAVESTATES
MENUITEM "Compress Savestates", ID_ENABLE_COMPRESSSAVESTATES
END END
POPUP "&Display" POPUP "&Display"
BEGIN BEGIN

View File

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

View File

@ -387,6 +387,7 @@ void UpdateCheckedMenuItems()
CheckMenuItem(fceumenu, MENU_DISPLAY_FA_LAGSKIP, frameAdvanceLagSkip?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, MENU_CONFIG_BINDSAVES, bindSavestate?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_ENABLE_BACKUPSAVESTATES, backupSavestates?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, ID_ENABLE_BACKUPSAVESTATES, backupSavestates?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_ENABLE_COMPRESSSAVESTATES, compressSavestates?MF_CHECKED : MF_UNCHECKED);
//Config - Display SubMenu //Config - Display SubMenu
CheckMenuItem(fceumenu, MENU_DISPLAY_LAGCOUNTER, lagCounterDisplay?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, MENU_DISPLAY_LAGCOUNTER, lagCounterDisplay?MF_CHECKED : MF_UNCHECKED);
@ -1621,6 +1622,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
backupSavestates ^=1; backupSavestates ^=1;
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
break; break;
case ID_ENABLE_COMPRESSSAVESTATES:
compressSavestates ^=1;
UpdateCheckedMenuItems();
break;
//Display submenu //Display submenu
case MENU_INPUTDISPLAY_0: //Input display off case MENU_INPUTDISPLAY_0: //Input display off

View File

@ -81,6 +81,7 @@ bool redoLS = false; //This will be true if a backupstate was loaded, meaning
bool internalSaveLoad = false; bool internalSaveLoad = false;
bool backupSavestates = true; bool backupSavestates = true;
bool compressSavestates = true; //By default FCEUX compresses savestates when a movie is inactive.
#define SFMDATA_SIZE (64) #define SFMDATA_SIZE (64)
static SFORMAT SFMDATA[SFMDATA_SIZE]; static SFORMAT SFMDATA[SFMDATA_SIZE];
@ -416,7 +417,7 @@ bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel)
int error = Z_OK; int error = Z_OK;
uint8* cbuf = (uint8*)ms.buf(); uint8* cbuf = (uint8*)ms.buf();
uLongf comprlen = -1; uLongf comprlen = -1;
if(compressionLevel != Z_NO_COMPRESSION) if(compressionLevel != Z_NO_COMPRESSION && compressSavestates)
{ {
//worst case compression. //worst case compression.
//zlib says "0.1% larger than sourceLen plus 12 bytes" //zlib says "0.1% larger than sourceLen plus 12 bytes"

View File

@ -75,3 +75,5 @@ extern bool undoLS; //undo loadstate flag
extern bool redoLS; //redo savestate flag extern bool redoLS; //redo savestate flag
extern bool backupSavestates; //Whether or not to make backups, true by default extern bool backupSavestates; //Whether or not to make backups, true by default
bool CheckBackupSaveStateExist(); //Checks if backupsavestate exists bool CheckBackupSaveStateExist(); //Checks if backupsavestate exists
extern bool compressSavestates; //Whether or not to compress non-movie savestates (by default, yes)

Binary file not shown.