Merge pull request #8693 from meleu/patch-5

add "Use Old Implementation" in the Achievements menu
This commit is contained in:
Twinaphex 2019-05-05 01:19:01 +02:00 committed by GitHub
commit 786a5bd9a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 50 additions and 17 deletions

View File

@ -300,7 +300,7 @@ static bool command_read_ram(const char *arg)
reply_at = reply + snprintf(reply, alloc_size - 1, SMY_CMD_STR " %x", addr);
/* RCHEEVOS TODO: remove if condition below */
if (settings->bools.cheevos_rcheevos_enable)
if (!settings->bools.cheevos_old_enable)
{
data = rcheevos_patch_address(addr, rcheevos_get_console());
}
@ -338,7 +338,7 @@ static bool command_write_ram(const char *arg)
/* RCHEEVOS TODO: remove settings init and test */
settings_t *settings = config_get_ptr();
if (settings->bools.cheevos_rcheevos_enable)
if (!settings->bools.cheevos_old_enable)
{
addr = strtoul(arg, (char**)&arg, 16);
data = (uint8_t *)rcheevos_patch_address(addr, rcheevos_get_console());
@ -1113,7 +1113,7 @@ static void command_event_deinit_core(bool reinit)
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove settings init and test */
settings_t *settings = config_get_ptr();
settings->bools.cheevos_rcheevos_enable ? rcheevos_unload() : cheevos_unload();
!settings->bools.cheevos_old_enable ? rcheevos_unload() : cheevos_unload();
#endif
RARCH_LOG("Unloading game..\n");
@ -1911,11 +1911,11 @@ bool command_event(enum event_command cmd, void *data)
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_CHEEVOS
settings->bools.cheevos_rcheevos_enable ? rcheevos_set_cheats() : cheevos_set_cheats();
!settings->bools.cheevos_old_enable ? rcheevos_set_cheats() : cheevos_set_cheats();
#endif
core_reset();
#ifdef HAVE_CHEEVOS
settings->bools.cheevos_rcheevos_enable ? rcheevos_reset_game() : cheevos_reset_game();
!settings->bools.cheevos_old_enable ? rcheevos_reset_game() : cheevos_reset_game();
#endif
#if HAVE_NETWORKING
netplay_driver_ctl(RARCH_NETPLAY_CTL_RESET, NULL);
@ -2012,7 +2012,7 @@ bool command_event(enum event_command cmd, void *data)
/* RCHEEVOS TODO: remove starting block bracket, settings init and test */
{
settings_t *settings = config_get_ptr();
settings->bools.cheevos_rcheevos_enable ? rcheevos_toggle_hardcore_mode() : cheevos_toggle_hardcore_mode();
!settings->bools.cheevos_old_enable ? rcheevos_toggle_hardcore_mode() : cheevos_toggle_hardcore_mode();
}
#endif
break;

View File

@ -1537,7 +1537,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("cheevos_leaderboards_enable", &settings->bools.cheevos_leaderboards_enable, true, false, false);
SETTING_BOOL("cheevos_verbose_enable", &settings->bools.cheevos_verbose_enable, true, false, false);
SETTING_BOOL("cheevos_auto_screenshot", &settings->bools.cheevos_auto_screenshot, true, false, false);
SETTING_BOOL("cheevos_rcheevos_enable", &settings->bools.cheevos_rcheevos_enable, true, true, false);
SETTING_BOOL("cheevos_old_enable", &settings->bools.cheevos_old_enable, true, false, false);
/* RCHEEVOS TODO: remove line above */
#ifdef HAVE_XMB
SETTING_BOOL("cheevos_badges_enable", &settings->bools.cheevos_badges_enable, true, false, false);

View File

@ -241,7 +241,7 @@ typedef struct settings
bool cheevos_badges_enable;
bool cheevos_verbose_enable;
bool cheevos_auto_screenshot;
bool cheevos_rcheevos_enable; /* RCHEEVOS TODO: remove line */
bool cheevos_old_enable; /* RCHEEVOS TODO: remove line */
/* Camera */
bool camera_allow;

View File

@ -1940,7 +1940,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
bool state = *(const bool*)data;
RARCH_LOG("Environ SET_SUPPORT_ACHIEVEMENTS: %s.\n", state ? "yes" : "no");
/* RCHEEVOS TODO: remove settings test */
settings->bools.cheevos_rcheevos_enable ? rcheevos_set_support_cheevos(state) : cheevos_set_support_cheevos(state);
!settings->bools.cheevos_old_enable ? rcheevos_set_support_cheevos(state) : cheevos_set_support_cheevos(state);
}
#endif
break;

