Fix for video driver config overwrite when video driver was forced by core on exit.

This commit is contained in:
Rinnegatamante 2019-10-11 15:15:18 +02:00
parent 77d185ba8b
commit ff726d212c

View File

@ -942,7 +942,7 @@ static char current_library_name[1024] = {0};
static char current_library_version[1024] = {0};
static char current_valid_extensions[1024] = {0};
static char error_string[255] = {0};
static char cached_video_driver[32] = {0};
#ifdef HAVE_MENU
/* MENU INPUT GLOBAL VARIABLES */
@ -4893,6 +4893,13 @@ bool command_event(enum event_command cmd, void *data)
command_event_save_auto_state();
command_event_disable_overrides();
retroarch_unset_runtime_shader_preset();
if (cached_video_driver[0])
{
settings_t *settings = configuration_settings;
strcpy(settings->arrays.video_driver, cached_video_driver);
cached_video_driver[0] = 0;
}
if ( runloop_remaps_core_active
|| runloop_remaps_content_dir_active
@ -6042,6 +6049,12 @@ static void global_free(void)
void main_exit(void *args)
{
settings_t *settings = configuration_settings;
if (cached_video_driver[0])
{
strcpy(settings->arrays.video_driver, cached_video_driver);
cached_video_driver[0] = 0;
}
if (settings->bools.config_save_on_exit)
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
@ -19021,6 +19034,7 @@ static bool video_driver_find_driver(void)
if (hwr && hw_render_context_is_vulkan(hwr->context_type))
{
RARCH_LOG("[Video]: Using HW render, Vulkan driver forced.\n");
strcpy(cached_video_driver, settings->arrays.video_driver);
strcpy(settings->arrays.video_driver, "vulkan");
current_video = &video_vulkan;
}
@ -19036,10 +19050,12 @@ static bool video_driver_find_driver(void)
!string_is_equal(settings->arrays.video_driver, "glcore"))
{
#if defined(HAVE_OPENGL_CORE)
strcpy(cached_video_driver, settings->arrays.video_driver);
strcpy(settings->arrays.video_driver, "glcore");
current_video = &video_gl_core;
RARCH_LOG("[Video]: Forcing \"glcore\" driver.\n");
#else
strcpy(cached_video_driver, settings->arrays.video_driver);
strcpy(settings->arrays.video_driver, "gl");
current_video = &video_gl2;
RARCH_LOG("[Video]: Forcing \"gl\" driver.\n");