From a7f0b140810b338d6ea4103ba837ea9c6e214947 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 27 Apr 2023 12:14:25 +0100 Subject: [PATCH] Add selector between Voxel and Future lighting --- Bloxstrap/Singletons/FastFlagManager.cs | 11 +++++++-- Bloxstrap/ViewModels/ModsViewModel.cs | 31 +++++++++++++++++++++---- Bloxstrap/Views/Pages/ModsPage.xaml | 6 ++--- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Bloxstrap/Singletons/FastFlagManager.cs b/Bloxstrap/Singletons/FastFlagManager.cs index ff3106a..08d801a 100644 --- a/Bloxstrap/Singletons/FastFlagManager.cs +++ b/Bloxstrap/Singletons/FastFlagManager.cs @@ -20,8 +20,15 @@ namespace Bloxstrap.Singletons { { "Automatic", "" }, { "Direct3D 11", "FFlagDebugGraphicsPreferD3D11" }, - { "OpenGL", "FFlagDebugGraphicsPreferOpenGL" }, - { "Vulkan", "FFlagDebugGraphicsPreferVulkan" } + { "Vulkan", "FFlagDebugGraphicsPreferVulkan" }, + { "OpenGL", "FFlagDebugGraphicsPreferOpenGL" } + }; + + public static IReadOnlyDictionary LightingTechnologies => new Dictionary + { + { "Automatic", "" }, + { "Voxel", "DFFlagDebugRenderForceTechnologyVoxel" }, + { "Future Is Bright", "FFlagDebugForceFutureIsBrightPhase3" } }; // this is one hell of a variable definition lmao diff --git a/Bloxstrap/ViewModels/ModsViewModel.cs b/Bloxstrap/ViewModels/ModsViewModel.cs index 81e3efd..828b944 100644 --- a/Bloxstrap/ViewModels/ModsViewModel.cs +++ b/Bloxstrap/ViewModels/ModsViewModel.cs @@ -127,11 +127,34 @@ namespace Bloxstrap.ViewModels get => App.Settings.Prop.DisableFullscreenOptimizations; set => App.Settings.Prop.DisableFullscreenOptimizations = value; } - - public bool ForceFutureEnabled + + public IReadOnlyDictionary LightingTechnologies => FastFlagManager.LightingTechnologies; + + // this is basically the same as the code for rendering selection, maybe this could be abstracted in some way? + public string SelectedLightingTechnology { - get => App.FastFlags.GetValue("FFlagDebugForceFutureIsBrightPhase3") == "True"; - set => App.FastFlags.SetValue("FFlagDebugForceFutureIsBrightPhase3", value ? "True" : null); + get + { + foreach (var mode in LightingTechnologies) + { + if (App.FastFlags.GetValue(mode.Value) == "True") + return mode.Key; + } + + return "Automatic"; + } + + set + { + foreach (var mode in LightingTechnologies) + { + if (mode.Key != "Automatic") + App.FastFlags.SetValue(mode.Value, null); + } + + if (value != "Automatic") + App.FastFlags.SetValue(LightingTechnologies[value], "True"); + } } } } diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml b/Bloxstrap/Views/Pages/ModsPage.xaml index c89642f..24efc0e 100644 --- a/Bloxstrap/Views/Pages/ModsPage.xaml +++ b/Bloxstrap/Views/Pages/ModsPage.xaml @@ -154,11 +154,11 @@ - - + + - +