diff --git a/Source/OpenTK/Platform/SDL2/Sdl2.cs b/Source/OpenTK/Platform/SDL2/Sdl2.cs index 5d0cde57..8ad25480 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2.cs @@ -300,6 +300,10 @@ namespace OpenTK.Platform.SDL2 [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickGetButton", ExactSpelling = true)] public static extern byte JoystickGetButton(IntPtr joystick, int button); + [SuppressUnmanagedCodeSecurity] + [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickGetGuid", ExactSpelling = true)] + public static extern JoystickGuid JoystickGetGUID(IntPtr joystick); + [SuppressUnmanagedCodeSecurity] [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickName", ExactSpelling = true)] static extern IntPtr JoystickNameInternal(IntPtr joystick); @@ -1404,6 +1408,26 @@ namespace OpenTK.Platform.SDL2 byte padding2; } + struct JoystickGuid + { + unsafe fixed byte data[16]; + + public Guid ToGuid() + { + byte[] bytes = new byte[16]; + + unsafe + { + fixed (byte* pdata = data) + { + Marshal.Copy(new IntPtr(pdata), bytes, 0, bytes.Length); + } + } + + return new Guid(bytes); + } + } + struct KeyboardEvent { public EventType Type;