From: Holger Schemel Date: Thu, 3 Sep 2020 23:44:27 +0000 (+0200) Subject: added option for setting hint for render driver to setup config file X-Git-Tag: 4.2.0.2~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=737e6b265c7b282ab560e98be0de6eb95b529066;p=rocksndiamonds.git added option for setting hint for render driver to setup config file --- diff --git a/src/files.c b/src/files.c index c0704345..ba5b8f58 100644 --- a/src/files.c +++ b/src/files.c @@ -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; diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 990054de..e561b177 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -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()); diff --git a/src/libgame/system.h b/src/libgame/system.h index da86181f..e3f0fba9 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1296,6 +1296,7 @@ struct SetupShortcutInfo struct SetupSystemInfo { + char *sdl_renderdriver; char *sdl_videodriver; char *sdl_audiodriver; int audio_fragment_size; diff --git a/src/screens.c b/src/screens.c index 01b8031b..9c5a86fd 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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;