From e0d5b0be7bad01c1bd24feb650f1ab8311544a72 Mon Sep 17 00:00:00 2001 From: s2s <12202580+standard-two-simplex@users.noreply.github.com> Date: Sun, 23 May 2021 21:28:16 +0200 Subject: [PATCH] Shift S2DEX background texture coordinates in non-native resolutions. --- src/uCodes/S2DEX.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/uCodes/S2DEX.cpp b/src/uCodes/S2DEX.cpp index 75d0a02c..37356c9f 100644 --- a/src/uCodes/S2DEX.cpp +++ b/src/uCodes/S2DEX.cpp @@ -502,9 +502,16 @@ struct ObjCoordinates lrs = uls + (lrx - ulx) * scaleW; lrt = ult + (lry - uly) * scaleH; + if (config.frameBufferEmulation.nativeResFactor != 1 || config.video.multisampling != 0) { + uls -= 0.5f * scaleW; + ult -= 0.5f * scaleH; + lrs -= 0.5f * scaleW; + lrt -= 0.5f * scaleH; + } + // G_CYC_COPY (BgRectCopyOnePiece()) does not allow texture filtering if (gDP.otherMode.cycleType != G_CYC_COPY) { - // Correct texture coordinates if G_OBJRM_BILERP + // Correct texture coordinates if G_OBJRM_BILERP // bilinear interpolation is set if ((gSP.objRendermode & G_OBJRM_BILERP) != 0) { // No correction gives the best picture, but is this correct? @@ -521,7 +528,7 @@ struct ObjCoordinates lrs -= 0.5f; lrt -= 0.5f; } - // SHRINKSIZE_2 adds a 1.0f perimeter + // SHRINKSIZE_2 adds a 1.0f perimeter // upper left texture coords += 1.0f; lower left texture coords -= 1.0f else if ((gSP.objRendermode&G_OBJRM_SHRINKSIZE_2) != 0) { uls += 1.0f;