From a7695760f235b31c3fcb486f0c8e703aa7ba7cf0 Mon Sep 17 00:00:00 2001 From: gocha Date: Sat, 4 Aug 2012 13:37:00 +0900 Subject: [PATCH] Add lag frame count display, instead of "ignored" sign. Adjust reset timing: - move IPPU.TotalEmulatedFrames initialization from InitROM to S9xResetPPU (part of S9xReset) - reset pad_read in S9xResetPPU (it must be reset at the beginning of emulation including movie playing/recording, otherwise the lag frame count can show a different value, because of the first frame.) --- controls.cpp | 3 +++ memmap.cpp | 2 -- movie.cpp | 7 +++++++ ppu.cpp | 5 +++++ ppu.h | 1 + snes9x.cpp | 1 + snes9x.h | 1 + win32/wconfig.cpp | 1 + 8 files changed, 19 insertions(+), 2 deletions(-) diff --git a/controls.cpp b/controls.cpp index 714bb206..e81eeaf6 100644 --- a/controls.cpp +++ b/controls.cpp @@ -3321,6 +3321,9 @@ void S9xControlEOF (void) S9xMovieUpdate(); + if(!pad_read) + IPPU.PadIgnoredFrames++; + pad_read_last = pad_read; pad_read = false; } diff --git a/memmap.cpp b/memmap.cpp index 72196bb1..053f8ae2 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -2695,8 +2695,6 @@ void CMemory::InitROM (void) Timings.NMIDMADelay = 24; Timings.IRQPendCount = 0; - IPPU.TotalEmulatedFrames = 0; - //// Hack games ApplyROMFixes(); diff --git a/movie.cpp b/movie.cpp index b8668e0d..7ee8c8e1 100644 --- a/movie.cpp +++ b/movie.cpp @@ -1209,4 +1209,11 @@ void S9xUpdateFrameCounter (int offset) double second = fmod(totalseconds, 60.0); sprintf(GFX.FrameDisplayString, "Frame: %d (%d:%02d:%05.2f)", frame, hour, minute, second); } + + if (Settings.DisplayLagFrame) + { + char LagFrameDisplayString[64]; + sprintf(LagFrameDisplayString, " | %d", IPPU.PadIgnoredFrames); + strcat(GFX.FrameDisplayString, LagFrameDisplayString); + } } diff --git a/ppu.cpp b/ppu.cpp index 59d11f25..b62f9993 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -1812,6 +1812,11 @@ void S9xResetPPU (void) PPU.M7HOFS = 0; PPU.M7VOFS = 0; PPU.M7byte = 0; + + IPPU.TotalEmulatedFrames = 0; + IPPU.PadIgnoredFrames = 0; + extern bool8 pad_read, pad_read_last; + pad_read = pad_read_last = FALSE; } void S9xSoftResetPPU (void) diff --git a/ppu.h b/ppu.h index a35d70ac..d437a6cc 100644 --- a/ppu.h +++ b/ppu.h @@ -237,6 +237,7 @@ struct InternalPPU uint32 TotalEmulatedFrames; uint32 SkippedFrames; uint32 FrameSkip; + uint32 PadIgnoredFrames; }; struct SOBJ diff --git a/snes9x.cpp b/snes9x.cpp index 3a554daf..d36ab95e 100644 --- a/snes9x.cpp +++ b/snes9x.cpp @@ -416,6 +416,7 @@ void S9xLoadConfigFiles (char **argv, int argc) Settings.DisplayWatchedAddresses = conf.GetBool("Display::DisplayWatchedAddresses", false); Settings.DisplayPressedKeys = conf.GetBool("Display::DisplayInput", false); Settings.DisplayMovieFrame = conf.GetBool("Display::DisplayFrameCount", false); + Settings.DisplayLagFrame = conf.GetBool("Display::DisplayLagFrameCount", false); Settings.AutoDisplayMessages = conf.GetBool("Display::MessagesInImage", true); Settings.InitialInfoStringTimeout = conf.GetInt ("Display::MessageDisplayTime", 120); diff --git a/snes9x.h b/snes9x.h index aecbb9c1..d0aa3f9d 100644 --- a/snes9x.h +++ b/snes9x.h @@ -402,6 +402,7 @@ struct SSettings bool8 DisplayWatchedAddresses; bool8 DisplayPressedKeys; bool8 DisplayMovieFrame; + bool8 DisplayLagFrame; bool8 AutoDisplayMessages; uint32 InitialInfoStringTimeout; uint16 DisplayColor; diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index b847fd37..168bae48 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -860,6 +860,7 @@ void WinRegisterConfigItems() AddBool2C("FrameRate", Settings.DisplayFrameRate, false, "on to display the framerate (will be inaccurate if AutoMaxSkipFrames is too small)"); AddBoolC("DisplayInput", Settings.DisplayPressedKeys, false, "true to show which buttons are pressed"); AddBoolC("DisplayFrameCount", Settings.DisplayMovieFrame, true, "true to show the frame count when a movie is playing"); + AddBoolC("DisplayLagFrameCount", Settings.DisplayLagFrame, true, "true to show the lag frame count"); #undef CATEGORY #define CATEGORY "Display\\Win" AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D, 2=OpenGL");