From: notaz Date: Sat, 12 Apr 2025 20:51:39 +0000 (+0300) Subject: unbreak enhanced resolution X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a03928337088516cadafbb2cccecab8997380006;p=pcsx_rearmed.git unbreak enhanced resolution Fixes: cdc1d78f3e3e22c45e8461368b3aa58fce23c09c --- diff --git a/frontend/libretro.c b/frontend/libretro.c index d8462e49..407253e3 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -380,6 +380,8 @@ static void vout_flip(const void *vram_, int vram_ofs, int bgr24, unsigned char *dest = vout_buf_ptr; const unsigned char *vram = vram_; int dstride = vout_pitch_b, h1 = h; + int enhres = w > psx_w; + u32 vram_mask = enhres ? ~0 : 0xfffff; int port = 0, hwrapped; if (vram == NULL || dims_changed || (in_enable_crosshair[0] + in_enable_crosshair[1]) > 0) @@ -400,11 +402,11 @@ static void vout_flip(const void *vram_, int vram_ofs, int bgr24, for (; h1-- > 0; dest += dstride) { bgr_to_fb(dest, vram + vram_ofs, w * bytes_pp_s); - vram_ofs = (vram_ofs + 2048) & 0xfffff; + vram_ofs = (vram_ofs + 2048) & vram_mask; } hwrapped = (vram_ofs & 2047) + w * bytes_pp_s - 2048; - if (hwrapped > 0) { + if (!enhres && hwrapped > 0) { // this is super-rare so just fix-up vram_ofs = (vram_ofs - h * 2048) & 0xff800; dest -= dstride * h; diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index e2268c76..98e86ea3 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -318,6 +318,7 @@ static void pl_vout_flip(const void *vram_, int vram_ofs, int bgr24, const unsigned char *vram = vram_; int dstride = pl_vout_w, h1 = h; int h_full = pl_vout_h - pl_vout_yoffset; + int enhres = w > psx_w; int xoffs = 0, doffs; int hwrapped; @@ -438,13 +439,14 @@ static void pl_vout_flip(const void *vram_, int vram_ofs, int bgr24, #endif else { + unsigned int vram_mask = enhres ? ~0 : 0xfffff; for (; h1-- > 0; dest += dstride * 2) { bgr555_to_rgb565(dest, vram + vram_ofs, w * 2); - vram_ofs = (vram_ofs + 2048) & 0xfffff; + vram_ofs = (vram_ofs + 2048) & vram_mask; } hwrapped = (vram_ofs & 2047) + w * 2 - 2048; - if (hwrapped > 0) { + if (!enhres && hwrapped > 0) { vram_ofs = (vram_ofs - h * 2048) & 0xff800; dest -= dstride * 2 * h; dest += w * 2 - hwrapped;