aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Common')
-rw-r--r--Ryujinx.Common/Ryujinx.Common.csproj6
-rw-r--r--Ryujinx.Common/System/ForceDpiAware.cs15
2 files changed, 14 insertions, 7 deletions
diff --git a/Ryujinx.Common/Ryujinx.Common.csproj b/Ryujinx.Common/Ryujinx.Common.csproj
index a7e9c66c..e0cc2d56 100644
--- a/Ryujinx.Common/Ryujinx.Common.csproj
+++ b/Ryujinx.Common/Ryujinx.Common.csproj
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net5.0</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
- <PackageReference Include="System.Drawing.Common" Version="5.0.1" />
- <PackageReference Include="System.Management" Version="5.0.0" />
+ <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
+ <PackageReference Include="System.Management" Version="6.0.0" />
</ItemGroup>
</Project>
diff --git a/Ryujinx.Common/System/ForceDpiAware.cs b/Ryujinx.Common/System/ForceDpiAware.cs
index 81c69376..dc513307 100644
--- a/Ryujinx.Common/System/ForceDpiAware.cs
+++ b/Ryujinx.Common/System/ForceDpiAware.cs
@@ -2,6 +2,7 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
namespace Ryujinx.Common.System
{
@@ -19,7 +20,7 @@ namespace Ryujinx.Common.System
public static void Windows()
{
// Make process DPI aware for proper window sizing on high-res screens.
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.OSVersion.Version.Major >= 6)
+ if (OperatingSystem.IsWindowsVersionAtLeast(6))
{
SetProcessDPIAware();
}
@@ -27,16 +28,22 @@ namespace Ryujinx.Common.System
public static double GetWindowScaleFactor()
{
- double userDpiScale;
+ double userDpiScale = 96.0;
try
{
- userDpiScale = Graphics.FromHwnd(IntPtr.Zero).DpiX;
+ if (OperatingSystem.IsWindows())
+ {
+ userDpiScale = Graphics.FromHwnd(IntPtr.Zero).DpiX;
+ }
+ else
+ {
+ // TODO: Linux support
+ }
}
catch (Exception e)
{
Logger.Warning?.Print(LogClass.Application, $"Couldn't determine monitor DPI: {e.Message}");
- userDpiScale = 96.0;
}
return Math.Min(userDpiScale / _standardDpiScale, _maxScaleFactor);