mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Move nonblock_state to input_driver.c (NOTE: we probably need
to relocate this later on)
This commit is contained in:
parent
f7bb3650d9
commit
1c867cedf0
5
driver.c
5
driver.c
@ -233,7 +233,6 @@ void init_drivers_pre(void)
|
||||
static void driver_adjust_system_rates(void)
|
||||
{
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES, NULL);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_MONITOR_ADJUST_SYSTEM_RATES, NULL);
|
||||
@ -275,7 +274,7 @@ 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;
|
||||
bool enable = input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL);
|
||||
|
||||
/* Only apply non-block-state for video if we're using vsync. */
|
||||
if (driver->video_active && video_driver_get_ptr(false))
|
||||
@ -418,7 +417,7 @@ void init_drivers(int flags)
|
||||
if (flags & (DRIVER_VIDEO | DRIVER_AUDIO))
|
||||
{
|
||||
/* Keep non-throttled state as good as possible. */
|
||||
if (driver->nonblock_state)
|
||||
if (input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL))
|
||||
driver_set_nonblock_state();
|
||||
}
|
||||
}
|
||||
|
1
driver.h
1
driver.h
@ -266,7 +266,6 @@ typedef struct driver
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
rarch_remote_t *remote;
|
||||
#endif
|
||||
bool nonblock_state;
|
||||
|
||||
/* Last message given to the video driver */
|
||||
char current_msg[PATH_MAX_LENGTH];
|
||||
|
@ -1846,7 +1846,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
* and pause to prevent flicker. */
|
||||
if (
|
||||
settings->video.black_frame_insertion
|
||||
&& !driver->nonblock_state
|
||||
&& !input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)
|
||||
&& !is_slowmotion && !is_paused)
|
||||
{
|
||||
gfx_ctx_swap_buffers(gl);
|
||||
|
@ -85,6 +85,7 @@ struct turbo_buttons
|
||||
static bool flushing_input;
|
||||
static bool block_libretro_input;
|
||||
static bool block_hotkey;
|
||||
static bool nonblock_state;
|
||||
static turbo_buttons_t turbo_btns;
|
||||
|
||||
/**
|
||||
@ -689,6 +690,7 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
case RARCH_INPUT_CTL_DESTROY:
|
||||
flushing_input = false;
|
||||
block_hotkey = false;
|
||||
nonblock_state = false;
|
||||
memset(&turbo_btns, 0, sizeof(turbo_buttons_t));
|
||||
if (!driver)
|
||||
return false;
|
||||
@ -744,6 +746,14 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED:
|
||||
return block_libretro_input;
|
||||
case RARCH_INPUT_CTL_SET_NONBLOCK_STATE:
|
||||
nonblock_state = true;
|
||||
break;
|
||||
case RARCH_INPUT_CTL_UNSET_NONBLOCK_STATE:
|
||||
nonblock_state = false;
|
||||
break;
|
||||
case RARCH_INPUT_CTL_IS_NONBLOCK_STATE:
|
||||
return nonblock_state;
|
||||
case RARCH_INPUT_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -62,7 +62,10 @@ enum rarch_input_ctl_state
|
||||
RARCH_INPUT_CTL_IS_FLUSHING_INPUT,
|
||||
RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED,
|
||||
RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED,
|
||||
RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED
|
||||
RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED,
|
||||
RARCH_INPUT_CTL_SET_NONBLOCK_STATE,
|
||||
RARCH_INPUT_CTL_UNSET_NONBLOCK_STATE,
|
||||
RARCH_INPUT_CTL_IS_NONBLOCK_STATE
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
|
25
runloop.c
25
runloop.c
@ -230,8 +230,7 @@ static bool check_pause(settings_t *settings,
|
||||
* Checks if the fast forward key has been pressed for this frame.
|
||||
*
|
||||
**/
|
||||
static void check_fast_forward_button(driver_t *driver,
|
||||
bool fastforward_pressed,
|
||||
static void check_fast_forward_button(bool fastforward_pressed,
|
||||
bool hold_pressed, bool old_hold_pressed)
|
||||
{
|
||||
/* To avoid continous switching if we hold the button down, we require
|
||||
@ -239,9 +238,19 @@ static void check_fast_forward_button(driver_t *driver,
|
||||
* to be able to toggle between then.
|
||||
*/
|
||||
if (fastforward_pressed)
|
||||
driver->nonblock_state = !driver->nonblock_state;
|
||||
{
|
||||
if (input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL))
|
||||
input_driver_ctl(RARCH_INPUT_CTL_UNSET_NONBLOCK_STATE, NULL);
|
||||
else
|
||||
input_driver_ctl(RARCH_INPUT_CTL_SET_NONBLOCK_STATE, NULL);
|
||||
}
|
||||
else if (old_hold_pressed != hold_pressed)
|
||||
driver->nonblock_state = hold_pressed;
|
||||
{
|
||||
if (hold_pressed)
|
||||
input_driver_ctl(RARCH_INPUT_CTL_SET_NONBLOCK_STATE, NULL);
|
||||
else
|
||||
input_driver_ctl(RARCH_INPUT_CTL_UNSET_NONBLOCK_STATE, NULL);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
@ -523,7 +532,7 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
|
||||
if (!rarch_main_ctl(RARCH_MAIN_CTL_CHECK_IDLE_STATE, data))
|
||||
return false;
|
||||
|
||||
check_fast_forward_button(driver,
|
||||
check_fast_forward_button(
|
||||
cmd->fastforward_pressed,
|
||||
cmd->hold_pressed, cmd->old_hold_pressed);
|
||||
check_stateslots(settings, cmd->state_slot_increase,
|
||||
@ -997,7 +1006,8 @@ int rarch_main_iterate(unsigned *sleep_ms)
|
||||
|
||||
retro_time_t current = retro_get_time_usec();
|
||||
retro_time_t delta = current - system->frame_time_last;
|
||||
bool is_locked_fps = (main_is_paused || driver->nonblock_state) |
|
||||
bool is_locked_fps = (main_is_paused ||
|
||||
input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) |
|
||||
!!driver->recording_data;
|
||||
|
||||
if (!system->frame_time_last || is_locked_fps)
|
||||
@ -1115,7 +1125,8 @@ int rarch_main_iterate(unsigned *sleep_ms)
|
||||
settings->input.analog_dpad_mode[i]);
|
||||
}
|
||||
|
||||
if ((settings->video.frame_delay > 0) && !driver->nonblock_state)
|
||||
if ((settings->video.frame_delay > 0) &&
|
||||
!input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL))
|
||||
retro_sleep(settings->video.frame_delay);
|
||||
|
||||
/* Run libretro for one frame. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user