mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 14:28:47 +00:00
Rewrite cheats
This commit is contained in:
parent
d029cafdd9
commit
45477658e1
@ -425,19 +425,6 @@ bool cheat_manager_get_code_state(unsigned i)
|
||||
return handle->cheats[i].state;
|
||||
}
|
||||
|
||||
void cheat_manager_state_checks(
|
||||
bool cheat_index_plus_pressed,
|
||||
bool cheat_index_minus_pressed,
|
||||
bool cheat_toggle_pressed)
|
||||
{
|
||||
if (cheat_index_plus_pressed)
|
||||
cheat_manager_index_next();
|
||||
else if (cheat_index_minus_pressed)
|
||||
cheat_manager_index_prev();
|
||||
else if (cheat_toggle_pressed)
|
||||
cheat_manager_toggle();
|
||||
}
|
||||
|
||||
void cheat_manager_state_free(void)
|
||||
{
|
||||
cheat_manager_free();
|
||||
|
@ -64,11 +64,6 @@ const char *cheat_manager_get_code(unsigned i);
|
||||
|
||||
bool cheat_manager_get_code_state(unsigned i);
|
||||
|
||||
void cheat_manager_state_checks(
|
||||
bool cheat_index_plus_pressed,
|
||||
bool cheat_index_minus_pressed,
|
||||
bool cheat_toggle_pressed);
|
||||
|
||||
void cheat_manager_state_free(void);
|
||||
|
||||
bool cheat_manager_alloc_if_empty(void);
|
||||
|
27
retroarch.c
27
retroarch.c
@ -2699,10 +2699,29 @@ static enum runloop_state runloop_check_state(
|
||||
old_state = new_state;
|
||||
}
|
||||
|
||||
cheat_manager_state_checks(
|
||||
runloop_cmd_triggered(trigger_input, RARCH_CHEAT_INDEX_PLUS),
|
||||
runloop_cmd_triggered(trigger_input, RARCH_CHEAT_INDEX_MINUS),
|
||||
runloop_cmd_triggered(trigger_input, RARCH_CHEAT_TOGGLE));
|
||||
/* Check cheats */
|
||||
{
|
||||
static bool old_cheat_index_plus = false;
|
||||
static bool old_cheat_index_minus = false;
|
||||
static bool old_cheat_index_toggle = false;
|
||||
bool cheat_index_plus = runloop_cmd_press(
|
||||
current_input, RARCH_CHEAT_INDEX_PLUS);
|
||||
bool cheat_index_minus = runloop_cmd_press(
|
||||
current_input, RARCH_CHEAT_INDEX_MINUS);
|
||||
bool cheat_index_toggle = runloop_cmd_press(
|
||||
current_input, RARCH_CHEAT_TOGGLE);
|
||||
|
||||
if (cheat_index_plus && !old_cheat_index_plus)
|
||||
cheat_manager_index_next();
|
||||
else if (cheat_index_minus && !old_cheat_index_minus)
|
||||
cheat_manager_index_prev();
|
||||
else if (cheat_index_toggle && !old_cheat_index_toggle)
|
||||
cheat_manager_toggle();
|
||||
|
||||
old_cheat_index_plus = cheat_index_plus;
|
||||
old_cheat_index_minus = cheat_index_minus;
|
||||
old_cheat_index_toggle = cheat_index_toggle;
|
||||
}
|
||||
|
||||
return RUNLOOP_STATE_ITERATE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user