From 93b14ad91579d7608f3eab6ac89c102f490a4e3c Mon Sep 17 00:00:00 2001 From: Brucio Date: Sun, 15 Feb 2026 18:05:05 -0500 Subject: [PATCH] refactor: core feature version mismatch UI enhancement --- src/Feature.cpp | 4 +++- src/FeatureIssues.cpp | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index b300b2f7ad..874bb732cf 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -96,7 +96,9 @@ void Feature::Load(json& o_json) std::string minimalVersionString = Util::GetFormattedVersion(minimalFeatureVersion); - if (majorVersionMismatch) { + if (IsCore()) { + failedLoadedMessage = std::format("This feature is already included as part of the core Community Shaders installation. Uninstall this feature with your mod manager."); + } else if (majorVersionMismatch) { failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); } else { failedLoadedMessage = std::format("{} {} is an old feature version, required: {}", GetShortName(), value, minimalVersionString); diff --git a/src/FeatureIssues.cpp b/src/FeatureIssues.cpp index 4c67821e24..5cbb5d6731 100644 --- a/src/FeatureIssues.cpp +++ b/src/FeatureIssues.cpp @@ -9,6 +9,7 @@ namespace FeatureIssues { // Forward declarations static void DrawFeatureIssue(const FeatureIssueInfo& issue, const ImVec4& color); + static bool IsVersionMismatchForCoreFeature(const FeatureIssueInfo& issue); // Static storage for feature issues static std::vector s_featureIssues; @@ -401,7 +402,7 @@ namespace FeatureIssues } // Version Mismatch Section if (auto section = Util::SectionWrapper("Wrong Version Features", - "The following features have version compatibility issues and were disabled automatically. Updating them may resolve the issues.", + "The following features have version compatibility issues and were disabled automatically. Please check for any updates or if the feature is considered obsolete.", theme.StatusPalette.Warning, !versionIssues.empty())) { for (const auto* issue : versionIssues) { DrawFeatureIssue(*issue, theme.StatusPalette.Warning); @@ -574,7 +575,13 @@ namespace FeatureIssues } // Handle download action for version mismatch features - if (issue.IsVersionMismatch()) { + if (IsVersionMismatchForCoreFeature(issue)) { + ImGui::SameLine(); + ImGui::Text("Core feature already installed"); + if (auto _tt = Util::HoverTooltipWrapper()) { + ImGui::TextWrapped("This feature is already included as part of the core Community Shaders installation. Uninstall this feature with your mod manager."); + } + } else if (issue.IsVersionMismatch()) { ImGui::SameLine(); if (!issue.replacementFeatureModLink.empty()) { @@ -625,7 +632,7 @@ namespace FeatureIssues // Show delete button for: // 1. Features that don't modify shader directories (safe to delete) // 2. Obsolete features with replacements (user can install replacement after deletion) - bool canSafelyDelete = !issue.ModifiedShaderDirectory() || (issue.IsObsolete() && !issue.replacementFeature.empty()); + bool canSafelyDelete = (!issue.ModifiedShaderDirectory() || (issue.IsObsolete() && !issue.replacementFeature.empty())) && !IsVersionMismatchForCoreFeature(issue); if (canSafelyDelete) { ImGui::SameLine(); std::string deleteButtonId = "Delete##" + issue.shortName; @@ -699,6 +706,14 @@ namespace FeatureIssues ImGui::PopID(); } + static bool IsVersionMismatchForCoreFeature(const FeatureIssueInfo& issue) + { + if (!issue.IsVersionMismatch()) + return false; + Feature* f = s_featureLookupCache.FindFeature(issue.shortName); + return f && f->IsCore(); + } + bool IsReplacementFeatureInstalled(const std::string& featureName) { Feature* feature = s_featureLookupCache.FindFeature(featureName);