From 4bcdc006c96b4126d7fb347220dcd6241ade7fdd Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 8 Mar 2026 02:49:20 +0200 Subject: [PATCH] gpulib: more doubleres hacks libretro/pcsx_rearmed#912 --- plugins/gpulib/gpu.c | 1 + plugins/gpulib/gpu.h | 3 ++- plugins/gpulib/vout_pl.c | 16 +++++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 271e1c79..b6f35656 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -1205,6 +1205,7 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs) gpu.state.frame_count = (uint32_t *)cbs->gpu_frame_count; gpu.state.allow_interlace = cbs->gpu_neon.allow_interlace; gpu.state.enhancement_enable = cbs->gpu_neon.enhancement_enable; + gpu.state.enhancement_active = 0; gpu.state.downscale_enable = cbs->scale_hires; gpu.state.screen_centering_type_default = cbs->screen_centering_type_default; if (gpu.state.screen_centering_type != cbs->screen_centering_type diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h index 86b1fe6a..177e5aac 100644 --- a/plugins/gpulib/gpu.h +++ b/plugins/gpulib/gpu.h @@ -101,7 +101,8 @@ struct psx_gpu { uint32_t hcnt; } last_list; uint32_t last_vram_read_frame; - uint32_t w_out_old, h_out_old, status_vo_old; + uint16_t w_out_old, h_out_old, src_y_old; + uint32_t status_vo_old; short screen_centering_type; short screen_centering_type_default; short screen_centering_x; diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c index b96d9c28..07cf6daa 100644 --- a/plugins/gpulib/vout_pl.c +++ b/plugins/gpulib/vout_pl.c @@ -38,13 +38,15 @@ static void check_mode_change(struct psx_gpu *gpu, int force) w = w_out = (gpu->status & PSX_GPU_STATUS_RGB24) ? 2048/3 : 1024; h = h_out = 512; #endif - gpu->state.enhancement_active = - gpu->get_enhancement_bufer != NULL && gpu->state.enhancement_enable - && w <= 512 && h <= 256 && !(gpu->status & PSX_GPU_STATUS_RGB24); - - if (gpu->state.enhancement_active) { - w_out *= 2; - h_out *= 2; + if (gpu->get_enhancement_bufer != NULL && gpu->state.enhancement_enable) { + gpu->state.enhancement_active = + w <= 512 && h <= 256 && !(gpu->status & PSX_GPU_STATUS_RGB24) && + gpu->screen.src_y < (512 - 256/2) && gpu->state.src_y_old < (512 - 256/2); + gpu->state.src_y_old = gpu->screen.src_y; + if (gpu->state.enhancement_active) { + w_out *= 2; + h_out *= 2; + } } if (gpu->status & PSX_GPU_STATUS_RGB24) { // some asm relies on this alignment -- 2.47.3