Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e68650237d | ||
|
1faff14e73 |
@@ -82,7 +82,7 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
}
|
}
|
||||||
else if (OperatingSystem.IsMacOS())
|
else if (OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
return CreateMacOs();
|
return CreateMacOS();
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateNativeControlCore(control);
|
return base.CreateNativeControlCore(control);
|
||||||
@@ -113,11 +113,12 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("linux")]
|
[SupportedOSPlatform("linux")]
|
||||||
protected virtual IPlatformHandle CreateLinux(IPlatformHandle control)
|
private IPlatformHandle CreateLinux(IPlatformHandle control)
|
||||||
{
|
{
|
||||||
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
|
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
|
||||||
{
|
{
|
||||||
X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(control.Handle));
|
X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(control.Handle));
|
||||||
|
X11Window.Hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -227,7 +228,7 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("macos")]
|
[SupportedOSPlatform("macos")]
|
||||||
IPlatformHandle CreateMacOs()
|
IPlatformHandle CreateMacOS()
|
||||||
{
|
{
|
||||||
MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback);
|
MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback);
|
||||||
|
|
||||||
|
@@ -2,14 +2,13 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using Silk.NET.Vulkan;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Renderer
|
namespace Ryujinx.Ava.UI.Renderer
|
||||||
{
|
{
|
||||||
public partial class RendererHost : UserControl, IDisposable
|
public partial class RendererHost : UserControl, IDisposable
|
||||||
{
|
{
|
||||||
public EmbeddedWindow EmbeddedWindow;
|
public readonly EmbeddedWindow EmbeddedWindow;
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowCreated;
|
public event EventHandler<EventArgs> WindowCreated;
|
||||||
public event Action<object, Size> SizeChanged;
|
public event Action<object, Size> SizeChanged;
|
||||||
@@ -18,8 +17,6 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Dispose();
|
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl)
|
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl)
|
||||||
{
|
{
|
||||||
EmbeddedWindow = new EmbeddedWindowOpenGL();
|
EmbeddedWindow = new EmbeddedWindowOpenGL();
|
||||||
@@ -47,6 +44,8 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated;
|
EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated;
|
||||||
EmbeddedWindow.SizeChanged -= CurrentWindow_SizeChanged;
|
EmbeddedWindow.SizeChanged -= CurrentWindow_SizeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
|
@@ -7,65 +7,33 @@ namespace Ryujinx.Ui.Helper
|
|||||||
{
|
{
|
||||||
public static int TimePlayedSort(ITreeModel model, TreeIter a, TreeIter b)
|
public static int TimePlayedSort(ITreeModel model, TreeIter a, TreeIter b)
|
||||||
{
|
{
|
||||||
string aValue = model.GetValue(a, 5).ToString();
|
static string ReverseFormat(string time)
|
||||||
string bValue = model.GetValue(b, 5).ToString();
|
{
|
||||||
float aFloat;
|
if (time == "Never")
|
||||||
float bFloat;
|
{
|
||||||
|
return "00";
|
||||||
|
}
|
||||||
|
|
||||||
if (aValue.Length > 7 && aValue[^7..] == "minutes")
|
var numbers = time.Split(new char[] { 'd', 'h', 'm' });
|
||||||
{
|
|
||||||
aValue = aValue.Replace("minutes", "");
|
time = time.Replace(" ", "").Replace("d", ".").Replace("h", ":").Replace("m", "");
|
||||||
aFloat = (float.Parse(aValue) * 60);
|
|
||||||
}
|
if (numbers.Length == 2)
|
||||||
else if (aValue.Length > 5 && aValue[^5..] == "hours")
|
{
|
||||||
{
|
return $"00.00:{time}";
|
||||||
aValue = aValue.Replace("hours", "");
|
}
|
||||||
aFloat = (float.Parse(aValue) * 3600);
|
else if (numbers.Length == 3)
|
||||||
}
|
{
|
||||||
else if (aValue.Length > 4 && aValue[^4..] == "days")
|
return $"00.{time}";
|
||||||
{
|
}
|
||||||
aValue = aValue.Replace("days", "");
|
|
||||||
aFloat = (float.Parse(aValue) * 86400);
|
return time;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aValue = aValue.Replace("seconds", "");
|
|
||||||
aFloat = float.Parse(aValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bValue.Length > 7 && bValue[^7..] == "minutes")
|
string aValue = ReverseFormat(model.GetValue(a, 5).ToString());
|
||||||
{
|
string bValue = ReverseFormat(model.GetValue(b, 5).ToString());
|
||||||
bValue = bValue.Replace("minutes", "");
|
|
||||||
bFloat = (float.Parse(bValue) * 60);
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 5 && bValue[^5..] == "hours")
|
|
||||||
{
|
|
||||||
bValue = bValue.Replace("hours", "");
|
|
||||||
bFloat = (float.Parse(bValue) * 3600);
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 4 && bValue[^4..] == "days")
|
|
||||||
{
|
|
||||||
bValue = bValue.Replace("days", "");
|
|
||||||
bFloat = (float.Parse(bValue) * 86400);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bValue = bValue[0..^8];
|
|
||||||
bFloat = float.Parse(bValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aFloat > bFloat)
|
return TimeSpan.Compare(TimeSpan.Parse(aValue), TimeSpan.Parse(bValue));
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (bFloat > aFloat)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int LastPlayedSort(ITreeModel model, TreeIter a, TreeIter b)
|
public static int LastPlayedSort(ITreeModel model, TreeIter a, TreeIter b)
|
||||||
@@ -123,4 +91,4 @@ namespace Ryujinx.Ui.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user