added option for setting hint for render driver to setup config file
authorHolger Schemel <info@artsoft.org>
Thu, 3 Sep 2020 23:44:27 +0000 (01:44 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 3 Sep 2020 23:47:07 +0000 (01:47 +0200)
src/files.c
src/libgame/sdl.c
src/libgame/system.h
src/screens.c

index c07043450023b9650e5102c5d9a9cb45b4e29f55..ba5b8f5816be4ce7edfec09805a51bfed1661efe 100644 (file)
@@ -8888,6 +8888,10 @@ static struct TokenInfo player_setup_tokens[] =
 
 static struct TokenInfo system_setup_tokens[] =
 {
+  {
+    TYPE_STRING,
+    &setup.system.sdl_renderdriver,            "system.sdl_renderdriver"
+  },
   {
     TYPE_STRING,
     &setup.system.sdl_videodriver,             "system.sdl_videodriver"
@@ -9334,6 +9338,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
     si->input[i].key.drop  = (i == 0 ? DEFAULT_KEY_DROP  : KSYM_UNDEFINED);
   }
 
+  si->system.sdl_renderdriver = getStringCopy(ARG_DEFAULT);
   si->system.sdl_videodriver = getStringCopy(ARG_DEFAULT);
   si->system.sdl_audiodriver = getStringCopy(ARG_DEFAULT);
   si->system.audio_fragment_size = DEFAULT_AUDIO_FRAGMENT_SIZE;
index 990054de955f965cab82e6c66936b1aaf63ac17f..e561b177579961dea8066def3053a9cd2f284368 100644 (file)
@@ -437,6 +437,10 @@ void SDLFreeBitmapTextures(Bitmap *bitmap)
 
 void SDLInitVideoDisplay(void)
 {
+  // set hint to select render driver as specified in setup config file
+  if (!strEqual(setup.system.sdl_renderdriver, ARG_DEFAULT))
+    SDL_SetHint(SDL_HINT_RENDER_DRIVER, setup.system.sdl_renderdriver);
+
   // initialize SDL video
   if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
     Error(ERR_EXIT, "SDL_InitSubSystem() failed: %s", SDL_GetError());
index da86181fb716075dbf47d45f705b552f175c9c3e..e3f0fba93d7cc6d5be48f90f3c531debbfe2ba3d 100644 (file)
@@ -1296,6 +1296,7 @@ struct SetupShortcutInfo
 
 struct SetupSystemInfo
 {
+  char *sdl_renderdriver;
   char *sdl_videodriver;
   char *sdl_audiodriver;
   int audio_fragment_size;
index 01b8031bf94a452bfb95135a732dab3d5236609d..9c5a86fd482db0b9defdac9d88de2982695fa427 100644 (file)
@@ -3768,7 +3768,7 @@ static void DrawInfoScreen_Version(void)
     getStringCopyNStatic(SDLGetRendererName(), driver_name_len);
 
   DrawTextF(xstart1, ystart, font_text, "Render Driver");
-  DrawTextF(xstart2, ystart, font_text, "%s", ARG_DEFAULT);
+  DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_renderdriver);
   DrawTextF(xstart3, ystart, font_text, "%s", driver_name);
   ystart += ystep_line;