Some comments, first modifications for ZMV format using variable speed code.

This commit is contained in:
grinvader
2005-05-13 16:13:49 +00:00
parent dcd315d436
commit 886fec7b7d
3 changed files with 21 additions and 26 deletions

View File

@@ -55,7 +55,7 @@ EXTSYM fxbit67pcal,SfxSFR,nosprincr,cpucycle,switchtovirqdeb,switchtonmideb
EXTSYM MovieSeekBehind,SaveSramData,BackupCVFrame,RestoreCVFrame,loadstate EXTSYM MovieSeekBehind,SaveSramData,BackupCVFrame,RestoreCVFrame,loadstate
EXTSYM KeyInsrtChap,KeyNextChap,KeyPrevChap,MovieInsertChapter,MovieSeekAhead EXTSYM KeyInsrtChap,KeyNextChap,KeyPrevChap,MovieInsertChapter,MovieSeekAhead
EXTSYM ResetDuringMovie,EMUPauseKey,INCRFrameKey,MovieWaiting,NoInputRead EXTSYM ResetDuringMovie,EMUPauseKey,INCRFrameKey,MovieWaiting,NoInputRead
EXTSYM AllocatedRewindStates EXTSYM AllocatedRewindStates,SlowDownLock
%ifdef __MSDOS__ %ifdef __MSDOS__
EXTSYM dssel EXTSYM dssel
@@ -1432,6 +1432,7 @@ NEWSYM cpuover
.noframeincr .noframeincr
cmp byte[EMUPause],1 cmp byte[EMUPause],1
jne .noemupause jne .noemupause
mov byte[SlowDownLock],0 ; prevents some random desyncs
call ProcessRewind call ProcessRewind
@@ -2336,6 +2337,3 @@ NEWSYM execsingle
mov byte[intrset],2 mov byte[intrset],2
.nointrset2 .nointrset2
jmp switchtovirqdeb jmp switchtovirqdeb

View File

@@ -232,10 +232,10 @@ SaveRamSaved db 'SAVED SRAM DATA',0
SECTION .bss SECTION .bss
FastForwardLock resb 1 FastForwardLock resb 1
SlowDownLock resb 1 NEWSYM SlowDownLock, resb 1
FastForwardLockp resb 1 FastForwardLockp resb 1
NEWSYM CSprWinPtr, resd 1 NEWSYM CSprWinPtr, resd 1
NEWSYM SloMo50, resb 1 NEWSYM SloMo, resb 1 ; number of extra times to draw a frame
section .text section .text
NEWSYM cachevideo NEWSYM cachevideo
@@ -313,12 +313,10 @@ NEWSYM cachevideo
.ffmode2 .ffmode2
mov eax,[KeyFastFrwrd] mov eax,[KeyFastFrwrd]
test byte[pressed+eax],1 test byte[pressed+eax],1
je .nofastfor jz .nofastfor
mov byte[pressed+eax],2 mov byte[pressed+eax],2
xor byte[FastForwardLock],1 xor byte[FastForwardLock],1
jmp .ff
.nofastfor .nofastfor
.ff
cmp byte[FastForwardLock],1 cmp byte[FastForwardLock],1
je near .fastfor je near .fastfor
.ffskip .ffskip
@@ -332,7 +330,7 @@ NEWSYM cachevideo
.sdmode2 .sdmode2
mov eax,[KeySlowDown] mov eax,[KeySlowDown]
test byte[pressed+eax],1 test byte[pressed+eax],1
je .noslowdwn jz .noslowdwn
mov byte[pressed+eax],2 mov byte[pressed+eax],2
xor byte[SlowDownLock],1 xor byte[SlowDownLock],1
.noslowdwn .noslowdwn
@@ -340,13 +338,13 @@ NEWSYM cachevideo
je near .slowdwn je near .slowdwn
jmp .sdskip jmp .sdskip
.slowdwn .slowdwn
mov ax,2 mov byte[SloMo],1 ; hardcoded 50% slowdown
mov byte[SloMo50],1
jmp .skipnoslowdown jmp .skipnoslowdown
.sdskip .sdskip
mov ax,1 mov byte[SloMo],0
mov byte[SloMo50],0
.skipnoslowdown .skipnoslowdown
mov ax,[SloMo]
inc ax ; total times frame is drawn
cmp byte[frameskip],0 cmp byte[frameskip],0
jne near .frameskip jne near .frameskip
@@ -370,15 +368,13 @@ NEWSYM cachevideo
jbe near .nofrskip jbe near .nofrskip
mov word[t1cc],0 mov word[t1cc],0
mov byte[curblank],0 mov byte[curblank],0
mov byte[fskipped],0
jmp .nofrskip
.noskip2 .noskip2
mov byte[fskipped],0 mov byte[fskipped],0
jmp .nofrskip jmp .nofrskip
.fastfor .fastfor
inc byte[frskipper] inc byte[frskipper]
push ebx push ebx
mov bl,10 mov bl,10 ; hardcoded number of frames to skip
jmp .fastforb jmp .fastforb
.frameskip .frameskip
inc byte[frskipper] inc byte[frskipper]

