From 16e15fdb2d94a7d94e8d871d93932c8feb2a53c3 Mon Sep 17 00:00:00 2001 From: Mary Date: Sat, 14 Aug 2021 09:10:25 +0200 Subject: [PATCH] Add multiple missing pointer overloads THis adds some missing overloads that Ryujinx uses. Changelog: - Add a new overload of SDL_MixAudioFormat to allow passing raw pointers as dest and src (useful for usage with SDL_AudioSpec's callback). - Add a new overload of SDL_OpenAudioDevice to allow passing null for the device parameter. - Add a new overload of SDL_Vulkan_GetInstanceExtensions to allow passing null for the pName parameter. --- src/SDL2.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/SDL2.cs b/src/SDL2.cs index d2df222..a3a1c3d 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -2277,6 +2277,17 @@ namespace SDL2 [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_Vulkan_UnloadLibrary(); + /* window refers to an SDL_Window*, pNames to a const char**. + * Only available in 2.0.6 or higher. + * This overload allows for IntPtr.Zero (null) to be passed for pNames. + */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern SDL_bool SDL_Vulkan_GetInstanceExtensions( + IntPtr window, + out uint pCount, + IntPtr pNames + ); + /* window refers to an SDL_Window*, pNames to a const char**. * Only available in 2.0.6 or higher. */ @@ -7777,6 +7788,17 @@ namespace SDL2 int volume ); + /* format refers to an SDL_AudioFormat */ + /* This overload allows raw pointers to be passed for dst and src. */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void SDL_MixAudioFormat( + IntPtr dst, + IntPtr src, + ushort format, + uint len, + int volume + ); + /* format refers to an SDL_AudioFormat */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_MixAudioFormat( @@ -7801,6 +7823,17 @@ namespace SDL2 IntPtr obtained ); + /* uint refers to an SDL_AudioDeviceID */ + /* This overload allows for IntPtr.Zero (null) to be passed for device. */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe uint SDL_OpenAudioDevice( + IntPtr device, + int iscapture, + ref SDL_AudioSpec desired, + out SDL_AudioSpec obtained, + int allowed_changes + ); + /* uint refers to an SDL_AudioDeviceID */ [DllImport(nativeLibName, EntryPoint = "SDL_OpenAudioDevice", CallingConvention = CallingConvention.Cdecl)] private static extern unsafe uint INTERNAL_SDL_OpenAudioDevice(