View File

@ -176,6 +176,8 @@ MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE,
"cheevos_verbose_enable")
MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT,
"cheevos_auto_screenshot")
MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_OLD_ENABLE,
"cheevos_old_enable")
MSG_HASH(MENU_ENUM_LABEL_CLOSE_CONTENT,
"unload_core")
MSG_HASH(MENU_ENUM_LABEL_COLLECTION,

View File

@ -569,6 +569,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT,
"Automatic Screenshot"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEEVOS_OLD_ENABLE,
"Use Old Implementation (Debug Only)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT,
"Close Content"
@ -3968,6 +3972,11 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT,
"Automatically take a screenshot when an achievement is triggered."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CHEEVOS_OLD_ENABLE,
"Use the old achievements processing implementation\n"
"(if unsure, keep it off)."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_DRIVER_SETTINGS,
"Change drivers used by the system."

View File

@ -105,7 +105,7 @@ void cheat_manager_apply_cheats(void)
#ifdef HAVE_CHEEVOS
data_bool = idx != 0;
/* RCHEEVOS TODO: remove settings test */
settings->bools.cheevos_rcheevos_enable ? rcheevos_apply_cheats(&data_bool) : cheevos_apply_cheats(&data_bool);
!settings->bools.cheevos_old_enable ? rcheevos_apply_cheats(&data_bool) : cheevos_apply_cheats(&data_bool);
#endif
}

View File

@ -108,6 +108,7 @@ default_sublabel_macro(action_bind_sublabel_cheevos_leaderboards_enable, MENU_
default_sublabel_macro(action_bind_sublabel_cheevos_badges_enable, MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE)
default_sublabel_macro(action_bind_sublabel_cheevos_verbose_enable, MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE)
default_sublabel_macro(action_bind_sublabel_cheevos_auto_screenshot, MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT)
default_sublabel_macro(action_bind_sublabel_cheevos_old_enable, MENU_ENUM_SUBLABEL_CHEEVOS_OLD_ENABLE)
default_sublabel_macro(action_bind_sublabel_menu_views_settings_list, MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS)
default_sublabel_macro(action_bind_sublabel_quick_menu_views_settings_list, MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS)
default_sublabel_macro(action_bind_sublabel_menu_settings_list, MENU_ENUM_SUBLABEL_MENU_SETTINGS)
@ -598,7 +599,7 @@ static int action_bind_sublabel_cheevos_entry(
desc_info.s = s;
desc_info.len = len;
/* RCHEEVOS TODO: remove test */
settings->bools.cheevos_rcheevos_enable ? rcheevos_get_description((rcheevos_ctx_desc_t*) &desc_info) : cheevos_get_description(&desc_info);
!settings->bools.cheevos_old_enable ? rcheevos_get_description((rcheevos_ctx_desc_t*) &desc_info) : cheevos_get_description(&desc_info);
strlcpy(s, desc_info.s, len);
#endif
@ -2136,6 +2137,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot);
break;
case MENU_ENUM_LABEL_CHEEVOS_OLD_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_old_enable);
break;
case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_config_save_on_exit);
break;

View File

