diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index a5833744d2..6d51de452f 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -48,6 +48,7 @@ #include "cond.h" #include "../file_path_special.h" +#include "../paths.h" #include "../command.h" #include "../dynamic.h" #include "../configuration.h" @@ -1962,6 +1963,22 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set) cheevos_make_unlock_url(cheevo, url, sizeof(url)); task_push_http_transfer(url, true, NULL, cheevos_unlocked, cheevo); + + if(settings->bools.cheevos_auto_screenshot) + { + char shotname[256]; + + snprintf(shotname, sizeof(shotname), "%s/%s-cheevo-%u", + settings->paths.directory_screenshot, + path_basename(path_get(RARCH_PATH_BASENAME)), + cheevo->id); + shotname[sizeof(shotname) - 1] = '\0'; + + if(take_screenshot(shotname, true, video_driver_cached_frame_has_valid_framebuffer())) + RARCH_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id); + else + RARCH_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id); + } } cheevo->last = valid; diff --git a/configuration.c b/configuration.c index 69dfde6614..7989fd3215 100644 --- a/configuration.c +++ b/configuration.c @@ -1335,10 +1335,11 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("cheevos_test_unofficial", &settings->bools.cheevos_test_unofficial, true, false, false); SETTING_BOOL("cheevos_hardcore_mode_enable", &settings->bools.cheevos_hardcore_mode_enable, true, false, false); 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); #ifdef HAVE_XMB SETTING_BOOL("cheevos_badges_enable", &settings->bools.cheevos_badges_enable, true, false, false); #endif - SETTING_BOOL("cheevos_verbose_enable", &settings->bools.cheevos_verbose_enable, true, false, false); #endif #ifdef HAVE_OVERLAY SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false); diff --git a/configuration.h b/configuration.h index 19582b7047..d705298732 100644 --- a/configuration.h +++ b/configuration.h @@ -195,6 +195,7 @@ typedef struct settings bool cheevos_leaderboards_enable; bool cheevos_badges_enable; bool cheevos_verbose_enable; + bool cheevos_auto_screenshot; /* Camera */ bool camera_allow; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1cbf32f46f..7291354735 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -156,6 +156,8 @@ MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_USERNAME, "cheevos_username") 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_CLOSE_CONTENT, "unload_core") MSG_HASH(MENU_ENUM_LABEL_COLLECTION, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 495e166a78..7e8f235a75 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -502,6 +502,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, "Achievements Verbose Mode" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, + "Achievements Automatic Screenshot" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, "Close Content" @@ -1907,6 +1911,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, "Enable or disable badge display in Achievement List.") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, "Enable or disable OSD verbosity for achievements.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, + "Automatically take a screenshot when an achievement is triggered.") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, "Change drivers used by the system.") MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 1a2f147a24..01f5529163 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -69,6 +69,7 @@ default_sublabel_macro(action_bind_sublabel_cheevos_hardcore_mode_enable, MENU_ default_sublabel_macro(action_bind_sublabel_cheevos_leaderboards_enable, MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE) 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_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) @@ -1310,6 +1311,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_verbose_enable); break; + case MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot); + break; case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_config_save_on_exit); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 991ce9f96e..66f3756e96 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5395,6 +5395,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT, + PARSE_ONLY_BOOL, false); info->need_refresh = true; info->need_push = true; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 81f15af93b..3b35c7a881 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6626,6 +6626,22 @@ static bool setting_append_list( SD_FLAG_NONE ); + CONFIG_BOOL( + list, list_info, + &settings->bools.cheevos_auto_screenshot, + MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT, + MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, + 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, diff --git a/msg_hash.h b/msg_hash.h index b7fe8b6d4d..09c6567800 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -894,6 +894,7 @@ enum msg_hash_enums MENU_LABEL(CHEEVOS_BADGES_ENABLE), MENU_LABEL(CHEEVOS_TEST_UNOFFICIAL), MENU_LABEL(CHEEVOS_VERBOSE_ENABLE), + MENU_LABEL(CHEEVOS_AUTO_SCREENSHOT), MENU_LABEL(CHEEVOS_ENABLE), MENU_LABEL(CHEEVOS_DESCRIPTION), MENU_LABEL(CHEEVOS_UNLOCKED_ACHIEVEMENTS),