From b1623ee832dba85336730ea992fe539668f9032c Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Mon, 16 Jun 2025 20:52:31 +1000 Subject: [PATCH 01/20] Updated uninstalled info --- src/Feature.cpp | 22 +++++++++++++++++++++- src/Feature.h | 17 ++++++++--------- src/Features/TerrainHelper.cpp | 20 -------------------- src/Features/TerrainHelper.h | 2 -- src/Features/TerrainVariation.cpp | 5 ----- src/Features/TerrainVariation.h | 4 +--- src/Menu.cpp | 10 +++------- 7 files changed, 33 insertions(+), 47 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 42ff7df094..bbbccdd3e5 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -110,7 +110,7 @@ void Feature::Load(json& o_json) hasError = true; errorVersion = "unknown"; errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - failedLoadedMessage = std::format("{} missing version info; not successfully loaded", ini_filename); + failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, GetRequiredVersion()); } if (hasError) { @@ -228,4 +228,24 @@ bool Feature::ToggleAtBootSetting() state->SetFeatureDisabled(featureName, !disabled); return state->IsFeatureDisabled(featureName); // Return the new state +} + +std::string Feature::GetRequiredVersion() const +{ + try { + std::string shortName = const_cast(this)->GetShortName(); + + if (FeatureVersions::FEATURE_MINIMAL_VERSIONS.contains(shortName)) { + const auto& minimalFeatureVersion = FeatureVersions::FEATURE_MINIMAL_VERSIONS.at(shortName); + std::string minimalVersionString = minimalFeatureVersion.string(); + // Remove trailing .0 if present + if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { + minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); + } + return minimalVersionString; + } + return "Unknown"; + } catch (const std::exception&) { + return "Unknown"; + } } \ No newline at end of file diff --git a/src/Feature.h b/src/Feature.h index 5abbdad0d1..6f86f64dd3 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -49,11 +49,6 @@ struct Feature */ virtual bool IsInMenu() const { return true; } - /** - * Whether to print the INI version missing message when this feature is unloaded - */ - virtual bool DrawFailLoadMessage() const { return true; } - /** * Get feature summary and key features for hover tooltip and unloaded UI * @@ -61,17 +56,22 @@ struct Feature */ virtual std::pair> GetFeatureSummary() { return {}; } + /** + * @return The minimum version string required by the Community Shaders + */ + std::string GetRequiredVersion() const; + virtual void SetupResources() {} virtual void Reset() {} - virtual void DrawSettings() {} virtual void DrawUnloadedUI() { auto [description, keyFeatures] = GetFeatureSummary(); - if (!description.empty() || !keyFeatures.empty()) { - ImGui::TextColored(Menu::GetSingleton()->GetTheme().StatusPalette.Error, "This feature is not installed!"); + if (!failedLoadedMessage.empty()) { + ImGui::TextColored(Menu::GetSingleton()->GetTheme().StatusPalette.Error, "%s", failedLoadedMessage.c_str()); ImGui::Spacing(); + } if (!description.empty()) { ImGui::TextWrapped("%s", description.c_str()); @@ -84,7 +84,6 @@ struct Feature ImGui::BulletText("%s", feature.c_str()); } ImGui::Spacing(); - } } } diff --git a/src/Features/TerrainHelper.cpp b/src/Features/TerrainHelper.cpp index 413540a210..12b9c1eebc 100644 --- a/src/Features/TerrainHelper.cpp +++ b/src/Features/TerrainHelper.cpp @@ -3,26 +3,6 @@ #include "ShaderCache.h" #include "State.h" -void TerrainHelper::DrawUnloadedUI() -{ - auto [description, keyFeatures] = GetFeatureSummary(); - - ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); - ImGui::Text("%s", description.c_str()); - - if (!keyFeatures.empty()) { - ImGui::Spacing(); - ImGui::Text("Key Features:"); - for (const auto& feature : keyFeatures) { - ImGui::BulletText("%s", feature.c_str()); - } - } - - ImGui::Spacing(); - ImGui::TextWrapped("Note: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing."); - ImGui::PopTextWrapPos(); -} - void TerrainHelper::DataLoaded() { // Get the default landscape texture set for terrain helper diff --git a/src/Features/TerrainHelper.h b/src/Features/TerrainHelper.h index fb18f16c49..dbd986de13 100644 --- a/src/Features/TerrainHelper.h +++ b/src/Features/TerrainHelper.h @@ -44,8 +44,6 @@ struct TerrainHelper : Feature virtual void DataLoaded() override; virtual bool SupportsVR() override { return true; }; virtual std::string GetFeatureModLink() override { return MakeNexusModURL(MOD_ID); } - virtual void DrawUnloadedUI() override; - virtual bool DrawFailLoadMessage() const override { return false; }; void SetShaderResouces(ID3D11DeviceContext* a_context); bool TESObjectLAND_SetupMaterial(RE::TESObjectLAND* land); diff --git a/src/Features/TerrainVariation.cpp b/src/Features/TerrainVariation.cpp index 83e8b53a37..06cd9d227a 100644 --- a/src/Features/TerrainVariation.cpp +++ b/src/Features/TerrainVariation.cpp @@ -135,9 +135,4 @@ void TerrainVariation::LoadSettings(json& o_json) void TerrainVariation::SaveSettings(json& o_json) { o_json = settings; -} - -bool TerrainVariation::DrawFailLoadMessage() const -{ - return false; } \ No newline at end of file diff --git a/src/Features/TerrainVariation.h b/src/Features/TerrainVariation.h index 9ef1339b17..01bd3b668d 100644 --- a/src/Features/TerrainVariation.h +++ b/src/Features/TerrainVariation.h @@ -25,7 +25,7 @@ struct TerrainVariation : Feature return { "Terrain Variation reduces the repeating pattern effect on terrain textures.\n" "This technique creates more natural-looking terrain by adding variation to texture sampling.", - { "Reduces terrain texture tiling", + { "Removes terrain texture tiling", "Adjustable distance-based blending", "Improved terrain visual quality", "Compatible with Extended Materials parallax" } @@ -56,9 +56,7 @@ struct TerrainVariation : Feature 1.0f, // shadowRayDirFactor 1 // hashQuality - default to high quality }; - virtual void DrawSettings() override; - virtual bool DrawFailLoadMessage() const override; virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings() override diff --git a/src/Menu.cpp b/src/Menu.cpp index a49df20a73..123e3106cc 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -519,14 +519,10 @@ void Menu::DrawSettings() } } - ImGui::EndTable(); - } - - if (hasFailedMessage && feat->DrawFailLoadMessage()) { - ImGui::TextColored(themeSettings.StatusPalette.Error, feat->failedLoadedMessage.c_str()); - } + ImGui::EndTable(); + } - if (!isDisabled) { + if (!isDisabled) { if (ImGui::BeginChild("##FeatureConfigFrame", { 0, 0 }, true)) { if (isLoaded) { // draw settings for loaded feature From fc1fde468a453c3e4e3427d0b2c19a44bfd9d104 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Mon, 16 Jun 2025 20:52:37 +1000 Subject: [PATCH 02/20] Update Feature.h --- src/Feature.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Feature.h b/src/Feature.h index 6f86f64dd3..60a48e364c 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -57,6 +57,7 @@ struct Feature virtual std::pair> GetFeatureSummary() { return {}; } /** + * Gets the minimum required version string for this feature * @return The minimum version string required by the Community Shaders */ std::string GetRequiredVersion() const; From 44cc983e6f7c2fe2381bc02cdd3c62196e731d49 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 10:57:10 +0000 Subject: [PATCH 03/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.h | 20 ++++++++++---------- src/Menu.cpp | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index 60a48e364c..33a20b6708 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -74,17 +74,17 @@ struct Feature ImGui::Spacing(); } - if (!description.empty()) { - ImGui::TextWrapped("%s", description.c_str()); - ImGui::Spacing(); - } + if (!description.empty()) { + ImGui::TextWrapped("%s", description.c_str()); + ImGui::Spacing(); + } - if (!keyFeatures.empty()) { - ImGui::TextWrapped("Key features:"); - for (const auto& feature : keyFeatures) { - ImGui::BulletText("%s", feature.c_str()); - } - ImGui::Spacing(); + if (!keyFeatures.empty()) { + ImGui::TextWrapped("Key features:"); + for (const auto& feature : keyFeatures) { + ImGui::BulletText("%s", feature.c_str()); + } + ImGui::Spacing(); } } diff --git a/src/Menu.cpp b/src/Menu.cpp index 123e3106cc..2774b2a257 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -519,10 +519,10 @@ void Menu::DrawSettings() } } - ImGui::EndTable(); - } + ImGui::EndTable(); + } - if (!isDisabled) { + if (!isDisabled) { if (ImGui::BeginChild("##FeatureConfigFrame", { 0, 0 }, true)) { if (isLoaded) { // draw settings for loaded feature From ef5c00983279de663863db2d895015dad5a4ac14 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Tue, 17 Jun 2025 12:42:49 +1000 Subject: [PATCH 04/20] Update Feature.h --- src/Feature.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Feature.h b/src/Feature.h index 33a20b6708..36d0963010 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -49,6 +49,13 @@ struct Feature */ virtual bool IsInMenu() const { return true; } + /** + * Whether to print the INI version missing message when this feature is unloaded + * Default false to prevent duplicate error messages. Retains functionality for author to include custom error message. + * Set to "true" in header file of individual feature. + */ + virtual bool DrawFailLoadMessage() const { return false; } + /** * Get feature summary and key features for hover tooltip and unloaded UI * From de122cd47a21d987e5aa992161773a14b60b0cc3 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Tue, 17 Jun 2025 12:44:43 +1000 Subject: [PATCH 05/20] Update Feature.h --- src/Feature.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Feature.h b/src/Feature.h index 36d0963010..c36656cfec 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -51,7 +51,8 @@ struct Feature /** * Whether to print the INI version missing message when this feature is unloaded - * Default false to prevent duplicate error messages. Retains functionality for author to include custom error message. + * Default false to prevent duplicate error messages. This is handled by failedLoadedMessage in Feature.cpp. + * Retains functionality for author to include custom error message. * Set to "true" in header file of individual feature. */ virtual bool DrawFailLoadMessage() const { return false; } From e16aab3624b581910287249b5c03955c24fa1a3a Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Tue, 17 Jun 2025 23:28:55 +1000 Subject: [PATCH 06/20] duplication removal --- src/Feature.cpp | 46 +++++++++++++++++++++++++--------------------- src/Feature.h | 6 ------ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index bbbccdd3e5..870bda30c5 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -56,6 +56,7 @@ void Feature::Load(json& o_json) bool hasError = false; std::string errorVersion; + std::string requiredVersion = "Unknown"; // Store required version for later use FeatureIssues::FeatureIssueInfo::IssueType errorType = FeatureIssues::FeatureIssueInfo::IssueType::UNKNOWN; if (FeatureIssues::IsObsoleteFeature(GetShortName())) { @@ -77,6 +78,13 @@ void Feature::Load(json& o_json) } else { // Version compatibility check auto& minimalFeatureVersion = iter->second; + std::string rawVersion = minimalFeatureVersion.string(); + // Remove trailing "-0" if present + if (rawVersion.size() >= 2 && rawVersion.substr(rawVersion.size() - 2) == "-0") { + requiredVersion = rawVersion.substr(0, rawVersion.size() - 2); + } else { + requiredVersion = rawVersion; + } bool oldFeature = featureVersion.compare(minimalFeatureVersion) == std::strong_ordering::less; bool majorVersionMismatch = featureVersion.major() < minimalFeatureVersion.major(); @@ -89,7 +97,10 @@ void Feature::Load(json& o_json) errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; std::string minimalVersionString = minimalFeatureVersion.string(); + // Remove trailing "-0" if present for error messages + if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); + } if (majorVersionMismatch) { failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); @@ -110,7 +121,20 @@ void Feature::Load(json& o_json) hasError = true; errorVersion = "unknown"; errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, GetRequiredVersion()); + + // Look up the required version for the missing file error message + auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); + if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { + std::string rawVersion = iter->second.string(); + // Remove trailing "-0" if present + if (rawVersion.size() >= 2 && rawVersion.substr(rawVersion.size() - 2) == "-0") { + requiredVersion = rawVersion.substr(0, rawVersion.size() - 2); + } else { + requiredVersion = rawVersion; + } + } + + failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); } if (hasError) { @@ -229,23 +253,3 @@ bool Feature::ToggleAtBootSetting() return state->IsFeatureDisabled(featureName); // Return the new state } - -std::string Feature::GetRequiredVersion() const -{ - try { - std::string shortName = const_cast(this)->GetShortName(); - - if (FeatureVersions::FEATURE_MINIMAL_VERSIONS.contains(shortName)) { - const auto& minimalFeatureVersion = FeatureVersions::FEATURE_MINIMAL_VERSIONS.at(shortName); - std::string minimalVersionString = minimalFeatureVersion.string(); - // Remove trailing .0 if present - if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { - minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); - } - return minimalVersionString; - } - return "Unknown"; - } catch (const std::exception&) { - return "Unknown"; - } -} \ No newline at end of file diff --git a/src/Feature.h b/src/Feature.h index c36656cfec..dfd63a36f9 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -64,12 +64,6 @@ struct Feature */ virtual std::pair> GetFeatureSummary() { return {}; } - /** - * Gets the minimum required version string for this feature - * @return The minimum version string required by the Community Shaders - */ - std::string GetRequiredVersion() const; - virtual void SetupResources() {} virtual void Reset() {} virtual void DrawSettings() {} From 49ef75197c4ca2fbb4ba0b78235b5a2ab3aa4c07 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 13:29:22 +0000 Subject: [PATCH 07/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 870bda30c5..a88086fbb6 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -56,7 +56,7 @@ void Feature::Load(json& o_json) bool hasError = false; std::string errorVersion; - std::string requiredVersion = "Unknown"; // Store required version for later use + std::string requiredVersion = "Unknown"; // Store required version for later use FeatureIssues::FeatureIssueInfo::IssueType errorType = FeatureIssues::FeatureIssueInfo::IssueType::UNKNOWN; if (FeatureIssues::IsObsoleteFeature(GetShortName())) { @@ -97,10 +97,10 @@ void Feature::Load(json& o_json) errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; std::string minimalVersionString = minimalFeatureVersion.string(); - // Remove trailing "-0" if present for error messages - if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { - minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); - } + // Remove trailing "-0" if present for error messages + if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { + minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); + } if (majorVersionMismatch) { failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); @@ -121,7 +121,7 @@ void Feature::Load(json& o_json) hasError = true; errorVersion = "unknown"; errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - + // Look up the required version for the missing file error message auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { @@ -133,7 +133,7 @@ void Feature::Load(json& o_json) requiredVersion = rawVersion; } } - + failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); } From 14170375f56cc50048b1f8036c798d35be2e5bb5 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Tue, 17 Jun 2025 23:53:04 +1000 Subject: [PATCH 08/20] punctuation --- src/Feature.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index a88086fbb6..fe4fc107ae 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -32,7 +32,7 @@ void Feature::Load(json& o_json) { if (o_json[GetName()].is_structured()) { - logger::info("Loading {} settings", GetName()); + logger::info("Loading {} settings.", GetName()); try { LoadSettings(o_json[GetName()]); } catch (...) { @@ -40,7 +40,7 @@ void Feature::Load(json& o_json) RestoreDefaultSettings(); } } else { - logger::info("Loading default settings for {}", GetName()); + logger::info("Loading default settings for {}.", GetName()); RestoreDefaultSettings(); } @@ -63,7 +63,7 @@ void Feature::Load(json& o_json) hasError = true; errorVersion = "N/A"; errorType = FeatureIssues::FeatureIssueInfo::IssueType::OBSOLETE; - failedLoadedMessage = std::format("{} is an obsolete feature that has been removed", GetShortName()); + failedLoadedMessage = std::format("{} is an obsolete feature that has been removed.", GetShortName()); } else if (auto value = ini.GetValue("Info", "Version")) { try { REL::Version featureVersion(std::regex_replace(value, std::regex("-"), ".")); @@ -158,7 +158,7 @@ void Feature::Load(json& o_json) FeatureIssues::AddFeatureIssue(shortName, errorVersion, failedLoadedMessage, errorType, fileInfo, minimumVersion); } else { - logger::error("Feature has empty short name, cannot add to feature issues list"); + logger::error("Feature has empty short name, cannot add to feature issues list."); } } } @@ -188,14 +188,14 @@ bool Feature::ValidateCache(CSimpleIniA& a_ini) if (loaded) { auto versionInCache = a_ini.GetValue(ini_name.c_str(), "Version"); if (strcmp(versionInCache, version.c_str()) != 0) { - logger::info("Change in version detected. Installed {} but {} in Disk Cache", version, versionInCache); + logger::info("Change in version detected. Installed {} but {} in Disk Cache.", version, versionInCache); return false; } else { logger::info("Installed version and cached version match."); } } - logger::info("Cached feature is valid"); + logger::info("Cached feature is valid."); return true; } From b39c2449052165219e2523f131df7baa2f10ac1b Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Tue, 17 Jun 2025 23:54:56 +1000 Subject: [PATCH 09/20] Update Feature.cpp --- src/Feature.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index fe4fc107ae..06e7937350 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -32,15 +32,15 @@ void Feature::Load(json& o_json) { if (o_json[GetName()].is_structured()) { - logger::info("Loading {} settings.", GetName()); + logger::info("Loading {} settings", GetName()); try { LoadSettings(o_json[GetName()]); } catch (...) { - logger::warn("Invalid settings for {}, using default.", GetName()); + logger::warn("Invalid settings for {}, using default", GetName()); RestoreDefaultSettings(); } } else { - logger::info("Loading default settings for {}.", GetName()); + logger::info("Loading default settings for {}", GetName()); RestoreDefaultSettings(); } @@ -158,7 +158,7 @@ void Feature::Load(json& o_json) FeatureIssues::AddFeatureIssue(shortName, errorVersion, failedLoadedMessage, errorType, fileInfo, minimumVersion); } else { - logger::error("Feature has empty short name, cannot add to feature issues list."); + logger::error("Feature has empty short name, cannot add to feature issues list"); } } } @@ -188,14 +188,14 @@ bool Feature::ValidateCache(CSimpleIniA& a_ini) if (loaded) { auto versionInCache = a_ini.GetValue(ini_name.c_str(), "Version"); if (strcmp(versionInCache, version.c_str()) != 0) { - logger::info("Change in version detected. Installed {} but {} in Disk Cache.", version, versionInCache); + logger::info("Change in version detected. Installed {} but {} in Disk Cache", version, versionInCache); return false; } else { - logger::info("Installed version and cached version match."); + logger::info("Installed version and cached version match"); } } - logger::info("Cached feature is valid."); + logger::info("Cached feature is valid"); return true; } From ea4fb329b7a10c94de3a4e3bf19e3ae8f230c5a9 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 09:57:47 +1000 Subject: [PATCH 10/20] Update TerrainHelper.h --- src/Features/TerrainHelper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Features/TerrainHelper.h b/src/Features/TerrainHelper.h index dbd986de13..9f6f267f66 100644 --- a/src/Features/TerrainHelper.h +++ b/src/Features/TerrainHelper.h @@ -20,6 +20,7 @@ struct TerrainHelper : Feature { return { "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.", + "\n Note: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing.", { "Extended texture slot support for terrain materials", "Parallax mapping integration for terrain textures", "Automatic terrain material detection and setup", From d7e005c51570f75ba0926ce5166c0c847f294b53 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 10:00:54 +1000 Subject: [PATCH 11/20] Update TerrainHelper.h --- src/Features/TerrainHelper.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Features/TerrainHelper.h b/src/Features/TerrainHelper.h index 9f6f267f66..e3c7c773e4 100644 --- a/src/Features/TerrainHelper.h +++ b/src/Features/TerrainHelper.h @@ -19,8 +19,7 @@ struct TerrainHelper : Feature virtual std::pair> GetFeatureSummary() override { return { - "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.", - "\n Note: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing.", + "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.\nNote: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing.", { "Extended texture slot support for terrain materials", "Parallax mapping integration for terrain textures", "Automatic terrain material detection and setup", From 5126e417692d6010b9902226d278cce26a43d92c Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 10:08:24 +1000 Subject: [PATCH 12/20] Update Feature.cpp --- src/Feature.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 06e7937350..2f2d516f94 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -29,6 +29,16 @@ #include "State.h" +namespace { + // Utility function to clean up version strings by removing trailing "-0" + std::string CleanVersionString(const std::string& versionString) { + if (versionString.size() >= 2 && versionString.substr(versionString.size() - 2) == "-0") { + return versionString.substr(0, versionString.size() - 2); + } + return versionString; + } +} + void Feature::Load(json& o_json) { if (o_json[GetName()].is_structured()) { @@ -79,12 +89,7 @@ void Feature::Load(json& o_json) // Version compatibility check auto& minimalFeatureVersion = iter->second; std::string rawVersion = minimalFeatureVersion.string(); - // Remove trailing "-0" if present - if (rawVersion.size() >= 2 && rawVersion.substr(rawVersion.size() - 2) == "-0") { - requiredVersion = rawVersion.substr(0, rawVersion.size() - 2); - } else { - requiredVersion = rawVersion; - } + requiredVersion = CleanVersionString(rawVersion); bool oldFeature = featureVersion.compare(minimalFeatureVersion) == std::strong_ordering::less; bool majorVersionMismatch = featureVersion.major() < minimalFeatureVersion.major(); @@ -96,11 +101,7 @@ void Feature::Load(json& o_json) errorVersion = value; errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - std::string minimalVersionString = minimalFeatureVersion.string(); - // Remove trailing "-0" if present for error messages - if (minimalVersionString.size() >= 2 && minimalVersionString.substr(minimalVersionString.size() - 2) == "-0") { - minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); - } + std::string minimalVersionString = CleanVersionString(minimalFeatureVersion.string()); if (majorVersionMismatch) { failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); @@ -125,13 +126,7 @@ void Feature::Load(json& o_json) // Look up the required version for the missing file error message auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { - std::string rawVersion = iter->second.string(); - // Remove trailing "-0" if present - if (rawVersion.size() >= 2 && rawVersion.substr(rawVersion.size() - 2) == "-0") { - requiredVersion = rawVersion.substr(0, rawVersion.size() - 2); - } else { - requiredVersion = rawVersion; - } + requiredVersion = CleanVersionString(iter->second.string()); } failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); From 8cc0958211f92b3799cc984ea15cb3cf8d19b45b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 00:49:30 +0000 Subject: [PATCH 13/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 417a2ad663..cd9370585c 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -29,9 +29,11 @@ #include "State.h" -namespace { +namespace +{ // Utility function to clean up version strings by removing trailing "-0" - std::string CleanVersionString(const std::string& versionString) { + std::string CleanVersionString(const std::string& versionString) + { if (versionString.size() >= 2 && versionString.substr(versionString.size() - 2) == "-0") { return versionString.substr(0, versionString.size() - 2); } From f2cbd2937f4ff3183f1a472242e3863df730872e Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 11:42:58 +1000 Subject: [PATCH 14/20] 1 --- src/Feature.cpp | 17 ++++------------- src/Feature.h | 1 + src/FeatureIssues.cpp | 20 ++++++++++---------- src/Utils/Format.cpp | 8 ++++++++ src/Utils/Format.h | 2 ++ 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 2f2d516f94..2eeba02146 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -2,6 +2,7 @@ #include "FeatureIssues.h" #include "FeatureVersions.h" +#include "Utils/Format.h" #include "Features/CloudShadows.h" #include "Features/DynamicCubemaps.h" #include "Features/ExtendedMaterials.h" @@ -29,16 +30,6 @@ #include "State.h" -namespace { - // Utility function to clean up version strings by removing trailing "-0" - std::string CleanVersionString(const std::string& versionString) { - if (versionString.size() >= 2 && versionString.substr(versionString.size() - 2) == "-0") { - return versionString.substr(0, versionString.size() - 2); - } - return versionString; - } -} - void Feature::Load(json& o_json) { if (o_json[GetName()].is_structured()) { @@ -89,7 +80,7 @@ void Feature::Load(json& o_json) // Version compatibility check auto& minimalFeatureVersion = iter->second; std::string rawVersion = minimalFeatureVersion.string(); - requiredVersion = CleanVersionString(rawVersion); + requiredVersion = Util::CleanVersionString(rawVersion); bool oldFeature = featureVersion.compare(minimalFeatureVersion) == std::strong_ordering::less; bool majorVersionMismatch = featureVersion.major() < minimalFeatureVersion.major(); @@ -101,7 +92,7 @@ void Feature::Load(json& o_json) errorVersion = value; errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - std::string minimalVersionString = CleanVersionString(minimalFeatureVersion.string()); + std::string minimalVersionString = Util::CleanVersionString(minimalFeatureVersion.string()); if (majorVersionMismatch) { failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); @@ -126,7 +117,7 @@ void Feature::Load(json& o_json) // Look up the required version for the missing file error message auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { - requiredVersion = CleanVersionString(iter->second.string()); + requiredVersion = Util::CleanVersionString(iter->second.string()); } failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); diff --git a/src/Feature.h b/src/Feature.h index dfd63a36f9..a2a0ba7e35 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -1,6 +1,7 @@ #pragma once #include "Menu.h" +#include "Utils/Format.h" struct Feature { diff --git a/src/FeatureIssues.cpp b/src/FeatureIssues.cpp index f3d17f978a..0cef71c8b2 100644 --- a/src/FeatureIssues.cpp +++ b/src/FeatureIssues.cpp @@ -4,6 +4,7 @@ #include "Menu.h" #include "State.h" #include "Util.h" +#include "Utils/Format.h" namespace FeatureIssues { @@ -483,12 +484,12 @@ namespace FeatureIssues ImGui::TextWrapped("INI Path: %s", issue.iniPath.c_str()); ImGui::Spacing(); } - if (!issue.version.empty()) { - ImGui::TextWrapped("Current Version: %s", issue.version.c_str()); + if (!issue.version.empty()) { + ImGui::TextWrapped("Current Version: %s", Util::CleanVersionString(issue.version).c_str()); ImGui::Spacing(); } if (issue.IsVersionMismatch() && !issue.minimumVersionRequired.empty()) { - ImGui::TextWrapped("Minimum Required: %s", issue.minimumVersionRequired.c_str()); + ImGui::TextWrapped("Minimum Required: %s", Util::CleanVersionString(issue.minimumVersionRequired).c_str()); ImGui::Spacing(); } ImGui::TextWrapped("Issue: %s", issue.rejectionReason.c_str()); @@ -577,15 +578,14 @@ namespace FeatureIssues if (!issue.replacementFeatureModLink.empty()) { std::string buttonText = issue.minimumVersionRequired.empty() ? ("Download Latest " + issue.replacementFeatureDisplayName) : - ("Download " + issue.replacementFeatureDisplayName + " " + issue.minimumVersionRequired + "+"); + ("Download " + issue.replacementFeatureDisplayName + " " + Util::CleanVersionString(issue.minimumVersionRequired) + "+"); if (ImGui::SmallButton(buttonText.c_str())) { ShellExecuteA(0, 0, issue.replacementFeatureModLink.c_str(), 0, 0, SW_SHOW); } - if (auto _tt = Util::HoverTooltipWrapper()) { - if (!issue.minimumVersionRequired.empty()) { - ImGui::Text("Download %s version %s or later", issue.replacementFeatureDisplayName.c_str(), issue.minimumVersionRequired.c_str()); + if (auto _tt = Util::HoverTooltipWrapper()) { if (!issue.minimumVersionRequired.empty()) { + ImGui::Text("Download %s version %s or later", issue.replacementFeatureDisplayName.c_str(), Util::CleanVersionString(issue.minimumVersionRequired).c_str()); } else { ImGui::Text("Download the latest version of %s", issue.replacementFeatureDisplayName.c_str()); } @@ -594,12 +594,12 @@ namespace FeatureIssues // Show message when no download link is available std::string updateText = issue.minimumVersionRequired.empty() ? "Update Required" : - ("Update to " + issue.minimumVersionRequired + "+ Required"); + ("Update to " + Util::CleanVersionString(issue.minimumVersionRequired) + "+ Required"); ImGui::TextWrapped("%s", updateText.c_str()); if (auto _tt = Util::HoverTooltipWrapper()) { - if (!issue.minimumVersionRequired.empty()) { - ImGui::Text("This feature needs to be updated to version %s or later. Check the mod page manually.", issue.minimumVersionRequired.c_str()); + if (!issue.minimumVersionRequired.empty()) { + ImGui::Text("This feature needs to be updated to version %s or later. Check the mod page manually.", Util::CleanVersionString(issue.minimumVersionRequired).c_str()); } else { ImGui::Text("This feature needs to be updated but no download link is available. Check the mod page manually."); } diff --git a/src/Utils/Format.cpp b/src/Utils/Format.cpp index 875b0e2af2..2602d8da39 100644 --- a/src/Utils/Format.cpp +++ b/src/Utils/Format.cpp @@ -8,6 +8,14 @@ namespace Util return v.substr(0, v.find_last_of(".")); } + std::string CleanVersionString(const std::string& versionString) + { + if (versionString.size() >= 2 && versionString.substr(versionString.size() - 2) == "-0") { + return versionString.substr(0, versionString.size() - 2); + } + return versionString; + } + std::string DefinesToString(const std::vector>& defines) { std::string result; diff --git a/src/Utils/Format.h b/src/Utils/Format.h index 4ae33a1b3e..ebe04313e0 100644 --- a/src/Utils/Format.h +++ b/src/Utils/Format.h @@ -6,6 +6,8 @@ namespace Util { std::string GetFormattedVersion(const REL::Version& version); + std::string CleanVersionString(const std::string& versionString); + std::string DefinesToString(const std::vector>& defines); std::string DefinesToString(const std::vector& defines); From a2e2728624724b6609d4dd1a2e350b033535984b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 01:45:50 +0000 Subject: [PATCH 15/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.cpp | 2 +- src/FeatureIssues.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 87c0eb76f4..29f95a7cab 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -2,7 +2,6 @@ #include "FeatureIssues.h" #include "FeatureVersions.h" -#include "Utils/Format.h" #include "Features/CloudShadows.h" #include "Features/DynamicCubemaps.h" #include "Features/ExtendedMaterials.h" @@ -27,6 +26,7 @@ #include "Features/VolumetricLighting.h" #include "Features/WaterEffects.h" #include "Features/WetnessEffects.h" +#include "Utils/Format.h" #include "State.h" diff --git a/src/FeatureIssues.cpp b/src/FeatureIssues.cpp index 3dd083e0ad..f8e2f83a27 100644 --- a/src/FeatureIssues.cpp +++ b/src/FeatureIssues.cpp @@ -484,7 +484,7 @@ namespace FeatureIssues ImGui::TextWrapped("INI Path: %s", issue.iniPath.c_str()); ImGui::Spacing(); } - if (!issue.version.empty()) { + if (!issue.version.empty()) { ImGui::TextWrapped("Current Version: %s", Util::CleanVersionString(issue.version).c_str()); ImGui::Spacing(); } @@ -584,7 +584,8 @@ namespace FeatureIssues ShellExecuteA(0, 0, issue.replacementFeatureModLink.c_str(), 0, 0, SW_SHOW); } - if (auto _tt = Util::HoverTooltipWrapper()) { if (!issue.minimumVersionRequired.empty()) { + if (auto _tt = Util::HoverTooltipWrapper()) { + if (!issue.minimumVersionRequired.empty()) { ImGui::Text("Download %s version %s or later", issue.replacementFeatureDisplayName.c_str(), Util::CleanVersionString(issue.minimumVersionRequired).c_str()); } else { ImGui::Text("Download the latest version of %s", issue.replacementFeatureDisplayName.c_str()); @@ -598,7 +599,7 @@ namespace FeatureIssues ImGui::TextWrapped("%s", updateText.c_str()); if (auto _tt = Util::HoverTooltipWrapper()) { - if (!issue.minimumVersionRequired.empty()) { + if (!issue.minimumVersionRequired.empty()) { ImGui::Text("This feature needs to be updated to version %s or later. Check the mod page manually.", Util::CleanVersionString(issue.minimumVersionRequired).c_str()); } else { ImGui::Text("This feature needs to be updated but no download link is available. Check the mod page manually."); From 483040b6c671d32e51484a6776d09f9fe8ce30d5 Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 11:46:44 +1000 Subject: [PATCH 16/20] Update Feature.cpp --- src/Feature.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 87c0eb76f4..65849bf3a6 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -30,17 +30,6 @@ #include "State.h" -namespace -{ - // Utility function to clean up version strings by removing trailing "-0" - std::string CleanVersionString(const std::string& versionString) - { - if (versionString.size() >= 2 && versionString.substr(versionString.size() - 2) == "-0") { - return versionString.substr(0, versionString.size() - 2); - } - return versionString; - } -} void Feature::Load(json& o_json) { From d60675ff99a50e268379016fe85a8257ba611890 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 01:51:57 +0000 Subject: [PATCH 17/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 9da788332b..284f09239a 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -30,7 +30,6 @@ #include "State.h" - void Feature::Load(json& o_json) { if (o_json[GetName()].is_structured()) { From a933efb695048e7ec348cdcc057aa59bf899cf7c Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 12:14:46 +1000 Subject: [PATCH 18/20] Update Feature.cpp --- src/Feature.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 9da788332b..ba301c8873 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -56,8 +56,29 @@ void Feature::Load(json& o_json) SI_Error rc = ini.LoadFile(ini_path.c_str()); if (rc < 0) { - if (!FeatureIssues::IsObsoleteFeature(GetShortName())) + if (FeatureIssues::IsObsoleteFeature(GetShortName())) { + // Handle obsolete features + version = "obsolete"; // Set version so it shows error color in UI + failedLoadedMessage = std::format("{} is an obsolete feature that has been removed.", GetShortName()); + FeatureIssues::FeatureFileInfo fileInfo = FeatureIssues::GetFeatureFileInfo(GetShortName()); + FeatureIssues::AddFeatureIssue(GetShortName(), "N/A", failedLoadedMessage, + FeatureIssues::FeatureIssueInfo::IssueType::OBSOLETE, fileInfo, ""); + } else { logger::info("{} failed to load, feature disabled", ini_filename); + + // Set error message for missing file + std::string requiredVersion = "Unknown"; + auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); + if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { + requiredVersion = Util::CleanVersionString(iter->second.string()); + } + failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); + + // Add to feature issues + FeatureIssues::FeatureFileInfo fileInfo = FeatureIssues::GetFeatureFileInfo(GetShortName()); + FeatureIssues::AddFeatureIssue(GetShortName(), "unknown", failedLoadedMessage, + FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH, fileInfo, requiredVersion); + } loaded = false; return; } @@ -66,9 +87,9 @@ void Feature::Load(json& o_json) std::string errorVersion; std::string requiredVersion = "Unknown"; // Store required version for later use FeatureIssues::FeatureIssueInfo::IssueType errorType = FeatureIssues::FeatureIssueInfo::IssueType::UNKNOWN; - if (FeatureIssues::IsObsoleteFeature(GetShortName())) { hasError = true; + version = "obsolete"; // Set version so it shows error color in UI errorVersion = "N/A"; errorType = FeatureIssues::FeatureIssueInfo::IssueType::OBSOLETE; failedLoadedMessage = std::format("{} is an obsolete feature that has been removed.", GetShortName()); @@ -116,18 +137,6 @@ void Feature::Load(json& o_json) errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; failedLoadedMessage = std::format("{} {} has invalid version format: {}", GetShortName(), value, e.what()); } - } else { - hasError = true; - errorVersion = "unknown"; - errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; - - // Look up the required version for the missing file error message - auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); - if (iter != FeatureVersions::FEATURE_MINIMAL_VERSIONS.end()) { - requiredVersion = Util::CleanVersionString(iter->second.string()); - } - - failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); } if (hasError) { From 6867bb03167f4672cfbc3a4a960e83fa37d9eaae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 02:17:17 +0000 Subject: [PATCH 19/20] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Feature.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index d0e33eb2d7..925639443a 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -55,16 +55,16 @@ void Feature::Load(json& o_json) SI_Error rc = ini.LoadFile(ini_path.c_str()); if (rc < 0) { - if (FeatureIssues::IsObsoleteFeature(GetShortName())) { + if (FeatureIssues::IsObsoleteFeature(GetShortName())) { // Handle obsolete features version = "obsolete"; // Set version so it shows error color in UI failedLoadedMessage = std::format("{} is an obsolete feature that has been removed.", GetShortName()); FeatureIssues::FeatureFileInfo fileInfo = FeatureIssues::GetFeatureFileInfo(GetShortName()); - FeatureIssues::AddFeatureIssue(GetShortName(), "N/A", failedLoadedMessage, + FeatureIssues::AddFeatureIssue(GetShortName(), "N/A", failedLoadedMessage, FeatureIssues::FeatureIssueInfo::IssueType::OBSOLETE, fileInfo, ""); } else { logger::info("{} failed to load, feature disabled", ini_filename); - + // Set error message for missing file std::string requiredVersion = "Unknown"; auto iter = FeatureVersions::FEATURE_MINIMAL_VERSIONS.find(GetShortName()); @@ -72,10 +72,10 @@ void Feature::Load(json& o_json) requiredVersion = Util::CleanVersionString(iter->second.string()); } failedLoadedMessage = std::format("The {} file is missing. This feature is not installed! Version required: {}", ini_filename, requiredVersion); - + // Add to feature issues FeatureIssues::FeatureFileInfo fileInfo = FeatureIssues::GetFeatureFileInfo(GetShortName()); - FeatureIssues::AddFeatureIssue(GetShortName(), "unknown", failedLoadedMessage, + FeatureIssues::AddFeatureIssue(GetShortName(), "unknown", failedLoadedMessage, FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH, fileInfo, requiredVersion); } loaded = false; From d0d695de554b1b514a2e253fd193612e110638fe Mon Sep 17 00:00:00 2001 From: David Kehoe Date: Wed, 18 Jun 2025 14:43:34 +1000 Subject: [PATCH 20/20] Update Feature.cpp --- src/Feature.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index 925639443a..d8d69a5753 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -32,18 +32,6 @@ void Feature::Load(json& o_json) { - if (o_json[GetName()].is_structured()) { - logger::info("Loading {} settings", GetName()); - try { - LoadSettings(o_json[GetName()]); - } catch (...) { - logger::warn("Invalid settings for {}, using default", GetName()); - RestoreDefaultSettings(); - } - } else { - logger::info("Loading default settings for {}", GetName()); - RestoreDefaultSettings(); - } // Convert string to wstring auto ini_filename = std::format("{}.ini", GetShortName()); std::wstring ini_filename_w;