From c7600508fe511d29747e3eb64b8f7c39012c07dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gerdau?= Date: Sat, 2 May 2020 15:25:02 +0200 Subject: [PATCH 1/2] Properly round down GS_REG_ST According to the GS manual, the 8 lower bits of S and T of GS_REG_ST must be rounded down. This commit just masks them away, which just serves that purpose. --- Source/gs/GSHandler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/gs/GSHandler.cpp b/Source/gs/GSHandler.cpp index 4b82c79d96..717b1c0fd7 100644 --- a/Source/gs/GSHandler.cpp +++ b/Source/gs/GSHandler.cpp @@ -658,6 +658,9 @@ void CGSHandler::WriteRegisterImpl(uint8 nRegister, uint64 nData) switch(nRegister) { + case GS_REG_ST: + m_nReg[nRegister] &= 0xFFFFFF00FFFFFF00; + break; case GS_REG_TEX0_1: case GS_REG_TEX0_2: { From 01ffa3828e8d7b91024cbb8aeebab035ce444f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gerdau?= Date: Sat, 2 May 2020 17:05:42 +0200 Subject: [PATCH 2/2] Move the center of the screen half a pixel The PS2 assumes the 0,0 pixel at the center of the screen. OpenGL (at least) assumes the 0,0 pixel at the top left. When the screen width/height is even, this causes a slight discrepancy. --- Source/gs/GSH_OpenGL/GSH_OpenGL.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/gs/GSH_OpenGL/GSH_OpenGL.cpp b/Source/gs/GSH_OpenGL/GSH_OpenGL.cpp index e270e9fd84..e49be10dfc 100644 --- a/Source/gs/GSH_OpenGL/GSH_OpenGL.cpp +++ b/Source/gs/GSH_OpenGL/GSH_OpenGL.cpp @@ -640,6 +640,12 @@ void CGSH_OpenGL::SetRenderingContext(uint64 primReg) m_nPrimOfsX = offset.GetX(); m_nPrimOfsY = offset.GetY(); + // Account for the fact that PS2 assumes the pixel center at the bottom left, + // but OpenGL at the center of the screen. On even resolutions this causes a slight + // discrepancy. + m_nPrimOfsX -= 0.5f; + m_nPrimOfsY -= 0.5f; + CHECKGLERROR(); m_renderState.isValid = true;