From c5d46f5d46b0e438fe1316107f60ee3320f1faf3 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 13 Apr 2023 21:04:54 +0200 Subject: [PATCH] Change how default flag values are handled they're now all handled before they're saved/loaded --- Bloxstrap/App.xaml.cs | 3 --- Bloxstrap/Helpers/FastFlagManager.cs | 4 ++++ Bloxstrap/Helpers/Updater.cs | 8 -------- Bloxstrap/ViewModels/ModsViewModel.cs | 9 +++------ Bloxstrap/Views/Pages/ModsPage.xaml.cs | 3 +-- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index bc11e55..faf6167 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -173,9 +173,6 @@ namespace Bloxstrap BaseDirectory = Path.Combine(Directories.LocalAppData, ProjectName); InitLog(); - // we have reshade enabled by default so we need this - FastFlags.SetRenderingMode("Direct3D 11"); - if (!IsQuiet) { IsSetupComplete = false; diff --git a/Bloxstrap/Helpers/FastFlagManager.cs b/Bloxstrap/Helpers/FastFlagManager.cs index 170e6b9..a4ab45f 100644 --- a/Bloxstrap/Helpers/FastFlagManager.cs +++ b/Bloxstrap/Helpers/FastFlagManager.cs @@ -72,6 +72,10 @@ namespace Bloxstrap.Helpers // set to 9999 by default if it doesnt already exist if (GetValue("DFIntTaskSchedulerTargetFps") is null) SetValue("DFIntTaskSchedulerTargetFps", 9999); + + // reshade / exclusive fullscreen requires direct3d 11 to work + if (GetValue(RenderingModes["Direct3D 11"]) != "True" && (App.Settings.Prop.UseReShade || App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False")) + SetRenderingMode("Direct3D 11"); } public override void Save() diff --git a/Bloxstrap/Helpers/Updater.cs b/Bloxstrap/Helpers/Updater.cs index c36636e..c9c1ebe 100644 --- a/Bloxstrap/Helpers/Updater.cs +++ b/Bloxstrap/Helpers/Updater.cs @@ -78,14 +78,6 @@ namespace Bloxstrap.Helpers Bootstrapper.Register(); - // update check: if we're upgrading to v2.1.0 and have reshade enabled, - // we need to set our renderer to direct3d 11 - if (App.Settings.Prop.UseReShade && App.FastFlags.GetValue(FastFlagManager.RenderingModes["Direct3D 11"]) is null) - { - App.FastFlags.SetRenderingMode("Direct3D 11"); - App.FastFlags.Save(); - } - if (isAutoUpgrade) { NotifyIcon notification = new() diff --git a/Bloxstrap/ViewModels/ModsViewModel.cs b/Bloxstrap/ViewModels/ModsViewModel.cs index 10f9b1a..db8b2f7 100644 --- a/Bloxstrap/ViewModels/ModsViewModel.cs +++ b/Bloxstrap/ViewModels/ModsViewModel.cs @@ -15,10 +15,7 @@ namespace Bloxstrap.ViewModels public ICommand OpenModsFolderCommand => new RelayCommand(OpenModsFolder); - private void OpenModsFolder() - { - Process.Start("explorer.exe", Directories.Modifications); - } + private void OpenModsFolder() => Process.Start("explorer.exe", Directories.Modifications); public bool OldDeathSoundEnabled { @@ -43,7 +40,7 @@ namespace Bloxstrap.ViewModels public int FramerateLimit { get => Int32.TryParse(App.FastFlags.GetValue("DFIntTaskSchedulerTargetFps"), out int x) ? x : 60; - set => App.FastFlags.Changes["DFIntTaskSchedulerTargetFps"] = value; + set => App.FastFlags.SetValue("DFIntTaskSchedulerTargetFps", value); } public string SelectedRenderingMode @@ -68,7 +65,7 @@ namespace Bloxstrap.ViewModels get => App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False"; set { - App.FastFlags.SetValue("FFlagHandleAltEnterFullscreenManually", value ? false : null); + App.FastFlags.SetValue("FFlagHandleAltEnterFullscreenManually", value ? "False" : null); if (value) { diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml.cs b/Bloxstrap/Views/Pages/ModsPage.xaml.cs index 76fd5c3..704448e 100644 --- a/Bloxstrap/Views/Pages/ModsPage.xaml.cs +++ b/Bloxstrap/Views/Pages/ModsPage.xaml.cs @@ -13,8 +13,7 @@ namespace Bloxstrap.Views.Pages { public ModsPage() { - if (!App.IsFirstRun) - App.FastFlags.Load(); + App.FastFlags.Load(); DataContext = new ModsViewModel(); InitializeComponent();