Implement WPF software rendering

This commit is contained in:
pizzaboxer 2024-09-27 22:29:11 +01:00
parent 1d03c216d1
commit 5a0149fca8
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
3 changed files with 16 additions and 6 deletions

View File

@ -22,6 +22,8 @@ namespace Bloxstrap
public LaunchFlag NoLaunchFlag { get; } = new("nolaunch"); public LaunchFlag NoLaunchFlag { get; } = new("nolaunch");
public LaunchFlag NoGPUFlag { get; } = new("nogpu");
public LaunchFlag UpgradeFlag { get; } = new("upgrade"); public LaunchFlag UpgradeFlag { get; } = new("upgrade");
public LaunchFlag PlayerFlag { get; } = new("player"); public LaunchFlag PlayerFlag { get; } = new("player");

View File

@ -15,6 +15,7 @@ namespace Bloxstrap.Models.Persistable
public string Locale { get; set; } = "nil"; public string Locale { get; set; } = "nil";
public bool ForceRobloxLanguage { get; set; } = false; public bool ForceRobloxLanguage { get; set; } = false;
public bool UseFastFlagManager { get; set; } = true; public bool UseFastFlagManager { get; set; } = true;
public bool WPFSoftwareRender { get; set; } = false;
// integration configuration // integration configuration
public bool EnableActivityTracking { get; set; } = true; public bool EnableActivityTracking { get; set; } = true;

View File

@ -1,9 +1,5 @@
using System; using System.Windows;
using System.Collections.Generic; using System.Windows.Interop;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wpf.Ui.Appearance; using Wpf.Ui.Appearance;
using Wpf.Ui.Controls; using Wpf.Ui.Controls;
using Wpf.Ui.Mvvm.Contracts; using Wpf.Ui.Mvvm.Contracts;
@ -25,5 +21,16 @@ namespace Bloxstrap.UI.Elements.Base
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light); _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
_themeService.SetSystemAccent(); _themeService.SetSystemAccent();
} }
protected override void OnSourceInitialized(EventArgs e)
{
if (App.Settings.Prop.WPFSoftwareRender || App.LaunchSettings.NoGPUFlag.Active)
{
if (PresentationSource.FromVisual(this) is HwndSource hwndSource)
hwndSource.CompositionTarget.RenderMode = RenderMode.SoftwareOnly;
}
base.OnSourceInitialized(e);
}
} }
} }