mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-04 14:27:38 +00:00
Merge pull request #12878 from libretro/input-get-rid-of-getters-setters
Get rid of getters/setters in big driver files from now
This commit is contained in:
commit
c66bcc05cf
@ -365,27 +365,6 @@ float input_driver_get_sensor(
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/**************************************/
|
||||
|
||||
bool input_driver_get_nonblocking(input_driver_state_t *driver_state)
|
||||
{
|
||||
if (!driver_state)
|
||||
return false;
|
||||
|
||||
return driver_state->nonblocking_flag;
|
||||
}
|
||||
|
||||
void input_driver_set_nonblocking(input_driver_state_t *driver_state,
|
||||
bool new_value)
|
||||
{
|
||||
if (!driver_state)
|
||||
return;
|
||||
|
||||
driver_state->nonblocking_flag = new_value;
|
||||
}
|
||||
|
||||
/**************************************/
|
||||
|
||||
const input_device_driver_t *input_joypad_init_driver(
|
||||
const char *ident, void *data)
|
||||
{
|
||||
|
@ -345,12 +345,6 @@ float input_driver_get_sensor(
|
||||
input_driver_state_t *driver_state,
|
||||
unsigned port, bool sensors_enable, unsigned id);
|
||||
|
||||
|
||||
bool input_driver_get_nonblocking(input_driver_state_t *driver_state);
|
||||
|
||||
void input_driver_set_nonblocking(input_driver_state_t *driver_state,
|
||||
bool new_value);
|
||||
|
||||
/**
|
||||
* Get an enumerated list of all joypad driver names
|
||||
*
|
||||
|
51
retroarch.c
51
retroarch.c
@ -15787,7 +15787,7 @@ void emscripten_mainloop(void)
|
||||
settings_t *settings = p_rarch->configuration_settings;
|
||||
input_driver_state_t *input_driver_st = &(p_rarch->input_driver_state);
|
||||
bool black_frame_insertion = settings->uints.video_black_frame_insertion;
|
||||
bool input_driver_nonblock_state = input_driver_get_nonblocking(input_driver_st);
|
||||
bool input_driver_nonblock_state = input_driver_st ? input_driver_st->nonblocking_flag : false;
|
||||
bool runloop_is_slowmotion = runloop_state.slowmotion;
|
||||
bool runloop_is_paused = runloop_state.paused;
|
||||
|
||||
@ -21872,7 +21872,8 @@ void input_set_nonblock_state(void)
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
input_driver_state_t *input_driver_st = &p_rarch->input_driver_state;
|
||||
|
||||
input_driver_set_nonblocking(input_driver_st, true);
|
||||
if (input_driver_st)
|
||||
input_driver_st->nonblocking_flag = true;
|
||||
}
|
||||
|
||||
void input_unset_nonblock_state(void)
|
||||
@ -21880,7 +21881,8 @@ void input_unset_nonblock_state(void)
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
input_driver_state_t *input_driver_st = &p_rarch->input_driver_state;
|
||||
|
||||
input_driver_set_nonblocking(input_driver_st, false);
|
||||
if (input_driver_st)
|
||||
input_driver_st->nonblocking_flag = false;
|
||||
}
|
||||
|
||||
void *input_driver_get_data(void)
|
||||
@ -31927,7 +31929,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
video_info->runloop_is_paused = runloop_state.paused;
|
||||
video_info->runloop_is_slowmotion = runloop_state.slowmotion;
|
||||
|
||||
video_info->input_driver_nonblock_state = input_driver_get_nonblocking(input_driver_st);
|
||||
video_info->input_driver_nonblock_state = input_driver_st ?
|
||||
input_driver_st->nonblocking_flag : false;
|
||||
video_info->input_driver_grab_mouse_state = p_rarch->input_driver_grab_mouse_state;
|
||||
video_info->disp_userdata = &p_rarch->dispgfx;
|
||||
|
||||
@ -32870,9 +32873,12 @@ static void driver_adjust_system_rates(
|
||||
**/
|
||||
void driver_set_nonblock_state(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
input_driver_state_t *input_driver_st = &p_rarch->input_driver_state;
|
||||
bool enable = input_driver_get_nonblocking(input_driver_st);
|
||||
struct rarch_state
|
||||
*p_rarch = &rarch_st;
|
||||
input_driver_state_t
|
||||
*input_driver_st = &p_rarch->input_driver_state;
|
||||
bool enable = input_driver_st ?
|
||||
input_driver_st->nonblocking_flag : false;
|
||||
settings_t *settings = p_rarch->configuration_settings;
|
||||
bool audio_sync = settings->bools.audio_sync;
|
||||
bool video_vsync = settings->bools.video_vsync;
|
||||
@ -33101,7 +33107,7 @@ static void drivers_init(struct rarch_state *p_rarch,
|
||||
if (flags & (DRIVER_VIDEO_MASK | DRIVER_AUDIO_MASK))
|
||||
{
|
||||
/* Keep non-throttled state as good as possible. */
|
||||
if (input_driver_get_nonblocking(input_driver_st))
|
||||
if (input_driver_st && input_driver_st->nonblocking_flag)
|
||||
driver_set_nonblock_state();
|
||||
}
|
||||
|
||||
@ -33263,7 +33269,9 @@ static void retroarch_deinit_drivers(
|
||||
p_rarch->input_driver_keyboard_linefeed_enable = false;
|
||||
p_rarch->input_driver_block_hotkey = false;
|
||||
p_rarch->input_driver_block_libretro_input = false;
|
||||
input_driver_set_nonblocking(input_driver_st, false);
|
||||
|
||||
if (input_driver_st)
|
||||
input_driver_st->nonblocking_flag = false;
|
||||
|
||||
p_rarch->input_driver_flushing_input = 0;
|
||||
memset(&p_rarch->input_driver_turbo_btns, 0, sizeof(turbo_buttons_t));
|
||||
@ -37140,14 +37148,19 @@ static void runloop_apply_fastmotion_override(
|
||||
if (p_runloop->fastmotion !=
|
||||
p_runloop->fastmotion_override.current.fastforward)
|
||||
{
|
||||
input_driver_state_t *input_driver_st = &p_rarch->input_driver_state;
|
||||
p_runloop->fastmotion =
|
||||
p_runloop->fastmotion_override.current.fastforward;
|
||||
|
||||
if (p_runloop->fastmotion)
|
||||
input_driver_set_nonblocking(&p_rarch->input_driver_state, true);
|
||||
{
|
||||
if (input_driver_st)
|
||||
input_driver_st->nonblocking_flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_driver_set_nonblocking(&p_rarch->input_driver_state, false);
|
||||
if (input_driver_st)
|
||||
input_driver_st->nonblocking_flag = false;
|
||||
p_rarch->fastforward_after_frames = 1;
|
||||
}
|
||||
|
||||
@ -38127,11 +38140,17 @@ static enum runloop_state runloop_check_state(
|
||||
|
||||
if (check2)
|
||||
{
|
||||
bool check1 = input_driver_get_nonblocking(input_driver_st);
|
||||
input_driver_set_nonblocking(input_driver_st, !check1);
|
||||
runloop_state.fastmotion = !check1;
|
||||
if (check1)
|
||||
if (input_driver_st->nonblocking_flag)
|
||||
{
|
||||
input_driver_st->nonblocking_flag = false;
|
||||
runloop_state.fastmotion = false;
|
||||
p_rarch->fastforward_after_frames = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_driver_st->nonblocking_flag = true;
|
||||
runloop_state.fastmotion = true;
|
||||
}
|
||||
|
||||
driver_set_nonblock_state();
|
||||
|
||||
@ -38637,7 +38656,7 @@ int runloop_iterate(void)
|
||||
}
|
||||
}
|
||||
|
||||
if ((video_frame_delay > 0) && !input_driver_get_nonblocking(input_driver_st))
|
||||
if ((video_frame_delay > 0) && input_driver_st && !input_driver_st->nonblocking_flag)
|
||||
retro_sleep(video_frame_delay);
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user