Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions src/Features/HDRDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,25 +294,23 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
void HDRDisplay::DrawSettings()
{
if (isHDRMonitor) {
ImGui::TextColored(Util::Colors::GetSuccess(), "HDR Display Detected");
Util::Text::Success("HDR Display Detected");
} else if (isHDRCapableMonitor) {
ImGui::TextColored(Util::Colors::GetWarning(), "HDR Capable Display (Windows HDR is off)");
Util::Text::Warning("HDR Capable Display (Windows HDR is off)");
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Your monitor supports HDR, but Windows HDR is currently disabled.");
ImGui::Text("Enable HDR in Windows Display Settings to allow auto-detection.");
}
} else {
ImGui::TextColored(Util::Colors::GetWarning(), "SDR Display (HDR not detected)");
Util::Text::Warning("SDR Display (HDR not detected)");
}

const bool isExclusiveFullscreen = globals::features::upscaling.loaded ? !globals::features::upscaling.isWindowed : wasExclusiveFullscreen;

if (isExclusiveFullscreen) {
ImGui::Spacing();
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::TextWrapped("WARNING: Exclusive Fullscreen detected.");
ImGui::TextWrapped("HDR is not compatible with Exclusive Fullscreen and may not work correctly. Switch to Borderless Windowed mode for proper HDR support.");
ImGui::PopStyleColor();
Util::Text::WrappedWarning("WARNING: Exclusive Fullscreen detected.");
Util::Text::WrappedWarning("HDR is not compatible with Exclusive Fullscreen and may not work correctly. Switch to Borderless Windowed mode for proper HDR support.");
ImGui::Spacing();
}

Expand Down Expand Up @@ -401,9 +399,7 @@ void HDRDisplay::DrawSettings()
std::lock_guard<std::mutex> lock(settingsMutex);
if (!isHDRMonitor && settings.enableHDR) {
ImGui::Spacing();
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::TextWrapped("HDR is enabled but no HDR display was detected.");
ImGui::PopStyleColor();
Util::Text::WrappedWarning("HDR is enabled but no HDR display was detected.");
}
}

Expand All @@ -415,13 +411,11 @@ void HDRDisplay::DrawSettings()
// Prevent background dimming by pushing lower modal dimming
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 1.0f);

ImGui::TextColored(Util::Colors::GetWarning(), "WARNING: Force Enable HDR");
Util::Text::Warning("WARNING: Force Enable HDR");
ImGui::Separator();
ImGui::Spacing();
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::TextWrapped("HDR was not detected on your monitor.");
ImGui::TextWrapped("The game will look VERY WRONG on an SDR (standard) display.");
ImGui::PopStyleColor();
Util::Text::WrappedWarning("HDR was not detected on your monitor.");
Util::Text::WrappedWarning("The game will look VERY WRONG on an SDR (standard) display.");
ImGui::Spacing();
ImGui::TextWrapped("Only proceed if you have an HDR-capable display that was not detected correctly.");
ImGui::Spacing();
Expand Down
32 changes: 9 additions & 23 deletions src/Features/Upscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,9 @@ void Upscaling::DrawSettings()
if (!globals::game::isVR && upscaleMethod == UpscaleMethod::kDLSS) {
auto screenSize = globals::state->screenSize;
if (screenSize.x > streamline.MAX_RESOLUTION || screenSize.y > streamline.MAX_RESOLUTION) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: Requested resolution %.0f x %.0f exceeds maximum supported resolution %d x %d for DLSS.",
Util::Text::Warning("Warning: Requested resolution %.0f x %.0f exceeds maximum supported resolution %d x %d for DLSS.",
screenSize.x, screenSize.y, streamline.MAX_RESOLUTION, streamline.MAX_RESOLUTION);
ImGui::Text("DLSS will not function. Lower your resolution or select a different upscaling method.");
ImGui::PopStyleColor();
Util::Text::Warning("DLSS will not function. Lower your resolution or select a different upscaling method.");
}
}

Expand Down Expand Up @@ -277,40 +275,28 @@ void Upscaling::DrawSettings()
bool onlyRequiresRestart = true;

if (!isWindowed) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: Requires windowed mode");
ImGui::PopStyleColor();
Util::Text::Warning("Warning: Requires windowed mode");

onlyRequiresRestart = false;
}

if (lowRefreshRate && !settings.frameGenerationForceEnable) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: Requires a high refresh rate monitor or Force Enable Frame Generation");
ImGui::PopStyleColor();
Util::Text::Warning("Warning: Requires a high refresh rate monitor or Force Enable Frame Generation");

onlyRequiresRestart = false;
}

if (fidelityFXMissing) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: FidelityFX DLLs are not loaded");
ImGui::PopStyleColor();
Util::Text::Warning("Warning: FidelityFX DLLs are not loaded");

onlyRequiresRestart = false;
}

