diff --git a/src/Ryujinx.Common/Helpers/RunningPlatform.cs b/src/Ryujinx.Common/Helpers/RunningPlatform.cs new file mode 100644 index 000000000..61f5bd614 --- /dev/null +++ b/src/Ryujinx.Common/Helpers/RunningPlatform.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.InteropServices; +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable InconsistentNaming + +namespace Ryujinx.Common.Helper +{ + public static class RunningPlatform + { + public static bool IsMacOS => OperatingSystem.IsMacOS(); + public static bool IsWindows => OperatingSystem.IsWindows(); + public static bool IsLinux => OperatingSystem.IsLinux(); + + public static bool IsIntelMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.X64; + public static bool IsArmMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.Arm64; + + public static bool IsX64Windows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.X64); + public static bool IsArmWindows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.Arm64); + + public static bool IsX64Linux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.X64); + public static bool IsArmLinux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.Arm64); + } +} diff --git a/src/Ryujinx.Common/TitleIDs.cs b/src/Ryujinx.Common/TitleIDs.cs index 301dcdbf6..54241d053 100644 --- a/src/Ryujinx.Common/TitleIDs.cs +++ b/src/Ryujinx.Common/TitleIDs.cs @@ -1,5 +1,6 @@ using Gommon; using Ryujinx.Common.Configuration; +using Ryujinx.Common.Helper; using System; using System.Linq; using System.Runtime.InteropServices; @@ -21,7 +22,7 @@ namespace Ryujinx.Common return currentBackend; } - if (!(OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture is Architecture.Arm64)) + if (!RunningPlatform.IsArmMac) return GraphicsBackend.Vulkan; return GreatMetalTitles.ContainsIgnoreCase(titleId) ? GraphicsBackend.Metal : GraphicsBackend.Vulkan; diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index cdb177eb8..0ee59325a 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -736,9 +736,7 @@ namespace Ryujinx.Ava.UI.Windows }); } - private static bool _intelMacWarningShown = !(OperatingSystem.IsMacOS() && - (RuntimeInformation.OSArchitecture == Architecture.X64 || - RuntimeInformation.OSArchitecture == Architecture.X86)); + private static bool _intelMacWarningShown = !RunningPlatform.IsIntelMac; public static async Task ShowIntelMacWarningAsync() {