From 5c79cf9cd846b0a20e8ea439fc07b182fb763adc Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 2 Aug 2026 00:19:18 +0300 Subject: [PATCH] db: more hacks libretro/pcsx_rearmed#930 --- frontend/plugin.c | 3 +++ frontend/plugin_lib.h | 14 ++++++++++---- libpcsxcore/database.c | 8 ++++++++ libpcsxcore/psxcommon.h | 1 + plugins/gpulib/gpu.c | 2 ++ plugins/gpulib/gpu.h | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/plugin.c b/frontend/plugin.c index e7ae2097..0821a6f7 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -169,6 +169,9 @@ void plugin_call_rearmed_cbs(void) Config.hacks.gpu_centering ? C_INGAME : C_AUTO; pl_rearmed_cbs.alt_flip = Config.AlternativeFlip > 0 || (Config.AlternativeFlip < 0 && Config.hacks.alt_flip); + pl_rearmed_cbs.gpu_hacks = 0; + if (Config.hacks.needs_interlace) + pl_rearmed_cbs.gpu_hacks |= GPU_HACK_NEEDS_INTERLACE; rearmed_set_cbs = SysLoadSym(hGPUDriver, "GPUrearmedCallbacks"); if (rearmed_set_cbs != NULL) diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 4ff3ddf3..45d14828 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -77,12 +77,15 @@ struct rearmed_cbs { unsigned int *gpu_hcnt; unsigned int flip_cnt; // increment manually if not using pl_vout_flip unsigned char only_16bpp; // platform is 16bpp-only - unsigned char dithering; // 0 off, 1 on, 2 force + unsigned char dithering; // 0 off, 1 on, 2 force unsigned char scale_hires; unsigned char alt_flip; - int thread_rendering; // -1 auto, 0 off, 1 on + unsigned char gpu_caps; // gpu_plugin_caps + unsigned char gpu_hacks; // gpu_plugin_hacks + unsigned char pad[2]; + int thread_rendering; // -1 auto, 0 off, 1 on struct { - int allow_interlace; // 0 off, 1 on, 2 guess + int allow_interlace; // 0 off, 1 on, 2 guess, 3 on_db int enhancement_enable; int enhancement_no_main; int enhancement_tex_adj; @@ -106,7 +109,6 @@ struct rearmed_cbs { int iVRamSize, iTexGarbageCollection; } gpu_peopsgl; // misc - int gpu_caps; int screen_centering_type; int screen_centering_type_default; int screen_centering_x; @@ -124,6 +126,10 @@ enum gpu_plugin_caps { GPU_CAP_SUPPORTS_2X = (1 << 1), }; +enum gpu_plugin_hacks { + GPU_HACK_NEEDS_INTERLACE = (1 << 0), +}; + // platform hooks extern void (*pl_plat_clear)(void); extern void (*pl_plat_blit)(int doffs, const void *src, diff --git a/libpcsxcore/database.c b/libpcsxcore/database.c index 83d55fa7..60252735 100644 --- a/libpcsxcore/database.c +++ b/libpcsxcore/database.c @@ -114,6 +114,13 @@ static const char * const drc_no_thread_db[] = "SLUS01414", }; +static const char * const needs_interlace_db[] = +{ + /* Worms Pinball */ + "SLES00483", + /* Pro Pinball series games have a different hack... */ +}; + #define HACK_ENTRY(var, list) \ { #var, &Config.hacks.var, list, ARRAY_SIZE(list) } @@ -134,6 +141,7 @@ hack_db[] = HACK_ENTRY(f1, f1_hack_db), HACK_ENTRY(alt_flip, alt_flip_db), HACK_ENTRY(drc_no_thread, drc_no_thread_db), + HACK_ENTRY(needs_interlace, needs_interlace_db), }; static const struct diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index 96906707..b6b20aa5 100644 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -148,6 +148,7 @@ typedef struct { boolean f1; boolean alt_flip; boolean drc_no_thread; + boolean needs_interlace; } hacks; } PcsxConfig; diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index b3470461..f04e3a55 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -1227,6 +1227,8 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs) gpu.state.hcnt = (uint32_t *)cbs->gpu_hcnt; gpu.state.frame_count = (uint32_t *)cbs->gpu_frame_count; gpu.state.allow_interlace = cbs->gpu_neon.allow_interlace; + if (gpu.state.allow_interlace > 1) + gpu.state.allow_interlace = (cbs->gpu_hacks & GPU_HACK_NEEDS_INTERLACE) ? 3 : 2; gpu.state.enhancement_enable = cbs->gpu_neon.enhancement_enable; gpu.state.enhancement_active = 0; gpu.state.downscale_enable = cbs->scale_hires; diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h index 6073fbf0..e929fe60 100644 --- a/plugins/gpulib/gpu.h +++ b/plugins/gpulib/gpu.h @@ -84,7 +84,7 @@ struct psx_gpu { uint32_t fb_dirty_display_area:1; uint32_t draw_display_intersect:1; uint32_t old_interlace:1; - uint32_t allow_interlace:2; + uint32_t allow_interlace:2; // 0 off, 1 on, 2 guess, 3 on_db uint32_t blanked:1; uint32_t use_alternative_flip:1; uint32_t enhancement_enable:1;