@ -3593,6 +3593,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
{MENU_ENUM_LABEL_CHEEVOS_TEST_UNOFFICIAL, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_CHEEVOS_OLD_ENABLE, PARSE_ONLY_BOOL },
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -5140,7 +5141,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{ /* RCHEEVOS TODO: remove brackets, settings and settings test */
settings_t *settings = config_get_ptr();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
settings->bools.cheevos_rcheevos_enable ? rcheevos_populate_menu(info) : cheevos_populate_menu(info);
!settings->bools.cheevos_old_enable ? rcheevos_populate_menu(info) : cheevos_populate_menu(info);
}
#endif
info->need_push = true;

View File

@ -5922,7 +5922,7 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting)
if (settings && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable)
{
/* RCHEEVOS TODO: remove settings test */
settings->bools.cheevos_rcheevos_enable ? rcheevos_toggle_hardcore_mode() : cheevos_toggle_hardcore_mode();
!settings->bools.cheevos_old_enable ? rcheevos_toggle_hardcore_mode() : cheevos_toggle_hardcore_mode();
command_event(CMD_EVENT_RESET, NULL);
return;
}
@ -12883,6 +12883,22 @@ static bool setting_append_list(
SD_FLAG_NONE
);
CONFIG_BOOL(
list, list_info,
&settings->bools.cheevos_old_enable,
MENU_ENUM_LABEL_CHEEVOS_OLD_ENABLE,
MENU_ENUM_LABEL_VALUE_CHEEVOS_OLD_ENABLE,
false,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
list, list_info,
&settings->bools.cheevos_hardcore_mode_enable,

View File

@ -179,7 +179,7 @@ int menu_dialog_iterate(char *s, size_t len, const char *label)
desc_info.idx = menu_dialog_current_id;
desc_info.s = s;
desc_info.len = len;
settings->bools.cheevos_rcheevos_enable ? rcheevos_get_description((rcheevos_ctx_desc_t*) &desc_info) : cheevos_get_description(&desc_info);
!settings->bools.cheevos_old_enable ? rcheevos_get_description((rcheevos_ctx_desc_t*) &desc_info) : cheevos_get_description(&desc_info);
}
break;

View File

@ -1073,6 +1073,7 @@ enum msg_hash_enums
MENU_LABEL(CHEEVOS_TEST_UNOFFICIAL),
MENU_LABEL(CHEEVOS_VERBOSE_ENABLE),
MENU_LABEL(CHEEVOS_AUTO_SCREENSHOT),
MENU_LABEL(CHEEVOS_OLD_ENABLE),
MENU_LABEL(CHEEVOS_ENABLE),
MENU_LABEL(CHEEVOS_DESCRIPTION),
MENU_LABEL(CHEEVOS_UNLOCKED_ACHIEVEMENTS),

View File

@ -4526,7 +4526,7 @@ int runloop_iterate(unsigned *sleep_ms)
#ifdef HAVE_CHEEVOS
if (runloop_check_cheevos()) /* RCHEEVOS TODO: remove settings test */
settings->bools.cheevos_rcheevos_enable ? rcheevos_test() : cheevos_test();
!settings->bools.cheevos_old_enable ? rcheevos_test() : cheevos_test();
#endif
cheat_manager_apply_retro_cheats();

View File

@ -740,10 +740,10 @@ static bool content_file_load(
const char *content_path = content->elems[0].data;
enum rarch_content_type type = path_is_media_type(content_path);
settings->bools.cheevos_rcheevos_enable ? rcheevos_set_cheats() : cheevos_set_cheats();
!settings->bools.cheevos_old_enable ? rcheevos_set_cheats() : cheevos_set_cheats();
if (type == RARCH_CONTENT_NONE && !string_is_empty(content_path))
settings->bools.cheevos_rcheevos_enable ? rcheevos_load(info) : cheevos_load(info);
!settings->bools.cheevos_old_enable ? rcheevos_load(info) : cheevos_load(info);
}
#endif