View File

@@ -118,7 +118,7 @@ Header
4 bytes - Number of frames in this movie 4 bytes - Number of frames in this movie
4 bytes - Number of rerecords 4 bytes - Number of rerecords
4 bytes - Number of frames removed by rerecord 4 bytes - Number of frames removed by rerecord
4 bytes - Number of frames with slow down 4 bytes - Number of frames advanced step-by-step
4 bytes - Number of key combos 4 bytes - Number of key combos
2 bytes - Number of internal chapters 2 bytes - Number of internal chapters
2 bytes - Length of author name 2 bytes - Length of author name
@@ -240,7 +240,7 @@ struct zmv_header
unsigned int frames; unsigned int frames;
unsigned int rerecords; unsigned int rerecords;
unsigned int removed_frames; unsigned int removed_frames;
unsigned int slow_frames; unsigned int incr_frames;
unsigned int key_combos; unsigned int key_combos;
unsigned short internal_chapters; unsigned short internal_chapters;
unsigned short author_len; unsigned short author_len;
@@ -263,7 +263,7 @@ static void zmv_header_write(struct zmv_header *zmv_head, FILE *fp)
fwrite4(zmv_head->frames, fp); fwrite4(zmv_head->frames, fp);
fwrite4(zmv_head->rerecords, fp); fwrite4(zmv_head->rerecords, fp);
fwrite4(zmv_head->removed_frames, fp); fwrite4(zmv_head->removed_frames, fp);
fwrite4(zmv_head->slow_frames, fp); fwrite4(zmv_head->incr_frames, fp);
fwrite4(zmv_head->key_combos, fp); fwrite4(zmv_head->key_combos, fp);
fwrite2(zmv_head->internal_chapters, fp); fwrite2(zmv_head->internal_chapters, fp);
fwrite2(zmv_head->author_len, fp); fwrite2(zmv_head->author_len, fp);
@@ -325,7 +325,7 @@ static bool zmv_header_read(struct zmv_header *zmv_head, FILE *fp)
zmv_head->frames = fread4(fp); zmv_head->frames = fread4(fp);
zmv_head->rerecords = fread4(fp); zmv_head->rerecords = fread4(fp);
zmv_head->removed_frames = fread4(fp); zmv_head->removed_frames = fread4(fp);
zmv_head->slow_frames = fread4(fp); zmv_head->incr_frames = fread4(fp);
zmv_head->key_combos = fread4(fp); zmv_head->key_combos = fread4(fp);
zmv_head->internal_chapters = fread2(fp); zmv_head->internal_chapters = fread2(fp);
zmv_head->author_len = fread2(fp); zmv_head->author_len = fread2(fp);
@@ -853,13 +853,13 @@ static void zmv_record_command(enum zmv_commands command)
skip_bits = bit_encoder(prev, 0xFFF00000, press_buf, skip_bits); \ skip_bits = bit_encoder(prev, 0xFFF00000, press_buf, skip_bits); \
} }
static void zmv_record(bool slow, unsigned char combos_used) static void zmv_record(bool pause, unsigned char combos_used, unsigned char slow)
{ {
unsigned char flag = 0; unsigned char flag = 0;
unsigned char press_buf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char press_buf[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
size_t skip_bits = 0; size_t skip_bits = 0;
if (slow) { zmv_vars.header.slow_frames++; } if (pause) { zmv_vars.header.incr_frames++; }
zmv_vars.header.key_combos += combos_used; zmv_vars.header.key_combos += combos_used;
@@ -1811,10 +1811,11 @@ enum MovieStatus { MOVIE_OFF = 0, MOVIE_PLAYBACK, MOVIE_RECORD, MOVIE_OLD_PLAY }
#define SetMovieMode(mode) (MovieProcessing = (unsigned char)mode) #define SetMovieMode(mode) (MovieProcessing = (unsigned char)mode)
bool RawDumpInProgress = false; bool RawDumpInProgress = false;
extern bool SRAMState, SloMo50;
bool PrevSRAMState; bool PrevSRAMState;
extern bool SRAMState;
extern unsigned char ComboCounter, MovieRecordWinVal, AllocatedRewindStates; extern unsigned char ComboCounter, MovieRecordWinVal, AllocatedRewindStates;
extern unsigned char SloMo, EMUPause;
char MovieFrameStr[10]; char MovieFrameStr[10];
void SRAMChdir(); void SRAMChdir();
void ChangetoLOADdir(); void ChangetoLOADdir();
@@ -2082,7 +2083,7 @@ void ProcessMovies()
Replay(); Replay();
break; break;
case MOVIE_RECORD: case MOVIE_RECORD:
zmv_record(SloMo50 ? true : false, ComboCounter); zmv_record(EMUPause ? true : false, ComboCounter, SloMo);
break; break;
case MOVIE_OLD_PLAY: case MOVIE_OLD_PLAY:
OldMovieReplay(); OldMovieReplay();