Pause rewind now mostly implemented.

This commit is contained in:
n-a-c-h
2005-05-14 18:23:16 +00:00
parent af7dacccf7
commit cc2814c5cf
2 changed files with 42 additions and 13 deletions

View File

@@ -56,6 +56,7 @@ EXTSYM MovieSeekBehind,SaveSramData,BackupCVFrame,RestoreCVFrame,loadstate
EXTSYM KeyInsrtChap,KeyNextChap,KeyPrevChap,MovieInsertChapter,MovieSeekAhead
EXTSYM ResetDuringMovie,EMUPauseKey,INCRFrameKey,MovieWaiting,NoInputRead
EXTSYM AllocatedRewindStates,SlowDownLock,FastForwardLock
EXTSYM PauseFrameMode,RestorePauseFrame
%ifdef __MSDOS__
EXTSYM dssel
@@ -1425,24 +1426,40 @@ NEWSYM cpuover
.noinputread
;Pause and Frame increment
cmp byte[PauseFrameMode],2
jne .nopauseframemode2
pushad
call RestorePauseFrame
popad
.nopauseframemode2
cmp byte[EMUPause],1
jne .noemupause
; prevents some random desyncs
mov byte[SlowDownLock],0
mov byte[FastForwardLock],0
call ProcessRewind
cmp byte[PauseFrameMode],1
jne .nopauseframemode1
mov byte[PauseFrameMode],2
jmp .noprocmovie
.nopauseframemode1
cmp byte[INCRFrame],1
jne .noframeincr
xor byte[INCRFrame],1
jmp .noemupause
.noframeincr
cmp byte[EMUPause],1
jne .noemupause
mov byte[SlowDownLock],0 ; prevents some random desyncs
mov byte[FastForwardLock],0 ; prevents some random desyncs
call ProcessRewind
;Update screen (we should also kill sound)
pushad
call StartDrawNewGfx
call showvideo
popad
;jmp .nocache
jmp .nonewgfx
.noemupause

View File

@@ -220,18 +220,28 @@ void ClearCacheCheck()
}
//Code to handle special frames for pausing, and desync checking
unsigned char *SpecialPauseBackup = 0;
unsigned char *SpecialPauseBackup = 0, PauseFrameMode = 0;
/*
Pause frame modes
0 - no pause frame stored
1 - pause frame stored
2 - pause frame ready for reload
*/
void *doMemAlloc(size_t);
void BackupPauseFrame()
{
copy_state_data(SpecialPauseBackup, memcpyinc, csm_save_rewind);
PauseFrameMode = 1;
}
void RestorePauseFrame()
{
copy_state_data(SpecialPauseBackup, memcpyrinc, csm_load_rewind);
ClearCacheCheck();
PauseFrameMode = 0;
}
#define ActualRewindFrames (RewindFrames * (romispal ? 10 : 12))
@@ -285,14 +295,16 @@ void RestoreCVFrame()
zmv_rewind_load(LatestRewindPos, true);
}
if ((EMUPause = PauseRewind)) //Yes this if supposed to have a single equal
{
BackupPauseFrame();
}
EMUPause = PauseRewind;
}
copy_state_data(RewindBufferPos, memcpyrinc, csm_load_rewind);
if (EMUPause)
{
BackupPauseFrame();
}
ClearCacheCheck();
RewindTimer = ActualRewindFrames;