Add FFlag mod preset for menu versions

This commit is contained in:
pizzaboxer 2023-04-14 23:18:24 +01:00
parent 3927d58290
commit eafce44bad
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
3 changed files with 87 additions and 4 deletions

View File

@ -16,7 +16,7 @@ namespace Bloxstrap.Helpers
public Dictionary<string, object?> Changes = new();
// only one missing here is Metal because lol
public static IReadOnlyDictionary<string, string> RenderingModes { get; set; } = new Dictionary<string, string>()
public static IReadOnlyDictionary<string, string> RenderingModes => new Dictionary<string, string>
{
{ "Automatic", "" },
{ "Direct3D 11", "FFlagDebugGraphicsPreferD3D11" },
@ -24,11 +24,51 @@ namespace Bloxstrap.Helpers
{ "Vulkan", "FFlagDebugGraphicsPreferVulkan" }
};
// this is one hell of a variable definition lmao
public static IReadOnlyDictionary<string, Dictionary<string, string?>> IGMenuVersions => new Dictionary<string, Dictionary<string, string?>>
{
{
"Default",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", null },
{ "FFlagEnableInGameMenuV3", null }
}
},
{
"Version 1 (2015)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "True" },
{ "FFlagEnableInGameMenuV3", "False" }
}
},
{
"Version 2 (2020)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "False" },
{ "FFlagEnableInGameMenuV3", "False" }
}
},
{
"Version 3 (2021)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "False" },
{ "FFlagEnableInGameMenuV3", "True" }
}
}
};
// all fflags are stored as strings
// to delete a flag, set the value as null
public void SetValue(string key, object? value)
{
if (value == null)
if (value is null)
{
Changes[key] = null;
App.Logger.WriteLine($"[FastFlagManager::SetValue] Deletion of '{key}' is pending");

View File

@ -35,14 +35,14 @@ namespace Bloxstrap.ViewModels
set => App.Settings.Prop.UseDisableAppPatch = value;
}
public IReadOnlyDictionary<string, string> RenderingModes => FastFlagManager.RenderingModes;
public int FramerateLimit
{
get => Int32.TryParse(App.FastFlags.GetValue("DFIntTaskSchedulerTargetFps"), out int x) ? x : 60;
set => App.FastFlags.SetValue("DFIntTaskSchedulerTargetFps", value);
}
public IReadOnlyDictionary<string, string> RenderingModes => FastFlagManager.RenderingModes;
public string SelectedRenderingMode
{
get
@ -75,6 +75,39 @@ namespace Bloxstrap.ViewModels
}
}
public IReadOnlyDictionary<string, Dictionary<string, string?>> IGMenuVersions => FastFlagManager.IGMenuVersions;
public string SelectedIGMenuVersion
{
get
{
// yeah this kinda sucks
foreach (var version in IGMenuVersions)
{
bool flagsMatch = true;
foreach (var flag in version.Value)
{
if (App.FastFlags.GetValue(flag.Key) != flag.Value)
flagsMatch = false;
}
if (flagsMatch)
return version.Key;
}
return "Default";
}
set
{
foreach (var flag in IGMenuVersions[value])
{
App.FastFlags.SetValue(flag.Key, flag.Value);
}
}
}
public bool AlternateGraphicsSelectorEnabled
{
get => App.FastFlags.GetValue("FFlagFixGraphicsQuality") == "True";

View File

@ -101,6 +101,7 @@
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ui:CardControl Grid.Row="0" Margin="0,8,0,0" Padding="16,13,16,12">
@ -139,6 +140,15 @@
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding AlternateGraphicsSelectorEnabled, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Grid.Row="4" Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="In-game menu version" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which version of the in-game menu to use. Current default is v1." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding IGMenuVersions.Keys, Mode=OneTime}" Text="{Binding SelectedIGMenuVersion, Mode=TwoWay}" />
</ui:CardControl>
</Grid>
<StackPanel x:Name="MiscellaneousOptions">