From 0ff2a2eb4918b1df104271459781b4c67e16bab9 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 15 Nov 2015 18:02:20 -0600 Subject: [PATCH] fix crashy bugs in snes gfx debugger --- BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs | 4 ++++ .../Consoles/Nintendo/SNES/SNESGraphicsDecoder.cs | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs index dc76e411a8..9754c7cb3d 100644 --- a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs @@ -1160,6 +1160,10 @@ namespace BizHawk.Client.EmuHawk { var bg = si.BG[(int)CurrDisplaySelection]; + //unavailable BG for this mode + if (bg.Bpp == 0) + break; + if (bg.TileSize == 16) { tx /= 2; ty /= 2; } //worry about this later. need to pass a different flag into `currViewingTile` int tloc = ty * bg.ScreenSizeInTiles.Width + tx; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SNESGraphicsDecoder.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SNESGraphicsDecoder.cs index 1f3ac22c98..362c524900 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SNESGraphicsDecoder.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SNESGraphicsDecoder.cs @@ -6,8 +6,7 @@ //http://wiki.superfamicom.org/snes/show/Registers //TODO -//SF2 title art doesnt seem to show up.. -//scanline control doesnt work? +//when a BG is not available, the last rendered BG still shows up. should clear it using System; @@ -645,6 +644,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// public void DecodeBG(int* screen, int stride, TileEntry[] map, int tiledataBaseAddr, ScreenSize size, int bpp, int tilesize, int paletteStart) { + //emergency backstop. this can only happen if we're displaying an unavailable BG or other similar such value + if (bpp == 0) return; + int ncolors = 1 << bpp; int[] tileBuf = new int[16*16];