1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Use appropriate SDL_ShowSimpleMessageBox

This commit is contained in:
Susko3 2024-05-23 13:00:18 +02:00
parent 45ed86f46c
commit ccf8473aae

View File

@ -28,6 +28,14 @@ namespace osu.Desktop
private static LegacyTcpIpcProvider? legacyIpc; private static LegacyTcpIpcProvider? legacyIpc;
private static unsafe void showMessageBox(string title, string message)
{
if (FrameworkEnvironment.UseSDL3)
SDL3.SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, title, message, null);
else
SDL2.SDL.SDL_ShowSimpleMessageBox(SDL2.SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, title, message, IntPtr.Zero);
}
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
@ -51,21 +59,17 @@ namespace osu.Desktop
// While .NET 8 only supports Windows 10 and above, running on Windows 7/8.1 may still work. We are limited by realm currently, as they choose to only support 8.1 and higher. // While .NET 8 only supports Windows 10 and above, running on Windows 7/8.1 may still work. We are limited by realm currently, as they choose to only support 8.1 and higher.
// See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/ // See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/
if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2)) if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2))
{
unsafe
{ {
// If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider // 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. // disabling it ourselves.
// We could also better detect compatibility mode if required: // 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 // 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, showMessageBox("Your operating system is too old to run osu!",
"Your operating system is too old to run osu!"u8, "This version of osu! requires at least Windows 8.1 to run.\n"
"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"
+ "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!");
+ "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!"u8, null);
return; return;
} }
}
setupSquirrel(); setupSquirrel();
} }