mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
Press left/right on a cheat entry now to turn it ON/OFF
This commit is contained in:
parent
03f2421154
commit
21b99c3ac5
6
cheats.c
6
cheats.c
@ -171,13 +171,15 @@ void cheat_manager_free(cheat_manager_t *handle)
|
||||
free(handle);
|
||||
}
|
||||
|
||||
static void cheat_manager_update(cheat_manager_t *handle)
|
||||
void cheat_manager_update(cheat_manager_t *handle)
|
||||
{
|
||||
msg_queue_clear(g_extern.msg_queue);
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s",
|
||||
handle->ptr, handle->cheats[handle->ptr].state ? "ON" : "OFF",
|
||||
handle->cheats[handle->ptr].desc);
|
||||
(handle->cheats[handle->ptr].desc) ?
|
||||
(handle->cheats[handle->ptr].desc) : (handle->cheats[handle->ptr].code)
|
||||
);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
2
cheats.h
2
cheats.h
@ -55,6 +55,8 @@ void cheat_manager_toggle(cheat_manager_t *handle);
|
||||
|
||||
void cheat_manager_apply_cheats(cheat_manager_t *handle);
|
||||
|
||||
void cheat_manager_update(cheat_manager_t *handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -342,8 +342,6 @@ static int action_ok_cheat_file_load(const char *path,
|
||||
|
||||
fill_pathname_join(cheat_path, menu_path, path, sizeof(cheat_path));
|
||||
|
||||
RARCH_LOG("menu path is: %s\n", menu_path);
|
||||
|
||||
if (g_extern.cheat)
|
||||
cheat_manager_free(g_extern.cheat);
|
||||
|
||||
@ -927,6 +925,27 @@ static int shader_action_parameter_preset_toggle(unsigned type, const char *labe
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_toggle_cheat(unsigned type, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
size_t idx = type - MENU_SETTINGS_CHEAT_BEGIN;
|
||||
|
||||
if (!cheat)
|
||||
return -1;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
case MENU_ACTION_RIGHT:
|
||||
cheat->cheats[idx].state = !cheat->cheats[idx].state;
|
||||
cheat_manager_update(cheat);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
extern size_t hack_shader_pass;
|
||||
#endif
|
||||
@ -2531,6 +2550,9 @@ static void menu_entries_cbs_init_bind_toggle(menu_file_list_cbs_t *cbs,
|
||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||
cbs->action_toggle = shader_action_parameter_preset_toggle;
|
||||
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
|
||||
&& type <= MENU_SETTINGS_CHEAT_END)
|
||||
cbs->action_toggle = action_toggle_cheat;
|
||||
else if (
|
||||
!strcmp(label, "core_list") ||
|
||||
!strcmp(label, "history_list") ||
|
||||
|
@ -2405,10 +2405,11 @@ void setting_data_get_label(char *type_str,
|
||||
{
|
||||
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
|
||||
if (cheat_index < g_extern.cheat->buf_size)
|
||||
snprintf(type_str, type_str_size, "%s",
|
||||
(
|
||||
snprintf(type_str, type_str_size, "%s : (%s)",
|
||||
(g_extern.cheat->cheats[cheat_index].code != NULL)
|
||||
) ? g_extern.cheat->cheats[cheat_index].code : "N/A");
|
||||
? g_extern.cheat->cheats[cheat_index].code : "N/A",
|
||||
g_extern.cheat->cheats[cheat_index].state ? "ON" : "OFF"
|
||||
);
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
|
||||
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
||||
|
Loading…
Reference in New Issue
Block a user