Add disabling fullscreen optimizations (#98)

This commit is contained in:
pizzaboxer 2023-03-09 11:02:58 +00:00
parent 4050b1c2e6
commit db21afaaeb
5 changed files with 68 additions and 1 deletions

View File

@ -704,6 +704,21 @@ namespace Bloxstrap
// and also to delete our old version folder // and also to delete our old version folder
Directory.Delete(oldVersionFolder, true); Directory.Delete(oldVersionFolder, true);
} }
// move old compatibility flags for the old location
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
{
string oldGameClientLocation = Path.Combine(oldVersionFolder, "RobloxPlayerBeta.exe");
string newGameClientLocation = Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
string? appFlags = (string?)appFlagsKey.GetValue(oldGameClientLocation);
if (appFlags is not null)
{
App.Logger.WriteLine($"[Bootstrapper::InstallLatestVersion] Migrating app compatibility flags from {oldGameClientLocation} to {newGameClientLocation}...");
appFlagsKey.SetValue(newGameClientLocation, appFlags);
appFlagsKey.DeleteValue(oldGameClientLocation);
}
}
} }
if (Dialog is not null) if (Dialog is not null)
@ -718,6 +733,30 @@ namespace Bloxstrap
{ {
SetStatus("Applying Roblox modifications..."); SetStatus("Applying Roblox modifications...");
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
{
const string flag = " DISABLEDXMAXIMIZEDWINDOWEDMODE";
string gameClientLocation = Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
string? appFlags = (string?)appFlagsKey.GetValue(gameClientLocation);
if (App.Settings.Prop.DisableFullscreenOptimizations)
{
if (appFlags is null)
appFlagsKey.SetValue(gameClientLocation, $"~{flag}");
else if (!appFlags.Contains(flag))
appFlagsKey.SetValue(gameClientLocation, appFlags + flag);
}
else if (appFlags is not null && appFlags.Contains(flag))
{
// if there's more than one space, there's more flags set we need to preserve
if (appFlags.Split(' ').Length > 2)
appFlagsKey.SetValue(gameClientLocation, appFlags.Remove(appFlags.IndexOf(flag), flag.Length));
else
appFlagsKey.DeleteValue(gameClientLocation);
}
}
// handle file mods
string modFolder = Path.Combine(Directories.Modifications); string modFolder = Path.Combine(Directories.Modifications);
// manifest has been moved to State.json // manifest has been moved to State.json

View File

@ -36,5 +36,6 @@ namespace Bloxstrap.Models
public bool UseOldDeathSound { get; set; } = true; public bool UseOldDeathSound { get; set; } = true;
public bool UseOldMouseCursor { get; set; } = false; public bool UseOldMouseCursor { get; set; } = false;
public bool UseDisableAppPatch { get; set; } = false; public bool UseDisableAppPatch { get; set; } = false;
public bool DisableFullscreenOptimizations { get; set; } = false;
} }
} }

View File

@ -31,5 +31,11 @@ namespace Bloxstrap.ViewModels
get => App.Settings.Prop.UseDisableAppPatch; get => App.Settings.Prop.UseDisableAppPatch;
set => App.Settings.Prop.UseDisableAppPatch = value; set => App.Settings.Prop.UseDisableAppPatch = value;
} }
public bool DisableFullscreenOptimizationsEnabled
{
get => App.Settings.Prop.DisableFullscreenOptimizations;
set => App.Settings.Prop.DisableFullscreenOptimizations = value;
}
} }
} }

View File

@ -93,5 +93,20 @@
<ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" /> <ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" />
</ui:CardControl> </ui:CardControl>
</Grid> </Grid>
<StackPanel x:Name="MiscellaneousOptions">
<TextBlock Text="Miscellaneous" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Disable full-screen optimizations" />
<TextBlock Margin="0,2,0,0" FontSize="12" Foreground="{DynamicResource TextFillColorTertiaryBrush}">
A Windows feature that can potentially cause problems - <Hyperlink Foreground="{DynamicResource TextFillColorPrimaryBrush}" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://devblogs.microsoft.com/directx/demystifying-full-screen-optimizations/">see more info.</Hyperlink>.
</TextBlock>
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding DisableFullscreenOptimizationsEnabled, Mode=TwoWay}" />
</ui:CardControl>
</StackPanel>
</StackPanel> </StackPanel>
</ui:UiPage> </ui:UiPage>

View File

@ -1,4 +1,6 @@
using Bloxstrap.ViewModels; using System;
using System.Windows;
using Bloxstrap.ViewModels;
namespace Bloxstrap.Views.Pages namespace Bloxstrap.Views.Pages
{ {
@ -11,6 +13,10 @@ namespace Bloxstrap.Views.Pages
{ {
DataContext = new ModsViewModel(); DataContext = new ModsViewModel();
InitializeComponent(); InitializeComponent();
// fullscreen optimizations were only added in windows 10 build 17093
if (Environment.OSVersion.Version.Build < 17093)
this.MiscellaneousOptions.Visibility = Visibility.Collapsed;
} }
} }
} }