Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 0775c3016d62c0a479400d0fffc8dff1692d9dcd Mon Sep 17 00:00:00 2001
- From: gocha <gochaism@gmail.com>
- Date: Sun, 30 Jan 2011 19:47:45 +0900
- Subject: [PATCH] - added lag counter and Settings.DisplayLagCounter (TODO: add GUI item for it).
- - changed the position of input display text to avoid overlapping frame counter.
- - Settings.DisplayMovieFrame now becomes Settings.DisplayFrameCounter, and displays IPPU.TotalEmulatedFrames when movie is not active.
- - Made those frame counters a little more deterministic. (i.e. reset the values on SNES reset)
- TODO: add IPPU.TotalEmulatedFrames and IPPU.TotalLagFrames to snapshot, as well as pad_read.
- ---
- controls.cpp | 5 +++++
- gfx.cpp | 4 ++--
- memmap.cpp | 2 --
- movie.cpp | 17 +++++++++++++++--
- ppu.cpp | 17 +++++++++++++----
- ppu.h | 1 +
- snes9x.cpp | 3 ++-
- snes9x.h | 3 ++-
- win32/wconfig.cpp | 3 ++-
- 9 files changed, 42 insertions(+), 13 deletions(-)
- diff --git a/controls.cpp b/controls.cpp
- index 5985781..d0ec914 100644
- --- a/controls.cpp
- +++ b/controls.cpp
- @@ -3319,6 +3319,11 @@ void S9xControlEOF (void)
- S9xMovieUpdate();
- + if (!pad_read)
- + {
- + IPPU.TotalLagFrames++;
- + }
- +
- pad_read_last = pad_read;
- pad_read = false;
- }
- diff --git a/gfx.cpp b/gfx.cpp
- index f7bb546..9397b89 100644
- --- a/gfx.cpp
- +++ b/gfx.cpp
- @@ -2044,7 +2044,7 @@ static void DisplayPressedKeys (void)
- static int KeyOrder[] = { 8, 10, 7, 9, 0, 6, 14, 13, 5, 1, 4, 3, 2, 11, 12 }; // < ^ > v A B Y X L R S s
- enum controllers controller;
- - int line = 1;
- + int line = 2;
- int8 ids[4];
- char string[255];
- @@ -2194,7 +2194,7 @@ void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int sca
- if (Settings.DisplayPressedKeys)
- DisplayPressedKeys();
- - if (Settings.DisplayMovieFrame && S9xMovieActive())
- + if (Settings.DisplayFrameCounter)
- S9xDisplayString(GFX.FrameDisplayString, 1, 1, false);
- if (GFX.InfoString && *GFX.InfoString)
- diff --git a/memmap.cpp b/memmap.cpp
- index 4844e52..8c5c042 100644
- --- a/memmap.cpp
- +++ b/memmap.cpp
- @@ -2597,8 +2597,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 f4b018b..779ab61 100644
- --- a/movie.cpp
- +++ b/movie.cpp
- @@ -1172,7 +1172,7 @@ void S9xMovieToggleRecState (void)
- void S9xMovieToggleFrameDisplay (void)
- {
- - Settings.DisplayMovieFrame = !Settings.DisplayMovieFrame;
- + Settings.DisplayFrameCounter = !Settings.DisplayFrameCounter;
- S9xReRefresh();
- }
- @@ -1182,7 +1182,7 @@ void S9xUpdateFrameCounter (int offset)
- offset++;
- - if (!Settings.DisplayMovieFrame)
- + if (!Settings.DisplayFrameCounter)
- *GFX.FrameDisplayString = 0;
- else
- if (Movie.State == MOVIE_STATE_RECORD)
- @@ -1198,4 +1198,17 @@ void S9xUpdateFrameCounter (int offset)
- sprintf(GFX.FrameDisplayString, "%s frame: %d", Settings.NetPlayServer ? "Server" : "Client",
- max(0, (int) (NetPlay.FrameCount + offset)));
- #endif
- + else
- + sprintf(GFX.FrameDisplayString, "Playing frame: %d",
- + max(0, (int) IPPU.TotalEmulatedFrames));
- +
- + if (Settings.DisplayLagCounter)
- + {
- + char LagCounterString[24];
- + sprintf(LagCounterString, "%d", IPPU.TotalLagFrames);
- +
- + if (Settings.DisplayFrameCounter)
- + strcat(GFX.FrameDisplayString, " | ");
- + strcat(GFX.FrameDisplayString, LagCounterString);
- + }
- }
- diff --git a/ppu.cpp b/ppu.cpp
- index a9dc271..26c3926 100644
- --- a/ppu.cpp
- +++ b/ppu.cpp
- @@ -1671,14 +1671,14 @@ uint8 S9xGetCPU (uint16 Address)
- {
- if (Address < 0x4200)
- {
- - #ifdef SNES_JOY_READ_CALLBACKS
- extern bool8 pad_read;
- if (Address == 0x4016 || Address == 0x4017)
- {
- + #ifdef SNES_JOY_READ_CALLBACKS
- S9xOnSNESPadRead();
- + #endif
- pad_read = TRUE;
- }
- - #endif
- switch (Address)
- {
- @@ -1783,14 +1783,14 @@ uint8 S9xGetCPU (uint16 Address)
- case 0x421d: // JOY3H
- case 0x421e: // JOY4L
- case 0x421f: // JOY4H
- - #ifdef SNES_JOY_READ_CALLBACKS
- extern bool8 pad_read;
- if (Memory.FillRAM[0x4200] & 1)
- {
- S9xOnSNESPadRead();
- + #ifdef SNES_JOY_READ_CALLBACKS
- pad_read = TRUE;
- + #endif
- }
- - #endif
- return (Memory.FillRAM[Address]);
- default:
- @@ -1977,6 +1977,15 @@ void S9xSoftResetPPU (void)
- IPPU.SkippedFrames = 0;
- IPPU.FrameSkip = 0;
- + if (!S9xMovieActive())
- + {
- + extern bool8 pad_read, pad_read_last;
- + IPPU.TotalEmulatedFrames = 0;
- + IPPU.TotalLagFrames = 0;
- + pad_read = 0;
- + pad_read_last = 0;
- + }
- +
- S9xFixColourBrightness();
- for (int c = 0; c < 0x8000; c += 0x100)
- diff --git a/ppu.h b/ppu.h
- index c5cb9d7..11d7fb1 100644
- --- a/ppu.h
- +++ b/ppu.h
- @@ -234,6 +234,7 @@ struct InternalPPU
- uint32 RenderedFramesCount;
- uint32 DisplayedRenderedFrameCount;
- uint32 TotalEmulatedFrames;
- + uint32 TotalLagFrames;
- uint32 SkippedFrames;
- uint32 FrameSkip;
- };
- diff --git a/snes9x.cpp b/snes9x.cpp
- index a467614..4d470af 100644
- --- a/snes9x.cpp
- +++ b/snes9x.cpp
- @@ -414,7 +414,8 @@ void S9xLoadConfigFiles (char **argv, int argc)
- Settings.DisplayFrameRate = conf.GetBool("Display::DisplayFrameRate", false);
- Settings.DisplayWatchedAddresses = conf.GetBool("Display::DisplayWatchedAddresses", false);
- Settings.DisplayPressedKeys = conf.GetBool("Display::DisplayInput", false);
- - Settings.DisplayMovieFrame = conf.GetBool("Display::DisplayFrameCount", false);
- + Settings.DisplayFrameCounter = conf.GetBool("Display::DisplayFrameCount", false);
- + Settings.DisplayLagCounter = conf.GetBool("Display::LagCounter", false);
- Settings.AutoDisplayMessages = conf.GetBool("Display::MessagesInImage", true);
- Settings.InitialInfoStringTimeout = conf.GetInt ("Display::MessageDisplayTime", 120);
- diff --git a/snes9x.h b/snes9x.h
- index ccab877..fd8c5c0 100644
- --- a/snes9x.h
- +++ b/snes9x.h
- @@ -387,7 +387,8 @@ struct SSettings
- bool8 DisplayFrameRate;
- bool8 DisplayWatchedAddresses;
- bool8 DisplayPressedKeys;
- - bool8 DisplayMovieFrame;
- + bool8 DisplayFrameCounter;
- + bool8 DisplayLagCounter;
- bool8 AutoDisplayMessages;
- uint32 InitialInfoStringTimeout;
- uint16 DisplayColor;
- diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp
- index 28242ee..95c3ab2 100644
- --- a/win32/wconfig.cpp
- +++ b/win32/wconfig.cpp
- @@ -857,7 +857,8 @@ void WinRegisterConfigItems()
- AddBoolC("MessagesInImage", Settings.AutoDisplayMessages, false, "true to draw text inside the SNES image (will get into AVIs, screenshots, and filters)");
- 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("DisplayFrameCount", Settings.DisplayFrameCounter, true, "true to show the frame count");
- + AddBoolC("DisplayLagCounter", Settings.DisplayLagCounter, true, "true to show the \"ignored\" frame count which increments when input was not used by the SNES");
- #undef CATEGORY
- #define CATEGORY "Display\\Win"
- AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D");
- --
- 1.7.3.1.msysgit.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement