Skip to content

Commit

Permalink
OSD: Add hardware info statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanTheToaster authored and F0bes committed Aug 1, 2024
1 parent 7086060 commit 63e516e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 40 deletions.
4 changes: 4 additions & 0 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.osdShowInputs, "EmuCore/GS", "OsdShowInputs", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.osdShowFrameTimes, "EmuCore/GS", "OsdShowFrameTimes", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.osdShowVersion, "EmuCore/GS", "OsdShowVersion", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.osdShowHardwareInfo, "EmuCore/GS", "OsdShowHardwareInfo", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.warnAboutUnsafeSettings, "EmuCore", "WarnAboutUnsafeSettings", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.fxaa, "EmuCore/GS", "fxaa", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.shadeBoost, "EmuCore/GS", "ShadeBoost", false);
Expand Down Expand Up @@ -736,6 +737,9 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
dialog->registerWidgetHelp(m_ui.osdShowVersion, tr("Show PCSX2 Version"), tr("Unchecked"),
tr("Shows the current PCSX2 version on the top-right corner of the display"));

dialog->registerWidgetHelp(m_ui.osdShowHardwareInfo, tr("Show Hardware Info"), tr("Unchecked"),
tr("Shows the current system hardware information on the OSD."));

dialog->registerWidgetHelp(m_ui.warnAboutUnsafeSettings, tr("Warn About Unsafe Settings"), tr("Checked"),
tr("Displays warnings when settings are enabled which may break games."));
}
Expand Down
69 changes: 38 additions & 31 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1662,17 +1662,31 @@
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QCheckBox" name="osdShowResolution">
<item row="5" column="0">
<widget class="QCheckBox" name="osdShowFrameTimes">
<property name="text">
<string>Show Resolution</string>
<string>Show Frame Times</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="osdShowFPS">
<item row="2" column="0">
<widget class="QCheckBox" name="osdShowVersion">
<property name="text">
<string>Show FPS</string>
<string>Show PCSX2 Version</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="osdShowIndicators">
<property name="text">
<string>Show Indicators</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="osdShowSpeed">
<property name="text">
<string>Show Speed Percentages</string>
</property>
</widget>
</item>
Expand All @@ -1690,24 +1704,17 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="osdShowVersion">
<property name="text">
<string>Show PCSX2 Version</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="osdShowSpeed">
<item row="4" column="0">
<widget class="QCheckBox" name="osdShowGSStats">
<property name="text">
<string>Show Speed Percentages</string>
<string>Show Statistics</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="osdShowIndicators">
<item row="5" column="1">
<widget class="QCheckBox" name="warnAboutUnsafeSettings">
<property name="text">
<string>Show Indicators</string>
<string>Warn About Unsafe Settings</string>
</property>
</widget>
</item>
Expand All @@ -1718,31 +1725,31 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="osdShowGSStats">
<item row="0" column="1">
<widget class="QCheckBox" name="osdShowFPS">
<property name="text">
<string>Show Statistics</string>
<string>Show FPS</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="osdShowInputs">
<item row="0" column="0">
<widget class="QCheckBox" name="osdShowResolution">
<property name="text">
<string>Show Inputs</string>
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="osdShowFrameTimes">
<item row="4" column="1">
<widget class="QCheckBox" name="osdShowInputs">
<property name="text">
<string>Show Frame Times</string>
<string>Show Inputs</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="warnAboutUnsafeSettings">
<item row="6" column="0">
<widget class="QCheckBox" name="osdShowHardwareInfo">
<property name="text">
<string>Warn About Unsafe Settings</string>
<string>Show Hardware Info</string>
</property>
</widget>
</item>
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ struct Pcsx2Config
OsdShowInputs : 1,
OsdShowFrameTimes : 1,
OsdShowVersion : 1,
OsdShowHardwareInfo : 1,
HWSpinGPUForReadbacks : 1,
HWSpinCPUForReadbacks : 1,
GPUPaletteConversion : 1,
Expand Down
3 changes: 3 additions & 0 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,9 @@ void FullscreenUI::DrawInterfaceSettingsPage()
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_HEARTBEAT_ALT, "Show Frame Times"),
FSUI_CSTR("Shows a visual history of frame times in the upper-left corner of the display."), "EmuCore/GS", "OsdShowFrameTimes",
false);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_MONITOR_CODE, "Show Hardware Info"),
FSUI_CSTR("Shows the current system hardware information on the OSD."), "EmuCore/GS", "OsdShowHardwareInfo",
false);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_EXCLAMATION, "Warn About Unsafe Settings"),
FSUI_CSTR("Displays warnings when settings are enabled which may break games."), "EmuCore", "WarnAboutUnsafeSettings", true);

