From 4ba88ccabfbe7d40e7330a2d14941c6a316dbc02 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 26 Sep 2015 13:12:26 +0200 Subject: [PATCH] Refactor away rarch_main_set_pause --- command_event.c | 13 +++++++++---- runloop.c | 13 ++++++++----- runloop.h | 3 +-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/command_event.c b/command_event.c index 39ecf106b5..1f11b63b79 100644 --- a/command_event.c +++ b/command_event.c @@ -1456,16 +1456,21 @@ bool event_command(enum event_command cmd) } break; case EVENT_CMD_PAUSE_TOGGLE: - rarch_main_ctl(RARCH_MAIN_CTL_IS_PAUSED, &boolean); - rarch_main_set_pause(!boolean); + rarch_main_ctl(RARCH_MAIN_CTL_IS_PAUSED, &boolean); + boolean = !boolean; + rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean); event_command(EVENT_CMD_PAUSE_CHECKS); break; case EVENT_CMD_UNPAUSE: - rarch_main_set_pause(false); + boolean = false; + + rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean); event_command(EVENT_CMD_PAUSE_CHECKS); break; case EVENT_CMD_PAUSE: - rarch_main_set_pause(true); + boolean = true; + + rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean); event_command(EVENT_CMD_PAUSE_CHECKS); break; case EVENT_CMD_MENU_PAUSE_LIBRETRO: diff --git a/runloop.c b/runloop.c index 0078ce078a..407dbcfba5 100644 --- a/runloop.c +++ b/runloop.c @@ -886,11 +886,6 @@ void rarch_main_set_max_frames(unsigned val) main_max_frames = val; } -void rarch_main_set_pause(unsigned enable) -{ - main_is_paused = enable; -} - void rarch_main_set_idle(unsigned enable) { main_is_idle = enable; @@ -916,6 +911,14 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) *ptr = main_is_slowmotion; } return true; + case RARCH_MAIN_CTL_SET_PAUSED: + { + bool *ptr = (bool*)data; + if (!ptr) + return false; + main_is_paused = *ptr; + } + return true; case RARCH_MAIN_CTL_IS_PAUSED: { bool *ptr = (bool*)data; diff --git a/runloop.h b/runloop.h index f4ddb4c2f9..13d52137ce 100644 --- a/runloop.h +++ b/runloop.h @@ -38,6 +38,7 @@ enum rarch_main_ctl_state RARCH_MAIN_CTL_IS_IDLE = 0, RARCH_MAIN_CTL_IS_SLOWMOTION, RARCH_MAIN_CTL_IS_PAUSED, + RARCH_MAIN_CTL_SET_PAUSED }; typedef struct rarch_resolution @@ -338,8 +339,6 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data); void rarch_main_set_slowmotion(unsigned enable); -void rarch_main_set_pause(unsigned enable); - void rarch_main_set_frame_limit_last_time(void); void rarch_main_set_max_frames(unsigned val);