Refactor away rarch_main_set_pause

This commit is contained in:
twinaphex 2015-09-26 13:12:26 +02:00
parent 0d18c61bc5
commit 4ba88ccabf
3 changed files with 18 additions and 11 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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);