Expand Down
21 changes: 16 additions & 5 deletions pcsx2/ImGui/ImGuiOverlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "USB/USB.h"
#include "VMManager.h"
#include "svnrev.h"
#include "cpuinfo.h"

#include "common/BitUtils.h"
#include "common/FileSystem.h"
Expand Down Expand Up @@ -191,6 +192,13 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
GSgetMemoryStats(text);
if (!text.empty())
DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255));

text.clear();
text.append_format("{} QF | {:.2f}ms | {:.2f}ms | {:.2f}ms",
MTGS::GetCurrentVsyncQueueSize() - 1, // we subtract one for the current frame
PerformanceMetrics::GetMinimumFrameTime(), PerformanceMetrics::GetAverageFrameTime(),
PerformanceMetrics::GetMaximumFrameTime());
DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255));
}

if (GSConfig.OsdShowResolution)
Expand All @@ -203,15 +211,18 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255));
}

if (GSConfig.OsdShowCPU)
if (GSConfig.OsdShowHardwareInfo)
{
text.clear();
text.append_format("{} QF | {:.2f}ms | {:.2f}ms | {:.2f}ms",
MTGS::GetCurrentVsyncQueueSize() - 1, // we subtract one for the current frame
PerformanceMetrics::GetMinimumFrameTime(), PerformanceMetrics::GetAverageFrameTime(),
PerformanceMetrics::GetMaximumFrameTime());
text.append_format("CPU: {} ({}C/{}T)",
cpuinfo_get_package(0)->name,
cpuinfo_get_cores_count(),
cpuinfo_get_processors_count());
DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255));
}

if (GSConfig.OsdShowCPU)
{
text.clear();
if (EmuConfig.Speedhacks.EECycleRate != 0 || EmuConfig.Speedhacks.EECycleSkip != 0)
text.append_format("EE[{}/{}]: ", EmuConfig.Speedhacks.EECycleRate, EmuConfig.Speedhacks.EECycleSkip);
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/Pcsx2Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ Pcsx2Config::GSOptions::GSOptions()
OsdShowInputs = false;
OsdShowFrameTimes = false;
OsdShowVersion = false;
OsdShowHardwareInfo = false;

HWDownloadMode = GSHardwareDownloadMode::Enabled;
HWSpinGPUForReadbacks = false;
Expand Down Expand Up @@ -838,6 +839,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
SettingsWrapBitBool(OsdShowInputs);
SettingsWrapBitBool(OsdShowFrameTimes);
SettingsWrapBitBool(OsdShowVersion);
SettingsWrapBitBool(OsdShowHardwareInfo);

SettingsWrapBitBool(HWSpinGPUForReadbacks);
SettingsWrapBitBool(HWSpinCPUForReadbacks);
Expand Down
6 changes: 2 additions & 4 deletions pcsx2/VMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2370,8 +2370,7 @@ inline void LogUserPowerPlan()
}
#endif

#if 0
#if defined(__linux__) || defined(_WIN32)
#if defined(_WIN32)
void LogGPUCapabilities()
{
Console.WriteLn(Color_StrongBlack, "Graphics Adapters Detected:");
Expand Down Expand Up @@ -2484,7 +2483,6 @@ void LogGPUCapabilities()
#endif
}
#endif
#endif

void VMManager::LogCPUCapabilities()
{
Expand Down Expand Up @@ -2532,7 +2530,7 @@ void VMManager::LogCPUCapabilities()
}
#endif

#if 0
#if defined(_WIN32)
LogGPUCapabilities();
#endif
}
Expand Down

0 comments on commit 63e516e

Please sign in to comment.