From cdc4609993afd7b35ea544bec4d2009b6012bd5e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 25 Sep 2025 23:34:09 +0200 Subject: [PATCH] Add headers for unsupported sources --- VisualC-GDK/SDL/SDL.vcxproj | 2 + VisualC-GDK/SDL/SDL.vcxproj.filters | 2 + VisualC/SDL/SDL.vcxproj | 2 + VisualC/SDL/SDL.vcxproj.filters | 8 +++- src/core/SDL_core_unsupported.c | 39 ++++------------- src/core/SDL_core_unsupported.h | 65 +++++++++++++++++++++++++++++ src/dynapi/SDL_dynapi.c | 2 + src/dynapi/SDL_dynapi_unsupported.h | 16 ------- src/video/SDL_video_unsupported.c | 13 ++---- src/video/SDL_video_unsupported.h | 61 +++++++++++++++++++++++++++ 10 files changed, 153 insertions(+), 57 deletions(-) create mode 100644 src/core/SDL_core_unsupported.h create mode 100644 src/video/SDL_video_unsupported.h diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index 8fa5213a68..fc014c84a3 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -423,6 +423,7 @@ + @@ -600,6 +601,7 @@ + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index e934615a0b..aee0794aaa 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -331,6 +331,7 @@ + @@ -453,6 +454,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 2a6eace6c6..78539fc5a7 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -334,6 +334,7 @@ + @@ -508,6 +509,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index e25be14aac..661206d034 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -489,6 +489,9 @@ audio + + core + core\windows @@ -684,12 +687,15 @@ video - + video video + + video + video\dummy diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index 9ace0e0bba..ecc862c2f1 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -20,18 +20,18 @@ */ #include "SDL_internal.h" +#include "SDL_core_unsupported.h" + #ifndef SDL_VIDEO_DRIVER_X11 -SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata); void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata) { } -#endif +#endif /* !SDL_VIDEO_DRIVER_X11 */ #ifndef SDL_PLATFORM_LINUX -SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) { (void)threadID; @@ -39,7 +39,6 @@ bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) return SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { (void)threadID; @@ -48,37 +47,32 @@ bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int s return SDL_Unsupported(); } -#endif +#endif /* !SDL_PLATFORM_LINUX */ #ifndef SDL_PLATFORM_GDK -SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); void SDL_GDKSuspendComplete(void) { SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(void *outUserHandle); /* XUserHandle *outUserHandle */ -bool SDL_GetGDKDefaultUser(void *outUserHandle) +bool SDL_GetGDKDefaultUser(XUserHandle *outUserHandle) { return SDL_Unsupported(); } -SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device); void SDL_GDKSuspendGPU(SDL_GPUDevice *device) { } -SDL_DECLSPEC void SDLCALL SDL_GDKResumeGPU(SDL_GPUDevice *device); void SDL_GDKResumeGPU(SDL_GPUDevice *device) { } -#endif +#endif /* !SDL_PLATFORM_GDK */ #if !defined(SDL_PLATFORM_WINDOWS) -SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst) { (void)name; @@ -87,7 +81,6 @@ bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst) return SDL_Unsupported(); } -SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(void *callback, void *userdata); // SDL_WindowsMessageHook callback void SDL_SetWindowsMessageHook(void *callback, void *userdata) { (void)callback; @@ -95,30 +88,26 @@ void SDL_SetWindowsMessageHook(void *callback, void *userdata) SDL_Unsupported(); } -SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); void SDL_UnregisterApp(void) { SDL_Unsupported(); } -#endif +#endif /* !SDL_PLATFORM_WINDOWS */ #ifndef SDL_PLATFORM_ANDROID -SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); void SDL_SendAndroidBackButton(void) { SDL_Unsupported(); } -SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); void *SDL_GetAndroidActivity(void) { SDL_Unsupported(); return NULL; } -SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); const char *SDL_GetAndroidCachePath(void) { SDL_Unsupported(); @@ -126,35 +115,29 @@ const char *SDL_GetAndroidCachePath(void) } -SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); const char *SDL_GetAndroidExternalStoragePath(void) { SDL_Unsupported(); return NULL; } -SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); Uint32 SDL_GetAndroidExternalStorageState(void) { SDL_Unsupported(); return 0; } -SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); const char *SDL_GetAndroidInternalStoragePath(void) { SDL_Unsupported(); return NULL; } -SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); void *SDL_GetAndroidJNIEnv(void) { SDL_Unsupported(); return NULL; } -typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, bool granted); -SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) { (void)permission; @@ -163,7 +146,6 @@ bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPerm return SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); bool SDL_SendAndroidMessage(Uint32 command, int param) { (void)command; @@ -171,7 +153,6 @@ bool SDL_SendAndroidMessage(Uint32 command, int param) return SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset) { (void)message; @@ -182,28 +163,24 @@ bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xo return SDL_Unsupported(); } -SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); int SDL_GetAndroidSDKVersion(void) { return SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); bool SDL_IsChromebook(void) { SDL_Unsupported(); return false; } -SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); bool SDL_IsDeXMode(void) { SDL_Unsupported(); return false; } -SDL_DECLSPEC Sint32 SDLCALL JNI_OnLoad(void *vm, void *reserved); -Sint32 JNI_OnLoad(void *vm, void *reserved) +Sint32 JNI_OnLoad(JavaVM *vm, void *reserved) { (void)vm; (void)reserved; diff --git a/src/core/SDL_core_unsupported.h b/src/core/SDL_core_unsupported.h new file mode 100644 index 0000000000..63b4264f77 --- /dev/null +++ b/src/core/SDL_core_unsupported.h @@ -0,0 +1,65 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2025 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. +*/ + +#ifndef SDL_VIDEO_DRIVER_X11 +extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata); +#endif + +#ifndef SDL_PLATFORM_LINUX +extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); +extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); +#endif + +#if !defined(SDL_PLATFORM_GDK) +typedef struct XUserHandle XUserHandle; + +extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle); +extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device); +extern SDL_DECLSPEC void SDLCALL SDL_GDKResumeGPU(SDL_GPUDevice *device); +#endif /* !SDL_PLATFORM_GDK */ + +#if !defined(SDL_PLATFORM_WINDOWS) +extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); +extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(void *callback, void *userdata); +extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); +#endif /* !SDL_PLATFORM_WINDOWS */ + +#if !defined(SDL_PLATFORM_ANDROID) + +typedef void *SDL_RequestAndroidPermissionCallback; +typedef void *JavaVM; + +extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); +extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); +extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); +extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); +extern SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); +extern SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); +extern SDL_DECLSPEC Sint32 SDLCALL JNI_OnLoad(JavaVM *vm, void *reserved); +#endif /* !SDL_PLATFORM_ANDROID */ diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index a7b4e850c4..7b0ac7afad 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -40,6 +40,8 @@ #include #define SDL_MAIN_NOIMPL // don't drag in header-only implementation of SDL_main #include +#include "../core/SDL_core_unsupported.h" +#include "../video/SDL_video_unsupported.h" // These headers have system specific definitions, so aren't included above diff --git a/src/dynapi/SDL_dynapi_unsupported.h b/src/dynapi/SDL_dynapi_unsupported.h index 143943abcc..394f837ae5 100644 --- a/src/dynapi/SDL_dynapi_unsupported.h +++ b/src/dynapi/SDL_dynapi_unsupported.h @@ -33,20 +33,4 @@ typedef struct ID3D11Device ID3D11Device; typedef struct IDirect3DDevice9 IDirect3DDevice9; #endif -#ifndef SDL_PLATFORM_GDK -typedef struct XTaskQueueHandle XTaskQueueHandle; -#endif - -#ifndef SDL_PLATFORM_GDK -typedef struct XUserHandle XUserHandle; -#endif - -#ifndef SDL_PLATFORM_ANDROID -typedef void *SDL_RequestAndroidPermissionCallback; -#endif - -#ifndef SDL_PLATFORM_IOS -typedef void *SDL_iOSAnimationCallback; -#endif - #endif diff --git a/src/video/SDL_video_unsupported.c b/src/video/SDL_video_unsupported.c index 52e5b8b434..84a77cc190 100644 --- a/src/video/SDL_video_unsupported.c +++ b/src/video/SDL_video_unsupported.c @@ -20,6 +20,8 @@ */ #include "SDL_internal.h" +#include "SDL_video_unsupported.h" + #ifndef SDL_VIDEO_DRIVER_WINDOWS #if defined(SDL_PLATFORM_WINDOWS) @@ -42,7 +44,6 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) #endif // defined(SDL_PLATFORM_WINDOWS) -SDL_DECLSPEC bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); bool SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) { (void)displayID; @@ -51,7 +52,6 @@ bool SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outp return SDL_Unsupported(); } -SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID) { (void)displayID; @@ -61,7 +61,6 @@ int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID) #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) -SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID) { (void)displayID; @@ -73,8 +72,7 @@ int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID) #ifndef SDL_PLATFORM_GDK -SDL_DECLSPEC bool SDLCALL SDL_GetGDKTaskQueue(void *outTaskQueue); -bool SDL_GetGDKTaskQueue(void *outTaskQueue) +bool SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue) { (void)outTaskQueue; return SDL_Unsupported(); @@ -82,9 +80,8 @@ bool SDL_GetGDKTaskQueue(void *outTaskQueue) #endif -#ifndef SDL_VIDEO_DRIVER_UIKIT +#if !defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_VISIONOS) -SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); void SDL_OnApplicationDidChangeStatusBarOrientation(void) { SDL_Unsupported(); @@ -95,7 +92,6 @@ void SDL_OnApplicationDidChangeStatusBarOrientation(void) #ifndef SDL_VIDEO_DRIVER_UIKIT typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata); -SDL_DECLSPEC bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); bool SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam) { (void)window; @@ -105,7 +101,6 @@ bool SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimat return SDL_Unsupported(); } -SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); void SDL_SetiOSEventPump(bool enabled) { (void)enabled; diff --git a/src/video/SDL_video_unsupported.h b/src/video/SDL_video_unsupported.h new file mode 100644 index 0000000000..b549c60d05 --- /dev/null +++ b/src/video/SDL_video_unsupported.h @@ -0,0 +1,61 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2025 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. +*/ + +#if !defined(SDL_VIDEO_DRIVER_WINDOWS) + +#if defined(SDL_PLATFORM_WINDOWS) + +extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); +extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); +extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); + +#endif /* SDL_PLATFORM_WINDOWS */ + +extern SDL_DECLSPEC bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); +extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); + +#elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) + +extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); + +#endif /* !SDL_VIDEO_DRIVER_WINDOWS */ + +#if !defined(SDL_PLATFORM_GDK) + +typedef struct XTaskQueueHandle XTaskQueueHandle; + +extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue); + +#endif /* !SDL_PLATFORM_GDK */ + +#if !defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_VISIONOS) + +extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); + +#endif + +#if !defined(SDL_VIDEO_DRIVER_UIKIT) + +typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata); + +extern SDL_DECLSPEC bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); +extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); +#endif