diff --git a/SDL3-CS/SDL-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch index 631fdba..74aeaf0 100644 --- a/SDL3-CS/SDL-use-proper-types.patch +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -1,8 +1,8 @@ diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h -index b178d2ade..5c54b9ab5 100644 +index 6cda579f7..bc2952a4e 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h -@@ -29,6 +29,8 @@ +@@ -28,6 +28,8 @@ #ifndef SDL_h_ #define SDL_h_ @@ -12,10 +12,10 @@ index b178d2ade..5c54b9ab5 100644 #include #include diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h -index 0fddf1f24..36b98b569 100644 +index 9e26dd64e..1950b1037 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h -@@ -244,7 +244,7 @@ typedef enum +@@ -247,7 +247,7 @@ typedef enum SDL_EventType */ typedef struct SDL_CommonEvent { @@ -24,7 +24,7 @@ index 0fddf1f24..36b98b569 100644 Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ } SDL_CommonEvent; -@@ -726,7 +726,7 @@ typedef struct SDL_QuitEvent +@@ -804,7 +804,7 @@ typedef struct SDL_QuitEvent */ typedef struct SDL_UserEvent { @@ -33,7 +33,7 @@ index 0fddf1f24..36b98b569 100644 Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The associated window if any */ -@@ -741,7 +741,7 @@ typedef struct SDL_UserEvent +@@ -821,7 +821,7 @@ typedef struct SDL_UserEvent */ typedef union SDL_Event { @@ -42,16 +42,16 @@ index 0fddf1f24..36b98b569 100644 SDL_CommonEvent common; /**< Common event data */ SDL_DisplayEvent display; /**< Display event data */ SDL_WindowEvent window; /**< Window event data */ -@@ -868,7 +868,7 @@ typedef enum +@@ -948,7 +948,7 @@ typedef enum SDL_eventaction * \sa SDL_PumpEvents * \sa SDL_PushEvent */ --extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType); -+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType); +-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType); ++extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, SDL_EventType minType, SDL_EventType maxType); /* @} */ /** -@@ -885,7 +885,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL +@@ -965,7 +965,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL * * \sa SDL_HasEvents */ @@ -60,7 +60,7 @@ index 0fddf1f24..36b98b569 100644 /** -@@ -904,7 +904,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); +@@ -984,7 +984,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); * * \sa SDL_HasEvents */ @@ -69,7 +69,7 @@ index 0fddf1f24..36b98b569 100644 /** * Clear events of a specific type from the event queue. -@@ -930,7 +930,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); +@@ -1010,7 +1010,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); * * \sa SDL_FlushEvents */ @@ -78,7 +78,7 @@ index 0fddf1f24..36b98b569 100644 /** * Clear events of a range of types from the event queue. -@@ -955,7 +955,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); +@@ -1035,7 +1035,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); * * \sa SDL_FlushEvent */ @@ -87,16 +87,16 @@ index 0fddf1f24..36b98b569 100644 /** * Poll for currently pending events. -@@ -1234,7 +1234,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user +@@ -1324,7 +1324,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user * - * \sa SDL_IsEventEnabled + * \sa SDL_EventEnabled */ -extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); +extern DECLSPEC void SDLCALL SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); /** * Query the state of processing events by type. -@@ -1246,7 +1246,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); +@@ -1336,7 +1336,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); * * \sa SDL_SetEventEnabled */ @@ -106,10 +106,10 @@ index 0fddf1f24..36b98b569 100644 /** * Allocate a set of user-defined events, and return the beginning event diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h -index d1b925270..30cc4a8b7 100644 +index 00593334d..712fe0c6f 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h -@@ -110,7 +110,7 @@ typedef enum +@@ -112,7 +112,7 @@ typedef enum SDL_InitFlags * \sa SDL_SetMainReady * \sa SDL_WasInit */ @@ -118,7 +118,7 @@ index d1b925270..30cc4a8b7 100644 /** * Compatibility function to initialize the SDL library. -@@ -127,7 +127,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); +@@ -129,7 +129,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); * \sa SDL_Quit * \sa SDL_QuitSubSystem */ @@ -127,7 +127,7 @@ index d1b925270..30cc4a8b7 100644 /** * Shut down specific SDL subsystems. -@@ -142,7 +142,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); +@@ -144,7 +144,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); * \sa SDL_InitSubSystem * \sa SDL_Quit */ @@ -136,7 +136,7 @@ index d1b925270..30cc4a8b7 100644 /** * Get a mask of the specified subsystems which are currently initialized. -@@ -156,7 +156,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); +@@ -158,7 +158,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); * \sa SDL_Init * \sa SDL_InitSubSystem */ @@ -146,10 +146,10 @@ index d1b925270..30cc4a8b7 100644 /** * Clean up all initialized subsystems. diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h -index 99d2f2c36..eef01cac7 100644 +index 3ded311ff..5b39a1c96 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h -@@ -135,7 +135,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); +@@ -140,7 +140,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); * \sa SDL_LogResetPriorities * \sa SDL_LogSetAllPriority */ @@ -158,7 +158,7 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority); /** -@@ -148,7 +148,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, +@@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, * * \sa SDL_LogSetPriority */ @@ -167,7 +167,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Reset all priorities to default. -@@ -201,7 +201,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . +@@ -206,7 +206,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . * \sa SDL_LogMessageV * \sa SDL_LogWarn */ @@ -176,7 +176,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_DEBUG. -@@ -222,7 +222,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI +@@ -227,7 +227,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -185,7 +185,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_INFO. -@@ -243,7 +243,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING +@@ -248,7 +248,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -194,7 +194,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_WARN. -@@ -264,7 +264,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING +@@ -269,7 +269,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogMessageV * \sa SDL_LogVerbose */ @@ -203,7 +203,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_ERROR. -@@ -285,7 +285,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING +@@ -290,7 +290,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -212,7 +212,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_CRITICAL. -@@ -306,7 +306,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING +@@ -311,7 +311,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -221,7 +221,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with the specified category and priority. -@@ -328,7 +328,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR +@@ -333,7 +333,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -230,7 +230,7 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); -@@ -351,7 +351,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, +@@ -356,7 +356,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -239,9 +239,9 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); -@@ -365,7 +365,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, - * \param priority the priority of the message - * \param message the message being output +@@ -372,7 +372,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, + * + * \since This datatype is available since SDL 3.0.0. */ -typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, SDL_LogCategory category, SDL_LogPriority priority, const char *message); @@ -249,28 +249,28 @@ index 99d2f2c36..eef01cac7 100644 /** * Get the current log output function. diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h -index 3d6855275..2b540a3fa 100644 +index 48f63239b..d851c0df9 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h -@@ -58,7 +58,7 @@ typedef enum +@@ -66,7 +66,7 @@ typedef enum SDL_MessageBoxButtonFlags */ - typedef struct + typedef struct SDL_MessageBoxButtonData { - Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ + SDL_MessageBoxButtonFlags flags; /**< ::SDL_MessageBoxButtonFlags */ int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char *text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; -@@ -94,7 +94,7 @@ typedef struct +@@ -112,7 +112,7 @@ typedef struct SDL_MessageBoxColorScheme */ - typedef struct + typedef struct SDL_MessageBoxData { - Uint32 flags; /**< ::SDL_MessageBoxFlags */ + SDL_MessageBoxFlags flags; /**< ::SDL_MessageBoxFlags */ SDL_Window *window; /**< Parent window, can be NULL */ const char *title; /**< UTF-8 title */ const char *message; /**< UTF-8 message text */ -@@ -180,7 +180,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message +@@ -198,7 +198,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message * * \sa SDL_ShowMessageBox */ @@ -280,10 +280,10 @@ index 3d6855275..2b540a3fa 100644 /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h -index 5024931e7..f1f61be21 100644 +index f875433ce..74c631f7f 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h -@@ -80,7 +80,7 @@ typedef enum +@@ -86,7 +86,7 @@ typedef enum SDL_RendererFlags typedef struct SDL_RendererInfo { const char *name; /**< The name of the renderer */ @@ -292,7 +292,7 @@ index 5024931e7..f1f61be21 100644 int num_texture_formats; /**< The number of available texture formats */ SDL_PixelFormatEnum texture_formats[16]; /**< The available texture formats */ int max_texture_width; /**< The maximum texture width */ -@@ -225,7 +225,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S +@@ -241,7 +241,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S * \sa SDL_GetRenderDriver * \sa SDL_GetRendererInfo */ @@ -302,23 +302,30 @@ index 5024931e7..f1f61be21 100644 /** * Create a 2D rendering context for a window, with the specified properties. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h -index e6a387c31..8aafb96c8 100644 +index 00a54a139..24ae06c13 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h -@@ -132,8 +132,8 @@ char *alloca(); - /** - * A boolean type. +@@ -146,7 +146,7 @@ void *alloca(size_t); + * + * \sa SDL_bool */ -#define SDL_FALSE 0 --#define SDL_TRUE 1 +#define SDL_FALSE (SDL_bool)0 -+#define SDL_TRUE (SDL_bool)1 - typedef int SDL_bool; /** -@@ -192,8 +192,8 @@ typedef uint64_t Uint64; - * They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() and SDL_SECONDS_TO_NS(), - * and between Windows FILETIME values with SDL_TimeToWindows() and SDL_TimeFromWindows(). + * A boolean true. +@@ -155,7 +155,7 @@ void *alloca(size_t); + * + * \sa SDL_bool + */ +-#define SDL_TRUE 1 ++#define SDL_TRUE (SDL_bool)1 + + /** + * A boolean type: true or false. +@@ -249,8 +249,8 @@ typedef uint64_t Uint64; + * + * \since This macro is available since SDL 3.0.0. */ -#define SDL_MAX_TIME SDL_MAX_SINT64 -#define SDL_MIN_TIME SDL_MIN_SINT64 @@ -327,4 +334,7 @@ index e6a387c31..8aafb96c8 100644 typedef Sint64 SDL_Time; /* @} *//* Basic data types */ - \ No newline at end of file + +base-commit: 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 +-- +2.40.0.windows.1 diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index b405427..4186ddb 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -7,7 +7,7 @@ Generates C# bindings for SDL3 using ClangSharp. Prerequisites: - run `dotnet tool restore` (to install ClangSharpPInvokeGenerator) - https://github.com/libsdl-org/SDL checked out alongside this repository -- git apply `SDL-use-proper-types.patch` to SDL repo +- git apply --3way `SDL-use-proper-types.patch` to SDL repo This script should be run manually. """