-
Notifications
You must be signed in to change notification settings - Fork 138
feat(ui): cleaned uninstalled feature missing ini message, added "required-version" based on cs version #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b1623ee
Updated uninstalled info
davo0411 fc1fde4
Update Feature.h
davo0411 44cc983
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] ef5c009
Update Feature.h
davo0411 de122cd
Update Feature.h
davo0411 e16aab3
duplication removal
davo0411 49ef751
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] 1417037
punctuation
davo0411 b39c244
Update Feature.cpp
davo0411 ea4fb32
Update TerrainHelper.h
davo0411 d7e005c
Update TerrainHelper.h
davo0411 5126e41
Update Feature.cpp
davo0411 008f22e
Merge branch 'dev' into version-info
davo0411 8cc0958
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] f2cbd29
1
davo0411 953d4cd
Merge branch 'version-info' of https://github.com/davo0411/skyrim-com…
davo0411 a2e2728
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] 483040b
Update Feature.cpp
davo0411 cbb92d4
Merge branch 'version-info' of https://github.com/davo0411/skyrim-com…
davo0411 d60675f
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] a933efb
Update Feature.cpp
davo0411 c4e7274
Merge branch 'version-info' of https://github.com/davo0411/skyrim-com…
davo0411 6867bb0
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] 560b498
Merge branch 'dev' into version-info
alandtse d0d695d
Update Feature.cpp
davo0411 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| #include "Features/VolumetricLighting.h" | ||
| #include "Features/WaterEffects.h" | ||
| #include "Features/WetnessEffects.h" | ||
| #include "Utils/Format.h" | ||
|
|
||
| #include "State.h" | ||
|
|
||
|
|
@@ -42,21 +43,43 @@ 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); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. I don't think you understand the code. The ini is missing because they didn't install or deleted it. Why is that an issue to raise? |
||
| // 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; | ||
| } | ||
|
|
||
| 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())) { | ||
| 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()); | ||
| 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("-"), ".")); | ||
|
|
@@ -71,6 +94,8 @@ void Feature::Load(json& o_json) | |
| } else { | ||
| // Version compatibility check | ||
| auto& minimalFeatureVersion = iter->second; | ||
| std::string rawVersion = minimalFeatureVersion.string(); | ||
| requiredVersion = Util::CleanVersionString(rawVersion); | ||
| bool oldFeature = featureVersion.compare(minimalFeatureVersion) == std::strong_ordering::less; | ||
| bool majorVersionMismatch = featureVersion.major() < minimalFeatureVersion.major(); | ||
|
|
||
|
|
@@ -82,8 +107,7 @@ void Feature::Load(json& o_json) | |
| errorVersion = value; | ||
| errorType = FeatureIssues::FeatureIssueInfo::IssueType::VERSION_MISMATCH; | ||
|
|
||
| std::string minimalVersionString = minimalFeatureVersion.string(); | ||
| minimalVersionString = minimalVersionString.substr(0, minimalVersionString.size() - 2); | ||
| std::string minimalVersionString = Util::CleanVersionString(minimalFeatureVersion.string()); | ||
|
|
||
| if (majorVersionMismatch) { | ||
| failedLoadedMessage = std::format("{} {} is too old, major version incompatibility detected. Required: {}", GetShortName(), value, minimalVersionString); | ||
|
|
@@ -100,11 +124,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; | ||
| failedLoadedMessage = std::format("{} missing version info; not successfully loaded", ini_filename); | ||
| } | ||
|
|
||
| if (hasError) { | ||
|
|
@@ -181,7 +200,7 @@ bool Feature::ValidateCache(CSimpleIniA& a_ini) | |
| 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"); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -262,4 +281,4 @@ bool Feature::ToggleAtBootSetting() | |
| state->SetFeatureDisabled(featureName, !disabled); | ||
|
|
||
| return state->IsFeatureDisabled(featureName); // Return the new state | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This doesn't make sense. If the file is deleted we don't have to talk about it.