Be more careful about overwriting global settings in driver init.

This commit is contained in:
Themaister 2012-08-15 20:43:26 +02:00
parent 3ac159845d
commit 405a901d18
3 changed files with 14 additions and 10 deletions

View File

@ -194,6 +194,7 @@ void init_drivers_pre(void)
static void adjust_system_rates(void)
{
g_extern.system.force_nonblock = false;
const struct retro_system_timing *info = &g_extern.system.av_info.timing;
float timing_skew = fabs(1.0f - info->fps / g_settings.video.refresh_rate);
@ -206,20 +207,21 @@ static void adjust_system_rates(void)
// We won't be able to do VSync reliably as game FPS > monitor FPS.
if (info->fps > g_settings.video.refresh_rate)
{
g_settings.video.vsync = false;
g_extern.system.force_nonblock = true;
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
#ifdef RARCH_CONSOLE
video_set_nonblock_state_func(true);
#endif
}
g_settings.video.refresh_rate = info->fps;
g_settings.audio.in_rate = info->sample_rate;
}
g_settings.audio.in_rate = info->sample_rate *
(g_settings.video.refresh_rate / info->fps);
else
g_settings.audio.in_rate = info->sample_rate *
(g_settings.video.refresh_rate / info->fps);
RARCH_LOG("Set audio input rate to: %.2f Hz.\n", g_settings.audio.in_rate);
#ifdef RARCH_CONSOLE
video_set_nonblock_state_func(!g_settings.video.vsync || g_extern.system.force_nonblock);
#endif
}
void init_drivers(void)
@ -596,7 +598,7 @@ void init_video_input(void)
video.width = width;
video.height = height;
video.fullscreen = g_settings.video.fullscreen;
video.vsync = g_settings.video.vsync;
video.vsync = g_settings.video.vsync && !g_extern.system.force_nonblock;
video.force_aspect = g_settings.video.force_aspect;
video.smooth = g_settings.video.smooth;
video.input_scale = scale;

View File

@ -338,6 +338,8 @@ struct global
bool shutdown;
unsigned performance_level;
bool rgb32;
bool force_nonblock;
} system;
struct

View File

@ -73,7 +73,7 @@ static void set_fast_forward_button(bool new_button_state, bool new_hold_button_
if (update_sync)
{
// Only apply non-block-state for video if we're using vsync.
if (g_extern.video_active && g_settings.video.vsync)
if (g_extern.video_active && g_settings.video.vsync && !g_extern.system.force_nonblock)
video_set_nonblock_state_func(syncing_state);
if (g_extern.audio_active)