Skip to content

Commit

Permalink
Implement WPF software rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Sep 27, 2024
1 parent 1d03c21 commit 5a0149f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Bloxstrap/LaunchSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class LaunchSettings

public LaunchFlag NoLaunchFlag { get; } = new("nolaunch");

public LaunchFlag NoGPUFlag { get; } = new("nogpu");

public LaunchFlag UpgradeFlag { get; } = new("upgrade");

public LaunchFlag PlayerFlag { get; } = new("player");
Expand Down
1 change: 1 addition & 0 deletions Bloxstrap/Models/Persistable/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Settings
public string Locale { get; set; } = "nil";
public bool ForceRobloxLanguage { get; set; } = false;
public bool UseFastFlagManager { get; set; } = true;
public bool WPFSoftwareRender { get; set; } = false;

// integration configuration
public bool EnableActivityTracking { get; set; } = true;
Expand Down
19 changes: 13 additions & 6 deletions Bloxstrap/UI/Elements/Base/WpfUiWindow.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Windows;
using System.Windows.Interop;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
using Wpf.Ui.Mvvm.Contracts;
Expand All @@ -25,5 +21,16 @@ public void ApplyTheme()
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
_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);
}
}
}

0 comments on commit 5a0149f

Please sign in to comment.