This commit is contained in:
twinaphex 2016-10-21 02:52:01 +02:00
parent eeb3d5e137
commit 1822726452

View File

@ -273,41 +273,6 @@ static bool runloop_check_pause(
return true; return true;
} }
/**
* runloop_check_stateslots:
* @pressed_increase : is state slot increase key pressed?
* @pressed_decrease : is state slot decrease key pressed?
*
* Checks if the state increase/decrease keys have been pressed
* for this frame.
**/
static void runloop_check_stateslots(settings_t *settings,
bool pressed_increase, bool pressed_decrease)
{
char msg[128];
msg[0] = '\0';
/* Save state slots */
if (pressed_increase)
settings->state_slot++;
else if (pressed_decrease)
{
if (settings->state_slot > 0)
settings->state_slot--;
}
else
return;
snprintf(msg, sizeof(msg), "%s: %d",
msg_hash_to_str(MSG_STATE_SLOT),
settings->state_slot);
runloop_msg_queue_push(msg, 2, 180, true);
RARCH_LOG("%s\n", msg);
}
/** /**
* rarch_game_specific_options: * rarch_game_specific_options:
* *
@ -338,12 +303,7 @@ static bool rarch_game_specific_options(char **output)
static bool runloop_check_pause_state(event_cmd_state_t *cmd) static bool runloop_check_pause_state(event_cmd_state_t *cmd)
{ {
bool check_is_oneshot = false; bool check_is_oneshot = runloop_cmd_triggered(cmd,
if (!cmd)
return false;
check_is_oneshot = runloop_cmd_triggered(cmd,
RARCH_FRAMEADVANCE) RARCH_FRAMEADVANCE)
|| runloop_cmd_press(cmd, RARCH_REWIND); || runloop_cmd_press(cmd, RARCH_REWIND);
@ -368,8 +328,7 @@ static bool runloop_check_state(event_cmd_state_t *cmd)
bool focused = true; bool focused = true;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (runloop_idle)
if (!cmd || runloop_idle)
return false; return false;
if (settings->pause_nonactive) if (settings->pause_nonactive)
@ -433,10 +392,42 @@ static bool runloop_check_state(event_cmd_state_t *cmd)
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
} }
runloop_check_stateslots(settings, /* Checks if the state increase/decrease keys have been pressed
runloop_cmd_triggered(cmd, RARCH_STATE_SLOT_PLUS), * for this frame. */
runloop_cmd_triggered(cmd, RARCH_STATE_SLOT_MINUS)
); if (runloop_cmd_triggered(cmd, RARCH_STATE_SLOT_PLUS))
{
char msg[128];
msg[0] = '\0';
settings->state_slot++;
snprintf(msg, sizeof(msg), "%s: %d",
msg_hash_to_str(MSG_STATE_SLOT),
settings->state_slot);
runloop_msg_queue_push(msg, 2, 180, true);
RARCH_LOG("%s\n", msg);
}
else if (runloop_cmd_triggered(cmd, RARCH_STATE_SLOT_MINUS))
{
char msg[128];
msg[0] = '\0';
if (settings->state_slot > 0)
settings->state_slot--;
snprintf(msg, sizeof(msg), "%s: %d",
msg_hash_to_str(MSG_STATE_SLOT),
settings->state_slot);
runloop_msg_queue_push(msg, 2, 180, true);
RARCH_LOG("%s\n", msg);
}
if (runloop_cmd_triggered(cmd, RARCH_SAVE_STATE_KEY)) if (runloop_cmd_triggered(cmd, RARCH_SAVE_STATE_KEY))
command_event(CMD_EVENT_SAVE_STATE, NULL); command_event(CMD_EVENT_SAVE_STATE, NULL);