RetroPie-Setup/scriptmodules/emulators/reicast/0003-fix-sdl2-sighandler-conflict.patch
Conn O'Griofa e659fc689d reicast: update for rpi4 & generic kms
* Add support for RPI4 and generic KMS targets
* Allow configuration of rpi3 platform in favour of rpi2 platform
* Move build configuration into separate function to avoid duplication between
  build and install functions.
* avoid duplication of addEmulator definitions due to audio backend options
* Set alsa as default audio backend for mesa (omx doesn't work, and oss backend via
  aoss causes emulator stuttering).

Patch details (may be removed after upstream is fixed):
* Add SDL/gles2 sub-platform for rpi4 to allow kmsdrm compatibility
* Ensure vsync is enforced for SDL, otherwise KMSDRM will run at unlocked framerate.
* Fix signal handler conflict by disabling SDL2's exit signal handler, and ensuring that
  reicast gracefully cleans up by stopping emulation and invoking SDL_Quit() during exit.
2019-11-01 04:11:33 +00:00

48 lines
1.2 KiB
Diff

diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp
index aa29515..f53c871 100644
--- a/core/linux-dist/main.cpp
+++ b/core/linux-dist/main.cpp
@@ -374,6 +374,9 @@ int main(int argc, wchar* argv[])
printf("Data dir is: %s\n", get_writable_data_path("/").c_str());
#if defined(USE_SDL)
+ // bypass SDL internal signal handlers due to conflict with reicast handlers
+ SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1");
+
if (SDL_Init(0) != 0)
{
die("SDL: Initialization failed!");
@@ -410,6 +413,10 @@ int main(int argc, wchar* argv[])
x11_window_destroy();
#endif
+ #if defined(USE_SDL)
+ SDL_Quit();
+ #endif
+
return 0;
}
#endif
diff --git a/core/linux/common.cpp b/core/linux/common.cpp
index 26449cb..fd73602 100644
--- a/core/linux/common.cpp
+++ b/core/linux/common.cpp
@@ -1,6 +1,8 @@
#include "types.h"
#include "cfg/cfg.h"
+extern void dc_exit();
+
#if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN
#if HOST_OS == OS_DARWIN
#define _XOPEN_SOURCE 1
@@ -195,7 +197,8 @@ void common_linux_setup()
enable_runfast();
install_fault_handler();
- signal(SIGINT, exit);
+ signal(SIGINT, dc_exit);
+ signal(SIGTERM, dc_exit);
settings.profile.run_counts=0;