diff --git a/config.def.h b/config.def.h index ed75f79bbe..6bf045ab21 100644 --- a/config.def.h +++ b/config.def.h @@ -552,6 +552,9 @@ static const bool fps_show = false; /* Enables displaying the current frame count. */ static const bool framecount_show = true; +/* Includes displaying the current memory usage/total with FPS/Frames. */ +static const bool memory_show = false; + /* Enables use of rewind. This will incur some memory footprint * depending on the save state buffer. */ static const bool rewind_enable = false; diff --git a/configuration.c b/configuration.c index 0d209a5940..db570b0d95 100644 --- a/configuration.c +++ b/configuration.c @@ -1318,6 +1318,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("fps_show", &settings->bools.video_fps_show, true, false, false); SETTING_BOOL("statistics_show", &settings->bools.video_statistics_show, true, false, false); SETTING_BOOL("framecount_show", &settings->bools.video_framecount_show, true, true, false); + SETTING_BOOL("memory_show", &settings->bools.video_memory_show, true, false, false); SETTING_BOOL("ui_menubar_enable", &settings->bools.ui_menubar_enable, true, true, false); SETTING_BOOL("suspend_screensaver_enable", &settings->bools.ui_suspend_screensaver_enable, true, true, false); SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false); diff --git a/configuration.h b/configuration.h index dee5497cb8..f2c71cb15c 100644 --- a/configuration.h +++ b/configuration.h @@ -103,6 +103,7 @@ typedef struct settings bool video_fps_show; bool video_statistics_show; bool video_framecount_show; + bool video_memory_show; bool video_msg_bgcolor_enable; bool video_3ds_lcd_bottom; diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index e7065979fc..3d935f41d2 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -305,8 +305,9 @@ void dxgi_copy( void dxgi_update_title(video_frame_info_t* video_info) { const ui_window_t* window = ui_companion_driver_get_window_ptr(); + const settings_t *settings = config_get_ptr(); - if (video_info->fps_show) + if (settings->bools.video_memory_show) { MEMORYSTATUS stat; char mem[128]; @@ -315,7 +316,7 @@ void dxgi_update_title(video_frame_info_t* video_info) GlobalMemoryStatus(&stat); snprintf( - mem, sizeof(mem), "|| MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), + mem, sizeof(mem), " || MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), stat.dwTotalPhys / (1024.0f * 1024.0f)); strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); } diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1571d7e991..c9cb27d08f 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1551,6 +1551,8 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE, "video_msg_color_blue") MSG_HASH(MENU_ENUM_LABEL_FRAMECOUNT_SHOW, "framecount_show") +MSG_HASH(MENU_ENUM_LABEL_MEMORY_SHOW, + "memory_show") MSG_HASH(MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, "automatically_add_content_to_playlist") MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 83db0a6a8e..e2d5c9c970 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -567,6 +567,11 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) "Enables displaying the current frames \n" "per second."); break; + case MENU_ENUM_LABEL_MEMORY_SHOW: + snprintf(s, len, + "Includes displaying the current memory \n" + "usage/total with FPS/Frames."); + break; case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: snprintf(s, len, "Show and/or hide onscreen messages."); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index a2f4bd8d41..bc5a90f3be 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -843,6 +843,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_FPS_SHOW, "Display Framerate" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MEMORY_SHOW, + "Include Memory Details" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, "Limit Maximum Run Speed" @@ -3634,6 +3638,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW, "Displays the current frame count onscreen." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MEMORY_SHOW, + "Includes the current memory usage/total onscreen with FPS/Frames." + ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, "Configure hotkey settings." diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 92c2fc8f9c..81347b8267 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -125,6 +125,7 @@ default_sublabel_macro(action_bind_sublabel_max_swapchain_images, MENU_ default_sublabel_macro(action_bind_sublabel_online_updater, MENU_ENUM_SUBLABEL_ONLINE_UPDATER) default_sublabel_macro(action_bind_sublabel_fps_show, MENU_ENUM_SUBLABEL_FPS_SHOW) default_sublabel_macro(action_bind_sublabel_framecount_show, MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW) +default_sublabel_macro(action_bind_sublabel_memory_show, MENU_ENUM_SUBLABEL_MEMORY_SHOW) default_sublabel_macro(action_bind_sublabel_statistics_show, MENU_ENUM_SUBLABEL_STATISTICS_SHOW) default_sublabel_macro(action_bind_sublabel_netplay_settings, MENU_ENUM_SUBLABEL_NETPLAY) default_sublabel_macro(action_bind_sublabel_user_bind_settings, MENU_ENUM_SUBLABEL_INPUT_USER_BINDS) @@ -1877,6 +1878,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_FRAMECOUNT_SHOW: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_framecount_show); break; + case MENU_ENUM_LABEL_MEMORY_SHOW: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_memory_show); + break; case MENU_ENUM_LABEL_MENU_VIEWS_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_views_settings_list); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1d0f6687b3..d28adcf9b3 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5606,6 +5606,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_STATISTICS_SHOW, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MEMORY_SHOW, + PARSE_ONLY_BOOL, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_FONT_PATH, PARSE_ONLY_PATH, false); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a009d79c31..c14112d8ee 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5102,6 +5102,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.video_memory_show, + MENU_ENUM_LABEL_MEMORY_SHOW, + MENU_ENUM_LABEL_VALUE_MEMORY_SHOW, + memory_show, + 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.video_statistics_show, diff --git a/msg_hash.h b/msg_hash.h index 3c16be4e89..5c4e151916 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1231,6 +1231,7 @@ enum msg_hash_enums MENU_LABEL(SHADER_PREV), MENU_LABEL(FRAME_ADVANCE), MENU_LABEL(FPS_SHOW), + MENU_LABEL(MEMORY_SHOW), MENU_LABEL(STATISTICS_SHOW), MENU_LABEL(FRAMECOUNT_SHOW), MENU_LABEL(BSV_RECORD_TOGGLE), diff --git a/retroarch.cfg b/retroarch.cfg index 671fa4a73c..da36413bda 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -124,6 +124,9 @@ # Display framerate. # fps_show = false +# Display memory. +# memory_show = false + # Display total number of frames rendered. (only displays if fps_show is enabled) # framecount_show =