From 14c26926f328c646ee3d7d4ec28f6199976238f8 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Tue, 9 Apr 2024 09:55:50 +0200 Subject: [PATCH 1/2] Upgrade to SDL3 --- osu.Desktop/OsuGameDesktop.cs | 11 ++++++----- osu.Desktop/Program.cs | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 2b232db274..e8783c997a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -22,7 +22,7 @@ using osu.Game.IPC; using osu.Game.Online.Multiplayer; using osu.Game.Performance; using osu.Game.Utils; -using SDL2; +using SDL; namespace osu.Desktop { @@ -161,7 +161,7 @@ namespace osu.Desktop host.Window.Title = Name; } - protected override BatteryInfo CreateBatteryInfo() => new SDL2BatteryInfo(); + protected override BatteryInfo CreateBatteryInfo() => new SDL3BatteryInfo(); protected override void Dispose(bool isDisposing) { @@ -170,13 +170,14 @@ namespace osu.Desktop archiveImportIPCChannel?.Dispose(); } - private class SDL2BatteryInfo : BatteryInfo + private unsafe class SDL3BatteryInfo : BatteryInfo { public override double? ChargeLevel { get { - SDL.SDL_GetPowerInfo(out _, out int percentage); + int percentage; + SDL3.SDL_GetPowerInfo(null, &percentage); if (percentage == -1) return null; @@ -185,7 +186,7 @@ namespace osu.Desktop } } - public override bool OnBattery => SDL.SDL_GetPowerInfo(out _, out _) == SDL.SDL_PowerState.SDL_POWERSTATE_ON_BATTERY; + public override bool OnBattery => SDL3.SDL_GetPowerInfo(null, null) == SDL_PowerState.SDL_POWERSTATE_ON_BATTERY; } } } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 2d7ec5aa5f..29b05a402f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -13,7 +13,7 @@ using osu.Framework.Platform; using osu.Game; using osu.Game.IPC; using osu.Game.Tournament; -using SDL2; +using SDL; using Squirrel; namespace osu.Desktop @@ -52,16 +52,19 @@ namespace osu.Desktop // See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/ if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2)) { - // If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider - // disabling it ourselves. - // We could also better detect compatibility mode if required: - // https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730 - SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, - "Your operating system is too old to run osu!", - "This version of osu! requires at least Windows 8.1 to run.\n" - + "Please upgrade your operating system or consider using an older version of osu!.\n\n" - + "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!", IntPtr.Zero); - return; + unsafe + { + // If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider + // disabling it ourselves. + // We could also better detect compatibility mode if required: + // https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730 + SDL3.SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, + "Your operating system is too old to run osu!"u8, + "This version of osu! requires at least Windows 8.1 to run.\n"u8 + + "Please upgrade your operating system or consider using an older version of osu!.\n\n"u8 + + "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!"u8, null); + return; + } } setupSquirrel(); From 46e2cfdba526d77106d1eff41ec5e542ac7e8bca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Apr 2024 18:33:30 +0800 Subject: [PATCH 2/2] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 2d7a9d2652..bf02a5d8e2 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + diff --git a/osu.iOS.props b/osu.iOS.props index b2e3fc0779..4f973dbeb9 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -23,6 +23,6 @@ iossimulator-x64 - +