From 312410a279051019e71202fc2e3810dbbd41d787 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sun, 15 Sep 2024 01:48:46 +0100 Subject: [PATCH] Add missing Win32 and GDK functions For now, SDL_GDKSuspendGPU and SDL_GDKResumeGPU from SDL_gpu.h are missing from auto-generated bindings. We can add them manually if needed. These missing funtions cause warnings to be logged when running `generate_bindings.py`. --- SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs | 37 ++++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_system.GDK.g.cs | 49 +++++++++++++++++++ .../SDL3/ClangSharp/SDL_system.Windows.g.cs | 8 +++ SDL3-CS/generate_bindings.py | 4 +- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.GDK.g.cs diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs new file mode 100644 index 0000000..6fecaff --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs @@ -0,0 +1,37 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + public static partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern void SDL_GDKSuspendComplete(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.GDK.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.GDK.g.cs new file mode 100644 index 0000000..3e102be --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.GDK.g.cs @@ -0,0 +1,49 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + public partial struct XTaskQueueObject + { + } + + public partial struct XUser + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern SDL_bool SDL_GetGDKTaskQueue([NativeTypeName("XTaskQueueHandle *")] XTaskQueueObject** outTaskQueue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern SDL_bool SDL_GetGDKDefaultUser([NativeTypeName("XUserHandle *")] XUser** outUserHandle); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs index 0c31d33..ff22710 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -34,5 +34,13 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern SDL_bool SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int* adapterIndex, int* outputIndex); } } diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 52312bf..be9a477 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -314,6 +314,7 @@ def main(): generate_platform_specific_headers(sdl_api, add("SDL3/SDL_main.h"), [ (["SDL_PLATFORM_WINDOWS"], "Windows", "Windows"), + (["SDL_PLATFORM_GDK"], "GDK", "Windows"), ]) generate_platform_specific_headers(sdl_api, add("SDL3/SDL_system.h"), [ @@ -321,7 +322,8 @@ def main(): (["SDL_PLATFORM_ANDROID"], "Android", "Android"), (["SDL_PLATFORM_IOS"], "iOS", "iOS"), (["SDL_PLATFORM_LINUX"], "Linux", "Linux"), - (["SDL_PLATFORM_WINDOWS"], "Windows", "Windows") + (["SDL_PLATFORM_WINDOWS", "SDL_PLATFORM_WIN32"], "Windows", "Windows"), + (["SDL_PLATFORM_GDK"], "GDK", "Windows"), ])