From 737332296248920e2232711577d63c323ede9ae3 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Tue, 10 Jun 2025 18:22:45 +0200 Subject: [PATCH] Fix sceGuVIewport with odd center values --- src/gu/sceGuViewport.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gu/sceGuViewport.c b/src/gu/sceGuViewport.c index 3955239f..bb582929 100644 --- a/src/gu/sceGuViewport.c +++ b/src/gu/sceGuViewport.c @@ -10,8 +10,14 @@ void sceGuViewport(int cx, int cy, int width, int height) { - sendCommandf(VIEWPORT_X_SCALE, (float)(width >> 1)); - sendCommandf(VIEWPORT_Y_SCALE, (float)((-height) >> 1)); - sendCommandf(VIEWPORT_X_CENTER, (float)cx); - sendCommandf(VIEWPORT_Y_CENTER, (float)cy); + float sx, sy, tx, ty; + sx = (float)(width) * 0.5f; + sy = (float)(height) * -0.5f; + tx = (float)cx; + ty = (float)cy; + + sendCommandf(VIEWPORT_X_SCALE, sx); + sendCommandf(VIEWPORT_Y_SCALE, sy); + sendCommandf(VIEWPORT_X_CENTER, tx); + sendCommandf(VIEWPORT_Y_CENTER, ty); }