From d9bfdc3fcd78e17ed7d0ac34337b4dfe9fa48271 Mon Sep 17 00:00:00 2001 From: SternXD Date: Sun, 8 Mar 2026 01:48:54 -0500 Subject: [PATCH] Qt/FullscreenUI: Add Bold OSD Text option Signed-off-by: SternXD --- pcsx2-qt/Settings/OSDSettingsWidget.cpp | 4 + pcsx2-qt/Settings/OSDSettingsWidget.ui | 367 ++++++++++++------------ pcsx2/Config.h | 1 + pcsx2/ImGui/FullscreenUI_Settings.cpp | 3 + pcsx2/ImGui/ImGuiOverlays.cpp | 109 ++++++- pcsx2/Pcsx2Config.cpp | 1 + 6 files changed, 306 insertions(+), 179 deletions(-) diff --git a/pcsx2-qt/Settings/OSDSettingsWidget.cpp b/pcsx2-qt/Settings/OSDSettingsWidget.cpp index 0c09c696cb..fcb5d31c95 100644 --- a/pcsx2-qt/Settings/OSDSettingsWidget.cpp +++ b/pcsx2-qt/Settings/OSDSettingsWidget.cpp @@ -38,6 +38,7 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showHardwareInfo, "EmuCore/GS", "OsdShowHardwareInfo", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showVersion, "EmuCore/GS", "OsdShowVersion", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showSettings, "EmuCore/GS", "OsdShowSettings", false); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.boldText, "EmuCore/GS", "OsdBoldText", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showPatches, "EmuCore/GS", "OsdshowPatches", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showInputs, "EmuCore/GS", "OsdShowInputs", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showVideoCapture, "EmuCore/GS", "OsdShowVideoCapture", true); @@ -98,6 +99,9 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p dialog()->registerWidgetHelp(m_ui.showSettings, tr("Show Settings"), tr("Unchecked"), tr("Displays various settings and the current values of those settings in the bottom-right corner of the display.")); + dialog()->registerWidgetHelp(m_ui.boldText, tr("Bold OSD Text"), tr("Checked"), + tr("Draws OSD text with heavier weight for improved readability.")); + dialog()->registerWidgetHelp(m_ui.showPatches, tr("Show Patches"), tr("Unchecked"), tr("Shows the amount of currently active patches/cheats in the bottom-right corner of the display.")); diff --git a/pcsx2-qt/Settings/OSDSettingsWidget.ui b/pcsx2-qt/Settings/OSDSettingsWidget.ui index 5da32553b0..da2f055923 100644 --- a/pcsx2-qt/Settings/OSDSettingsWidget.ui +++ b/pcsx2-qt/Settings/OSDSettingsWidget.ui @@ -20,36 +20,104 @@ On-Screen Display - - + + - OSD Messages Position: + OSD Text Style: - messagesPos + boldText - - - - - 0 - 0 - - - - % - - - 50 - - - 500 + + + + Bold OSD Text - + + + + Qt::Orientation::Vertical + + + QSizePolicy::Policy::Fixed + + + + 20 + 20 + + + + + + + + OSD Scale: + + + scale + + + + + + + + None + + + + + Top Left + + + + + Top Center + + + + + Top Right (Default) + + + + + Center Left + + + + + Center + + + + + Center Right + + + + + Bottom Left + + + + + Bottom Center + + + + + Bottom Right + + + + + @@ -103,8 +171,76 @@ - - + + + + + 0 + 0 + + + + px + + + 0 + + + 100 + + + + + + + + 0 + 0 + + + + % + + + 50 + + + 500 + + + + + + + OSD Margin: + + + margin + + + + + + + OSD Performance Position: + + + performancePos + + + + + + + OSD Messages Position: + + + messagesPos + + + + + QLayout::SizeConstraint::SetDefaultConstraint @@ -121,7 +257,7 @@ - + Messages @@ -142,20 +278,6 @@ - - - - Show Input Recording Status - - - - - - - Show Texture Replacement Status - - - @@ -219,21 +341,7 @@ - - - - Show Video Capture Status - - - - - - - Show Inputs - - - - + Warn About Unsafe Settings @@ -268,127 +376,36 @@ + + + + Show Inputs + + + + + + + Show Video Capture Status + + + + + + + Show Input Recording Status + + + + + + + Show Texture Replacement Status + + + - - - - OSD Scale: - - - scale - - - - - - - OSD Margin: - - - margin - - - - - - - - 0 - 0 - - - - px - - - 0 - - - 100 - - - - - - - - None - - - - - Top Left - - - - - Top Center - - - - - Top Right (Default) - - - - - Center Left - - - - - Center - - - - - Center Right - - - - - Bottom Left - - - - - Bottom Center - - - - - Bottom Right - - - - - - - - Qt::Orientation::Vertical - - - QSizePolicy::Policy::Fixed - - - - 20 - 20 - - - - - - - - OSD Performance Position: - - - performancePos - - - @@ -412,6 +429,7 @@ margin messagesPos performancePos + boldText showSpeedPercentages showFPS showVPS @@ -424,11 +442,6 @@ showHardwareInfo showVersion showSettings - showPatches - showInputs - showVideoCapture - showInputRec - showTextureReplacements warnAboutUnsafeSettings diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 3bcb4ea8a5..fb69737860 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -782,6 +782,7 @@ struct Pcsx2Config OsdShowVideoCapture : 1, OsdShowInputRec : 1, OsdShowTextureReplacements : 1, + OsdBoldText : 1, HWSpinGPUForReadbacks : 1, HWSpinCPUForReadbacks : 1, GPUPaletteConversion : 1, diff --git a/pcsx2/ImGui/FullscreenUI_Settings.cpp b/pcsx2/ImGui/FullscreenUI_Settings.cpp index e672cd34ba..94b801a957 100644 --- a/pcsx2/ImGui/FullscreenUI_Settings.cpp +++ b/pcsx2/ImGui/FullscreenUI_Settings.cpp @@ -3212,6 +3212,9 @@ void FullscreenUI::DrawOSDSettingsPage() DrawStringListSetting(bsi, FSUI_ICONSTR(ICON_FA_CHART_BAR, "OSD Performance Position"), FSUI_CSTR("Determines where performance statistics are positioned."), "EmuCore/GS", "OsdPerformancePos", "3", s_osd_position_options, s_osd_position_values, std::size(s_osd_position_options), true); + DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BOLD, "Bold OSD Text"), + FSUI_CSTR("Draws OSD text with heavier weight for improved readability."), + "EmuCore/GS", "OsdBoldText", true); DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_CODE_MERGE, "Show PCSX2 Version"), FSUI_CSTR("Shows the current PCSX2 version."), "EmuCore/GS", "OsdShowVersion", false); diff --git a/pcsx2/ImGui/ImGuiOverlays.cpp b/pcsx2/ImGui/ImGuiOverlays.cpp index e011b32d39..e7a2a2fa0c 100644 --- a/pcsx2/ImGui/ImGuiOverlays.cpp +++ b/pcsx2/ImGui/ImGuiOverlays.cpp @@ -225,8 +225,106 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f { \ text_size = font->CalcTextSizeA(size, std::numeric_limits::max(), -1.0f, (text), nullptr, nullptr); \ const ImVec2 text_pos = CalculatePerformanceOverlayTextPosition(GSConfig.OsdPerformancePos, margin, text_size, GetWindowWidth(), position_y); \ + const bool __bold_osd = GSConfig.OsdBoldText; \ dl->AddText(font, size, ImVec2(text_pos.x + shadow_offset, text_pos.y + shadow_offset), IM_COL32(0, 0, 0, 100), (text)); \ dl->AddText(font, size, text_pos, color, (text)); \ + const auto __is_all_digits = [](const char* __begin, const char* __end) -> bool \ + { \ + for (const char* __c = __begin; __c < __end; __c++) \ + { \ + if (!std::isdigit(static_cast(*__c))) \ + return false; \ + } \ + return true; \ + }; \ + const auto __is_all_alpha = [](const char* __begin, const char* __end) -> bool \ + { \ + for (const char* __c = __begin; __c < __end; __c++) \ + { \ + if (!std::isalpha(static_cast(*__c))) \ + return false; \ + } \ + return true; \ + }; \ + for (const char* __p = (text); __p && *__p;) \ + { \ + const char* __sep = strstr(__p, " | "); \ + const char* __seg_end = __sep ? __sep : __p + strlen(__p); \ + const char* __label_begin = nullptr; \ + const char* __label_end = nullptr; \ + const unsigned char __first = static_cast(*__p); \ + const bool __starts_numeric = (std::isdigit(__first) || __first == '+' || __first == '-' || __first == '.'); \ + for (const char* __c = __p; __c < __seg_end; __c++) \ + { \ + if (*__c == ':') \ + { \ + __label_begin = __p; \ + __label_end = __c + 1; \ + break; \ + } \ + } \ + if (!__label_begin) \ + { \ + if (!__starts_numeric) \ + { \ + __label_begin = __p; \ + __label_end = __seg_end; \ + } \ + else \ + { \ + const char* __first_space = __p; \ + while (__first_space < __seg_end && *__first_space != ' ') \ + __first_space++; \ + if (__first_space < __seg_end) \ + { \ + const char* __x = __p; \ + while (__x < __first_space && *__x != 'x' && *__x != 'X') \ + __x++; \ + const bool __has_resolution_prefix = \ + (__x > __p && (__x + 1) < __first_space && \ + __is_all_digits(__p, __x) && __is_all_digits(__x + 1, __first_space)); \ + if (__has_resolution_prefix && (__first_space + 1) < __seg_end) \ + { \ + __label_begin = __first_space + 1; \ + __label_end = __seg_end; \ + const char* __trim_end = __label_end; \ + while (__trim_end > __label_begin && std::isspace(static_cast(*(__trim_end - 1)))) \ + __trim_end--; \ + if (__trim_end > __label_begin && *(__trim_end - 1) == ')') \ + { \ + const char* __open = __trim_end - 1; \ + while (__open > __label_begin && *__open != '(') \ + __open--; \ + if (__open > __label_begin && *__open == '(' && *(__open - 1) == ' ') \ + __label_end = __open - 1; \ + } \ + } \ + } \ + if (!__label_begin) \ + { \ + const char* __space = __seg_end; \ + while (__space > __p && *(__space - 1) != ' ') \ + __space--; \ + if (__space > __p && __space < __seg_end && __is_all_alpha(__space, __seg_end)) \ + { \ + __label_begin = __space; \ + __label_end = __seg_end; \ + } \ + } \ + } \ + } \ + if (__label_begin && __label_end && __label_begin < __label_end) \ + { \ + const float __x0 = font->CalcTextSizeA(size, FLT_MAX, -1.0f, (text), __label_begin).x; \ + const ImVec2 __pos(text_pos.x + __x0, text_pos.y); \ + if (__bold_osd) \ + { \ + dl->AddText(font, size, __pos, color, __label_begin, __label_end); \ + dl->AddText(font, size, ImVec2(__pos.x + 0.6f, __pos.y), color, __label_begin, __label_end); \ + } \ + } \ + __p = __sep ? __sep + 3 : nullptr; \ + } \ position_y += text_size.y + spacing; \ } while (0) @@ -671,11 +769,18 @@ __ri void ImGuiManager::DrawSettingsOverlay(float scale, float margin, float spa ImDrawList* dl = ImGui::GetBackgroundDrawList(); ImVec2 text_size = font->CalcTextSizeA(font_size, std::numeric_limits::max(), -1.0f, text.c_str(), text.c_str() + text.length(), nullptr); + const ImVec2 text_pos(GetWindowWidth() - margin - text_size.x, position_y); + const bool bold_osd = GSConfig.OsdBoldText; dl->AddText(font, font_size, - ImVec2(GetWindowWidth() - margin - text_size.x + shadow_offset, position_y + shadow_offset), IM_COL32(0, 0, 0, 100), + ImVec2(text_pos.x + shadow_offset, text_pos.y + shadow_offset), IM_COL32(0, 0, 0, 100), text.c_str(), text.c_str() + text.length()); - dl->AddText(font, font_size, ImVec2(GetWindowWidth() - margin - text_size.x, position_y), white_color, + dl->AddText(font, font_size, text_pos, white_color, text.c_str(), text.c_str() + text.length()); + if (bold_osd) + { + dl->AddText(font, font_size, ImVec2(text_pos.x + 0.6f, text_pos.y), white_color, + text.c_str(), text.c_str() + text.length()); + } } __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spacing) diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 41e0184138..799e8fa686 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -968,6 +968,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap) SettingsWrapBitBool(OsdShowVideoCapture); SettingsWrapBitBool(OsdShowInputRec); SettingsWrapBitBool(OsdShowTextureReplacements); + SettingsWrapBitBool(OsdBoldText); SettingsWrapBitBool(HWSpinGPUForReadbacks); SettingsWrapBitBool(HWSpinCPUForReadbacks);