From 0a5f20c03407048af5a5f2292515a2acb2766032 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 11 Nov 2008 22:58:29 +0000 Subject: [PATCH] Frame counter can now display when no movie is loaded. (If no movie, reset and power reset the counter to 0). --- src/drivers/win/main.cpp | 1 - src/input.cpp | 10 ++++++++++ src/movie.cpp | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 95a718bf..166968d1 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -590,7 +590,6 @@ int main(int argc,char *argv[]) fullscreen = !!fullscreen; soundo = !!soundo; frame_display = !!frame_display; - //input_display = !!input_display; adelikat - input_display has 4 states, not 2, this shouldn't be done allowUDLR = !!allowUDLR; pauseAfterPlayback = !!pauseAfterPlayback; EnableBackgroundInput = !!EnableBackgroundInput; diff --git a/src/input.cpp b/src/input.cpp index 355bb732..e2213599 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -541,12 +541,21 @@ void FCEUI_VSUniCoin(void) FCEU_QSimpleCommand(FCEUNPCMD_VSUNICOIN); } +//Resets the frame counter if movie inactive and rom is reset or power-cycle +void ResetFrameCounter() +{ +extern EMOVIEMODE movieMode; + if(movieMode == MOVIEMODE_INACTIVE) + currFrameCounter = 0; +} + //Resets the NES void FCEUI_ResetNES(void) { if(!FCEU_IsValidUI(FCEUI_RESET)) return; FCEU_QSimpleCommand(FCEUNPCMD_RESET); + ResetFrameCounter(); } //Powers off the NES @@ -555,6 +564,7 @@ void FCEUI_PowerNES(void) if(!FCEU_IsValidUI(FCEUI_POWER)) return; FCEU_QSimpleCommand(FCEUNPCMD_POWER); + ResetFrameCounter(); } const char* FCEUI_CommandTypeNames[]= diff --git a/src/movie.cpp b/src/movie.cpp index 362cec59..5f19d208 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -943,7 +943,14 @@ void FCEU_DrawMovies(uint8 *XBuf) sprintf(counterbuf,"%d/%d",currFrameCounter,currMovieData.records.size()); else if(movieMode == MOVIEMODE_RECORD) sprintf(counterbuf,"%d",currMovieData.records.size()); - + + if(counterbuf[0]) + DrawTextTrans(XBuf+FCEU_TextScanlineOffsetFromBottom(24), 256, (uint8*)counterbuf, 0x20+0x80); + } + else + { + char counterbuf[32] = {0}; + sprintf(counterbuf,"%d (no movie)",currFrameCounter); if(counterbuf[0]) DrawTextTrans(XBuf+FCEU_TextScanlineOffsetFromBottom(24), 256, (uint8*)counterbuf, 0x20+0x80); }