From 0429fe4d0348276ec114084880696f9184c1d7d4 Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 16 Nov 2009 00:22:36 +0000 Subject: [PATCH] sync with FCEUX --- source/fceultra/ines.cpp | 2 +- source/fceultra/input/zapper.h | 2 ++ source/fceultra/movie.cpp | 2 +- source/fceultra/movie.h | 4 ++++ source/fceultra/state.cpp | 9 ++++++--- source/fceultra/state.h | 3 +++ 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/fceultra/ines.cpp b/source/fceultra/ines.cpp index c312bd9..f52b38b 100644 --- a/source/fceultra/ines.cpp +++ b/source/fceultra/ines.cpp @@ -1245,7 +1245,7 @@ static void iNESPower(void) all of the iNES mapper code... */ IRQCount=IRQLatch=IRQa=0; if(head.ROM_type&2) - memset(GameMemBlock+8192,0,sizeof(GameMemBlock)-8192); + memset(GameMemBlock+8192,0,GAME_MEM_BLOCK_SIZE-8192); else memset(GameMemBlock,0,GAME_MEM_BLOCK_SIZE); diff --git a/source/fceultra/input/zapper.h b/source/fceultra/input/zapper.h index 9141ce1..bffac43 100644 --- a/source/fceultra/input/zapper.h +++ b/source/fceultra/input/zapper.h @@ -1,6 +1,8 @@ #ifndef _ZAPPER_H_ #define _ZAPPER_H_ +#include "../types.h" + struct ZAPPER { uint32 mzx,mzy,mzb; diff --git a/source/fceultra/movie.cpp b/source/fceultra/movie.cpp index 68c08fb..62a981b 100644 --- a/source/fceultra/movie.cpp +++ b/source/fceultra/movie.cpp @@ -689,7 +689,7 @@ void FCEUI_StopMovie() #endif } -static void poweron(bool shouldDisableBatteryLoading) +void poweron(bool shouldDisableBatteryLoading) { //// make a for-movie-recording power-on clear the game's save data, too //extern char lastLoadedGameName [2048]; diff --git a/source/fceultra/movie.h b/source/fceultra/movie.h index c233866..f8ab0e7 100644 --- a/source/fceultra/movie.h +++ b/source/fceultra/movie.h @@ -9,6 +9,7 @@ #include "input/zapper.h" #include "utils/guid.h" +#include "utils/md5.h" struct FCEUFILE; @@ -272,4 +273,7 @@ void LoadSubtitles(MovieData); void ProcessSubtitles(void); void FCEU_DisplaySubtitles(char *format, ...); +void poweron(bool shouldDisableBatteryLoading); + + #endif //__MOVIE_H_ diff --git a/source/fceultra/state.cpp b/source/fceultra/state.cpp index a45828f..628f419 100644 --- a/source/fceultra/state.cpp +++ b/source/fceultra/state.cpp @@ -80,6 +80,9 @@ bool redoLS = false; //This will be true if a backupstate was loaded, meaning bool internalSaveLoad = false; +bool backupSavestates = true; +bool compressSavestates = true; //By default FCEUX compresses savestates when a movie is inactive. + #define SFMDATA_SIZE (64) static SFORMAT SFMDATA[SFMDATA_SIZE]; static int SFEXINDEX; @@ -422,7 +425,7 @@ bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel) int error = Z_OK; uint8* cbuf = (uint8*)ms.buf(); uLongf comprlen = -1; - if(compressionLevel != Z_NO_COMPRESSION) + if(compressionLevel != Z_NO_COMPRESSION && compressSavestates) { //worst case compression. //zlib says "0.1% larger than sourceLen plus 12 bytes" @@ -468,7 +471,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) @@ -900,7 +903,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 { diff --git a/source/fceultra/state.h b/source/fceultra/state.h index 1fab215..8a5065c 100644 --- a/source/fceultra/state.h +++ b/source/fceultra/state.h @@ -73,4 +73,7 @@ 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 + +extern bool compressSavestates; //Whether or not to compress non-movie savestates (by default, yes)