Add debug flags, fix mod preset bug

This commit is contained in:
pizzaboxer 2023-07-15 10:53:17 +01:00
parent 258746f5fa
commit d8842cc0cc
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
5 changed files with 88 additions and 13 deletions

View File

@ -1110,22 +1110,26 @@ namespace Bloxstrap
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<byte>() : 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<byte>() : 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)

View File

@ -9,8 +9,8 @@ namespace Bloxstrap.Extensions
public static IReadOnlyDictionary<string, CursorType> Selections => new Dictionary<string, CursorType>
{
{ "Default", CursorType.Default },
{ "Before 2022", CursorType.From2013 },
{ "Before 2013", CursorType.From2006 },
{ "2013 - 2022", CursorType.From2013 },
{ "2006 - 2013", CursorType.From2006 },
};
}
}

View File

@ -15,6 +15,7 @@ namespace Bloxstrap.Models
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;

View File

@ -41,6 +41,37 @@
</StackPanel>
</ui:CardAction>
<StackPanel Visibility="{Binding ShowDebugFlags, Mode=OneTime}">
<TextBlock Text="Debug" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="HTTP request logging" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Enables logging of HTTP requests (DFLogHttpTraceLight=12)." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding HttpRequestLogging, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="HTTP proxy address" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Set blank if not using a proxy. Don't forget to add cacert.pem as a mod." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:TextBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" Text="{Binding HttpRequestProxy, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Flag state overlay" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Show values of specified flags during runtime. Each flag is comma separated." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:TextBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" Text="{Binding StateOverlayFlags, Mode=TwoWay}" />
</ui:CardControl>
</StackPanel>
<TextBlock Text="Presets" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>

View File

@ -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 @@ namespace Bloxstrap.UI.ViewModels.Menu
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 @@ namespace Bloxstrap.UI.ViewModels.Menu
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");
}
}