Create generic_action_cheat_toggle

This commit is contained in:
twinaphex 2015-09-05 17:09:57 +02:00
parent b28892bcf1
commit bc323cc262
3 changed files with 14 additions and 12 deletions

View File

@ -59,17 +59,9 @@ static int shader_action_parameter_preset_left(unsigned type, const char *label,
static int action_left_cheat(unsigned type, const char *label,
bool wraparound)
{
global_t *global = global_get_ptr();
cheat_manager_t *cheat = global->cheat;
size_t idx = type - MENU_SETTINGS_CHEAT_BEGIN;
if (!cheat)
return -1;
cheat->cheats[idx].state = !cheat->cheats[idx].state;
cheat_manager_update(cheat, idx);
return 0;
return generic_action_cheat_toggle(idx, type, label,
wraparound);
}
static int action_left_input_desc(unsigned type, const char *label,

View File

@ -61,12 +61,11 @@ int shader_action_parameter_preset_right(unsigned type, const char *label,
MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
}
int action_right_cheat(unsigned type, const char *label,
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
bool wraparound)
{
global_t *global = global_get_ptr();
cheat_manager_t *cheat = global->cheat;
size_t idx = type - MENU_SETTINGS_CHEAT_BEGIN;
if (!cheat)
return -1;
@ -77,6 +76,14 @@ int action_right_cheat(unsigned type, const char *label,
return 0;
}
int action_right_cheat(unsigned type, const char *label,
bool wraparound)
{
size_t idx = type - MENU_SETTINGS_CHEAT_BEGIN;
return generic_action_cheat_toggle(idx, type, label,
wraparound);
}
int action_right_input_desc(unsigned type, const char *label,
bool wraparound)
{

View File

@ -38,6 +38,9 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo
int shader_action_parameter_preset_right(unsigned type, const char *label,
bool wraparound);
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
bool wraparound);
int action_ok_push_generic_list(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx);