diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/VDP.Mode4.cs b/BizHawk.Emulation/Consoles/Sega/SMS/VDP.Mode4.cs index b5d3adfcd5..158db1f348 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/VDP.Mode4.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/VDP.Mode4.cs @@ -289,10 +289,60 @@ namespace BizHawk.Emulation.Consoles.Sega if (mode == VdpMode.GameGear) { - int yStart = (FrameHeight - 144)/2; - for (int y = 0; y < 144; y++) - for (int x = 0; x < 160; x++) - GameGearFrameBuffer[(y * 160) + x] = FrameBuffer[((y + yStart) * 256) + x + 48]; + if (Sms.CoreInputComm.GG_ShowClippedRegions == false) + { + int yStart = (FrameHeight - 144)/2; + for (int y = 0; y < 144; y++) + for (int x = 0; x < 160; x++) + GameGearFrameBuffer[(y * 160) + x] = FrameBuffer[((y + yStart) * 256) + x + 48]; + } + + if (Sms.CoreInputComm.GG_HighlightActiveRegion && Sms.CoreInputComm.GG_ShowClippedRegions) + { + // Top 24 scanlines + for (int y = 0; y < 24; y++) + { + for (int x = 0; x < 256; x++) + { + int frameOffset = (y * 256) + x; + int p = (FrameBuffer[frameOffset] >> 1) & 0x7F7F7F7F; + FrameBuffer[frameOffset] = (int)((uint)p | 0x80000000); + } + } + + // Bottom 24 scanlines + for (int y = 168; y < 192; y++) + { + for (int x = 0; x < 256; x++) + { + int frameOffset = (y * 256) + x; + int p = (FrameBuffer[frameOffset] >> 1) & 0x7F7F7F7F; + FrameBuffer[frameOffset] = (int)((uint)p | 0x80000000); + } + } + + // Left 48 pixels + for (int y = 24; y < 168; y++) + { + for (int x = 0; x < 48; x++) + { + int frameOffset = (y * 256) + x; + int p = (FrameBuffer[frameOffset] >> 1) & 0x7F7F7F7F; + FrameBuffer[frameOffset] = (int)((uint)p | 0x80000000); + } + } + + // Right 48 pixels + for (int y = 24; y < 168; y++) + { + for (int x = 208; x < 256; x++) + { + int frameOffset = (y * 256) + x; + int p = (FrameBuffer[frameOffset] >> 1) & 0x7F7F7F7F; + FrameBuffer[frameOffset] = (int)((uint)p | 0x80000000); + } + } + } } } } diff --git a/BizHawk.Emulation/Interfaces/CoreComms.cs b/BizHawk.Emulation/Interfaces/CoreComms.cs index 3a7b85eb35..3973bb6cbe 100644 --- a/BizHawk.Emulation/Interfaces/CoreComms.cs +++ b/BizHawk.Emulation/Interfaces/CoreComms.cs @@ -9,6 +9,7 @@ namespace BizHawk public bool PCE_ShowBG1, PCE_ShowOBJ1, PCE_ShowBG2, PCE_ShowOBJ2; public bool SMS_ShowBG, SMS_ShowOBJ; public bool GG_ShowClippedRegions; + public bool GG_HighlightActiveDisplayRegion; public string SNES_FirmwaresPath; public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0;