Skip to content

Commit

Permalink
Enforce swap interval 1 in menu if vsync is on
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos committed Nov 10, 2023
1 parent f20c849 commit fc670b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions menu/menu_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -6323,6 +6323,9 @@ void menu_driver_toggle(

if (menu_driver_alive)
{
video_adaptive_vsync = settings->bools.video_adaptive_vsync
&& video_driver_test_all_flags(GFX_CTX_FLAGS_ADAPTIVE_VSYNC);

#ifdef WIIU
/* Enable burn-in protection menu is running */
IMEnableDim();
Expand All @@ -6340,6 +6343,15 @@ void menu_driver_toggle(
input_state_get_ptr()->flags &= ~INP_FLAG_NONBLOCKING;
driver_set_nonblock_state();

/* Menu should always run with swap interval 1 if vsync is on. */
if ( settings->bools.video_vsync
&& current_video->set_nonblock_state)
current_video->set_nonblock_state(
video_driver_data,
false,
video_adaptive_vsync,
1);

/* Stop all rumbling before entering the menu. */
command_event(CMD_EVENT_RUMBLE_STOP, NULL);

Expand Down
6 changes: 3 additions & 3 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -6950,10 +6950,10 @@ int runloop_iterate(void)
/* Always run menu in video refresh rate speed. */
if (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
{
float refresh_rate = video_driver_get_refresh_rate();
float refresh_rate = (video_st->video_refresh_rate_original)
? video_st->video_refresh_rate_original : settings->floats.video_refresh_rate;

runloop_st->frame_limit_minimum_time = (retro_time_t)
roundf(1000000.0f / ((refresh_rate) ? refresh_rate : settings->floats.video_refresh_rate));
runloop_st->frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f / refresh_rate);
}
else
runloop_set_frame_limit(&video_st->av_info, settings->floats.fastforward_ratio);
Expand Down

0 comments on commit fc670b6

Please sign in to comment.