diff options
Diffstat (limited to 'games/SameBoy/sdl.patch')
-rw-r--r-- | games/SameBoy/sdl.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/games/SameBoy/sdl.patch b/games/SameBoy/sdl.patch new file mode 100644 index 0000000000000..053a2a3747242 --- /dev/null +++ b/games/SameBoy/sdl.patch @@ -0,0 +1,62 @@ +From 453673a2a653a45d8ee378ba5335f98df5e22efa Mon Sep 17 00:00:00 2001 +From: Lior Halphon <LIJI32@gmail.com> +Date: Sat, 10 Nov 2018 18:58:22 +0200 +Subject: [PATCH] Apply the SDL 2.0.6 audio workaround to everything except + Windows, check the linked version instead of the headers version. Fixes #130 + +--- + SDL/main.c | 38 ++++++++++++++++++++++---------------- + 1 file changed, 22 insertions(+), 16 deletions(-) + +diff --git a/SDL/main.c b/SDL/main.c +index c21a96f9..7db59be4 100755 +--- a/SDL/main.c ++++ b/SDL/main.c +@@ -559,25 +559,31 @@ int main(int argc, char **argv) + want_aspec.freq = AUDIO_FREQUENCY; + want_aspec.format = AUDIO_S16SYS; + want_aspec.channels = 2; +-#if SDL_COMPILEDVERSION >= 2005 && defined(__APPLE__) +- /* SDL 2.0.5 on macOS introduced a bug where certain combinations of buffer lengths and frequencies ++ want_aspec.samples = 512; ++ ++ SDL_version _sdl_version; ++ SDL_GetVersion(&_sdl_version); ++ unsigned sdl_version = _sdl_version.major * 1000 + _sdl_version.minor * 100 + _sdl_version.patch; ++ ++#ifndef _WIN32 ++ /* SDL 2.0.5 on macOS and Linux introduced a bug where certain combinations of buffer lengths and frequencies + fail to produce audio correctly. */ +- want_aspec.samples = 2048; ++ if (sdl_version >= 2005) { ++ want_aspec.samples = 2048; ++ } + #else +- want_aspec.samples = 512; +-#endif +- +-#if SDL_COMPILEDVERSION >= 2006 && defined(_WIN32) +- /* SDL 2.0.6 offers WASAPI support which allows for much lower audio buffer lengths which at least +- theoretically reduces lagging. */ +- want_aspec.samples = 32; +-#endif +- +-#if SDL_COMPILEDVERSION <= 2005 && defined(_WIN32) +- /* Since WASAPI audio was introduced in SDL 2.0.6, we have to lower the audio frequency +- to 44100 because otherwise we would get garbled audio output.*/ +- want_aspec.freq = 44100; ++ if (sdl_version >= 2006) { ++ /* SDL 2.0.6 offers WASAPI support which allows for much lower audio buffer lengths which at least ++ theoretically reduces lagging. */ ++ want_aspec.samples = 32; ++ } ++ else { ++ /* Since WASAPI audio was introduced in SDL 2.0.6, we have to lower the audio frequency ++ to 44100 because otherwise we would get garbled audio output.*/ ++ want_aspec.freq = 44100; ++ } + #endif ++ + + want_aspec.callback = audio_callback; + want_aspec.userdata = &gb; |