From: notaz Date: Wed, 4 Dec 2024 22:25:40 +0000 (+0200) Subject: drc: disable thread for cache hack X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6baeda45dc7de599b9cdb91dcaf7e9e193618ec6;p=pcsx_rearmed.git drc: disable thread for cache hack can't mix drc with interpreter in this case libretro/pcsx_rearmed#854 --- diff --git a/libpcsxcore/database.c b/libpcsxcore/database.c index 76951a68..a393ee92 100644 --- a/libpcsxcore/database.c +++ b/libpcsxcore/database.c @@ -82,6 +82,18 @@ static const char * const fractional_Framerate_hack_db[] = "SCUS94425", "SCES02104", }; +static const char * const f1_hack_db[] = +{ + /* Formula One Arcade */ + "SCES03886", + /* Formula One '99 */ + "SLUS00870", "SCPS10101", "SCES01979", "SLES01979", + /* Formula One 2000 */ + "SLUS01134", "SCES02777", "SCES02778", "SCES02779", + /* Formula One 2001 */ + "SCES03404", "SCES03423", "SCES03424", "SCES03524", +}; + #define HACK_ENTRY(var, list) \ { #var, &Config.hacks.var, list, ARRAY_SIZE(list) } @@ -100,6 +112,7 @@ hack_db[] = HACK_ENTRY(gpu_timing1024, dualshock_timing1024_hack_db), HACK_ENTRY(dualshock_init_analog, dualshock_init_analog_hack_db), HACK_ENTRY(fractional_Framerate, fractional_Framerate_hack_db), + HACK_ENTRY(f1, f1_hack_db), }; static const struct @@ -142,35 +155,6 @@ cycle_multiplier_overrides[] = { 153, { "SLUS00943" } }, }; -static const struct -{ - const char * const id; - u32 hacks; -} -lightrec_hacks_db[] = -{ - /* Formula One Arcade */ - { "SCES03886", LIGHTREC_HACK_INV_DMA_ONLY }, - - /* Formula One '99 */ - { "SLUS00870", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCPS10101", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES01979", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SLES01979", LIGHTREC_HACK_INV_DMA_ONLY }, - - /* Formula One 2000 */ - { "SLUS01134", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES02777", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES02778", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES02779", LIGHTREC_HACK_INV_DMA_ONLY }, - - /* Formula One 2001 */ - { "SCES03404", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES03423", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES03424", LIGHTREC_HACK_INV_DMA_ONLY }, - { "SCES03524", LIGHTREC_HACK_INV_DMA_ONLY }, -}; - /* Function for automatic patching according to GameID. */ void Apply_Hacks_Cdrom(void) { @@ -211,6 +195,8 @@ void Apply_Hacks_Cdrom(void) /* Dynarec game-specific hacks */ ndrc_g.hacks_pergame = 0; + if (Config.hacks.f1) + ndrc_g.hacks_pergame |= NDHACK_THREAD_FORCE; // force without *_ON -> off Config.cycle_multiplier_override = 0; for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++) @@ -229,15 +215,12 @@ void Apply_Hacks_Cdrom(void) } } - lightrec_hacks = 0; - - for (i = 0; drc_is_lightrec() && i < ARRAY_SIZE(lightrec_hacks_db); i++) { - if (strcmp(CdromId, lightrec_hacks_db[i].id) == 0) - { - lightrec_hacks = lightrec_hacks_db[i].hacks; + if (drc_is_lightrec()) { + lightrec_hacks = 0; + if (Config.hacks.f1) + lightrec_hacks |= LIGHTREC_HACK_INV_DMA_ONLY; + if (lightrec_hacks) SysPrintf("using lightrec_hacks: 0x%x\n", lightrec_hacks); - break; - } } } diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 0dcec554..a19bd2dd 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -303,10 +303,10 @@ static void ari64_apply_config() else ndrc_g.hacks &= ~NDHACK_NO_STALLS; - thread_changed = (ndrc_g.hacks ^ ndrc_g.hacks_old) + thread_changed = ((ndrc_g.hacks | ndrc_g.hacks_pergame) ^ ndrc_g.hacks_old) & (NDHACK_THREAD_FORCE | NDHACK_THREAD_FORCE_ON); if (Config.cycle_multiplier != ndrc_g.cycle_multiplier_old - || ndrc_g.hacks != ndrc_g.hacks_old) + || (ndrc_g.hacks | ndrc_g.hacks_pergame) != ndrc_g.hacks_old) { new_dynarec_clear_full(); } @@ -485,7 +485,9 @@ static void ari64_thread_init(void) { int enable; - if (ndrc_g.hacks & NDHACK_THREAD_FORCE) + if (ndrc_g.hacks_pergame & NDHACK_THREAD_FORCE) + enable = 0; + else if (ndrc_g.hacks & NDHACK_THREAD_FORCE) enable = ndrc_g.hacks & NDHACK_THREAD_FORCE_ON; else { u32 cpu_count = cpu_features_get_core_amount(); diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index e19e4361..e247faf2 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -6292,13 +6292,13 @@ void new_dynarec_clear_full(void) stat_clear(stat_links); if (ndrc_g.cycle_multiplier_old != Config.cycle_multiplier - || ndrc_g.hacks_old != ndrc_g.hacks) + || ndrc_g.hacks_old != (ndrc_g.hacks | ndrc_g.hacks_pergame)) { SysPrintf("ndrc config: mul=%d, ha=%x, pex=%d\n", get_cycle_multiplier(), ndrc_g.hacks, Config.PreciseExceptions); } ndrc_g.cycle_multiplier_old = Config.cycle_multiplier; - ndrc_g.hacks_old = ndrc_g.hacks; + ndrc_g.hacks_old = ndrc_g.hacks | ndrc_g.hacks_pergame; } static int pgsize(void) diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index 8a0ac703..0a1ef707 100644 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -156,6 +156,7 @@ typedef struct { boolean dualshock_init_analog; boolean gpu_timing1024; boolean fractional_Framerate; + boolean f1; } hacks; } PcsxConfig;