libretro: disable spu thread by default, with option to reenable
authornotaz <notasas@gmail.com>
Thu, 6 Jul 2023 15:47:31 +0000 (18:47 +0300)
committernotaz <notasas@gmail.com>
Thu, 6 Jul 2023 15:51:13 +0000 (18:51 +0300)
it may still cause problems, especially with reverb, fixing it is too
much work for too little benefit

frontend/libretro.c
frontend/libretro_core_options.h
frontend/main.c
plugins/dfsound/spu.c

index 3e74b23..f4b23cd 100644 (file)
@@ -2074,6 +2074,16 @@ static void update_variables(bool in_flight)
          spu_config.iUseInterpolation = 0;
    }
 
+   var.value = NULL;
+   var.key = "pcsx_rearmed_spu_thread";
+   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+   {
+      if (strcmp(var.value, "enabled") == 0)
+         spu_config.iUseThread = 1;
+      else
+         spu_config.iUseThread = 0;
+   }
+
 #ifndef _WIN32
    var.value = NULL;
    var.key = "pcsx_rearmed_async_cd";
index 935c6f9..7d070f9 100644 (file)
@@ -752,6 +752,22 @@ struct retro_core_option_v2_definition option_defs_us[] = {
       },
       "enabled",
    },
+#if !defined(THREAD_ENABLED) && !defined(_WIN32) && !defined(NO_OS)
+   {
+      "pcsx_rearmed_spu_thread",
+      "Threaded SPU",
+      NULL,
+      "Emulates the PSX SPU on another CPU thread. May cause audio glitches in some games.",
+      NULL,
+      "audio",
+      {
+         { "disabled", NULL },
+         { "enabled",  NULL },
+         { NULL, NULL },
+      },
+      "disabled",
+   },
+#endif // THREAD_ENABLED
    {
       "pcsx_rearmed_show_input_settings",
       "Show Input Settings",
index 2773f7a..e0635ef 100644 (file)
@@ -158,7 +158,8 @@ void emu_set_default_config(void)
        spu_config.iXAPitch = 0;
        spu_config.iVolume = 768;
        spu_config.iTempo = 0;
-       spu_config.iUseThread = 1; // no effect if only 1 core is detected
+       // may cause issues, no effect if only 1 core is detected
+       spu_config.iUseThread = 0;
 #if defined(HAVE_PRE_ARMV7) && !defined(_3DS) /* XXX GPH hack */
        spu_config.iUseReverb = 0;
        spu_config.iUseInterpolation = 0;
index 97f07aa..ebebd2a 100644 (file)
@@ -18,8 +18,7 @@
  *                                                                         *
  ***************************************************************************/
 
-#if !defined(_WIN32) && !defined(NO_OS)
-#include <sys/time.h> // gettimeofday in xa.c
+#if !defined(THREAD_ENABLED) && !defined(_WIN32) && !defined(NO_OS)
 #define THREAD_ENABLED 1
 #endif
 #include "stdafx.h"