diff --git a/Ryujinx.Ava/Program.cs b/Ryujinx.Ava/Program.cs index a941302b2..910403970 100644 --- a/Ryujinx.Ava/Program.cs +++ b/Ryujinx.Ava/Program.cs @@ -1,8 +1,5 @@ using ARMeilleure.Translation.PTC; using Avalonia; -using Avalonia.Rendering; -using Avalonia.Threading; -using Ryujinx.Ava.Ui.Controls; using Ryujinx.Ava.Ui.Windows; using Ryujinx.Common; using Ryujinx.Common.Configuration; @@ -23,18 +20,15 @@ namespace Ryujinx.Ava { internal class Program { - public static double WindowScaleFactor { get; set; } - public static double ActualScaleFactor { get; set; } - public static string Version { get; private set; } - public static string ConfigurationPath { get; private set; } - public static bool PreviewerDetached { get; private set; } - public static RenderTimer RenderTimer { get; private set; } + public static double WindowScaleFactor { get; set; } + public static string Version { get; private set; } + public static string ConfigurationPath { get; private set; } + public static bool PreviewerDetached { get; private set; } [DllImport("user32.dll", SetLastError = true)] public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type); private const uint MB_ICONWARNING = 0x30; - private const int BaseDpi = 96; public static void Main(string[] args) { @@ -49,11 +43,7 @@ namespace Ryujinx.Ava Initialize(args); - RenderTimer = new RenderTimer(); - BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); - - RenderTimer.Dispose(); } public static AppBuilder BuildAvaloniaApp() @@ -65,7 +55,7 @@ namespace Ryujinx.Ava EnableMultiTouch = true, EnableIme = true, UseEGL = false, - UseGpu = false + UseGpu = true }) .With(new Win32PlatformOptions { @@ -75,12 +65,6 @@ namespace Ryujinx.Ava CompositionBackdropCornerRadius = 8.0f, }) .UseSkia() - .AfterSetup(_ => - { - AvaloniaLocator.CurrentMutable - .Bind().ToConstant(RenderTimer) - .Bind().ToConstant(new RenderLoop(RenderTimer, Dispatcher.UIThread)); - }) .LogToTrace(); } @@ -115,7 +99,6 @@ namespace Ryujinx.Ava ForceDpiAware.Windows(); WindowScaleFactor = ForceDpiAware.GetWindowScaleFactor(); - ActualScaleFactor = ForceDpiAware.GetActualScaleFactor() / BaseDpi; // Logging system information. PrintSystemInfo(); diff --git a/Ryujinx.Ava/Ui/Controls/RenderTimer.cs b/Ryujinx.Ava/Ui/Controls/RenderTimer.cs deleted file mode 100644 index 577115ea6..000000000 --- a/Ryujinx.Ava/Ui/Controls/RenderTimer.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Avalonia.Rendering; -using System; -using System.Threading; -using System.Timers; - -namespace Ryujinx.Ava.Ui.Controls -{ - internal class RenderTimer : IRenderTimer, IDisposable - { - public event Action Tick - { - add - { - _tick += value; - - if (_subscriberCount++ == 0) - { - Start(); - } - } - - remove - { - if (--_subscriberCount == 0) - { - Stop(); - } - - _tick -= value; - } - } - - private Thread _tickThread; - private readonly System.Timers.Timer _timer; - - private Action _tick; - private int _subscriberCount; - - private bool _isRunning; - - private AutoResetEvent _resetEvent; - - public RenderTimer() - { - _timer = new System.Timers.Timer(15); - _resetEvent = new AutoResetEvent(true); - _timer.Elapsed += Timer_Elapsed; - } - - private void Timer_Elapsed(object sender, ElapsedEventArgs e) - { - TickNow(); - } - - public void Start() - { - _timer.Start(); - if (_tickThread == null) - { - _tickThread = new Thread(RunTick); - _tickThread.Name = "RenderTimerTickThread"; - _tickThread.IsBackground = true; - _isRunning = true; - _tickThread.Start(); - } - } - - public void RunTick() - { - while (_isRunning) - { - _resetEvent.WaitOne(); - _tick?.Invoke(TimeSpan.FromMilliseconds(Environment.TickCount)); - } - } - - public void TickNow() - { - lock (_timer) - { - _resetEvent.Set(); - } - } - - public void Stop() - { - _timer.Stop(); - } - - public void Dispose() - { - _timer.Elapsed -= Timer_Elapsed; - _timer.Stop(); - _isRunning = false; - _resetEvent.Set(); - _tickThread.Join(); - _resetEvent.Dispose(); - } - } -} diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml index be72fd61e..5b27182df 100644 --- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml +++ b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml @@ -4,11 +4,4 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ryujinx.Ava.Ui.Controls.RendererHost"> - diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs index 0d1984fd5..b6986b7c8 100644 --- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs +++ b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs @@ -41,7 +41,7 @@ namespace Ryujinx.Ava.Ui.Controls { _currentWindow.WindowCreated += CurrentWindow_WindowCreated; _currentWindow.SizeChanged += CurrentWindow_SizeChanged; - View.Content = _currentWindow; + Content = _currentWindow; } public void CreateVulkan() diff --git a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml index 313e701c8..5b9dd8f91 100644 --- a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml +++ b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml @@ -13,7 +13,7 @@ Title="Ryujinx" Width="1280" Height="785" - MinWidth="1024" + MinWidth="1092" MinHeight="680" d:DesignHeight="720" d:DesignWidth="1280" @@ -57,6 +57,8 @@