diff options
Diffstat (limited to 'libpcsxcore')
| -rwxr-xr-x | libpcsxcore/misc.c | 12 | ||||
| -rwxr-xr-x | libpcsxcore/psxcommon.c | 5 | ||||
| -rwxr-xr-x | libpcsxcore/psxcommon.h | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 92bb12c5..26e456cc 100755 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -528,11 +528,13 @@ u32 mem_cur_save_count=0, mem_last_save; boolean mem_wrapped=FALSE; // Whether we went past max count and restarted counting void CreateRewindState() { - SaveStateMem(mem_last_save=mem_cur_save_count++); - - if (mem_cur_save_count > Config.RewindCount) { - mem_cur_save_count = 0; - mem_wrapped=TRUE; + if (Config.RewindCount > 0) { + SaveStateMem(mem_last_save=mem_cur_save_count++); + + if (mem_cur_save_count > Config.RewindCount) { + mem_cur_save_count = 0; + mem_wrapped=TRUE; + } } } diff --git a/libpcsxcore/psxcommon.c b/libpcsxcore/psxcommon.c index 959b9a7d..98525e51 100755 --- a/libpcsxcore/psxcommon.c +++ b/libpcsxcore/psxcommon.c @@ -29,6 +29,7 @@ boolean NetOpened = FALSE; int Log = 0; FILE *emuLog = NULL; +u32 rewind_counter=0; // It is safe if this overflows int EmuInit() { return psxInit(); @@ -57,6 +58,10 @@ void EmuUpdate() { SysUpdate(); ApplyCheats(); + + if (Config.RewindInterval > 0 && !(++rewind_counter%Config.RewindInterval)) { + CreateRewindState(); + } } void __Log(char *fmt, ...) { diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index 16428115..b6f83e74 100755 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -158,6 +158,7 @@ typedef struct { u8 Cpu; // CPU_DYNAREC or CPU_INTERPRETER u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL u32 RewindCount; + u32 RewindInterval; #ifdef _WIN32 char Lang[256]; #endif @@ -165,6 +166,7 @@ typedef struct { extern PcsxConfig Config; extern boolean NetOpened; +extern u32 rewind_counter; // It is safe if this overflows #define gzfreeze(ptr, size) { \ if (Mode == 1) gzwrite(f, ptr, size); \ |
