From db21afaaeb4323ea7606133c5968a7b2d45f6d4c Mon Sep 17 00:00:00 2001
From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com>
Date: Thu, 9 Mar 2023 11:02:58 +0000
Subject: [PATCH] Add disabling fullscreen optimizations (#98)
---
Bloxstrap/Bootstrapper.cs | 39 ++++++++++++++++++++++++++
Bloxstrap/Models/Settings.cs | 1 +
Bloxstrap/ViewModels/ModsViewModel.cs | 6 ++++
Bloxstrap/Views/Pages/ModsPage.xaml | 15 ++++++++++
Bloxstrap/Views/Pages/ModsPage.xaml.cs | 8 +++++-
5 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs
index 2150dc4..39fa664 100644
--- a/Bloxstrap/Bootstrapper.cs
+++ b/Bloxstrap/Bootstrapper.cs
@@ -704,6 +704,21 @@ namespace Bloxstrap
// and also to delete our old version folder
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)
@@ -718,6 +733,30 @@ namespace Bloxstrap
{
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);
// manifest has been moved to State.json
diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs
index bb88641..a9d34f3 100644
--- a/Bloxstrap/Models/Settings.cs
+++ b/Bloxstrap/Models/Settings.cs
@@ -36,5 +36,6 @@ namespace Bloxstrap.Models
public bool UseOldDeathSound { get; set; } = true;
public bool UseOldMouseCursor { get; set; } = false;
public bool UseDisableAppPatch { get; set; } = false;
+ public bool DisableFullscreenOptimizations { get; set; } = false;
}
}
diff --git a/Bloxstrap/ViewModels/ModsViewModel.cs b/Bloxstrap/ViewModels/ModsViewModel.cs
index 83eee29..fc35091 100644
--- a/Bloxstrap/ViewModels/ModsViewModel.cs
+++ b/Bloxstrap/ViewModels/ModsViewModel.cs
@@ -31,5 +31,11 @@ namespace Bloxstrap.ViewModels
get => App.Settings.Prop.UseDisableAppPatch;
set => App.Settings.Prop.UseDisableAppPatch = value;
}
+
+ public bool DisableFullscreenOptimizationsEnabled
+ {
+ get => App.Settings.Prop.DisableFullscreenOptimizations;
+ set => App.Settings.Prop.DisableFullscreenOptimizations = value;
+ }
}
}
diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml b/Bloxstrap/Views/Pages/ModsPage.xaml
index 16a7074..3d52339 100644
--- a/Bloxstrap/Views/Pages/ModsPage.xaml
+++ b/Bloxstrap/Views/Pages/ModsPage.xaml
@@ -93,5 +93,20 @@
+
+
+
+
+
+
+
+
+ A Windows feature that can potentially cause problems - see more info..
+
+
+
+
+
+
diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml.cs b/Bloxstrap/Views/Pages/ModsPage.xaml.cs
index 73fc1ab..210eb15 100644
--- a/Bloxstrap/Views/Pages/ModsPage.xaml.cs
+++ b/Bloxstrap/Views/Pages/ModsPage.xaml.cs
@@ -1,4 +1,6 @@
-using Bloxstrap.ViewModels;
+using System;
+using System.Windows;
+using Bloxstrap.ViewModels;
namespace Bloxstrap.Views.Pages
{
@@ -11,6 +13,10 @@ namespace Bloxstrap.Views.Pages
{
DataContext = new ModsViewModel();
InitializeComponent();
+
+ // fullscreen optimizations were only added in windows 10 build 17093
+ if (Environment.OSVersion.Version.Build < 17093)
+ this.MiscellaneousOptions.Visibility = Visibility.Collapsed;
}
}
}