OSD: Add InputRec/VideoCapture OSD Toggle

This commit is contained in:
KamFretoZ 2024-08-02 20:51:02 +07:00 committed by lightningterror
parent 2106c353d9
commit 72034da6ac
7 changed files with 107 additions and 58 deletions

View File

@ -127,6 +127,8 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
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.osdShowVideoCapture, "EmuCore/GS", "OsdShowVideoCapture", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.osdShowInputRec, "EmuCore/GS", "OsdShowInputRec", true);
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);
@ -735,7 +737,13 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
tr("Displays a graph showing the average frametimes."));
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"));
tr("Shows the current PCSX2 version on the top-right corner of the display."));
dialog->registerWidgetHelp(m_ui.osdShowVideoCapture, tr("Show Video Capture Status"), tr("Checked"),
tr("Shows the currently active video capture status."));
dialog->registerWidgetHelp(m_ui.osdShowInputRec, tr("Show Input Recording Status"), tr("Checked"),
tr("Shows the currently active input recording status."));
dialog->registerWidgetHelp(m_ui.osdShowHardwareInfo, tr("Show Hardware Info"), tr("Unchecked"),
tr("Shows the current system hardware information on the OSD."));

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>720</width>
<height>552</height>
<height>562</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -1583,7 +1583,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox_4">
<widget class="QGroupBox" name="osdLayout">
<property name="title">
<string>On-Screen Display</string>
</property>
@ -1661,7 +1661,21 @@
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_6">
<layout class="QGridLayout" name="osdOptionLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="osdShowResolution">
<property name="text">
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="osdShowFPS">
<property name="text">
<string>Show FPS</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="osdShowFrameTimes">
<property name="text">
@ -1669,10 +1683,24 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="osdShowVersion">
<item row="1" column="1">
<widget class="QCheckBox" name="osdShowGPU">
<property name="text">
<string>Show PCSX2 Version</string>
<string>Show GPU Usage</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="osdShowInputs">
<property name="text">
<string>Show Inputs</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="osdShowSettings">
<property name="text">
<string>Show Settings</string>
</property>
</widget>
</item>
@ -1690,6 +1718,34 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="osdShowHardwareInfo">
<property name="text">
<string>Show Hardware Info</string>
</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="5" column="1">
<widget class="QCheckBox" name="osdShowInputRec">
<property name="text">
<string>Show Input Recording Status</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="osdShowVideoCapture">
<property name="text">
<string>Show Video Capture Status</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="osdShowCPU">
<property name="text">
@ -1697,13 +1753,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="osdShowGPU">
<property name="text">
<string>Show GPU Usage</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="osdShowGSStats">
<property name="text">
@ -1711,48 +1760,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="0">
<widget class="QCheckBox" name="warnAboutUnsafeSettings">
<property name="text">
<string>Warn About Unsafe Settings</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="osdShowSettings">
<property name="text">
<string>Show Settings</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="osdShowFPS">
<property name="text">
<string>Show FPS</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="osdShowResolution">
<property name="text">
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="osdShowInputs">
<property name="text">
<string>Show Inputs</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="osdShowHardwareInfo">
<property name="text">
<string>Show Hardware Info</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -628,6 +628,8 @@ struct Pcsx2Config
OsdShowInputs : 1,
OsdShowFrameTimes : 1,
OsdShowVersion : 1,
OsdShowVideoCapture: 1,
OsdShowInputRec : 1,
OsdShowHardwareInfo : 1,
HWSpinGPUForReadbacks : 1,
HWSpinCPUForReadbacks : 1,

View File

@ -1045,6 +1045,8 @@ static void HotkeyToggleOSD()
{
GSConfig.OsdShowSettings ^= EmuConfig.GS.OsdShowSettings;
GSConfig.OsdShowInputs ^= EmuConfig.GS.OsdShowInputs;
GSConfig.OsdShowInputRec ^= EmuConfig.GS.OsdShowInputRec;
GSConfig.OsdShowVideoCapture ^= EmuConfig.GS.OsdShowVideoCapture;
GSConfig.OsdMessagesPos =
GSConfig.OsdMessagesPos == OsdOverlayPos::None ? EmuConfig.GS.OsdMessagesPos : OsdOverlayPos::None;

View File

@ -3146,6 +3146,12 @@ void FullscreenUI::DrawInterfaceSettingsPage()
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_PLAY, "Show Status Indicators"),
FSUI_CSTR("Shows indicators when fast forwarding, pausing, and other abnormal states are active."), "EmuCore/GS",
"OsdShowIndicators", true);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_KEYBOARD, "Show Input Recording Status"),
FSUI_CSTR("Shows the currently active input recording status."), "EmuCore/GS",
"OsdShowInputRec", true);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_VIDEO, "Show Video Capture Status"),
FSUI_CSTR("Shows the currently active video capture status."), "EmuCore/GS",
"OsdShowVideoCapture", true);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_SLIDERS_H, "Show Settings"),
FSUI_CSTR("Shows the current configuration in the bottom-right corner of the display."), "EmuCore/GS", "OsdShowSettings", false);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_GAMEPAD_ALT, "Show Inputs"),

View File

