From f1e29a0fda30736842b8010866c6d61018f1bacc Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sun, 25 Aug 2019 15:14:46 -0700 Subject: [PATCH] Fix linking issues --- sc2/src/libs/graphics/sdl/sdl_common.c | 3 +++ sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sc2/src/libs/graphics/sdl/sdl_common.c b/sc2/src/libs/graphics/sdl/sdl_common.c index b2fe9d4fd..e1bd7b2b4 100644 --- a/sc2/src/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/libs/graphics/sdl/sdl_common.c @@ -80,10 +80,13 @@ TFB_InitGraphics (int driver, int flags, int width, int height) result = TFB_Pure_InitGraphics (driver, flags, width, height); } +#if SDL_MAJOR_VERSION == 1 + /* Other versions do this when setting up the window */ sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s", UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_PATCH_VERSION, UQM_EXTRA_VERSION); SDL_WM_SetCaption (caption, NULL); +#endif if (flags & TFB_GFXFLAGS_FULLSCREEN) SDL_ShowCursor (SDL_DISABLE); diff --git a/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c b/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c index 72a1c2443..2df4c5baa 100644 --- a/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c +++ b/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c @@ -98,7 +98,6 @@ sint32 mixSDL_Init (audio_Driver *driver, sint32 flags) { int i; - char devicename[256]; SDL_AudioSpec desired, obtained; mixer_Quality quality; TFB_DecoderFormats formats = @@ -162,12 +161,19 @@ mixSDL_Init (audio_Driver *driver, sint32 flags) return -1; } - SDL_AudioDriverName (devicename, sizeof (devicename)); - log_add (log_Info, " using %s at %d Hz 16 bit %s, " - "%d samples audio buffer", - devicename, obtained.freq, - obtained.channels > 1 ? "stereo" : "mono", - obtained.samples); + { +#if SDL_MAJOR_VERSION == 1 + char devicename[256]; + SDL_AudioDriverName (devicename, sizeof (devicename)); +#else + const char *devicename = SDL_GetCurrentAudioDriver (); +#endif + log_add (log_Info, " using %s at %d Hz 16 bit %s, " + "%d samples audio buffer", + devicename, obtained.freq, + obtained.channels > 1 ? "stereo" : "mono", + obtained.samples); + } log_add (log_Info, "Initializing mixer."); if (!mixer_Init (obtained.freq, MIX_FORMAT_MAKE (2, obtained.channels),