From 87680e69f5e4803b3d20b8b954fc725d33904282 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 14 Jan 2013 23:35:53 -0500 Subject: Handle a game switching BG modes in the middle of a frame, to hi-res and to lo-res. This fixes Seiken Densetsu 3. --- source/gfx.cpp | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'source') diff --git a/source/gfx.cpp b/source/gfx.cpp index decd195..d2b8b6e 100644 --- a/source/gfx.cpp +++ b/source/gfx.cpp @@ -663,18 +663,9 @@ void S9xStartScreenRefresh () IPPU.Interlace = (Memory.FillRAM[0x2133] & 1); if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.Interlace)) { - if (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.Interlace) - { - IPPU.RenderedScreenWidth = 512; - IPPU.DoubleWidthPixels = TRUE; - IPPU.HalfWidthPixels = FALSE; - } - else - { - IPPU.RenderedScreenWidth = 256; - IPPU.DoubleWidthPixels = FALSE; - IPPU.HalfWidthPixels = FALSE; - } + IPPU.RenderedScreenWidth = 512; + IPPU.DoubleWidthPixels = TRUE; + IPPU.HalfWidthPixels = FALSE; if (IPPU.Interlace) { @@ -707,13 +698,13 @@ void S9xStartScreenRefresh () GFX.PPLx2 = GFX.PPL << 1; } } - else if (!Settings.SupportHiRes && (PPU.BGMode == 5)) + else if (!Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.Interlace)) { + IPPU.RenderedScreenWidth = 256; + IPPU.DoubleWidthPixels = FALSE; // Secret of Mana displays menus with mode 5. // Make them readable. - IPPU.DoubleWidthPixels = FALSE; IPPU.HalfWidthPixels = TRUE; - IPPU.DoubleHeightPixels = FALSE; } else { @@ -3741,6 +3732,27 @@ void S9xUpdateScreen () } } } + else if (!Settings.SupportHiRes) + { + if (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.Interlace) + { + if (!IPPU.HalfWidthPixels) + { + // The game has switched from lo-res to hi-res mode part way down + // the screen. Hi-res pixels must now be drawn at half width. + IPPU.HalfWidthPixels = TRUE; + } + } + else + { + if (IPPU.HalfWidthPixels) + { + // The game has switched from hi-res to lo-res mode part way down + // the screen. Lo-res pixels must now be drawn at FULL width. + IPPU.HalfWidthPixels = FALSE; + } + } + } uint32 black = BLACK | (BLACK << 16); -- cgit v1.2.3