From 1b60e30a0bb47bba937b20d51ee629a750665e25 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 12 Sep 2024 10:53:43 +0100 Subject: [PATCH] Add easy access to player compatibility settings --- Bloxstrap/NativeMethods.txt | 2 +- Bloxstrap/Resources/Strings.Designer.cs | 27 +++++++++++++++++++ Bloxstrap/Resources/Strings.resx | 9 +++++++ .../UI/Elements/Settings/Pages/ModsPage.xaml | 9 +++++++ .../Settings/IntegrationsViewModel.cs | 4 +-- .../UI/ViewModels/Settings/ModsViewModel.cs | 18 +++++++++++++ 6 files changed, 66 insertions(+), 3 deletions(-) diff --git a/Bloxstrap/NativeMethods.txt b/Bloxstrap/NativeMethods.txt index aaa0b6a..9c1249b 100644 --- a/Bloxstrap/NativeMethods.txt +++ b/Bloxstrap/NativeMethods.txt @@ -2,4 +2,4 @@ FlashWindow GetWindowLong SetWindowLong -EnumDisplaySettings +SHObjectProperties \ No newline at end of file diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 1462950..7911c5b 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -557,6 +557,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Roblox has not yet been installed. Please launch Roblox using Bloxstrap at least once before trying to use this option.. + /// + public static string Common_RobloxNotInstalled { + get { + return ResourceManager.GetString("Common.RobloxNotInstalled", resourceCulture); + } + } + /// /// Looks up a localized string similar to Shortcuts. /// @@ -2809,6 +2818,24 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Configure application parameters such as DPI scaling behaviour and [fullscreen optimizations]({0}).. + /// + public static string Menu_Mods_Misc_CompatibilitySettings_Description { + get { + return ResourceManager.GetString("Menu.Mods.Misc.CompatibilitySettings.Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Manage compatibility settings. + /// + public static string Menu_Mods_Misc_CompatibilitySettings_Title { + get { + return ResourceManager.GetString("Menu.Mods.Misc.CompatibilitySettings.Title", resourceCulture); + } + } + /// /// Looks up a localized string similar to Choose font.... /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 8cedffc..0a04ef2 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1183,4 +1183,13 @@ Please manually delete Bloxstrap.exe from the install location or try restarting Not available + + Manage compatibility settings + + + Configure application parameters such as DPI scaling behaviour and [fullscreen optimizations]({0}). + + + Roblox has not yet been installed. Please launch Roblox using Bloxstrap at least once before trying to use this option. + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml index af34a12..79e6627 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml @@ -25,18 +25,27 @@ + + + + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs index 3ea1352..aed332e 100644 --- a/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs @@ -1,8 +1,6 @@ using System.Collections.ObjectModel; using System.Windows.Input; -using Bloxstrap.Resources; - using Microsoft.Win32; using CommunityToolkit.Mvvm.Input; @@ -12,7 +10,9 @@ namespace Bloxstrap.UI.ViewModels.Settings public class IntegrationsViewModel : NotifyPropertyChangedViewModel { public ICommand AddIntegrationCommand => new RelayCommand(AddIntegration); + public ICommand DeleteIntegrationCommand => new RelayCommand(DeleteIntegration); + public ICommand BrowseIntegrationLocationCommand => new RelayCommand(BrowseIntegrationLocation); private void AddIntegration() diff --git a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs index 0e85f6c..f235af0 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs @@ -3,9 +3,14 @@ using System.Windows.Input; using Microsoft.Win32; +using Windows.Win32; +using Windows.Win32.UI.Shell; +using Windows.Win32.Foundation; + using CommunityToolkit.Mvvm.Input; using Bloxstrap.Models.SettingTasks; +using Bloxstrap.AppData; namespace Bloxstrap.UI.ViewModels.Settings { @@ -59,6 +64,8 @@ namespace Bloxstrap.UI.ViewModels.Settings public ICommand ManageCustomFontCommand => new RelayCommand(ManageCustomFont); + public ICommand OpenCompatSettingsCommand => new RelayCommand(OpenCompatSettings); + public ModPresetTask OldDeathSoundTask { get; } = new("OldDeathSound", @"content\sounds\ouch.ogg", "Sounds.OldDeath.ogg"); public ModPresetTask OldAvatarBackgroundTask { get; } = new("OldAvatarBackground", @"ExtraContent\places\Mobile.rbxl", "OldAvatarBackground.rbxl"); @@ -95,5 +102,16 @@ namespace Bloxstrap.UI.ViewModels.Settings }); public FontModPresetTask TextFontTask { get; } = new(); + + private void OpenCompatSettings() + { + string path = new RobloxPlayerData().ExecutablePath; + + if (File.Exists(path)) + PInvoke.SHObjectProperties(HWND.Null, SHOP_TYPE.SHOP_FILEPATH, path, "Compatibility"); + else + Frontend.ShowMessageBox(Strings.Common_RobloxNotInstalled, MessageBoxImage.Error); + + } } }