diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 59ff4093ab..9fa511787d 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -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, diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index c7939f8ca8..8d22b9c973 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -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) { diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index eeace61095..d42723f299 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -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);