Implement info callback for cheevos

This commit is contained in:
twinaphex 2016-11-06 13:05:28 +01:00
parent a57cb22da8
commit 89984e6579
2 changed files with 28 additions and 21 deletions

View File

@ -19,6 +19,8 @@
#include "../menu_navigation.h"
#include "../menu_cbs.h"
#include "../widgets/menu_dialog.h"
#ifndef BIND_ACTION_INFO
#define BIND_ACTION_INFO(cbs, name) \
cbs->action_info = name; \
@ -50,12 +52,37 @@ static int action_info_default(unsigned type, const char *label)
return 0;
}
#ifdef HAVE_CHEEVOS
int generic_action_ok_help(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
enum msg_hash_enums id, enum menu_dialog_type id2);
static int action_info_cheevos(unsigned type, const char *label)
{
unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START;
menu_dialog_set_current_id(new_id);
return generic_action_ok_help(NULL, label, new_id, 0, 0,
MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION,
MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION);
}
#endif
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
if (!cbs)
return -1;
#ifdef HAVE_CHEEVOS
if ((type >= MENU_SETTINGS_CHEEVOS_START))
{
BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0;
}
#endif
BIND_ACTION_INFO(cbs, action_info_default);
return -1;

View File

@ -1489,7 +1489,7 @@ static int action_ok_shader_pass_load(const char *path,
ACTION_OK_LOAD_SHADER_PASS, MENU_ENUM_LABEL_SHADER_OPTIONS);
}
static int generic_action_ok_help(const char *path,
int generic_action_ok_help(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
enum msg_hash_enums id, enum menu_dialog_type id2)
{
@ -1499,20 +1499,6 @@ static int generic_action_ok_help(const char *path,
entry_idx, ACTION_OK_DL_HELP);
}
#if 0
static int action_ok_cheevos(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START;
menu_dialog_set_current_id(new_id);
return generic_action_ok_help(path, label, new_id, idx, entry_idx,
MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION,
MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION);
}
#endif
static void menu_input_st_cheat_cb(void *userdata, const char *str)
{
(void)userdata;
@ -3975,12 +3961,6 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
{
BIND_ACTION_OK(cbs, NULL);
}
#if 0
else if ((type >= MENU_SETTINGS_CHEEVOS_START))
{
BIND_ACTION_OK(cbs, action_ok_cheevos);
}
#endif
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
{