drc: disable thread for cache hack
authornotaz <notasas@gmail.com>
Wed, 4 Dec 2024 22:25:40 +0000 (00:25 +0200)
committernotaz <notasas@gmail.com>
Wed, 4 Dec 2024 22:25:40 +0000 (00:25 +0200)
can't mix drc with interpreter in this case
libretro/pcsx_rearmed#854

libpcsxcore/database.c
libpcsxcore/new_dynarec/emu_if.c
libpcsxcore/new_dynarec/new_dynarec.c
libpcsxcore/psxcommon.h

index 76951a6..a393ee9 100644 (file)
@@ -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;
-               }
        }
 }
 
index 0dcec55..a19bd2d 100644 (file)
@@ -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();
index e19e436..e247faf 100644 (file)
@@ -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)
index 8a0ac70..0a1ef70 100644 (file)
@@ -156,6 +156,7 @@ typedef struct {
                boolean dualshock_init_analog;
                boolean gpu_timing1024;
                boolean fractional_Framerate;
+               boolean f1;
        } hacks;
 } PcsxConfig;