mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Enable D3D exclusive fullscreen by default
This commit is contained in:
parent
14a1872674
commit
670790a023
@ -22,9 +22,9 @@ namespace Bloxstrap.Singletons
|
|||||||
public static IReadOnlyDictionary<string, string> RenderingModes => new Dictionary<string, string>
|
public static IReadOnlyDictionary<string, string> RenderingModes => new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "Automatic", "" },
|
{ "Automatic", "" },
|
||||||
|
{ "Vulkan", "FFlagDebugGraphicsPreferVulkan" },
|
||||||
{ "Direct3D 11", "FFlagDebugGraphicsPreferD3D11" },
|
{ "Direct3D 11", "FFlagDebugGraphicsPreferD3D11" },
|
||||||
{ "Direct3D 10", "FFlagDebugGraphicsPreferD3D11FL10" },
|
{ "Direct3D 10", "FFlagDebugGraphicsPreferD3D11FL10" },
|
||||||
{ "Vulkan", "FFlagDebugGraphicsPreferVulkan" },
|
|
||||||
{ "OpenGL", "FFlagDebugGraphicsPreferOpenGL" }
|
{ "OpenGL", "FFlagDebugGraphicsPreferOpenGL" }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,6 +101,22 @@ namespace Bloxstrap.Singletons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this will set the flag to the corresponding value if the condition is true
|
||||||
|
// if the condition is not true, the flag will be erased
|
||||||
|
public void SetValueIf(bool condition, string key, object? value)
|
||||||
|
{
|
||||||
|
if (condition)
|
||||||
|
SetValue(key, value);
|
||||||
|
else if (GetValue(key) is not null)
|
||||||
|
SetValue(key, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetValueOnce(string key, object? value)
|
||||||
|
{
|
||||||
|
if (GetValue(key) is null)
|
||||||
|
SetValue(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
// this returns null if the fflag doesn't exist
|
// this returns null if the fflag doesn't exist
|
||||||
public string? GetValue(string key)
|
public string? GetValue(string key)
|
||||||
{
|
{
|
||||||
@ -114,42 +130,13 @@ namespace Bloxstrap.Singletons
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderingMode(string value)
|
|
||||||
{
|
|
||||||
foreach (var mode in RenderingModes)
|
|
||||||
{
|
|
||||||
if (mode.Key != "Automatic")
|
|
||||||
SetValue(mode.Value, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value != "Automatic")
|
|
||||||
SetValue(RenderingModes[value], "True");
|
|
||||||
|
|
||||||
if (value == "Vulkan")
|
|
||||||
SetValue("FFlagRenderVulkanFixMinimizeWindow", "True");
|
|
||||||
else if (GetValue("FFlagRenderVulkanFixMinimizeWindow") is not null)
|
|
||||||
SetValue("FFlagRenderVulkanFixMinimizeWindow", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load();
|
||||||
|
|
||||||
// set to 9999 by default if it doesnt already exist
|
// set to 9999 by default if it doesnt already exist
|
||||||
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
|
SetValueOnce("DFIntTaskSchedulerTargetFps", 9999);
|
||||||
SetValue("DFIntTaskSchedulerTargetFps", 9999);
|
SetValueOnce("FFlagHandleAltEnterFullscreenManually", "False");
|
||||||
|
|
||||||
if (GetValue("FFlagDebugGraphicsPreferVulkan") == "True" && GetValue("FFlagRenderVulkanFixMinimizeWindow") is null)
|
|
||||||
SetValue("FFlagRenderVulkanFixMinimizeWindow", "True");
|
|
||||||
|
|
||||||
// exclusive fullscreen requires direct3d 10/11 to work
|
|
||||||
if (App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False")
|
|
||||||
{
|
|
||||||
if (!(App.FastFlags.GetValue("FFlagDebugGraphicsPreferD3D11") == "True" || App.FastFlags.GetValue("FFlagDebugGraphicsPreferD3D11FL10") == "True"))
|
|
||||||
{
|
|
||||||
SetRenderingMode("Direct3D 11");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
|
@ -40,26 +40,19 @@ namespace Bloxstrap.UI.Menu.ViewModels
|
|||||||
return "Automatic";
|
return "Automatic";
|
||||||
}
|
}
|
||||||
|
|
||||||
set => App.FastFlags.SetRenderingMode(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this flag has to be set to false to work, weirdly enough
|
|
||||||
public bool ExclusiveFullscreenEnabled
|
|
||||||
{
|
|
||||||
get => App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False";
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
App.FastFlags.SetValue("FFlagHandleAltEnterFullscreenManually", value ? "False" : null);
|
foreach (var mode in RenderingModes)
|
||||||
|
|
||||||
if (value)
|
|
||||||
{
|
{
|
||||||
if (!(App.FastFlags.GetValue("FFlagDebugGraphicsPreferD3D11") == "True" || App.FastFlags.GetValue("FFlagDebugGraphicsPreferD3D11FL10") == "True"))
|
if (mode.Key != "Automatic")
|
||||||
{
|
App.FastFlags.SetValue(mode.Value, null);
|
||||||
App.FastFlags.SetRenderingMode("Direct3D 11");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnPropertyChanged(nameof(SelectedRenderingMode));
|
if (value == "Automatic")
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
App.FastFlags.SetValue(RenderingModes[value], "True");
|
||||||
|
App.FastFlags.SetValueIf(value == "Vulkan", "FFlagRenderVulkanFixMinimizeWindow", "True");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,15 +98,6 @@
|
|||||||
</ui:CardControl.Header>
|
</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}" />
|
<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>
|
||||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
|
||||||
<ui:CardControl.Header>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock FontSize="14" Text="Enable exclusive fullscreen" />
|
|
||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Enables using Alt + Enter to enter exclusive fullscreen. This will force enable Direct3D." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardControl.Header>
|
|
||||||
<ui:ToggleSwitch IsChecked="{Binding ExclusiveFullscreenEnabled, Mode=TwoWay}" />
|
|
||||||
</ui:CardControl>
|
|
||||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
Loading…
Reference in New Issue
Block a user