Create option for dx video drivers to toggle displaying memory use

This commit is contained in:
dukemiller 2018-11-22 16:27:55 -07:00
parent 3d913b8569
commit 8294bf86df
12 changed files with 49 additions and 2 deletions

View File

@ -552,6 +552,9 @@ static const bool fps_show = false;
/* Enables displaying the current frame count. */ /* Enables displaying the current frame count. */
static const bool framecount_show = true; 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 /* Enables use of rewind. This will incur some memory footprint
* depending on the save state buffer. */ * depending on the save state buffer. */
static const bool rewind_enable = false; static const bool rewind_enable = false;

View File

@ -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("fps_show", &settings->bools.video_fps_show, true, false, false);
SETTING_BOOL("statistics_show", &settings->bools.video_statistics_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("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("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("suspend_screensaver_enable", &settings->bools.ui_suspend_screensaver_enable, true, true, false);
SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false); SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false);

View File

@ -103,6 +103,7 @@ typedef struct settings
bool video_fps_show; bool video_fps_show;
bool video_statistics_show; bool video_statistics_show;
bool video_framecount_show; bool video_framecount_show;
bool video_memory_show;
bool video_msg_bgcolor_enable; bool video_msg_bgcolor_enable;
bool video_3ds_lcd_bottom; bool video_3ds_lcd_bottom;

View File

@ -305,8 +305,9 @@ void dxgi_copy(
void dxgi_update_title(video_frame_info_t* video_info) void dxgi_update_title(video_frame_info_t* video_info)
{ {
const ui_window_t* window = ui_companion_driver_get_window_ptr(); 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; MEMORYSTATUS stat;
char mem[128]; char mem[128];
@ -315,7 +316,7 @@ void dxgi_update_title(video_frame_info_t* video_info)
GlobalMemoryStatus(&stat); GlobalMemoryStatus(&stat);
snprintf( 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)); stat.dwTotalPhys / (1024.0f * 1024.0f));
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
} }

View File

@ -1551,6 +1551,8 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE,
"video_msg_color_blue") "video_msg_color_blue")
MSG_HASH(MENU_ENUM_LABEL_FRAMECOUNT_SHOW, MSG_HASH(MENU_ENUM_LABEL_FRAMECOUNT_SHOW,
"framecount_show") "framecount_show")
MSG_HASH(MENU_ENUM_LABEL_MEMORY_SHOW,
"memory_show")
MSG_HASH(MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, MSG_HASH(MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST,
"automatically_add_content_to_playlist") "automatically_add_content_to_playlist")
MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY,

View File

@ -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" "Enables displaying the current frames \n"
"per second."); "per second.");
break; 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: case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE:
snprintf(s, len, snprintf(s, len,
"Show and/or hide onscreen messages."); "Show and/or hide onscreen messages.");

View File

@ -843,6 +843,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_FPS_SHOW, MENU_ENUM_LABEL_VALUE_FPS_SHOW,
"Display Framerate" "Display Framerate"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MEMORY_SHOW,
"Include Memory Details"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE,
"Limit Maximum Run Speed" "Limit Maximum Run Speed"
@ -3634,6 +3638,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW, MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW,
"Displays the current frame count onscreen." "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( MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS,
"Configure hotkey settings." "Configure hotkey settings."

View File

@ -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_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_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_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_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_netplay_settings, MENU_ENUM_SUBLABEL_NETPLAY)
default_sublabel_macro(action_bind_sublabel_user_bind_settings, MENU_ENUM_SUBLABEL_INPUT_USER_BINDS) 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: case MENU_ENUM_LABEL_FRAMECOUNT_SHOW:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_framecount_show); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_framecount_show);
break; break;
case MENU_ENUM_LABEL_MEMORY_SHOW:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_memory_show);
break;
case MENU_ENUM_LABEL_MENU_VIEWS_SETTINGS: case MENU_ENUM_LABEL_MENU_VIEWS_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_views_settings_list); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_views_settings_list);
break; break;

View File

@ -5606,6 +5606,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
menu_displaylist_parse_settings_enum(menu, info, menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_STATISTICS_SHOW, MENU_ENUM_LABEL_STATISTICS_SHOW,
PARSE_ONLY_BOOL, false); 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_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_FONT_PATH, MENU_ENUM_LABEL_VIDEO_FONT_PATH,
PARSE_ONLY_PATH, false); PARSE_ONLY_PATH, false);

View File

@ -5102,6 +5102,21 @@ static bool setting_append_list(
general_read_handler, general_read_handler,
SD_FLAG_NONE); 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( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->bools.video_statistics_show, &settings->bools.video_statistics_show,

View File

@ -1231,6 +1231,7 @@ enum msg_hash_enums
MENU_LABEL(SHADER_PREV), MENU_LABEL(SHADER_PREV),
MENU_LABEL(FRAME_ADVANCE), MENU_LABEL(FRAME_ADVANCE),
MENU_LABEL(FPS_SHOW), MENU_LABEL(FPS_SHOW),
MENU_LABEL(MEMORY_SHOW),
MENU_LABEL(STATISTICS_SHOW), MENU_LABEL(STATISTICS_SHOW),
MENU_LABEL(FRAMECOUNT_SHOW), MENU_LABEL(FRAMECOUNT_SHOW),
MENU_LABEL(BSV_RECORD_TOGGLE), MENU_LABEL(BSV_RECORD_TOGGLE),

View File

@ -124,6 +124,9 @@
# Display framerate. # Display framerate.
# fps_show = false # fps_show = false
# Display memory.
# memory_show = false
# Display total number of frames rendered. (only displays if fps_show is enabled) # Display total number of frames rendered. (only displays if fps_show is enabled)
# framecount_show = # framecount_show =