From d8842cc0ccaf16b30a1a6edc507d9a2c672300b0 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 15 Jul 2023 10:53:17 +0100 Subject: [PATCH] Add debug flags, fix mod preset bug --- Bloxstrap/Bootstrapper.cs | 18 ++++--- Bloxstrap/Extensions/CursorTypeEx.cs | 4 +- Bloxstrap/Models/Settings.cs | 1 + .../UI/Elements/Menu/Pages/FastFlagsPage.xaml | 31 ++++++++++++ .../UI/ViewModels/Menu/FastFlagsViewModel.cs | 47 +++++++++++++++++-- 5 files changed, 88 insertions(+), 13 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 16059f88..98e21396 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1110,22 +1110,26 @@ private async Task ApplyModifications() private static async Task CheckModPreset(bool condition, string location, string name) { string fullLocation = Path.Combine(Directories.Modifications, location); - byte[] embeddedData = string.IsNullOrEmpty(name) ? Array.Empty() : await Resource.Get(name); - string fileHash = File.Exists(fullLocation) ? Utility.MD5Hash.FromFile(fullLocation) : ""; + + if (!condition) + { + if (fileHash != "") + File.Delete(fullLocation); + + return; + } + + byte[] embeddedData = string.IsNullOrEmpty(name) ? Array.Empty() : await Resource.Get(name); string embeddedHash = Utility.MD5Hash.FromBytes(embeddedData); - if (condition && fileHash != embeddedHash) + if (fileHash != embeddedHash) { Directory.CreateDirectory(Path.GetDirectoryName(fullLocation)!); File.Delete(fullLocation); await File.WriteAllBytesAsync(fullLocation, embeddedData); } - else if (!condition && fileHash != "") - { - File.Delete(fullLocation); - } } private async Task DownloadPackage(Package package) diff --git a/Bloxstrap/Extensions/CursorTypeEx.cs b/Bloxstrap/Extensions/CursorTypeEx.cs index 3afe6926..d2ba437b 100644 --- a/Bloxstrap/Extensions/CursorTypeEx.cs +++ b/Bloxstrap/Extensions/CursorTypeEx.cs @@ -9,8 +9,8 @@ static class CursorTypeEx public static IReadOnlyDictionary Selections => new Dictionary { { "Default", CursorType.Default }, - { "Before 2022", CursorType.From2013 }, - { "Before 2013", CursorType.From2006 }, + { "2013 - 2022", CursorType.From2013 }, + { "2006 - 2013", CursorType.From2006 }, }; } } diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index 604e3c20..104509f3 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -15,6 +15,7 @@ public class Settings public bool CheckForUpdates { get; set; } = true; public bool CreateDesktopIcon { get; set; } = true; public bool MultiInstanceLaunching { get; set; } = false; + public bool OhHeyYouFoundMe { get; set; } = false; // channel configuration public string Channel { get; set; } = RobloxDeployment.DefaultChannel; diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml index 5fa2d850..5a49eaf1 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml @@ -41,6 +41,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs index 566324ce..f1a17061 100644 --- a/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs @@ -1,6 +1,9 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel; using System.IO; +using System.Linq; +using System.Windows; using System.Windows.Input; using CommunityToolkit.Mvvm.Input; @@ -16,6 +19,42 @@ public class FastFlagsViewModel : INotifyPropertyChanged private void OpenClientSettings() => Utilities.ShellExecute(Path.Combine(Directories.Modifications, "ClientSettings\\ClientAppSettings.json")); + public Visibility ShowDebugFlags => App.Settings.Prop.OhHeyYouFoundMe ? Visibility.Visible : Visibility.Collapsed; + + public bool HttpRequestLogging + { + get => App.FastFlags.GetValue("DFLogHttpTraceLight") is not null; + set => App.FastFlags.SetValue("DFLogHttpTraceLight", value ? 12 : null); + } + + public string HttpRequestProxy + { + get => App.FastFlags.GetValue("DFStringDebugPlayerHttpProxyUrl") ?? ""; + + set + { + bool? boolValue = null; + string? stringValue = null; + + if (!String.IsNullOrEmpty(value)) + { + boolValue = true; + stringValue = value; + } + + App.FastFlags.SetValue("DFFlagDebugEnableHttpProxy", boolValue); + App.FastFlags.SetValue("DFStringDebugPlayerHttpProxyUrl", stringValue); + App.FastFlags.SetValue("DFStringHttpCurlProxyHostAndPort", stringValue); + App.FastFlags.SetValue("DFStringHttpCurlProxyHostAndPortForExternalUrl", stringValue); + } + } + + public string StateOverlayFlags + { + get => App.FastFlags.GetValue("FStringDebugShowFlagState") ?? ""; + set => App.FastFlags.SetValue("FStringDebugShowFlagState", String.IsNullOrEmpty(value) ? null : value); + } + public int FramerateLimit { get => int.TryParse(App.FastFlags.GetValue("DFIntTaskSchedulerTargetFps"), out int x) ? x : 60; @@ -111,18 +150,18 @@ public string SelectedLightingTechnology return mode.Key; } - return "Automatic"; + return LightingTechnologies.First().Key; } set { foreach (var mode in LightingTechnologies) { - if (mode.Key != "Automatic") + if (mode.Key != LightingTechnologies.First().Key) App.FastFlags.SetValue(mode.Value, null); } - if (value != "Automatic") + if (value != LightingTechnologies.First().Key) App.FastFlags.SetValue(LightingTechnologies[value], "True"); } }