Skip to content

Commit

Permalink
Add option to force MSAA samples (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 29, 2023
1 parent bfe32ab commit 92aaa86
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Bloxstrap/FastFlagManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class FastFlagManager : JsonManager<Dictionary<string, object>>
{ "Rendering.ManualFullscreen", "FFlagHandleAltEnterFullscreenManually" },
{ "Rendering.TexturePack", "FStringPartTexturePackTable2022" },
{ "Rendering.DisableScaling", "DFFlagDisableDPIScale" },
{ "Rendering.MSAA", "FIntDebugForceMSAASamples" },

{ "Rendering.Mode.D3D11", "FFlagDebugGraphicsPreferD3D11" },
{ "Rendering.Mode.D3D10", "FFlagDebugGraphicsPreferD3D11FL10" },
Expand Down Expand Up @@ -61,6 +62,15 @@ public class FastFlagManager : JsonManager<Dictionary<string, object>>
{ "Future (Phase 3)", "Future" }
};

public static IReadOnlyDictionary<string, string?> MSAAModes => new Dictionary<string, string?>
{
{ "Automatic", null },
{ "1x MSAA", "1" },
{ "2x MSAA", "2" },
{ "4x MSAA", "4" },
{ "8x MSAA", "8" }
};

// this is one hell of a dictionary definition lmao
// since these all set the same flags, wouldn't making this use bitwise operators be better?
public static IReadOnlyDictionary<string, Dictionary<string, string?>> IGMenuVersions => new Dictionary<string, Dictionary<string, string?>>
Expand Down Expand Up @@ -118,7 +128,7 @@ public void SetValue(string key, object? value)
else
{
if (Prop.ContainsKey(key))
App.Logger.WriteLine(LOG_IDENT, $"Setting of '{key}' from '{Prop[key]}' to '{value}' is pending");
App.Logger.WriteLine(LOG_IDENT, $"Changing of '{key}' from '{Prop[key]}' to '{value}' is pending");
else
App.Logger.WriteLine(LOG_IDENT, $"Setting of '{key}' to '{value}' is pending");

Expand Down
9 changes: 9 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@
</ui:CardControl.Header>
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding RenderingModes.Keys, Mode=OneTime}" Text="{Binding SelectedRenderingMode, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Antialiasing quality" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Forces the amount of MSAA samples that are taken." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding MSAAModes.Keys, Mode=OneTime}" Text="{Binding SelectedMSAAMode, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0">
<ui:CardControl.Header>
<StackPanel>
Expand Down
8 changes: 8 additions & 0 deletions Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ public string SelectedLightingMode
set => App.FastFlags.SetPresetEnum("Rendering.Lighting", LightingModes[value], "True");
}

public IReadOnlyDictionary<string, string?> MSAAModes => FastFlagManager.MSAAModes;

public string SelectedMSAAMode
{
get => MSAAModes.First(x => x.Value == App.FastFlags.GetPreset("Rendering.MSAA")).Key ?? MSAAModes.First().Key;
set => App.FastFlags.SetPreset("Rendering.MSAA", MSAAModes[value]);
}

public bool GuiHidingEnabled
{
get => App.FastFlags.GetPreset("UI.Hide") == "32380007";
Expand Down

0 comments on commit 92aaa86

Please sign in to comment.