From: notaz Date: Thu, 6 Jul 2023 15:47:31 +0000 (+0300) Subject: libretro: disable spu thread by default, with option to reenable X-Git-Tag: r24~272 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=16809ab9f432e902b4b049b4f1f01a0f42e92914 libretro: disable spu thread by default, with option to reenable it may still cause problems, especially with reverb, fixing it is too much work for too little benefit --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 3e74b230..f4b23cdf 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -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"; diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 935c6f97..7d070f9a 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -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", diff --git a/frontend/main.c b/frontend/main.c index 2773f7a1..e0635ef4 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -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; diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 97f07aae..ebebd2a2 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -18,8 +18,7 @@ * * ***************************************************************************/ -#if !defined(_WIN32) && !defined(NO_OS) -#include // gettimeofday in xa.c +#if !defined(THREAD_ENABLED) && !defined(_WIN32) && !defined(NO_OS) #define THREAD_ENABLED 1 #endif #include "stdafx.h"