From 1085ed6fad46eee3335db6f8e732399e513a95d8 Mon Sep 17 00:00:00 2001 From: BearOso Date: Wed, 13 Apr 2022 15:06:13 -0500 Subject: [PATCH] Remove Settings.SupportHires There's no point in disabling it at this point, so it's always supported. --- gfx.cpp | 45 +++++++++++++++++++---------------------- gfx.h | 2 +- gtk/src/gtk_config.cpp | 1 - gtk/src/gtk_display.cpp | 1 - libretro/libretro.cpp | 5 ----- macosx/mac-os.mm | 1 - snapshot.cpp | 12 +++++------ snes9x.cpp | 4 ---- snes9x.h | 3 --- unix/unix.cpp | 1 - win32/wconfig.cpp | 2 -- 11 files changed, 28 insertions(+), 49 deletions(-) diff --git a/gfx.cpp b/gfx.cpp index cf2f8a04..b717c7ff 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -123,7 +123,7 @@ void S9xGraphicsScreenResize (void) IPPU.InterlaceOBJ = Memory.FillRAM[0x2133] & 2; IPPU.PseudoHires = Memory.FillRAM[0x2133] & 8; - if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires)) + if (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires) { IPPU.DoubleWidthPixels = TRUE; IPPU.RenderedScreenWidth = SNES_WIDTH << 1; @@ -134,7 +134,7 @@ void S9xGraphicsScreenResize (void) IPPU.RenderedScreenWidth = SNES_WIDTH; } - if (Settings.SupportHiRes && IPPU.Interlace) + if (IPPU.Interlace) { GFX.PPL = GFX.RealPPL << 1; IPPU.DoubleHeightPixels = TRUE; @@ -472,34 +472,31 @@ void S9xUpdateScreen (void) PPU.RecomputeClipWindows = FALSE; } - if (Settings.SupportHiRes) + if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires)) { - if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires)) + // Have to back out of the regular speed hack + for (uint32 y = 0; y < GFX.StartY; y++) { - // Have to back out of the regular speed hack - for (uint32 y = 0; y < GFX.StartY; y++) - { - uint16 *p = GFX.Screen + y * GFX.PPL + 255; - uint16 *q = GFX.Screen + y * GFX.PPL + 510; + uint16 *p = GFX.Screen + y * GFX.PPL + 255; + uint16 *q = GFX.Screen + y * GFX.PPL + 510; - for (int x = 255; x >= 0; x--, p--, q -= 2) - *q = *(q + 1) = *p; - } - - IPPU.DoubleWidthPixels = TRUE; - IPPU.RenderedScreenWidth = 512; + for (int x = 255; x >= 0; x--, p--, q -= 2) + *q = *(q + 1) = *p; } - if (!IPPU.DoubleHeightPixels && IPPU.Interlace && (PPU.BGMode == 5 || PPU.BGMode == 6)) - { - IPPU.DoubleHeightPixels = TRUE; - IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1; - GFX.PPL = GFX.RealPPL << 1; - GFX.DoInterlace = 2; + IPPU.DoubleWidthPixels = TRUE; + IPPU.RenderedScreenWidth = 512; + } - for (int32 y = (int32) GFX.StartY - 2; y >= 0; y--) - memmove(GFX.Screen + (y + 1) * GFX.PPL, GFX.Screen + y * GFX.RealPPL, GFX.PPL * sizeof(uint16)); - } + if (!IPPU.DoubleHeightPixels && IPPU.Interlace && (PPU.BGMode == 5 || PPU.BGMode == 6)) + { + IPPU.DoubleHeightPixels = TRUE; + IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1; + GFX.PPL = GFX.RealPPL << 1; + GFX.DoInterlace = 2; + + for (int32 y = (int32) GFX.StartY - 2; y >= 0; y--) + memmove(GFX.Screen + (y + 1) * GFX.PPL, GFX.Screen + y * GFX.RealPPL, GFX.PPL * sizeof(uint16)); } if ((Memory.FillRAM[0x2130] & 0x30) != 0x30 && (Memory.FillRAM[0x2131] & 0x3f)) diff --git a/gfx.h b/gfx.h index bfbbcdd7..ad232692 100644 --- a/gfx.h +++ b/gfx.h @@ -16,7 +16,7 @@ struct SGFX const uint32 Pitch = sizeof(uint16) * MAX_SNES_WIDTH; const uint32 RealPPL = MAX_SNES_WIDTH; // true PPL of Screen buffer const uint32 ScreenSize = MAX_SNES_WIDTH * MAX_SNES_HEIGHT; - uint16 ScreenBuffer[512 * (478 + 64)]; + uint16 ScreenBuffer[MAX_SNES_WIDTH * (MAX_SNES_HEIGHT + 64)]; uint16 *Screen; uint16 *SubScreen; uint8 *ZBuffer; diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp index be0ba28e..02751134 100644 --- a/gtk/src/gtk_config.cpp +++ b/gtk/src/gtk_config.cpp @@ -177,7 +177,6 @@ int Snes9xConfig::load_defaults() Settings.StopEmulation = true; Settings.FrameTimeNTSC = 16639; Settings.FrameTimePAL = 20000; - Settings.SupportHiRes = true; Settings.FrameTime = Settings.FrameTimeNTSC; Settings.BlockInvalidVRAMAccessMaster = true; Settings.SoundSync = false; diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index 572d9ffe..7e7a7f03 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -1624,7 +1624,6 @@ static void S9xGTKDisplayString(const char *string, int linesFromBottom, void S9xInitDisplay(int argc, char **argv) { - Settings.SupportHiRes = true; S9xBlit2xSaIFilterInit(); #ifdef USE_HQ2X S9xBlitHQ2xFilterInit(); diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 58028418..e10b555d 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -372,10 +372,6 @@ static void update_variables(void) var.value=NULL; Settings.Transparency=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)); - var.key="snes9x_gfx_hires"; - var.value=NULL; - Settings.SupportHiRes=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)); - var.key="snes9x_audio_interpolation"; var.value=NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) @@ -1344,7 +1340,6 @@ void retro_init(void) Settings.Stereo = TRUE; Settings.SoundPlaybackRate = 32040; Settings.SoundInputRate = 32040; - Settings.SupportHiRes = TRUE; Settings.Transparency = TRUE; Settings.AutoDisplayMessages = TRUE; Settings.InitialInfoStringTimeout = 120; diff --git a/macosx/mac-os.mm b/macosx/mac-os.mm index f37a27dc..25075627 100644 --- a/macosx/mac-os.mm +++ b/macosx/mac-os.mm @@ -2508,7 +2508,6 @@ static void Initialize (void) Settings.Stereo = true; Settings.SoundPlaybackRate = 32000; Settings.SoundInputRate = 31950; - Settings.SupportHiRes = true; Settings.Transparency = true; Settings.AutoDisplayMessages = true; Settings.InitialInfoStringTimeout = 120; diff --git a/snapshot.cpp b/snapshot.cpp index b2a845da..64059dad 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -1754,11 +1754,11 @@ int S9xUnfreezeFromStream (STREAM stream) UnfreezeStructFromCopy(ssi, SnapScreenshot, COUNT(SnapScreenshot), local_screenshot, version); - IPPU.RenderedScreenWidth = min(ssi->Width, IMAGE_WIDTH); - IPPU.RenderedScreenHeight = min(ssi->Height, IMAGE_HEIGHT); + IPPU.RenderedScreenWidth = min(ssi->Width, MAX_SNES_WIDTH); + IPPU.RenderedScreenHeight = min(ssi->Height, MAX_SNES_HEIGHT); const bool8 scaleDownX = IPPU.RenderedScreenWidth < ssi->Width; const bool8 scaleDownY = IPPU.RenderedScreenHeight < ssi->Height && ssi->Height > SNES_HEIGHT_EXTENDED; - GFX.DoInterlace = Settings.SupportHiRes ? ssi->Interlaced : 0; + GFX.DoInterlace = ssi->Interlaced; uint8 *rowpix = ssi->Data; uint16 *screen = GFX.Screen; @@ -1795,7 +1795,7 @@ int S9xUnfreezeFromStream (STREAM stream) } // black out what we might have missed - for (uint32 y = IPPU.RenderedScreenHeight; y < (uint32) (IMAGE_HEIGHT); y++) + for (uint32 y = IPPU.RenderedScreenHeight; y < (uint32) (MAX_SNES_HEIGHT); y++) memset(GFX.Screen + y * GFX.RealPPL, 0, GFX.RealPPL * 2); delete ssi; @@ -1893,8 +1893,8 @@ int S9xUnfreezeScreenshotFromStream(STREAM stream, uint16 **image_buffer, int &w UnfreezeStructFromCopy(ssi, SnapScreenshot, COUNT(SnapScreenshot), local_screenshot, version); - width = min(ssi->Width, IMAGE_WIDTH); - height = min(ssi->Height, IMAGE_HEIGHT); + width = min(ssi->Width, MAX_SNES_WIDTH); + height = min(ssi->Height, MAX_SNES_HEIGHT); *image_buffer = (uint16 *)malloc(width * height * sizeof(uint16)); diff --git a/snes9x.cpp b/snes9x.cpp index c96c52d4..4a1ae67c 100644 --- a/snes9x.cpp +++ b/snes9x.cpp @@ -247,7 +247,6 @@ void S9xLoadConfigFiles (char **argv, int argc) // Display - Settings.SupportHiRes = conf.GetBool("Display::HiRes", true); Settings.Transparency = conf.GetBool("Display::Transparency", true); Settings.DisableGraphicWindows = !conf.GetBool("Display::GraphicWindows", true); Settings.DisplayTime = conf.GetBool("Display::DisplayTime", false); @@ -550,9 +549,6 @@ char * S9xParseArgs (char **argv, int argc) if (!strcasecmp(argv[i], "-displaykeypress")) Settings.DisplayPressedKeys = TRUE; else - if (!strcasecmp(argv[i], "-nohires")) - Settings.SupportHiRes = FALSE; - else if (!strcasecmp(argv[i], "-notransparency")) Settings.Transparency = FALSE; else diff --git a/snes9x.h b/snes9x.h index 720d39ae..e8d890e9 100644 --- a/snes9x.h +++ b/snes9x.h @@ -58,8 +58,6 @@ #define SNES_HEIGHT_EXTENDED 239 #define MAX_SNES_WIDTH (SNES_WIDTH * 2) #define MAX_SNES_HEIGHT (SNES_HEIGHT_EXTENDED * 2) -#define IMAGE_WIDTH (Settings.SupportHiRes ? MAX_SNES_WIDTH : SNES_WIDTH) -#define IMAGE_HEIGHT (Settings.SupportHiRes ? MAX_SNES_HEIGHT : SNES_HEIGHT_EXTENDED) #define NTSC_MASTER_CLOCK 21477272.727272 // 21477272 + 8/11 exact #define PAL_MASTER_CLOCK 21281370.0 @@ -242,7 +240,6 @@ struct SSettings int32 DynamicRateLimit; /* Multiplied by 1000 */ int32 InterpolationMethod; - bool8 SupportHiRes; bool8 Transparency; uint8 BG_Forced; bool8 DisableGraphicWindows; diff --git a/unix/unix.cpp b/unix/unix.cpp index e38568fd..0ea39c6a 100644 --- a/unix/unix.cpp +++ b/unix/unix.cpp @@ -1648,7 +1648,6 @@ int main (int argc, char **argv) Settings.Stereo = TRUE; Settings.SoundPlaybackRate = 48000; Settings.SoundInputRate = 31950; - Settings.SupportHiRes = TRUE; Settings.Transparency = TRUE; Settings.AutoDisplayMessages = TRUE; Settings.InitialInfoStringTimeout = 120; diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index e04c5ae5..01422e28 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -104,8 +104,6 @@ void WinSetDefaultValues () // CPU options Settings.Paused = false; - Settings.SupportHiRes = true; - #ifdef NETPLAY_SUPPORT Settings.Port = 1996; NetPlay.MaxFrameSkip = 10;