if (onlyRequiresRestart && settings.frameGenerationMode && !frameGenerationDx12PathActive) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: Requires restart");
ImGui::PopStyleColor();
}
if (onlyRequiresRestart && settings.frameGenerationMode && !frameGenerationDx12PathActive)
Util::Text::Warning("Warning: Requires restart");

if (!settings.frameGenerationMode && frameGenerationDx12PathActive) {
ImGui::PushStyleColor(ImGuiCol_Text, Util::Colors::GetWarning());
ImGui::Text("Warning: Requires restart");
ImGui::PopStyleColor();
}
if (!settings.frameGenerationMode && frameGenerationDx12PathActive)
Util::Text::Warning("Warning: Requires restart");

std::string enabledLabel = "Enabled";
const char* toggleModes[] = { "Disabled", "Enabled" };
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/AdvancedSettingsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void AdvancedSettingsRenderer::RenderShaderDebugSection()

float maxHeight = ImGui::GetContentRegionAvail().y * 0.3f; // Limit to 30% to keep Active Shaders visible
if (ImGui::BeginChild("##BlockedShaderInfo", ImVec2(0, maxHeight), true, ImGuiChildFlags_AutoResizeY)) {
ImGui::TextColored(Util::Colors::GetError(), "Shader Blocking Active");
Util::Text::Error("Shader Blocking Active");
ImGui::SameLine();
if (ImGui::SmallButton("Stop Blocking##Section")) {
shaderCache->DisableShaderBlocking();
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/OverlayRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void OverlayRenderer::RenderShaderBlockingStatus()
return;
}

ImGui::TextColored(Util::Colors::GetError(), "Shader Blocking Active");
Util::Text::Error("Shader Blocking Active");
ImGui::Text("Blocked: %s", shaderCache->blockedKey.c_str());

// Try to get more details from active shaders
Expand Down
47 changes: 47 additions & 0 deletions src/Utils/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,53 @@ namespace Util
{
return globals::menu->GetTheme().StatusPalette.Disable;
}

}

namespace Text
{
static void ColoredTextV(ImVec4 color, const char* fmt, va_list args)
{
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TextV(fmt, args);
ImGui::PopStyleColor();
}

static void ColoredTextWrappedV(ImVec4 color, const char* fmt, va_list args)
{
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TextWrappedV(fmt, args);
ImGui::PopStyleColor();
}

#define UTIL_TEXT(Name, ColorFn) \
void Name(const char* fmt, ...) { \
va_list args; \
va_start(args, fmt); \
ColoredTextV(Colors::ColorFn(), fmt, args); \
va_end(args); \
}
#define UTIL_TEXT_WRAPPED(Name, ColorFn) \
void Name(const char* fmt, ...) { \
va_list args; \
va_start(args, fmt); \
ColoredTextWrappedV(Colors::ColorFn(), fmt, args); \
va_end(args); \
}

UTIL_TEXT(Warning, GetWarning)
UTIL_TEXT_WRAPPED(WrappedWarning, GetWarning)
UTIL_TEXT(Error, GetError)
UTIL_TEXT_WRAPPED(WrappedError, GetError)
UTIL_TEXT(Success, GetSuccess)
UTIL_TEXT_WRAPPED(WrappedSuccess, GetSuccess)
UTIL_TEXT(Info, GetInfo)
UTIL_TEXT_WRAPPED(WrappedInfo, GetInfo)
UTIL_TEXT(Disabled, GetDisabled)
UTIL_TEXT_WRAPPED(WrappedDisabled, GetDisabled)

#undef UTIL_TEXT
#undef UTIL_TEXT_WRAPPED
}

namespace Input
Expand Down
16 changes: 16 additions & 0 deletions src/Utils/UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,22 @@ namespace Util
ImVec4 GetError(); // Red - error/negative (from theme Error)
ImVec4 GetInfo(); // Blue - informational (from theme InfoColor)
ImVec4 GetDisabled(); // Gray - disabled items (from theme Disable)

}

/** Theme-colored text rendering — self-contained push/text/pop per call. */
namespace Text
{
void Warning(const char* fmt, ...) IM_FMTARGS(1);
void WrappedWarning(const char* fmt, ...) IM_FMTARGS(1);
void Error(const char* fmt, ...) IM_FMTARGS(1);
void WrappedError(const char* fmt, ...) IM_FMTARGS(1);
void Success(const char* fmt, ...) IM_FMTARGS(1);
void WrappedSuccess(const char* fmt, ...) IM_FMTARGS(1);
void Info(const char* fmt, ...) IM_FMTARGS(1);
void WrappedInfo(const char* fmt, ...) IM_FMTARGS(1);
void Disabled(const char* fmt, ...) IM_FMTARGS(1);
void WrappedDisabled(const char* fmt, ...) IM_FMTARGS(1);
}

/**
Expand Down
Loading