From bddb8c8b97e25cfacdad80ccb5be1578af8f8ab5 Mon Sep 17 00:00:00 2001 From: Nolan Check Date: Sat, 18 Jul 2009 20:38:35 +0000 Subject: [PATCH] Seems to fix issue 1131. Please test Real XFB mode. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3838 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/BPStructs.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 4b2df5d4a9..6629f3f17b 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -206,12 +206,26 @@ void BPWritten(const Bypass& bp) #ifdef BBOX_SUPPORT *g_VideoInitialize.pBBoxActive = false; #endif - const float yScale = bpmem.dispcopyyscale / 256.0f; - const float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale); + + float yScale; + // PE_copy.scale_something may indicate that yScale is inverted. + // Not 100% sure if that's true, but this seems to fix SMG in PAL50 mode. + if (PE_copy.scale_something) + yScale = 256.0f / (float)bpmem.dispcopyyscale; + else + yScale = (float)bpmem.dispcopyyscale / 256.0f; + + float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale); + if (xfbLines > MAX_XFB_HEIGHT) + { + WARN_LOG(VIDEO, "Tried to scale EFB to too many XFB lines (%u)", (u32)xfbLines); + xfbLines = MAX_XFB_HEIGHT; + } + RenderToXFB(bp, rc, yScale, xfbLines, bpmem.copyTexDest << 5, - bpmem.copyMipMapStrideChannels << 4, - (u32)ceil(xfbLines)); + bpmem.copyMipMapStrideChannels << 4, + (u32)xfbLines); } // Clear the picture after it's done and submitted, to prepare for the next picture