mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-02 11:01:07 +00:00
Fixed memory corruption on string return type marshaling
This commit is contained in:
parent
4b3aac38b6
commit
e9f54dc61e
|
@ -206,7 +206,14 @@ namespace OpenTK.Platform.SDL2
|
|||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickName", ExactSpelling = true)]
|
||||
public static extern string JoystickName(IntPtr joystick);
|
||||
static extern IntPtr JoystickNameInternal(IntPtr joystick);
|
||||
public static string JoystickName(IntPtr joystick)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
return new string((sbyte*)JoystickNameInternal(joystick));
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickNumAxes", ExactSpelling = true)]
|
||||
|
|
Loading…
Reference in a new issue