mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-08-04 10:11:07 +00:00
Merge pull request #126 from thefiddler/sdlversion
[SDL] Do not attempt to use versions < 2.0.0
This commit is contained in:
commit
08829c4feb
|
@ -201,31 +201,54 @@ namespace OpenTK
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
|
|
||||||
// Detect whether SDL2 is supported
|
// Detect whether SDL2 is supported
|
||||||
|
// We require:
|
||||||
|
// - SDL2 version 2.0.0 or higher (previous beta
|
||||||
|
// versions are not ABI-compatible)
|
||||||
|
// - Successful SDL2 initialization (sometimes the
|
||||||
|
// binary exists but fails to initialize correctly)
|
||||||
|
var version = new Platform.SDL2.Version();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!OpenTK.Platform.SDL2.SDL.WasInit(0))
|
version = Platform.SDL2.SDL.Version;
|
||||||
|
if (version.Number >= 2000)
|
||||||
{
|
{
|
||||||
|
if (Platform.SDL2.SDL.WasInit(0))
|
||||||
|
{
|
||||||
|
supported = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Attempt to initialize SDL2.
|
||||||
var flags =
|
var flags =
|
||||||
OpenTK.Platform.SDL2.SystemFlags.VIDEO | Platform.SDL2.SystemFlags.TIMER;
|
Platform.SDL2.SystemFlags.VIDEO |
|
||||||
if (OpenTK.Platform.SDL2.SDL.Init(flags) == 0)
|
Platform.SDL2.SystemFlags.TIMER;
|
||||||
|
|
||||||
|
if (Platform.SDL2.SDL.Init(flags) == 0)
|
||||||
{
|
{
|
||||||
supported = true;
|
supported = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Print("SDL2 init failed with error: {0}", OpenTK.Platform.SDL2.SDL.GetError());
|
Debug.Print("SDL2 init failed with error: {0}",
|
||||||
|
Platform.SDL2.SDL.GetError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
supported = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Print("SDL2 init failed with exception: {0}", e);
|
Debug.Print("SDL2 init failed with exception: {0}", e);
|
||||||
}
|
}
|
||||||
Debug.Print("SDL2 is {0}", supported ? "supported" : "not supported");
|
|
||||||
|
if (!supported)
|
||||||
|
{
|
||||||
|
Debug.Print("SDL2 is not supported");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Print("SDL2 is supported. Version is {0}.{1}.{2}",
|
||||||
|
version.Major, version.Minor, version.Patch);
|
||||||
|
}
|
||||||
|
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue