mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Simplify driver_set_nonblock_state
This commit is contained in:
parent
e8d6e48a74
commit
f7bb3650d9
14
driver.c
14
driver.c
@ -244,7 +244,7 @@ static void driver_adjust_system_rates(void)
|
|||||||
if (system->force_nonblock)
|
if (system->force_nonblock)
|
||||||
event_command(EVENT_CMD_VIDEO_SET_NONBLOCKING_STATE);
|
event_command(EVENT_CMD_VIDEO_SET_NONBLOCKING_STATE);
|
||||||
else
|
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:
|
* 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
|
* If nonblock state is false, sets
|
||||||
* audio and video drivers instead.
|
* 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();
|
settings_t *settings = config_get_ptr();
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
driver_t *driver = driver_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. */
|
/* Only apply non-block-state for video if we're using vsync. */
|
||||||
if (driver->video_active && video_driver_get_ptr(false))
|
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. */
|
/* Keep non-throttled state as good as possible. */
|
||||||
if (driver->nonblock_state)
|
if (driver->nonblock_state)
|
||||||
driver_set_nonblock_state(driver->nonblock_state);
|
driver_set_nonblock_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
driver.h
5
driver.h
@ -328,14 +328,13 @@ bool find_next_driver(const char *label, char *s, size_t len);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* driver_set_nonblock_state:
|
* 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 @enable is false, sets blocking state for both
|
* If nonblock state is false, sets blocking state for both
|
||||||
* audio and video drivers instead.
|
* audio and video drivers instead.
|
||||||
**/
|
**/
|
||||||
void driver_set_nonblock_state(bool enable);
|
void driver_set_nonblock_state(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* driver_set_refresh_rate:
|
* driver_set_refresh_rate:
|
||||||
|
@ -287,7 +287,6 @@ int menu_driver_iterate(enum menu_action action)
|
|||||||
|
|
||||||
void menu_driver_toggle(bool latch)
|
void menu_driver_toggle(bool latch)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
@ -323,7 +322,7 @@ void menu_driver_toggle(bool latch)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!system->shutdown)
|
if (!system->shutdown)
|
||||||
driver_set_nonblock_state(driver->nonblock_state);
|
driver_set_nonblock_state();
|
||||||
|
|
||||||
if (settings && settings->menu.pause_libretro)
|
if (settings && settings->menu.pause_libretro)
|
||||||
event_command(EVENT_CMD_AUDIO_START);
|
event_command(EVENT_CMD_AUDIO_START);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user