mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-28 23:50:46 -07:00
infra: Migrate to .NET 6 (#2829)
* infra: Migrate to .NET 6 * Rollback version naming change * Workaround .NET 6 ZipArchive API issues * ci: Switch to VS 2022 for AppVeyor CI is now ready for .NET 6 * Suppress WebClient warning in DoUpdateWithMultipleThreads * Attempt to workaround System.Drawing.Common changes on 6.0.0 * Change keyboard rendering from System.Drawing to ImageSharp * Make the software keyboard renderer multithreaded * Bump ImageSharp version to 1.0.4 to fix a bug in Image.Load * Add fallback fonts to the keyboard renderer * Fix warnings * Address caian's comment * Clean up linux workaround as it's uneeded now * Update readme Co-authored-by: Caian Benedicto <caianbene@gmail.com>
This commit is contained in:
@ -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>
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user