@ -148,7 +148,7 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
}
first = false;
}
if (GSConfig.OsdShowSpeed)
{
text.append_format("{}{}%", first ? "" : " | ", static_cast<u32>(std::round(speed)));
@ -324,9 +324,10 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
text.append_format("{:.1f} ms", max);
text_size = fixed_font->CalcTextSizeA(fixed_font->FontSize, FLT_MAX, 0.0f, text.c_str(), text.c_str() + text.length());
win_dl->AddText(ImVec2((GSConfig.OsdPerformancePos == OsdOverlayPos::TopLeft ? 2.0f * spacing : wpos.x + history_size.x - text_size.x - spacing) + shadow_offset,
wpos.y + shadow_offset), IM_COL32(0, 0, 0, 100), text.c_str(), text.c_str() + text.length());
wpos.y + shadow_offset),
IM_COL32(0, 0, 0, 100), text.c_str(), text.c_str() + text.length());
win_dl->AddText(ImVec2((GSConfig.OsdPerformancePos == OsdOverlayPos::TopLeft ? 2.0f * spacing : wpos.x + history_size.x - text_size.x - spacing), wpos.y),
IM_COL32(255, 255, 255, 255), text.c_str(), text.c_str() + text.length());
IM_COL32(255, 255, 255, 255), text.c_str(), text.c_str() + text.length());
text.clear();
text.append_format("{:.1f} ms", min);
@ -335,7 +336,8 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
wpos.y + history_size.y - fixed_font->FontSize + shadow_offset),
IM_COL32(0, 0, 0, 100), text.c_str(), text.c_str() + text.length());
win_dl->AddText(ImVec2((GSConfig.OsdPerformancePos == OsdOverlayPos::TopLeft ? 2.0f * spacing : wpos.x + history_size.x - text_size.x - spacing),
wpos.y + history_size.y - fixed_font->FontSize), IM_COL32(255, 255, 255, 255), text.c_str(), text.c_str() + text.length());
wpos.y + history_size.y - fixed_font->FontSize),
IM_COL32(255, 255, 255, 255), text.c_str(), text.c_str() + text.length());
}
ImGui::End();
ImGui::PopFont();
@ -356,7 +358,8 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
__ri void ImGuiManager::DrawSettingsOverlay(float scale, float margin, float spacing)
{
if (!GSConfig.OsdShowSettings || VMManager::GetState() != VMState::Running)
if (!GSConfig.OsdShowSettings ||
FullscreenUI::HasActiveWindow())
return;
std::string text;
@ -491,7 +494,8 @@ __ri void ImGuiManager::DrawSettingsOverlay(float scale, float margin, float spa
__ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spacing)
{
// Technically this is racing the CPU thread.. but it doesn't really matter, at worst, the inputs get displayed onscreen late.
if (!GSConfig.OsdShowInputs || VMManager::GetState() != VMState::Running)
if (!GSConfig.OsdShowInputs ||
FullscreenUI::HasActiveWindow())
return;
const float shadow_offset = std::ceil(scale);
@ -639,7 +643,9 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
__ri void ImGuiManager::DrawInputRecordingOverlay(float& position_y, float scale, float margin, float spacing)
{
if (!g_InputRecording.isActive() || FullscreenUI::HasActiveWindow())
if (!GSConfig.OsdShowInputRec ||
!g_InputRecording.isActive() ||
FullscreenUI::HasActiveWindow())
return;
const float shadow_offset = std::ceil(scale);
@ -683,7 +689,10 @@ __ri void ImGuiManager::DrawInputRecordingOverlay(float& position_y, float scale
__ri void ImGuiManager::DrawVideoCaptureOverlay(float& position_y, float scale, float margin, float spacing)
{
if (!GSCapture::IsCapturing() || FullscreenUI::HasActiveWindow())
if (!GSConfig.OsdShowVideoCapture ||
!GSCapture::IsCapturing() ||
FullscreenUI::HasActiveWindow()
)
return;
const float shadow_offset = std::ceil(scale);
@ -1104,10 +1113,14 @@ void SaveStateSelectorUI::ShowSlotOSDMessage()
void ImGuiManager::RenderOverlays()
{
if (VMManager::GetState() != VMState::Running)
return;
const float scale = ImGuiManager::GetGlobalScale();
const float margin = std::ceil(10.0f * scale);
const float spacing = std::ceil(5.0f * scale);
float position_y = margin;
DrawVideoCaptureOverlay(position_y, scale, margin, spacing);
DrawInputRecordingOverlay(position_y, scale, margin, spacing);
if (GSConfig.OsdPerformancePos != OsdOverlayPos::None)

View File

@ -632,6 +632,8 @@ Pcsx2Config::GSOptions::GSOptions()
OsdShowFrameTimes = false;
OsdShowVersion = false;
OsdShowHardwareInfo = false;
OsdShowVideoCapture = true;
OsdShowInputRec = true;
HWDownloadMode = GSHardwareDownloadMode::Enabled;
HWSpinGPUForReadbacks = false;
@ -840,6 +842,8 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
SettingsWrapBitBool(OsdShowFrameTimes);
SettingsWrapBitBool(OsdShowVersion);
SettingsWrapBitBool(OsdShowHardwareInfo);
SettingsWrapBitBool(OsdShowVideoCapture);
SettingsWrapBitBool(OsdShowInputRec);
SettingsWrapBitBool(HWSpinGPUForReadbacks);
SettingsWrapBitBool(HWSpinCPUForReadbacks);