From 5722d90a382c9cdad8ab9379a87bd16b57ea5a0d Mon Sep 17 00:00:00 2001 From: sonninnos <45124675+sonninnos@users.noreply.github.com> Date: Fri, 14 Apr 2023 23:28:09 +0300 Subject: [PATCH] Show version in System Information + help/log version reformat (#15195) --- intl/msg_hash_us.h | 4 +++ menu/menu_displaylist.c | 55 +++++++++++++++++++++++++++-------------- msg_hash.h | 1 + retroarch.c | 26 ++++++++++++------- 4 files changed, 59 insertions(+), 27 deletions(-) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 6f731a249a..7d10a367eb 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -602,6 +602,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, "Build Date" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETROARCH_VERSION, + "RetroArch Version" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, "Git Version" diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b990b76821..26d77ea739 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -92,6 +92,7 @@ #include "../file_path_special.h" #include "../defaults.h" #include "../verbosity.h" +#include "../version.h" #ifdef HAVE_CHEATS #include "../cheat_manager.h" #endif @@ -1666,20 +1667,23 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) const char *tmp_string = NULL; const frontend_ctx_driver_t *frontend = frontend_get_ptr(); const char *menu_driver = menu_driver_ident(); - size_t _len = strlcpy(tmp, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE), - sizeof(tmp)); - tmp[_len ] = ':'; - tmp[_len+1] = ' '; - tmp[_len+2] = '\0'; - strlcat(tmp, __DATE__, sizeof(tmp)); - - if (menu_entries_append(list, tmp, "", - MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) - count++; (void)tmp_string; + { + size_t len = strlcpy(tmp, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETROARCH_VERSION), + sizeof(tmp)); + tmp[len ] = ':'; + tmp[len+1] = ' '; + tmp[len+2] = '\0'; + strlcat(tmp, PACKAGE_VERSION, sizeof(tmp)); + + if (menu_entries_append(list, tmp, "", + MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) + count++; + } + #ifdef HAVE_GIT_VERSION { size_t len = strlcpy(tmp, @@ -1689,12 +1693,27 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) tmp[len+1] = ' '; tmp[len+2] = '\0'; strlcat(tmp, retroarch_git_version, sizeof(tmp)); + if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) count++; } #endif + { + size_t len = strlcpy(tmp, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE), + sizeof(tmp)); + tmp[len ] = ':'; + tmp[len+1] = ' '; + tmp[len+2] = '\0'; + strlcat(tmp, __DATE__, sizeof(tmp)); + + if (menu_entries_append(list, tmp, "", + MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) + count++; + } + retroarch_get_capabilities(RARCH_CAPABILITIES_COMPILER, tmp, sizeof(tmp), 0); if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) @@ -4012,6 +4031,13 @@ static unsigned menu_displaylist_parse_information_list(file_list_t *info_list) } #endif + if (menu_entries_append(info_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION), + msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION), + MENU_ENUM_LABEL_SYSTEM_INFORMATION, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; + #if defined(HAVE_NETWORKING) && defined(HAVE_IFINFO) if (menu_entries_append(info_list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION), @@ -4021,13 +4047,6 @@ static unsigned menu_displaylist_parse_information_list(file_list_t *info_list) count++; #endif - if (menu_entries_append(info_list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION), - msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION), - MENU_ENUM_LABEL_SYSTEM_INFORMATION, - MENU_SETTING_ACTION, 0, 0, NULL)) - count++; - #ifdef HAVE_LIBRETRODB if (menu_entries_append(info_list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER), diff --git a/msg_hash.h b/msg_hash.h index fab501bf4e..2a891661df 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3210,6 +3210,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION, MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETROARCH_VERSION, MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_MODEL, MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, diff --git a/retroarch.c b/retroarch.c index cb92874586..bacf7ab314 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4906,17 +4906,17 @@ static void retroarch_print_version(void) frontend_driver_attach_console(); - fprintf(stdout, "%s: %s -- v%s", + fprintf(stdout, "%s - %s\n", msg_hash_to_str(MSG_PROGRAM), - msg_hash_to_str(MSG_LIBRETRO_FRONTEND), - PACKAGE_VERSION); + msg_hash_to_str(MSG_LIBRETRO_FRONTEND)); + + fprintf(stdout, "Version: %s", PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION - printf(" -- %s --\n", retroarch_git_version); -#else - printf("\n"); + fprintf(stdout, " (Git %s)", retroarch_git_version); #endif + fprintf(stdout, " " __DATE__ "\n"); + retroarch_get_capabilities(RARCH_CAPABILITIES_COMPILER, str, sizeof(str), 0); - strlcat(str, " Built: " __DATE__, sizeof(str)); fprintf(stdout, "%s\n", str); } @@ -6144,6 +6144,7 @@ bool retroarch_main_init(int argc, char *argv[]) RARCH_LOG_OUTPUT("%s", str_output); } + { char str_output[256]; char str[128]; @@ -6151,14 +6152,21 @@ bool retroarch_main_init(int argc, char *argv[]) #ifdef HAVE_GIT_VERSION snprintf(str_output, sizeof(str_output), - "%s: %s" "\n" FILE_PATH_LOG_INFO " Built: " __DATE__ "\n" FILE_PATH_LOG_INFO " Version: " PACKAGE_VERSION "\n" FILE_PATH_LOG_INFO " Git: %s" "\n" FILE_PATH_LOG_INFO " =================================================\n", + "%s: %s" "\n" + FILE_PATH_LOG_INFO " Version: " PACKAGE_VERSION "\n" + FILE_PATH_LOG_INFO " Git: %s" "\n" + FILE_PATH_LOG_INFO " Built: " __DATE__ "\n" + FILE_PATH_LOG_INFO " =================================================\n", msg_hash_to_str(MSG_CAPABILITIES), str, retroarch_git_version ); #else snprintf(str_output, sizeof(str_output), - "%s: %s" "\n" FILE_PATH_LOG_INFO " Built: " __DATE__ "\n" FILE_PATH_LOG_INFO " Version: " PACKAGE_VERSION "\n" FILE_PATH_LOG_INFO " =================================================\n", + "%s: %s" "\n" + FILE_PATH_LOG_INFO " Version: " PACKAGE_VERSION "\n" + FILE_PATH_LOG_INFO " Built: " __DATE__ "\n" + FILE_PATH_LOG_INFO " =================================================\n", msg_hash_to_str(MSG_CAPABILITIES), str); #endif