mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-19 14:30:29 -04:00
Re-add settings options and other misc changes
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user