Skip to content

Commit

Permalink
Make driver_set_nonblock_state a public function
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jan 22, 2017
1 parent 57f8c63 commit 768ce08
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
9 changes: 3 additions & 6 deletions driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void driver_adjust_system_rates(void)
if (runloop_ctl(RUNLOOP_CTL_IS_NONBLOCK_FORCED, NULL))
command_event(CMD_EVENT_VIDEO_SET_NONBLOCKING_STATE, NULL);
else
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}

/**
Expand All @@ -236,7 +236,7 @@ static void driver_adjust_system_rates(void)
* If nonblock state is false, sets
* blocking state for both audio and video drivers instead.
**/
static void driver_set_nonblock_state(void)
void driver_set_nonblock_state(void)
{
bool enable = input_driver_is_nonblock_state();

Expand Down Expand Up @@ -360,7 +360,7 @@ void drivers_init(int flags)
{
/* Keep non-throttled state as good as possible. */
if (input_driver_is_nonblock_state())
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}
}

Expand Down Expand Up @@ -472,9 +472,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
driver_adjust_system_rates();
}
break;
case RARCH_DRIVER_CTL_SET_NONBLOCK_STATE:
driver_set_nonblock_state();
break;
case RARCH_DRIVER_CTL_UPDATE_SYSTEM_AV_INFO:
{
const struct retro_system_av_info **info = (const struct retro_system_av_info**)data;
Expand Down
12 changes: 6 additions & 6 deletions driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ enum driver_ctl_state
* calls audio_monitor_set_refresh_rate(). */
RARCH_DRIVER_CTL_SET_REFRESH_RATE,

/* Sets audio and video drivers to nonblock state.
*
* If nonblock state is false, sets blocking state for both
* audio and video drivers instead. */
RARCH_DRIVER_CTL_SET_NONBLOCK_STATE,

/* Update the system Audio/Video information.
* Will reinitialize audio/video drivers.
* Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO. */
Expand All @@ -115,6 +109,12 @@ typedef struct driver_ctx_info

bool driver_ctl(enum driver_ctl_state state, void *data);

/* Sets audio and video drivers to nonblock state.
*
* If nonblock state is false, sets blocking state for both
* audio and video drivers instead. */
void driver_set_nonblock_state(void);

void drivers_init(int flags);

RETRO_END_DECLS
Expand Down
2 changes: 1 addition & 1 deletion menu/menu_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static void menu_driver_toggle(bool on)
else
{
if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();

if (settings && settings->menu.pause_libretro)
command_event(CMD_EVENT_AUDIO_START, NULL);
Expand Down
6 changes: 3 additions & 3 deletions network/netplay/netplay_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
{
netplay->catch_up = false;
input_driver_unset_nonblock_state();
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}
return;
}
Expand Down Expand Up @@ -524,7 +524,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
{
netplay->catch_up = false;
input_driver_unset_nonblock_state();
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}

}
Expand All @@ -535,7 +535,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
/* Are we falling behind? */
netplay->catch_up = true;
input_driver_set_nonblock_state();
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();

}
else if (netplay->self_frame_count + 2 < hi_frame_count)
Expand Down
4 changes: 2 additions & 2 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ static enum runloop_state runloop_check_state(
input_driver_unset_nonblock_state();
else
input_driver_set_nonblock_state();
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}
else if ((runloop_cmd_pressed(old_input, RARCH_FAST_FORWARD_HOLD_KEY)
!= runloop_cmd_press(current_input, RARCH_FAST_FORWARD_HOLD_KEY)))
Expand All @@ -919,7 +919,7 @@ static enum runloop_state runloop_check_state(
input_driver_set_nonblock_state();
else
input_driver_unset_nonblock_state();
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
driver_set_nonblock_state();
}

/* Checks if the state increase/decrease keys have been pressed
Expand Down

0 comments on commit 768ce08

Please sign in to comment.