Fix NVAPI startup exception on non-Windows platforms

pull/27733/head
Dan Balasescu 2024-03-27 00:07:51 +09:00
parent 02b98671b8
commit 4c1a1b54be
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View File

@ -8,11 +8,13 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using osu.Framework.Logging;
namespace osu.Desktop
{
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SupportedOSPlatform("windows")]
internal static class NVAPI
{
private const string osu_filename = "osu!.exe";

View File

@ -70,7 +70,8 @@ namespace osu.Desktop
// NVIDIA profiles are based on the executable name of a process.
// Lazer and stable share the same executable name.
// Stable sets this setting to "Off", which may not be what we want, so let's force it back to the default "Auto" on startup.
NVAPI.ThreadedOptimisations = NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
if (OperatingSystem.IsWindows())
NVAPI.ThreadedOptimisations = NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
// Back up the cwd before DesktopGameHost changes it
string cwd = Environment.CurrentDirectory;