From 1b1c59046ba0c5e3e2b6501d89ddcb0355688762 Mon Sep 17 00:00:00 2001 From: hwsmm Date: Sun, 28 Jul 2024 14:31:48 +0900 Subject: [PATCH] Update bindings to 35e42d0a254f230bb736cf993a9c3855ea1680a1 --- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 5 ---- SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs | 2 -- SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 6 ++--- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 8 ------- SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 4 ++-- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 10 ++++---- SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs | 5 ++-- SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 6 ++--- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 3 +++ SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 2 -- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 8 ++----- SDL3-CS/SDL3/SDL_audio.cs | 22 +++++++++++++++-- SDL3-CS/SDL3/SDL_camera.cs | 6 +++-- SDL3-CS/SDL3/SDL_gamepad.cs | 9 ++++--- SDL3-CS/SDL3/SDL_haptic.cs | 3 ++- SDL3-CS/SDL3/SDL_joystick.cs | 3 ++- SDL3-CS/SDL3/SDL_keyboard.cs | 3 ++- SDL3-CS/SDL3/SDL_locale.cs | 18 ++++++++++++++ SDL3-CS/SDL3/SDL_mouse.cs | 3 ++- SDL3-CS/SDL3/SDL_sensor.cs | 3 ++- SDL3-CS/SDL3/SDL_storage.cs | 23 ++++++++++++++++++ SDL3-CS/SDL3/SDL_touch.cs | 6 +++-- SDL3-CS/SDL3/SDL_video.cs | 9 ++++--- SDL3-CS/SDLArray.cs | 26 +++------------------ SDL3-CS/SDLPointerArray.cs | 10 ++++---- 32 files changed, 118 insertions(+), 93 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_locale.cs create mode 100644 SDL3-CS/SDL3/SDL_storage.cs diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 991ba4a..0c2d9c0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -68,11 +68,9 @@ namespace SDL public static extern byte* Unsafe_SDL_GetCurrentAudioDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_AudioDeviceID *")] public static extern SDL_AudioDeviceID* SDL_GetAudioPlaybackDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_AudioDeviceID *")] public static extern SDL_AudioDeviceID* SDL_GetAudioRecordingDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAudioDeviceName", ExactSpelling = true)] @@ -83,7 +81,6 @@ namespace SDL public static extern int SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec* spec, int* sample_frames); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const int *")] public static extern int* SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -147,11 +144,9 @@ namespace SDL public static extern int SDL_SetAudioStreamGain(SDL_AudioStream* stream, float gain); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const int *")] public static extern int* SDL_GetAudioStreamInputChannelMap(SDL_AudioStream* stream, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const int *")] public static extern int* SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream* stream, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index edf8804..6327e4b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -67,11 +67,9 @@ namespace SDL public static extern byte* Unsafe_SDL_GetCurrentCameraDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_CameraID *")] public static extern SDL_CameraID* SDL_GetCameras(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_CameraSpec *const *")] public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID devid, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs index 71584d2..eecc249 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -34,7 +34,7 @@ namespace SDL public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] byte* text); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -44,7 +44,7 @@ namespace SDL public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] byte* text); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrimarySelectionText", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -57,7 +57,7 @@ namespace SDL public static extern int SDL_ClearClipboardData(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const void *")] + [return: NativeTypeName("void*")] public static extern IntPtr SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 76d1723..ab07005 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -1110,14 +1110,6 @@ namespace SDL [return: NativeTypeName("Uint32")] public static extern uint SDL_RegisterEvents(int numevents); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("void*")] - public static extern IntPtr SDL_AllocateTemporaryMemory([NativeTypeName("size_t")] nuint size); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("void*")] - public static extern IntPtr SDL_ClaimTemporaryMemory([NativeTypeName("const void *")] IntPtr mem); - [NativeTypeName("#define SDL_RELEASED 0")] public const int SDL_RELEASED = 0; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index 6452cb6..ed05c18 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -73,7 +73,7 @@ namespace SDL public static extern byte* Unsafe_SDL_GetBasePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrefPath", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetUserFolder", ExactSpelling = true)] @@ -99,7 +99,7 @@ namespace SDL public static extern int SDL_GetPathInfo([NativeTypeName("const char *")] byte* path, SDL_PathInfo* info); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const char *const *")] + [return: NativeTypeName("char **")] public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count); [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index b8cbca6..639e98c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -192,15 +192,15 @@ namespace SDL public static extern int SDL_ReloadGamepadMappings(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const char *const *")] + [return: NativeTypeName("char **")] public static extern byte** SDL_GetGamepadMappings(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForGUID", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetGamepadMappingForGUID(SDL_GUID guid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMapping", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetGamepadMapping(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -210,7 +210,6 @@ namespace SDL public static extern SDL_bool SDL_HasGamepad(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_JoystickID *")] public static extern SDL_JoystickID* SDL_GetGamepads(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -249,7 +248,7 @@ namespace SDL public static extern SDL_GamepadType SDL_GetRealGamepadTypeForID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForID", ExactSpelling = true)] - [return: NativeTypeName("const char *")] + [return: NativeTypeName("char *")] public static extern byte* Unsafe_SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -330,7 +329,6 @@ namespace SDL public static extern SDL_bool SDL_GamepadEventsEnabled(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_GamepadBinding *const *")] public static extern SDL_GamepadBinding** SDL_GetGamepadBindings(SDL_Gamepad* gamepad, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs index 1cac982..816e7b3 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs @@ -42,9 +42,8 @@ namespace SDL public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GUIDToString", ExactSpelling = true)] - [return: NativeTypeName("const char *")] - public static extern byte* Unsafe_SDL_GUIDToString(SDL_GUID guid); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GUIDToString(SDL_GUID guid, [NativeTypeName("char *")] byte* pszGUID, int cbGUID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GUID SDL_StringToGUID([NativeTypeName("const char *")] byte* pchGUID); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs index 663fcb0..7ff4ade 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -326,7 +326,6 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_HapticID *")] public static extern SDL_HapticID* SDL_GetHaptics(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticNameForID", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index bc20ab4..41d8973 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -407,6 +407,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")] public static ReadOnlySpan SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8; + [NativeTypeName("#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE \"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE => "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"u8; + [NativeTypeName("#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH \"SDL_MOUSE_FOCUS_CLICKTHROUGH\"")] public static ReadOnlySpan SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH => "SDL_MOUSE_FOCUS_CLICKTHROUGH"u8; @@ -551,9 +554,6 @@ namespace SDL [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR \"SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR\"")] public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR => "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR"u8; - [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP \"SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP\"")] - public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP => "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP"u8; - [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION \"SDL_VIDEO_WAYLAND_MODE_EMULATION\"")] public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION => "SDL_VIDEO_WAYLAND_MODE_EMULATION"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index 890bd1f..93c33e7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -170,7 +170,6 @@ namespace SDL public static extern SDL_bool SDL_HasJoystick(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_JoystickID *")] public static extern SDL_JoystickID* SDL_GetJoysticks(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickNameForID", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs index cb8042a..70429b6 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -33,7 +33,6 @@ namespace SDL public static extern SDL_bool SDL_HasKeyboard(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_KeyboardID *")] public static extern SDL_KeyboardID* SDL_GetKeyboards(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyboardNameForID", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs index 33d017f..e93138a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs @@ -39,7 +39,6 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_Locale *const *")] public static extern SDL_Locale** SDL_GetPreferredLocales(int* count); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs index 821dacc..ab78696 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -68,7 +68,6 @@ namespace SDL public static extern SDL_bool SDL_HasMouse(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_MouseID *")] public static extern SDL_MouseID* SDL_GetMice(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseNameForID", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs index 0f63642..4fcb8ce 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -46,7 +46,6 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_SensorID *")] public static extern SDL_SensorID* SDL_GetSensors(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorNameForID", ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 2d14cfa..7385e35 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -80,6 +80,9 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_setenv([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, int overwrite); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_unsetenv([NativeTypeName("const char *")] byte* name); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_qsort([NativeTypeName("void*")] IntPtr @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("SDL_CompareCallback")] delegate* unmanaged[Cdecl] compare); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs index 77f92eb..42f8859 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -120,7 +120,7 @@ namespace SDL public static extern ulong SDL_GetStorageSpaceRemaining(SDL_Storage* storage); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const char *const *")] + [return: NativeTypeName("char **")] public static extern byte** SDL_GlobStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs index 80f7922..b2017fe 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -49,7 +49,6 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_TouchID *")] public static extern SDL_TouchID* SDL_GetTouchDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetTouchDeviceName", ExactSpelling = true)] @@ -60,7 +59,6 @@ namespace SDL public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_Finger *const *")] public static extern SDL_Finger** SDL_GetTouchFingers(SDL_TouchID touchID, int* count); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index 0c31659..15899dc 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -174,7 +174,6 @@ namespace SDL public static extern SDL_SystemTheme SDL_GetSystemTheme(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_DisplayID *")] public static extern SDL_DisplayID* SDL_GetDisplays(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -203,12 +202,10 @@ namespace SDL public static extern float SDL_GetDisplayContentScale(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_DisplayMode *const *")] public static extern SDL_DisplayMode** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const SDL_DisplayMode *")] - public static extern SDL_DisplayMode* SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); + public static extern int SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes, SDL_DisplayMode* mode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_DisplayMode *")] @@ -241,14 +238,13 @@ namespace SDL public static extern SDL_DisplayMode* SDL_GetWindowFullscreenMode(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const void *")] + [return: NativeTypeName("void*")] public static extern IntPtr SDL_GetWindowICCProfile(SDL_Window* window, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_Window *const *")] public static extern SDL_Window** SDL_GetWindows(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index 8112075..8f7e3ef 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -47,18 +47,36 @@ namespace SDL [Macro] public static int SDL_AUDIO_FRAMESIZE(SDL_AudioSpec x) => SDL_AUDIO_BYTESIZE((x).format) * (x).channels; + [MustDisposeResource] public static unsafe SDLArray? SDL_GetAudioPlaybackDevices() { int count; var array = SDL_GetAudioPlaybackDevices(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetAudioRecordingDevices() { int count; var array = SDL_GetAudioRecordingDevices(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetAudioStreamInputChannelMap(SDL_AudioStream* stream) + { + int count; + int* array = SDL_GetAudioStreamInputChannelMap(stream, &count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream* stream) + { + int count; + int* array = SDL_GetAudioStreamOutputChannelMap(stream, &count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_camera.cs b/SDL3-CS/SDL3/SDL_camera.cs index 841c98a..4b4400d 100644 --- a/SDL3-CS/SDL3/SDL_camera.cs +++ b/SDL3-CS/SDL3/SDL_camera.cs @@ -11,18 +11,20 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetCameras() { int count; var array = SDL_GetCameras(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetCameraSupportedFormats(SDL_CameraID devid) { int count; var array = SDL_GetCameraSupportedFormats(devid, &count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_gamepad.cs b/SDL3-CS/SDL3/SDL_gamepad.cs index edb4d7f..b22e209 100644 --- a/SDL3-CS/SDL3/SDL_gamepad.cs +++ b/SDL3-CS/SDL3/SDL_gamepad.cs @@ -12,25 +12,28 @@ namespace SDL /// /// An array of that can be passed to . /// + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepadMappings() { int count; IntPtr* array = (IntPtr*)SDL_GetGamepadMappings(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepads() { int count; var array = SDL_GetGamepads(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetGamepadBindings(SDL_Gamepad* gamepad) { int count; var array = SDL_GetGamepadBindings(gamepad, &count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_haptic.cs b/SDL3-CS/SDL3/SDL_haptic.cs index 41adeca..9b52131 100644 --- a/SDL3-CS/SDL3/SDL_haptic.cs +++ b/SDL3-CS/SDL3/SDL_haptic.cs @@ -11,11 +11,12 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetHaptics() { int count; var array = SDL_GetHaptics(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs index e0290e0..fdc7a2f 100644 --- a/SDL3-CS/SDL3/SDL_joystick.cs +++ b/SDL3-CS/SDL3/SDL_joystick.cs @@ -11,11 +11,12 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetJoysticks() { int count; var array = SDL_GetJoysticks(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs index 5ccafdc..160c394 100644 --- a/SDL3-CS/SDL3/SDL_keyboard.cs +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -11,11 +11,12 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetKeyboards() { int count; var array = SDL_GetKeyboards(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_locale.cs b/SDL3-CS/SDL3/SDL_locale.cs new file mode 100644 index 0000000..ed6167b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_locale.cs @@ -0,0 +1,18 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using JetBrains.Annotations; + +namespace SDL +{ + public static partial class SDL3 + { + [MustDisposeResource] + public static unsafe SDLPointerArray? SDL_GetPreferredLocales() + { + int count; + var array = SDL_GetPreferredLocales(&count); + return SDLArray.Create(array, count); + } + } +} diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 5001dc1..4128182 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -34,11 +34,12 @@ namespace SDL [Macro] public static SDL_MouseButtonFlags SDL_BUTTON(SDLButton button) => (SDL_MouseButtonFlags)(1 << ((int)button - 1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetMice() { int count; var array = SDL_GetMice(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs index 6bb60f5..540b22c 100644 --- a/SDL3-CS/SDL3/SDL_sensor.cs +++ b/SDL3-CS/SDL3/SDL_sensor.cs @@ -11,11 +11,12 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetSensors() { int count; var array = SDL_GetSensors(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_storage.cs b/SDL3-CS/SDL3/SDL_storage.cs new file mode 100644 index 0000000..71b1319 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_storage.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Runtime.InteropServices; +using JetBrains.Annotations; + +namespace SDL +{ + public static partial class SDL3 + { + /// + /// An array of that can be passed to . + /// + [MustDisposeResource] + public static unsafe SDLArray? SDL_GlobStorageDirectory(SDL_Storage* storage, byte* path, byte* pattern, SDL_GlobFlags flags) + { + int count; + IntPtr* array = (IntPtr*)SDL_GlobStorageDirectory(storage, path, pattern, flags, &count); + return SDLArray.Create(array, count); + } + } +} diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs index 4090c6e..d02076d 100644 --- a/SDL3-CS/SDL3/SDL_touch.cs +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -20,18 +20,20 @@ namespace SDL [Constant] public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetTouchDevices() { int count; var array = SDL_GetTouchDevices(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetTouchFingers(SDL_TouchID touchID) { int count; var array = SDL_GetTouchFingers(touchID, &count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index ba0c6da..37d99d1 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -55,25 +55,28 @@ namespace SDL [Macro] public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetDisplays() { int count; var array = SDL_GetDisplays(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID) { int count; var array = SDL_GetFullscreenDisplayModes(displayID, &count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetWindows() { int count; var array = SDL_GetWindows(&count); - return SDLArray.CreatePooled(array, count); + return SDLArray.Create(array, count); } } } diff --git a/SDL3-CS/SDLArray.cs b/SDL3-CS/SDLArray.cs index 9529e71..91f1d60 100644 --- a/SDL3-CS/SDLArray.cs +++ b/SDL3-CS/SDLArray.cs @@ -6,18 +6,17 @@ using JetBrains.Annotations; namespace SDL { + [MustDisposeResource] public sealed unsafe class SDLArray : IDisposable where T : unmanaged { private readonly T* array; - private readonly bool isPooled; public readonly int Count; private bool isDisposed; - internal SDLArray(T* array, int count, bool isPooled = false) + internal SDLArray(T* array, int count) { this.array = array; - this.isPooled = isPooled; Count = count; } @@ -39,8 +38,7 @@ namespace SDL isDisposed = true; - if (!isPooled) - SDL3.SDL_free(array); + SDL3.SDL_free(array); } } @@ -65,23 +63,5 @@ namespace SDL return new SDLPointerArray(array, count); } - - internal static SDLArray? CreatePooled(T* array, int count) - where T : unmanaged - { - if (array == null) - return null; - - return new SDLArray(array, count, true); - } - - internal static SDLPointerArray? CreatePooled(T** array, int count) - where T : unmanaged - { - if (array == null) - return null; - - return new SDLPointerArray(array, count, true); - } } } diff --git a/SDL3-CS/SDLPointerArray.cs b/SDL3-CS/SDLPointerArray.cs index 5cec8dd..621fd8c 100644 --- a/SDL3-CS/SDLPointerArray.cs +++ b/SDL3-CS/SDLPointerArray.cs @@ -8,18 +8,17 @@ using JetBrains.Annotations; namespace SDL { // T* can't be used as a type parameter, so this has to be a separate class + [MustDisposeResource] public sealed unsafe class SDLPointerArray : IDisposable where T : unmanaged { private readonly T** array; - private readonly bool isPooled; public readonly int Count; private bool isDisposed; - internal SDLPointerArray(T** array, int count, bool isPooled = false) + internal SDLPointerArray(T** array, int count) { this.array = array; - this.isPooled = isPooled; Count = count; } @@ -41,9 +40,8 @@ namespace SDL return; isDisposed = true; - - if (!isPooled) - SDL3.SDL_free(array); + + SDL3.SDL_free(array); } } }