mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Get rid of static functions
This commit is contained in:
parent
a19128422d
commit
d61e5504a7
205
retroarch.c
205
retroarch.c
@ -2242,109 +2242,6 @@ bool runloop_msg_queue_pull(const char **ret)
|
||||
#define runloop_netplay_pause() ((void)0)
|
||||
#endif
|
||||
|
||||
static void check_state_slots(settings_t *settings, uint64_t current_input)
|
||||
{
|
||||
static bool old_should_slot_increase = false;
|
||||
static bool old_should_slot_decrease = false;
|
||||
bool should_slot_increase = runloop_cmd_press(
|
||||
current_input, RARCH_STATE_SLOT_PLUS);
|
||||
bool should_slot_decrease = runloop_cmd_press(
|
||||
current_input, RARCH_STATE_SLOT_MINUS);
|
||||
|
||||
/* Checks if the state increase/decrease keys have been pressed
|
||||
* for this frame. */
|
||||
if (should_slot_increase && !old_should_slot_increase)
|
||||
{
|
||||
char msg[128];
|
||||
int new_state_slot = settings->ints.state_slot + 1;
|
||||
|
||||
msg[0] = '\0';
|
||||
|
||||
configuration_set_int(settings, settings->ints.state_slot, new_state_slot);
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: %d",
|
||||
msg_hash_to_str(MSG_STATE_SLOT),
|
||||
settings->ints.state_slot);
|
||||
|
||||
runloop_msg_queue_push(msg, 2, 180, true);
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
else if (should_slot_decrease && !old_should_slot_decrease)
|
||||
{
|
||||
char msg[128];
|
||||
int new_state_slot = settings->ints.state_slot - 1;
|
||||
|
||||
msg[0] = '\0';
|
||||
|
||||
if (settings->ints.state_slot > 0)
|
||||
{
|
||||
configuration_set_int(settings, settings->ints.state_slot, new_state_slot);
|
||||
}
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: %d",
|
||||
msg_hash_to_str(MSG_STATE_SLOT),
|
||||
settings->ints.state_slot);
|
||||
|
||||
runloop_msg_queue_push(msg, 2, 180, true);
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
||||
old_should_slot_increase = should_slot_increase;
|
||||
old_should_slot_decrease = should_slot_decrease;
|
||||
}
|
||||
|
||||
static void check_savestates(uint64_t current_input)
|
||||
{
|
||||
static bool old_should_savestate = false;
|
||||
static bool old_should_loadstate = false;
|
||||
bool should_savestate = runloop_cmd_press(
|
||||
current_input, RARCH_SAVE_STATE_KEY);
|
||||
bool should_loadstate = runloop_cmd_press(
|
||||
current_input, RARCH_LOAD_STATE_KEY);
|
||||
|
||||
if (should_savestate && !old_should_savestate)
|
||||
command_event(CMD_EVENT_SAVE_STATE, NULL);
|
||||
if (should_loadstate && !old_should_loadstate)
|
||||
command_event(CMD_EVENT_LOAD_STATE, NULL);
|
||||
|
||||
old_should_savestate = should_savestate;
|
||||
old_should_loadstate = should_loadstate;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void check_next_overlay(uint64_t current_input)
|
||||
{
|
||||
static bool old_should_check_next_overlay = false;
|
||||
bool should_check_next_overlay = runloop_cmd_press(
|
||||
current_input, RARCH_OVERLAY_NEXT);
|
||||
|
||||
if (should_check_next_overlay && !old_should_check_next_overlay)
|
||||
command_event(CMD_EVENT_OVERLAY_NEXT, NULL);
|
||||
|
||||
old_should_check_next_overlay = should_check_next_overlay;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void check_reset(uint64_t current_input)
|
||||
{
|
||||
static bool old_state = false;
|
||||
bool new_state = runloop_cmd_press(
|
||||
current_input, RARCH_RESET);
|
||||
|
||||
if (new_state && !old_state)
|
||||
{
|
||||
command_event(CMD_EVENT_RESET, NULL);
|
||||
#if 0
|
||||
task_push_audio_mixer_load("/home/squarepusher/SumertimeBlues.ogg",
|
||||
NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
old_state = new_state;
|
||||
}
|
||||
|
||||
static enum runloop_state runloop_check_state(
|
||||
settings_t *settings,
|
||||
uint64_t current_input,
|
||||
@ -2368,7 +2265,17 @@ static enum runloop_state runloop_check_state(
|
||||
video_driver_get_status(&frame_count, &is_alive, &is_focused);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
check_next_overlay(current_input);
|
||||
/* Check next overlay */
|
||||
{
|
||||
static bool old_should_check_next_overlay = false;
|
||||
bool should_check_next_overlay = runloop_cmd_press(
|
||||
current_input, RARCH_OVERLAY_NEXT);
|
||||
|
||||
if (should_check_next_overlay && !old_should_check_next_overlay)
|
||||
command_event(CMD_EVENT_OVERLAY_NEXT, NULL);
|
||||
|
||||
old_should_check_next_overlay = should_check_next_overlay;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||
@ -2600,8 +2507,76 @@ static enum runloop_state runloop_check_state(
|
||||
driver_set_nonblock_state();
|
||||
}
|
||||
|
||||
check_state_slots(settings, current_input);
|
||||
check_savestates(current_input);
|
||||
/* Check state slots */
|
||||
{
|
||||
static bool old_should_slot_increase = false;
|
||||
static bool old_should_slot_decrease = false;
|
||||
bool should_slot_increase = runloop_cmd_press(
|
||||
current_input, RARCH_STATE_SLOT_PLUS);
|
||||
bool should_slot_decrease = runloop_cmd_press(
|
||||
current_input, RARCH_STATE_SLOT_MINUS);
|
||||
|
||||
/* Checks if the state increase/decrease keys have been pressed
|
||||
* for this frame. */
|
||||
if (should_slot_increase && !old_should_slot_increase)
|
||||
{
|
||||
char msg[128];
|
||||
int new_state_slot = settings->ints.state_slot + 1;
|
||||
|
||||
msg[0] = '\0';
|
||||
|
||||
configuration_set_int(settings, settings->ints.state_slot, new_state_slot);
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: %d",
|
||||
msg_hash_to_str(MSG_STATE_SLOT),
|
||||
settings->ints.state_slot);
|
||||
|
||||
runloop_msg_queue_push(msg, 2, 180, true);
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
else if (should_slot_decrease && !old_should_slot_decrease)
|
||||
{
|
||||
char msg[128];
|
||||
int new_state_slot = settings->ints.state_slot - 1;
|
||||
|
||||
msg[0] = '\0';
|
||||
|
||||
if (settings->ints.state_slot > 0)
|
||||
{
|
||||
configuration_set_int(settings, settings->ints.state_slot, new_state_slot);
|
||||
}
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: %d",
|
||||
msg_hash_to_str(MSG_STATE_SLOT),
|
||||
settings->ints.state_slot);
|
||||
|
||||
runloop_msg_queue_push(msg, 2, 180, true);
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
||||
old_should_slot_increase = should_slot_increase;
|
||||
old_should_slot_decrease = should_slot_decrease;
|
||||
}
|
||||
|
||||
/* Check savestates */
|
||||
{
|
||||
static bool old_should_savestate = false;
|
||||
static bool old_should_loadstate = false;
|
||||
bool should_savestate = runloop_cmd_press(
|
||||
current_input, RARCH_SAVE_STATE_KEY);
|
||||
bool should_loadstate = runloop_cmd_press(
|
||||
current_input, RARCH_LOAD_STATE_KEY);
|
||||
|
||||
if (should_savestate && !old_should_savestate)
|
||||
command_event(CMD_EVENT_SAVE_STATE, NULL);
|
||||
if (should_loadstate && !old_should_loadstate)
|
||||
command_event(CMD_EVENT_LOAD_STATE, NULL);
|
||||
|
||||
old_should_savestate = should_savestate;
|
||||
old_should_loadstate = should_loadstate;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
if (!settings->bools.cheevos_hardcore_mode_enable)
|
||||
@ -2652,7 +2627,23 @@ static enum runloop_state runloop_check_state(
|
||||
else if (runloop_cmd_triggered(trigger_input, RARCH_DISK_PREV))
|
||||
command_event(CMD_EVENT_DISK_PREV, NULL);
|
||||
|
||||
check_reset(current_input);
|
||||
/* Check reset */
|
||||
{
|
||||
static bool old_state = false;
|
||||
bool new_state = runloop_cmd_press(
|
||||
current_input, RARCH_RESET);
|
||||
|
||||
if (new_state && !old_state)
|
||||
{
|
||||
command_event(CMD_EVENT_RESET, NULL);
|
||||
#if 0
|
||||
task_push_audio_mixer_load("/home/squarepusher/SumertimeBlues.ogg",
|
||||
NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
old_state = new_state;
|
||||
}
|
||||
|
||||
cheat_manager_state_checks(
|
||||
runloop_cmd_triggered(trigger_input, RARCH_CHEAT_INDEX_PLUS),
|
||||
|
Loading…
x
Reference in New Issue
Block a user