Re-add settings options and other misc changes

This commit is contained in:
Irastris
2026-05-08 19:21:38 -04:00
parent 41e128c582
commit 9a80f3a08a
5 changed files with 50 additions and 14 deletions
+3 -3
View File
@@ -167,6 +167,9 @@ struct UserSettings {
struct {
ConfigVar<std::string> isoPath;
ConfigVar<DiscVerificationState> isoVerification;
#if DUSK_TPHD
ConfigVar<std::string> hdContentPath;
#endif
ConfigVar<std::string> graphicsBackend;
ConfigVar<bool> skipPreLaunchUI;
ConfigVar<bool> showPipelineCompilation;
@@ -175,9 +178,6 @@ struct UserSettings {
ConfigVar<bool> checkForUpdates;
ConfigVar<int> cardFileType;
ConfigVar<bool> enableAdvancedSettings;
#if DUSK_TPHD
ConfigVar<std::string> hdContentPath; // path to TP-HD decrypted "content" folder
#endif
} backend;
};
+6 -6
View File
@@ -114,6 +114,9 @@ UserSettings g_userSettings = {
.backend = {
.isoPath {"backend.isoPath", ""},
.isoVerification {"backend.isoVerification", DiscVerificationState::Unknown},
#if DUSK_TPHD
.hdContentPath {"backend.hdContentPath", ""},
#endif
.graphicsBackend {"backend.graphicsBackend", "auto"},
.skipPreLaunchUI {"backend.skipPreLaunchUI", false},
.showPipelineCompilation {"backend.showPipelineCompilation", false},
@@ -122,9 +125,6 @@ UserSettings g_userSettings = {
.checkForUpdates {"backend.checkForUpdates", true},
.cardFileType {"backend.cardFileType", static_cast<int>(CARD_GCIFOLDER)},
.enableAdvancedSettings {"backend.enableAdvancedSettings", false},
#if DUSK_TPHD
.hdContentPath {"backend.hdContentPath", ""},
#endif
}
};
@@ -221,6 +221,9 @@ void registerSettings() {
Register(g_userSettings.backend.isoPath);
Register(g_userSettings.backend.isoVerification);
#if DUSK_TPHD
Register(g_userSettings.backend.hdContentPath);
#endif
Register(g_userSettings.backend.graphicsBackend);
Register(g_userSettings.backend.skipPreLaunchUI);
Register(g_userSettings.backend.showPipelineCompilation);
@@ -229,9 +232,6 @@ void registerSettings() {
Register(g_userSettings.backend.checkForUpdates);
Register(g_userSettings.backend.cardFileType);
Register(g_userSettings.backend.enableAdvancedSettings);
#if DUSK_TPHD
Register(g_userSettings.backend.hdContentPath);
#endif
}
// Transient settings
+7 -3
View File
@@ -504,9 +504,8 @@ void folder_dialog_callback(void*, const char* path, const char* error) {
return;
}
state.selectedHdContentPath = path;
state.errorString.clear();
getSettings().backend.hdContentPath.setValue(state.selectedHdContentPath);
state.configuredHdContentPath = path;
getSettings().backend.hdContentPath.setValue(path);
config::Save();
}
@@ -645,6 +644,8 @@ void ensure_initialized() noexcept {
state.activeDiscPath = state.configuredDiscPath;
state.configuredDiscValidation =
verification_from_config(getSettings().backend.isoVerification.getValue());
state.configuredHdContentPath = getSettings().backend.hdContentPath;
state.activeHdContentPath = state.configuredHdContentPath;
state.initialLanguage = getSettings().game.language;
state.initialGraphicsBackend = getSettings().backend.graphicsBackend;
state.initialCardFileType = getSettings().backend.cardFileType;
@@ -669,6 +670,9 @@ bool is_restart_pending() noexcept {
if (!state.activeDiscPath.empty() && state.configuredDiscPath != state.activeDiscPath) {
return true;
}
if (state.configuredHdContentPath != state.activeHdContentPath) {
return true;
}
if (getSettings().backend.graphicsBackend.getValue() != state.initialGraphicsBackend) {
return true;
}
+2 -2
View File
@@ -47,8 +47,8 @@ struct PrelaunchState {
iso::ValidationError configuredDiscValidation = iso::ValidationError::Unknown;
std::string activeDiscPath;
iso::DiscInfo activeDiscInfo{};
std::string initialHdContentPath;
std::string selectedHdContentPath;
std::string configuredHdContentPath;
std::string activeHdContentPath;
GameLanguage initialLanguage = GameLanguage::English;
std::string initialGraphicsBackend;
int initialCardFileType = 0;
+32
View File
@@ -336,6 +336,38 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
pane.add_rml("Set the disc image that Dusk uses to launch the game.<br/><br/>"
"Changes require a restart.");
});
#if DUSK_TPHD
leftPane.register_control(
leftPane
.add_select_button({
.key = "TPHD Content",
.getValue =
[] {
const auto& path = prelaunch_state().configuredHdContentPath;
std::string display;
if (path.empty()) {
display = "(none)";
} else {
display = std::filesystem::path(path).string();
if (display.empty()) {
display = path;
}
}
return display;
},
.isModified =
[] {
const auto& state = prelaunch_state();
const auto& active = state.activeHdContentPath;
return !active.empty() && state.configuredHdContentPath != active;
},
})
.on_pressed([] { open_folder_picker(); }),
rightPane, [](Pane& pane) {
pane.add_rml("Set the directory that Dusk loads eligible TPHD content from."
"<br/><br/>Changes require a restart.");
});
#endif
leftPane.register_control(
leftPane.add_select_button({
.key = "Language",