From f7bb3650d9f73344c20881aca533dc6d2f32c8da Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 29 Nov 2015 17:45:07 +0100 Subject: [PATCH] Simplify driver_set_nonblock_state --- driver.c | 14 +++++++------- driver.h | 5 ++--- menu/menu_driver.c | 3 +-- runloop.c | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/driver.c b/driver.c index ff1b893833..c7afb6234d 100644 --- a/driver.c +++ b/driver.c @@ -244,7 +244,7 @@ static void driver_adjust_system_rates(void) if (system->force_nonblock) event_command(EVENT_CMD_VIDEO_SET_NONBLOCKING_STATE); else - driver_set_nonblock_state(driver->nonblock_state); + driver_set_nonblock_state(); } /** @@ -264,18 +264,18 @@ void driver_set_refresh_rate(float hz) /** * driver_set_nonblock_state: - * @enable : Enable nonblock state? * - * Sets audio and video drivers to nonblock state. + * Sets audio and video drivers to nonblock state (if enabled). * - * If @enable is false, sets blocking state for both - * audio and video drivers instead. + * If nonblock state is false, sets + * blocking state for both audio and video drivers instead. **/ -void driver_set_nonblock_state(bool enable) +void driver_set_nonblock_state(void) { settings_t *settings = config_get_ptr(); rarch_system_info_t *system = rarch_system_info_get_ptr(); driver_t *driver = driver_get_ptr(); + bool enable = driver->nonblock_state; /* Only apply non-block-state for video if we're using vsync. */ if (driver->video_active && video_driver_get_ptr(false)) @@ -419,7 +419,7 @@ void init_drivers(int flags) { /* Keep non-throttled state as good as possible. */ if (driver->nonblock_state) - driver_set_nonblock_state(driver->nonblock_state); + driver_set_nonblock_state(); } } diff --git a/driver.h b/driver.h index a8dd99752b..770184eae0 100644 --- a/driver.h +++ b/driver.h @@ -328,14 +328,13 @@ bool find_next_driver(const char *label, char *s, size_t len); /** * driver_set_nonblock_state: - * @enable : Enable nonblock state? * * Sets audio and video drivers to nonblock state. * - * If @enable is false, sets blocking state for both + * If nonblock state is false, sets blocking state for both * audio and video drivers instead. **/ -void driver_set_nonblock_state(bool enable); +void driver_set_nonblock_state(void); /** * driver_set_refresh_rate: diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 073e15f6d0..d01757b9e4 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -287,7 +287,6 @@ int menu_driver_iterate(enum menu_action action) void menu_driver_toggle(bool latch) { - driver_t *driver = driver_get_ptr(); const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr(); settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); @@ -323,7 +322,7 @@ void menu_driver_toggle(bool latch) else { if (!system->shutdown) - driver_set_nonblock_state(driver->nonblock_state); + driver_set_nonblock_state(); if (settings && settings->menu.pause_libretro) event_command(EVENT_CMD_AUDIO_START); diff --git a/runloop.c b/runloop.c index 33ab6f32b0..08f50c0534 100644 --- a/runloop.c +++ b/runloop.c @@ -245,7 +245,7 @@ static void check_fast_forward_button(driver_t *driver, else return; - driver_set_nonblock_state(driver->nonblock_state); + driver_set_nonblock_state(); } /**