From eebbf3457ccb7ebca9a83cd77e8673a5f822e772 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 25 Feb 2022 17:19:25 +0000 Subject: [PATCH 001/459] emscripten: Use emscripten_webgl_ API directly --- src/video/emscripten/SDL_emscriptenopengles.c | 148 +++++++++++------- src/video/emscripten/SDL_emscriptenopengles.h | 16 +- src/video/emscripten/SDL_emscriptenvideo.c | 24 --- src/video/emscripten/SDL_emscriptenvideo.h | 7 - 4 files changed, 101 insertions(+), 94 deletions(-) diff --git a/src/video/emscripten/SDL_emscriptenopengles.c b/src/video/emscripten/SDL_emscriptenopengles.c index 10c6285cf..a3219372c 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.c +++ b/src/video/emscripten/SDL_emscriptenopengles.c @@ -20,83 +20,123 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if SDL_VIDEO_DRIVER_EMSCRIPTEN #include +#include #include #include "SDL_emscriptenvideo.h" #include "SDL_emscriptenopengles.h" #include "SDL_hints.h" -#define LOAD_FUNC(NAME) _this->egl_data->NAME = NAME; - -/* EGL implementation of SDL OpenGL support */ int -Emscripten_GLES_LoadLibrary(_THIS, const char *path) { - /*we can't load EGL dynamically*/ - _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); - if (!_this->egl_data) { - return SDL_OutOfMemory(); - } - - /* Emscripten forces you to manually cast eglGetProcAddress to the real - function type; grep for "__eglMustCastToProperFunctionPointerType" in - Emscripten's egl.h for details. */ - _this->egl_data->eglGetProcAddress = (void *(EGLAPIENTRY *)(const char *)) eglGetProcAddress; - - LOAD_FUNC(eglGetDisplay); - LOAD_FUNC(eglInitialize); - LOAD_FUNC(eglTerminate); - LOAD_FUNC(eglChooseConfig); - LOAD_FUNC(eglGetConfigAttrib); - LOAD_FUNC(eglCreateContext); - LOAD_FUNC(eglDestroyContext); - LOAD_FUNC(eglCreateWindowSurface); - LOAD_FUNC(eglDestroySurface); - LOAD_FUNC(eglMakeCurrent); - LOAD_FUNC(eglSwapBuffers); - LOAD_FUNC(eglSwapInterval); - LOAD_FUNC(eglWaitNative); - LOAD_FUNC(eglWaitGL); - LOAD_FUNC(eglBindAPI); - LOAD_FUNC(eglQueryString); - LOAD_FUNC(eglGetError); - - _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get EGL display"); - } - - if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize EGL"); - } - - if (path) { - SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); - } else { - *_this->gl_config.driver_path = '\0'; - } - +Emscripten_GLES_LoadLibrary(_THIS, const char *path) +{ return 0; } -SDL_EGL_CreateContext_impl(Emscripten) -SDL_EGL_MakeCurrent_impl(Emscripten) +void +Emscripten_GLES_UnloadLibrary(_THIS) +{ +} + +void * +Emscripten_GLES_GetProcAddress(_THIS, const char *proc) +{ + return emscripten_webgl_get_proc_address(proc); +} + +int +Emscripten_GLES_SetSwapInterval(_THIS, int interval) +{ + if (interval < 0) { + return SDL_SetError("Late swap tearing currently unsupported"); + } else if(interval == 0) { + emscripten_set_main_loop_timing(EM_TIMING_SETTIMEOUT, 0); + } else { + emscripten_set_main_loop_timing(EM_TIMING_RAF, interval); + } + + return 0; +} + +int +Emscripten_GLES_GetSwapInterval(_THIS) +{ + int mode, value; + + emscripten_get_main_loop_timing(&mode, &value); + + if(mode == EM_TIMING_RAF) + return value; + + return 0; +} + +SDL_GLContext +Emscripten_GLES_CreateContext(_THIS, SDL_Window * window) +{ + SDL_WindowData *window_data; + + EmscriptenWebGLContextAttributes attribs; + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context; + + emscripten_webgl_init_context_attributes(&attribs); + + attribs.alpha = _this->gl_config.alpha_size > 0; + attribs.depth = _this->gl_config.depth_size > 0; + attribs.stencil = _this->gl_config.stencil_size > 0; + attribs.antialias = _this->gl_config.multisamplebuffers == 1; + + if(_this->gl_config.major_version == 3) + attribs.majorVersion = 2; /* WebGL 2.0 ~= GLES 3.0 */ + + window_data = (SDL_WindowData *) window->driverdata; + context = emscripten_webgl_create_context(window_data->canvas_id, &attribs); + + if (context < 0) { + SDL_SetError("Could not create webgl context"); + return NULL; + } + + if (emscripten_webgl_make_context_current(context) != EMSCRIPTEN_RESULT_SUCCESS) { + emscripten_webgl_destroy_context(context); + return NULL; + } + + + return (SDL_GLContext)context; +} + +void +Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context) +{ + emscripten_webgl_destroy_context((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context); +} int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window) { - EGLBoolean ret = SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { /* give back control to browser for screen refresh */ emscripten_sleep(0); } - return ret; + return 0; } -#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */ +int +Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +{ + /* ignores window, as it isn't possible to reuse contexts across canvases */ + if (emscripten_webgl_make_context_current((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context) != EMSCRIPTEN_RESULT_SUCCESS) { + return SDL_SetError("Unable to make context current"); + } + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/emscripten/SDL_emscriptenopengles.h b/src/video/emscripten/SDL_emscriptenopengles.h index 9d178f690..6d58ac10d 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.h +++ b/src/video/emscripten/SDL_emscriptenopengles.h @@ -23,25 +23,23 @@ #ifndef SDL_emscriptenopengles_h_ #define SDL_emscriptenopengles_h_ -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if SDL_VIDEO_DRIVER_EMSCRIPTEN #include "../SDL_sysvideo.h" -#include "../SDL_egl_c.h" /* OpenGLES functions */ -#define Emscripten_GLES_GetAttribute SDL_EGL_GetAttribute -#define Emscripten_GLES_GetProcAddress SDL_EGL_GetProcAddress -#define Emscripten_GLES_UnloadLibrary SDL_EGL_UnloadLibrary -#define Emscripten_GLES_SetSwapInterval SDL_EGL_SetSwapInterval -#define Emscripten_GLES_GetSwapInterval SDL_EGL_GetSwapInterval -#define Emscripten_GLES_DeleteContext SDL_EGL_DeleteContext extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); +extern void Emscripten_GLES_UnloadLibrary(_THIS); +extern void * Emscripten_GLES_GetProcAddress(_THIS, const char *proc); +extern int Emscripten_GLES_SetSwapInterval(_THIS, int interval); +extern int Emscripten_GLES_GetSwapInterval(_THIS); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window); +extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ #endif /* SDL_emscriptenopengles_h_ */ diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 550031d3f..46813a721 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -27,7 +27,6 @@ #include "SDL_hints.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" -#include "../SDL_egl_c.h" #include "../../events/SDL_events_c.h" #include "SDL_emscriptenvideo.h" @@ -110,7 +109,6 @@ Emscripten_CreateDevice(void) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; -#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -120,7 +118,6 @@ Emscripten_CreateDevice(void) device->GL_GetSwapInterval = Emscripten_GLES_GetSwapInterval; device->GL_SwapWindow = Emscripten_GLES_SwapWindow; device->GL_DeleteContext = Emscripten_GLES_DeleteContext; -#endif device->free = Emscripten_DeleteDevice; @@ -259,21 +256,6 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } } -#if SDL_VIDEO_OPENGL_EGL - if (window->flags & SDL_WINDOW_OPENGL) { - if (!_this->egl_data) { - if (SDL_GL_LoadLibrary(NULL) < 0) { - return -1; - } - } - wdata->egl_surface = SDL_EGL_CreateSurface(_this, 0); - - if (wdata->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("Could not create GLES window surface"); - } - } -#endif - wdata->window = window; /* Setup driver data for this window */ @@ -329,12 +311,6 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window) data = (SDL_WindowData *) window->driverdata; Emscripten_UnregisterEventHandlers(data); -#if SDL_VIDEO_OPENGL_EGL - if (data->egl_surface != EGL_NO_SURFACE) { - SDL_EGL_DestroySurface(_this, data->egl_surface); - data->egl_surface = EGL_NO_SURFACE; - } -#endif /* We can't destroy the canvas, so resize it to zero instead */ emscripten_set_canvas_element_size(data->canvas_id, 0, 0); diff --git a/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h index e87788d3f..20481235e 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.h +++ b/src/video/emscripten/SDL_emscriptenvideo.h @@ -28,15 +28,8 @@ #include #include -#if SDL_VIDEO_OPENGL_EGL -#include -#endif - typedef struct SDL_WindowData { -#if SDL_VIDEO_OPENGL_EGL - EGLSurface egl_surface; -#endif SDL_Window *window; SDL_Surface *surface; From 539efc1bbaec197cb0d6663824fd29fd71060785 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Sat, 26 Feb 2022 12:24:32 +0000 Subject: [PATCH 002/459] emscripten: Return an error for webgl context limitations --- src/video/emscripten/SDL_emscriptenopengles.c | 30 ++++++++++++++++++- src/video/emscripten/SDL_emscriptenvideo.h | 2 ++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/video/emscripten/SDL_emscriptenopengles.c b/src/video/emscripten/SDL_emscriptenopengles.c index a3219372c..ccec124ce 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.c +++ b/src/video/emscripten/SDL_emscriptenopengles.c @@ -94,6 +94,12 @@ Emscripten_GLES_CreateContext(_THIS, SDL_Window * window) attribs.majorVersion = 2; /* WebGL 2.0 ~= GLES 3.0 */ window_data = (SDL_WindowData *) window->driverdata; + + if (window_data->gl_context) { + SDL_SetError("Cannot create multiple webgl contexts per window"); + return NULL; + } + context = emscripten_webgl_create_context(window_data->canvas_id, &attribs); if (context < 0) { @@ -106,6 +112,7 @@ Emscripten_GLES_CreateContext(_THIS, SDL_Window * window) return NULL; } + window_data->gl_context = (SDL_GLContext)context; return (SDL_GLContext)context; } @@ -113,6 +120,18 @@ Emscripten_GLES_CreateContext(_THIS, SDL_Window * window) void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context) { + SDL_Window *window; + + /* remove the context from its window */ + for (window = _this->windows; window != NULL; window = window->next) { + SDL_WindowData *window_data; + window_data = (SDL_WindowData *) window->driverdata; + + if (window_data->gl_context == context) { + window_data->gl_context = NULL; + } + } + emscripten_webgl_destroy_context((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context); } @@ -129,7 +148,16 @@ Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window) int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - /* ignores window, as it isn't possible to reuse contexts across canvases */ + /* it isn't possible to reuse contexts across canvases */ + if (window && context) { + SDL_WindowData *window_data; + window_data = (SDL_WindowData *) window->driverdata; + + if (context != window_data->gl_context) { + return SDL_SetError("Cannot make context current to another window"); + } + } + if (emscripten_webgl_make_context_current((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context) != EMSCRIPTEN_RESULT_SUCCESS) { return SDL_SetError("Unable to make context current"); } diff --git a/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h index 20481235e..4cd0a5ce5 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.h +++ b/src/video/emscripten/SDL_emscriptenvideo.h @@ -33,6 +33,8 @@ typedef struct SDL_WindowData SDL_Window *window; SDL_Surface *surface; + SDL_GLContext gl_context; + char *canvas_id; float pixel_ratio; From b5aedaad5923edd88ca33e6dab4b86503e8cb0f3 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Sun, 8 Apr 2018 16:54:29 +0100 Subject: [PATCH 003/459] emscripten: Modify UpdateWindowFramebuffer To work with multiple canvases --- src/video/emscripten/SDL_emscriptenframebuffer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/video/emscripten/SDL_emscriptenframebuffer.c index 03fea04ef..05e4aa745 100644 --- a/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -75,12 +75,15 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec var w = $0; var h = $1; var pixels = $2; + var canvasId = UTF8ToString($3); + var canvas = document.querySelector(canvasId); + //TODO: this should store a context per canvas if (!Module['SDL2']) Module['SDL2'] = {}; var SDL2 = Module['SDL2']; - if (SDL2.ctxCanvas !== Module['canvas']) { - SDL2.ctx = Module['createContext'](Module['canvas'], false, true); - SDL2.ctxCanvas = Module['canvas']; + if (SDL2.ctxCanvas !== canvas) { + SDL2.ctx = Module['createContext'](canvas, false, true); + SDL2.ctxCanvas = canvas; } if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) { SDL2.image = SDL2.ctx.createImageData(w, h); @@ -156,7 +159,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec } SDL2.ctx.putImageData(SDL2.image, 0, 0); - }, surface->w, surface->h, surface->pixels); + }, surface->w, surface->h, surface->pixels, data->canvas_id); if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { /* give back control to browser for screen refresh */ From d75fb0995dcf533bbc03bdac1c7d41caad678d68 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Sat, 26 Feb 2022 14:52:08 +0000 Subject: [PATCH 004/459] emscripten: Add a hint for specifying the canvas selector Now that we're not going through EGL, this is easy --- include/SDL_hints.h | 9 +++++++++ src/video/emscripten/SDL_emscriptenvideo.c | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 48f4f3689..6fee3e5fc 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -366,6 +366,15 @@ extern "C" { */ #define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY" +/** + * \brief Specify the CSS selector used for the "default" window/canvas + * + * This hint only applies to the emscripten platform + * + * The default value is "#canvas" + */ +#define SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR "SDL_EMSCRIPTEN_CANVAS_SELECTOR" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 46813a721..c8efac48f 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -215,6 +215,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) SDL_WindowData *wdata; double scaled_w, scaled_h; double css_w, css_h; + const char *selector; /* Allocate window internal data */ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); @@ -222,7 +223,12 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) return SDL_OutOfMemory(); } - wdata->canvas_id = SDL_strdup("#canvas"); + selector = SDL_GetHint(SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR); + if (!selector) { + selector = "#canvas"; + } + + wdata->canvas_id = SDL_strdup(selector); if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { wdata->pixel_ratio = emscripten_get_device_pixel_ratio(); From cfab203f91239a039be49a953242ad07db032b6d Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 29 Sep 2022 07:36:14 -0700 Subject: [PATCH 005/459] emscripten: Remove use of EM_ASM from SDL_timer code. Instead use the native emscripten timer API. See https://github.com/emscripten-core/emscripten/issues/17941 --- .github/workflows/emscripten.yml | 2 +- src/timer/SDL_timer.c | 37 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 06aee9e3a..3e8647c41 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v2 - uses: mymindstorm/setup-emsdk@v10 with: - version: 2.0.31 + version: 2.0.32 - name: Configure CMake run: | emcmake cmake -S . -B build \ diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index 7b7692df0..6741e97cb 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -375,11 +375,15 @@ SDL_RemoveTimer(SDL_TimerID id) #else #include +#include typedef struct _SDL_TimerMap { int timerID; int timeoutID; + Uint32 interval; + SDL_TimerCallback callback; + void *param; struct _SDL_TimerMap *next; } SDL_TimerMap; @@ -391,18 +395,14 @@ typedef struct { static SDL_TimerData SDL_timer_data; static void -SDL_Emscripten_TimerHelper(SDL_TimerMap *entry, Uint32 interval, SDL_TimerCallback callback, void *param) +SDL_Emscripten_TimerHelper(void *userdata) { - Uint32 new_timeout; - - new_timeout = callback(interval, param); - - if (new_timeout != 0) { - entry->timeoutID = EM_ASM_INT({ - return Browser.safeSetTimeout(function() { - dynCall('viiii', $0, [$1, $2, $3, $4]); - }, $2); - }, &SDL_Emscripten_TimerHelper, entry, interval, callback, param); + SDL_TimerMap *entry = (SDL_TimerMap*)userdata; + entry->interval = entry->callback(entry->interval, entry->param); + if (entry->interval > 0) { + entry->timeoutID = emscripten_set_timeout(&SDL_Emscripten_TimerHelper, + entry->interval, + entry); } } @@ -437,12 +437,13 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) return 0; } entry->timerID = ++data->nextID; + entry->callback = callback; + entry->param = param; + entry->interval = interval; - entry->timeoutID = EM_ASM_INT({ - return Browser.safeSetTimeout(function() { - dynCall('viiii', $0, [$1, $2, $3, $4]); - }, $2); - }, &SDL_Emscripten_TimerHelper, entry, interval, callback, param); + entry->timeoutID = emscripten_set_timeout(&SDL_Emscripten_TimerHelper, + entry->interval, + entry); entry->next = data->timermap; data->timermap = entry; @@ -470,9 +471,7 @@ SDL_RemoveTimer(SDL_TimerID id) } if (entry) { - EM_ASM_({ - window.clearTimeout($0); - }, entry->timeoutID); + emscripten_clear_timeout(entry->timeoutID); SDL_free(entry); return SDL_TRUE; From 1b895912a217e80aa8e2ac1c6377a018579d1c0a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 30 Sep 2022 14:23:36 -0400 Subject: [PATCH 006/459] docs: Note the lowest supported Emscripten version. Reference Issue #6304. --- docs/README-emscripten.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md index b535cc60a..7e9880b08 100644 --- a/docs/README-emscripten.md +++ b/docs/README-emscripten.md @@ -1,6 +1,10 @@ Emscripten ================================================================================ +SDL currently requires at least Emscripten 2.0.32 to build. Newer versions +are likely to work, as well. + + Build: $ mkdir build From 82e341bc9e914e753fe7842834d37b16aebc4ad5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Sep 2022 11:40:29 -0700 Subject: [PATCH 007/459] Android: use real editable text and mimic the edit operations to generate key events This fixes issues where the IME and the output would get out of sync --- Android.mk | 0 .../main/java/org/libsdl/app/SDLActivity.java | 196 +++++++++++++----- 2 files changed, 144 insertions(+), 52 deletions(-) mode change 100644 => 100755 Android.mk diff --git a/Android.mk b/Android.mk old mode 100644 new mode 100755 diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 8d4039c1b..c9019dad6 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -44,6 +44,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.widget.Button; +import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -1874,9 +1875,17 @@ class DummyEdit extends View implements View.OnKeyListener { class SDLInputConnection extends BaseInputConnection { + protected EditText mEditText; + protected int m_nLastContentLength = 0; + public SDLInputConnection(View targetView, boolean fullEditor) { super(targetView, fullEditor); + mEditText = new EditText(SDL.getContext()); + } + @Override + public Editable getEditable() { + return mEditText.getEditableText(); } @Override @@ -1899,79 +1908,162 @@ class SDLInputConnection extends BaseInputConnection { } } - return super.sendKeyEvent(event); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - - /* Generate backspaces for the text we're going to replace */ - final Editable content = getEditable(); - if (content != null) { - int a = getComposingSpanStart(content); - int b = getComposingSpanEnd(content); - if (a == -1 || b == -1) { - a = Selection.getSelectionStart(content); - b = Selection.getSelectionEnd(content); - } - if (a < 0) a = 0; - if (b < 0) b = 0; - if (b < a) { - int tmp = a; - a = b; - b = tmp; - } - int backspaces = (b - a); - - for (int i = 0; i < backspaces; i++) { - nativeGenerateScancodeForUnichar('\b'); - } - } - - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - if (c == '\n') { - if (SDLActivity.onNativeSoftReturnKey()) { - return true; - } - } - nativeGenerateScancodeForUnichar(c); - } - - SDLInputConnection.nativeCommitText(text.toString(), newCursorPosition); + replaceText(text, newCursorPosition, false); return super.commitText(text, newCursorPosition); } @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { - - nativeSetComposingText(text.toString(), newCursorPosition); + replaceText(text, newCursorPosition, true); return super.setComposingText(text, newCursorPosition); } + @Override + public boolean setComposingRegion(int start, int end) { + final Editable content = getEditable(); + if (content != null) { + int a = start; + int b = end; + if (a > b) { + int tmp = a; + a = b; + b = tmp; + } + + // Clip the end points to be within the content bounds. + final int length = content.length(); + if (a < 0) { + a = 0; + } + if (b < 0) { + b = 0; + } + if (a > length) { + a = length; + } + if (b > length) { + b = length; + } + + deleteText(a, b); + } + + return super.setComposingRegion(start, end); + } + + @Override + public boolean deleteSurroundingText(int beforeLength, int afterLength) { + final Editable content = getEditable(); + if (content != null) { + int a = Selection.getSelectionStart(content); + int b = Selection.getSelectionEnd(content); + + if (a > b) { + int tmp = a; + a = b; + b = tmp; + } + + // ignore the composing text. + int ca = getComposingSpanStart(content); + int cb = getComposingSpanEnd(content); + if (cb < ca) { + int tmp = ca; + ca = cb; + cb = tmp; + } + + if (ca != -1 && cb != -1) { + if (ca < a) { + a = ca; + } + if (cb > b) { + b = cb; + } + } + + if (beforeLength > 0) { + int start = a - beforeLength; + if (start < 0) { + start = 0; + } + deleteText(start, a); + } + } + + return super.deleteSurroundingText(beforeLength, afterLength); + } + + protected void replaceText(CharSequence text, int newCursorPosition, boolean composing) { + final Editable content = getEditable(); + if (content == null) { + return; + } + + // delete composing text set previously. + int a = getComposingSpanStart(content); + int b = getComposingSpanEnd(content); + + if (b < a) { + int tmp = a; + a = b; + b = tmp; + } + if (a == -1 || b == -1) { + a = Selection.getSelectionStart(content); + b = Selection.getSelectionEnd(content); + if (a < 0) { + a = 0; + } + if (b < 0) { + b = 0; + } + if (b < a) { + int tmp = a; + a = b; + b = tmp; + } + } + + deleteText(a, b); + + if (composing) { + nativeSetComposingText(text.toString(), newCursorPosition); + } else { + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (c == '\n') { + if (SDLActivity.onNativeSoftReturnKey()) { + return; + } + } + ++m_nLastContentLength; + nativeGenerateScancodeForUnichar(c); + } + SDLInputConnection.nativeCommitText(text.toString(), newCursorPosition); + } + } + + protected void deleteText(int start, int end) { + while (m_nLastContentLength > start) { + --m_nLastContentLength; + nativeGenerateScancodeForUnichar('\b'); + } + } + public static native void nativeCommitText(String text, int newCursorPosition); public native void nativeGenerateScancodeForUnichar(char c); public native void nativeSetComposingText(String text, int newCursorPosition); - @Override - public boolean deleteSurroundingText(int beforeLength, int afterLength) { - // Workaround to capture backspace key. Ref: http://stackoverflow.com/questions/14560344/android-backspace-in-webview-baseinputconnection - // and https://bugzilla.libsdl.org/show_bug.cgi?id=2265 - if (beforeLength > 0 && afterLength == 0) { - // backspace(s) - while (beforeLength-- > 0) { - nativeGenerateScancodeForUnichar('\b'); - } - return true; - } - - return super.deleteSurroundingText(beforeLength, afterLength); - } } class SDLClipboardHandler implements From 7567c4cb00d66818779466deed7721a470a50d3b Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 30 Sep 2022 21:51:11 +0300 Subject: [PATCH 008/459] revert executable permissions from Android.mk --- Android.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100755 => 100644 Android.mk diff --git a/Android.mk b/Android.mk old mode 100755 new mode 100644 index ce67ae2d7..facc54afb --- a/Android.mk +++ b/Android.mk @@ -75,7 +75,6 @@ LOCAL_CFLAGS += \ -Wstrict-prototypes \ -Wkeyword-macro \ - # Warnings we haven't fixed (yet) LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare @@ -91,6 +90,7 @@ LOCAL_STATIC_LIBRARIES := cpufeatures include $(BUILD_SHARED_LIBRARY) + ########################### # # SDL static library @@ -109,6 +109,7 @@ LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid include $(BUILD_STATIC_LIBRARY) + ########################### # # SDL main static library From e6640ef2d46a1baa34b4d893df661d17f0070b76 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 30 Sep 2022 14:53:07 -0400 Subject: [PATCH 009/459] coreaudio: Possibly fixed another shutdown race condition. Reference Issue #6159. --- src/audio/coreaudio/SDL_coreaudio.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 1a6871904..63ce6a5d3 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -701,6 +701,14 @@ COREAUDIO_CloseDevice(_THIS) } #endif + /* if callback fires again, feed silence; don't call into the app. */ + SDL_AtomicSet(&this->paused, 1); + + if (this->hidden->thread) { + SDL_assert(SDL_AtomicGet(&this->shutdown) != 0); /* should have been set by SDL_audio.c */ + SDL_WaitThread(this->hidden->thread, NULL); + } + if (iscapture) { open_capture_devices--; } else { @@ -725,18 +733,10 @@ COREAUDIO_CloseDevice(_THIS) open_devices = NULL; } - /* if callback fires again, feed silence; don't call into the app. */ - SDL_AtomicSet(&this->paused, 1); - if (this->hidden->audioQueue) { AudioQueueDispose(this->hidden->audioQueue, 1); } - if (this->hidden->thread) { - SDL_assert(SDL_AtomicGet(&this->shutdown) != 0); /* should have been set by SDL_audio.c */ - SDL_WaitThread(this->hidden->thread, NULL); - } - if (this->hidden->ready_semaphore) { SDL_DestroySemaphore(this->hidden->ready_semaphore); } From 28572702bfc77f799ccb5eddd3ae5982f402f042 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Sep 2022 17:25:57 -0700 Subject: [PATCH 010/459] Properly backspace over text that was entered when autocorrect updates text with the iPhone on-screen keyboard --- Android.mk | 0 src/video/uikit/SDL_uikitviewcontroller.m | 51 ++++++++++++++--------- 2 files changed, 31 insertions(+), 20 deletions(-) mode change 100644 => 100755 Android.mk diff --git a/Android.mk b/Android.mk old mode 100644 new mode 100755 diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index d0dd863f6..4aa2d287e 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -75,7 +75,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o BOOL hardwareKeyboard; BOOL showingKeyboard; BOOL rotatingOrientation; - NSString *changeText; + NSString *committedText; NSString *obligateForBackspace; #endif } @@ -263,12 +263,12 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o /* Set ourselves up as a UITextFieldDelegate */ - (void)initKeyboard { - changeText = nil; obligateForBackspace = @" "; /* 64 space */ textField = [[UITextField alloc] initWithFrame:CGRectZero]; textField.delegate = self; /* placeholder so there is something to delete! */ textField.text = obligateForBackspace; + committedText = textField.text; /* set UITextInputTrait properties, mostly to defaults */ textField.autocapitalizationType = UITextAutocapitalizationTypeNone; @@ -408,21 +408,39 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o - (void)textFieldTextDidChange:(NSNotification *)notification { - if (changeText!=nil && textField.markedTextRange == nil) - { - NSUInteger len = changeText.length; - if (len > 0) { + if (textField.markedTextRange == nil) { + NSUInteger compareLength = SDL_min(textField.text.length, committedText.length); + NSUInteger matchLength; + + /* Backspace over characters that are no longer in the string */ + for (matchLength = 0; matchLength < compareLength; ++matchLength) { + if ([committedText characterAtIndex:matchLength] != [textField.text characterAtIndex:matchLength]) { + break; + } + } + if (matchLength < committedText.length) { + size_t deleteLength = SDL_utf8strlen([[committedText substringFromIndex:matchLength] UTF8String]); + while (deleteLength > 0) { + /* Send distinct down and up events for each backspace action */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE); + --deleteLength; + } + } + + if (matchLength < textField.text.length) { + NSString *pendingText = [textField.text substringFromIndex:matchLength]; if (!SDL_HardwareKeyboardKeyPressed()) { /* Go through all the characters in the string we've been sent and * convert them to key presses */ - int i; - for (i = 0; i < len; i++) { - SDL_SendKeyboardUnicodeKey([changeText characterAtIndex:i]); + NSUInteger i; + for (i = 0; i < pendingText.length; i++) { + SDL_SendKeyboardUnicodeKey([pendingText characterAtIndex:i]); } } - SDL_SendKeyboardText([changeText UTF8String]); + SDL_SendKeyboardText([pendingText UTF8String]); } - changeText = nil; + committedText = textField.text; } } @@ -463,18 +481,11 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o /* UITextFieldDelegate method. Invoked when user types something. */ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSUInteger len = string.length; - if (len == 0) { - changeText = nil; - if (textField.markedTextRange == nil) { - /* it wants to replace text with nothing, ie a delete */ - SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_BACKSPACE); - } + if (textField.markedTextRange == nil) { if (textField.text.length < 16) { textField.text = obligateForBackspace; + committedText = textField.text; } - } else { - changeText = string; } return YES; } From 257cacab183b312bbe60bd7967eee44a3ad7be85 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Sep 2022 17:25:58 -0700 Subject: [PATCH 011/459] Android text input now works like iOS, where you get text in progress and then backspaces and new text if autocomplete changes it or the IME commits it. --- .../main/java/org/libsdl/app/SDLActivity.java | 161 +++++------------- 1 file changed, 43 insertions(+), 118 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index c9019dad6..61e4dfe8b 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1876,7 +1876,7 @@ class DummyEdit extends View implements View.OnKeyListener { class SDLInputConnection extends BaseInputConnection { protected EditText mEditText; - protected int m_nLastContentLength = 0; + protected String mCommittedText = ""; public SDLInputConnection(View targetView, boolean fullEditor) { super(targetView, fullEditor); @@ -1913,149 +1913,74 @@ class SDLInputConnection extends BaseInputConnection { @Override public boolean commitText(CharSequence text, int newCursorPosition) { - replaceText(text, newCursorPosition, false); - - return super.commitText(text, newCursorPosition); + if (!super.commitText(text, newCursorPosition)) { + return false; + } + updateText(); + return true; } @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { - replaceText(text, newCursorPosition, true); - - return super.setComposingText(text, newCursorPosition); - } - - @Override - public boolean setComposingRegion(int start, int end) { - final Editable content = getEditable(); - if (content != null) { - int a = start; - int b = end; - if (a > b) { - int tmp = a; - a = b; - b = tmp; - } - - // Clip the end points to be within the content bounds. - final int length = content.length(); - if (a < 0) { - a = 0; - } - if (b < 0) { - b = 0; - } - if (a > length) { - a = length; - } - if (b > length) { - b = length; - } - - deleteText(a, b); + if (!super.setComposingText(text, newCursorPosition)) { + return false; } - - return super.setComposingRegion(start, end); + updateText(); + return true; } @Override public boolean deleteSurroundingText(int beforeLength, int afterLength) { - final Editable content = getEditable(); - if (content != null) { - int a = Selection.getSelectionStart(content); - int b = Selection.getSelectionEnd(content); - - if (a > b) { - int tmp = a; - a = b; - b = tmp; - } - - // ignore the composing text. - int ca = getComposingSpanStart(content); - int cb = getComposingSpanEnd(content); - if (cb < ca) { - int tmp = ca; - ca = cb; - cb = tmp; - } - - if (ca != -1 && cb != -1) { - if (ca < a) { - a = ca; - } - if (cb > b) { - b = cb; - } - } - - if (beforeLength > 0) { - int start = a - beforeLength; - if (start < 0) { - start = 0; - } - deleteText(start, a); - } + if (!super.deleteSurroundingText(beforeLength, afterLength)) { + return false; } - - return super.deleteSurroundingText(beforeLength, afterLength); + updateText(); + return true; } - protected void replaceText(CharSequence text, int newCursorPosition, boolean composing) { + protected void updateText() { final Editable content = getEditable(); if (content == null) { return; } - - // delete composing text set previously. - int a = getComposingSpanStart(content); - int b = getComposingSpanEnd(content); - if (b < a) { - int tmp = a; - a = b; - b = tmp; + String text = content.toString(); + int compareLength = Math.min(text.length(), mCommittedText.length()); + int matchLength, offset; + + /* Backspace over characters that are no longer in the string */ + for (matchLength = 0; matchLength < compareLength; ) { + int codePoint = mCommittedText.codePointAt(matchLength); + if (codePoint != text.codePointAt(matchLength)) { + break; + } + matchLength += Character.charCount(codePoint); } - if (a == -1 || b == -1) { - a = Selection.getSelectionStart(content); - b = Selection.getSelectionEnd(content); - if (a < 0) { - a = 0; - } - if (b < 0) { - b = 0; - } - if (b < a) { - int tmp = a; - a = b; - b = tmp; - } + /* FIXME: This doesn't handle graphemes, like '🌬ï¸' */ + for (offset = matchLength; offset < mCommittedText.length(); ) { + int codePoint = mCommittedText.codePointAt(offset); + nativeGenerateScancodeForUnichar('\b'); + offset += Character.charCount(codePoint); } - deleteText(a, b); - - if (composing) { - nativeSetComposingText(text.toString(), newCursorPosition); - } else { - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - if (c == '\n') { + if (matchLength < text.length()) { + String pendingText = text.subSequence(matchLength, text.length()).toString(); + for (offset = 0; offset < pendingText.length(); ) { + int codePoint = pendingText.codePointAt(offset); + if (codePoint == '\n') { if (SDLActivity.onNativeSoftReturnKey()) { return; } } - ++m_nLastContentLength; - nativeGenerateScancodeForUnichar(c); + /* Higher code points don't generate simulated scancodes */ + if (codePoint < 128) { + nativeGenerateScancodeForUnichar((char)codePoint); + } + offset += Character.charCount(codePoint); } - SDLInputConnection.nativeCommitText(text.toString(), newCursorPosition); - } - } - - protected void deleteText(int start, int end) { - while (m_nLastContentLength > start) { - --m_nLastContentLength; - nativeGenerateScancodeForUnichar('\b'); + SDLInputConnection.nativeCommitText(pendingText, 0); } + mCommittedText = text; } public static native void nativeCommitText(String text, int newCursorPosition); From 6acc7a5622a6962538907dc144ebfc4fedc1124d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Sep 2022 17:45:08 -0700 Subject: [PATCH 012/459] Mark the editbox as multi-line so the return key is always visible Fixes https://github.com/libsdl-org/SDL/issues/6170 --- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 61e4dfe8b..f65e93c06 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -207,7 +207,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // Main components protected static SDLActivity mSingleton; protected static SDLSurface mSurface; - protected static View mTextEdit; + protected static DummyEdit mTextEdit; protected static boolean mScreenKeyboardShown; protected static ViewGroup mLayout; protected static SDLClipboardHandler mClipboardHandler; @@ -1865,9 +1865,10 @@ class DummyEdit extends View implements View.OnKeyListener { public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); - outAttrs.inputType = InputType.TYPE_CLASS_TEXT; - outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI - | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; + outAttrs.inputType = InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_FLAG_MULTI_LINE; + outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | + EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; } From c29629a5efa1b460a2058cffb007610854872fe9 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 1 Oct 2022 04:25:40 +0300 Subject: [PATCH 013/459] fix permissions of Android.mk --- Android.mk | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 Android.mk diff --git a/Android.mk b/Android.mk old mode 100755 new mode 100644 From 5e654a4bf28f30795f10727df7bec133dde8dfc0 Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Sat, 1 Oct 2022 16:10:46 -0700 Subject: [PATCH 014/459] Fixed Mac compile errors when OpenGL is disabled. --- src/video/cocoa/SDL_cocoawindow.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 02c01bdce..fa0096857 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -267,6 +267,8 @@ ScheduleContextUpdates(SDL_WindowData *data) } /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ + #if SDL_VIDEO_OPENGL + #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" @@ -287,6 +289,8 @@ ScheduleContextUpdates(SDL_WindowData *data) #ifdef __clang__ #pragma clang diagnostic pop #endif + + #endif /* SDL_VIDEO_OPENGL */ } /* !!! FIXME: this should use a hint callback. */ @@ -2350,11 +2354,15 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window) [data.nswindow close]; } + #if SDL_VIDEO_OPENGL + contexts = [data.nscontexts copy]; for (SDLOpenGLContext *context in contexts) { /* Calling setWindow:NULL causes the context to remove itself from the context list. */ [context setWindow:NULL]; } + + #endif /* SDL_VIDEO_OPENGL */ } window->driverdata = NULL; }} From bac54b3d267d50bd5092ead26ea2064270a2fabc Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 27 Sep 2022 17:45:36 +0200 Subject: [PATCH 015/459] Android: add script for building prefab archive --- build-scripts/android-prefab.sh | 351 ++++++++++++++++++++++++++++++++ 1 file changed, 351 insertions(+) create mode 100755 build-scripts/android-prefab.sh diff --git a/build-scripts/android-prefab.sh b/build-scripts/android-prefab.sh new file mode 100755 index 000000000..aef588eeb --- /dev/null +++ b/build-scripts/android-prefab.sh @@ -0,0 +1,351 @@ +#!/bin/bash + +set -e + +if ! [ "x$ANDROID_NDK_HOME" != "x" -a -d "$ANDROID_NDK_HOME" ]; then + echo "ANDROID_NDK_HOME environment variable is not set" + exit 1 +fi + +if ! [ "x$ANDROID_HOME" != "x" -a -d "$ANDROID_HOME" ]; then + echo "ANDROID_HOME environment variable is not set" + exit 1 +fi + +if [ "x$ANDROID_API" = "x" ]; then + ANDROID_API="$(ls "$ANDROID_HOME/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)" + if [ "x$ANDROID_API" = "x" ]; then + echo "No Android platform found in $ANDROID_HOME/platforms" + exit 1 + fi +else + if ! [ -d "$ANDROID_HOME/platforms/android-$ANDROID_API" ]; then + echo "Android api version $ANDROID_API is not available ($ANDROID_HOME/platforms/android-$ANDROID_API does not exist)" >2 + exit 1 + fi +fi + +android_platformdir="$ANDROID_HOME/platforms/android-$ANDROID_API" + +echo "Building for android api version $ANDROID_API" +echo "android_platformdir=$android_platformdir" + +scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") +sdl_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)") + +build_root="${sdl_root}/build-android-prefab" + +android_abis="armeabi-v7a arm64-v8a x86 x86_64" +android_api=19 +android_ndk=21 +android_stl="c++_shared" + +sdl_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' "${sdl_root}/include/SDL_version.h") +sdl_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' "${sdl_root}/include/SDL_version.h") +sdl_patch=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' "${sdl_root}/include/SDL_version.h") +sdl_version="${sdl_major}.${sdl_minor}.${sdl_patch}" +echo "Building Android prefab package for SDL version $sdl_version" + +prefabhome="${build_root}/prefab-${sdl_version}" +rm -rf "$prefabhome" +mkdir -p "${prefabhome}" + +build_cmake_projects() { + for android_abi in $android_abis; do + echo "Configuring CMake project for $android_abi" + cmake -S "$sdl_root" -B "${build_root}/build_${android_abi}" \ + -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \ + -DANDROID_PLATFORM=${android_platform} \ + -DANDROID_ABI=${android_abi} \ + -DSDL_SHARED=ON \ + -DSDL_STATIC=ON \ + -DSDL_STATIC_PIC=ON \ + -DSDL_TEST=ON \ + -DSDL2_DISABLE_SDL2MAIN=OFF \ + -DSDL2_DISABLE_INSTALL=OFF \ + -DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \ + -DCMAKE_INSTALL_INCLUDEDIR=include \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=Release \ + -GNinja + + rm -rf "${build_root}/build_${android_abi}/prefix" + + echo "Building CMake project for $android_abi" + cmake --build "${build_root}/build_${android_abi}" + + echo "Installing CMake project for $android_abi" + cmake --install "${build_root}/build_${android_abi}" + done +} + +classes_sources_jar_path="${prefabhome}/classes-sources.jar" +classes_jar_path="${prefabhome}/classes.jar" +compile_java() { + classes_sources_root="${prefabhome}/classes-sources" + + rm -rf "${classes_sources_root}" + mkdir -p "${classes_sources_root}/META-INF" + + echo "Copying LICENSE.txt to java build folder" + cp "$sdl_root/LICENSE.txt" "${classes_sources_root}/META-INF" + + echo "Copy JAVA sources to java build folder" + cp -r "$sdl_root/android-project/app/src/main/java/org" "${classes_sources_root}" + + java_sourceslist_path="${prefabhome}/java_sources.txt" + pushd "${classes_sources_root}" + echo "Collecting sources for classes-sources.jar" + find "." -name "*.java" >"${java_sourceslist_path}" + find "META-INF" -name "*" >>"${java_sourceslist_path}" + + echo "Creating classes-sources.jar" + jar -cf "${classes_sources_jar_path}" "@${java_sourceslist_path}" + popd + + classes_root="${prefabhome}/classes" + mkdir -p "${classes_root}/META-INF" + cp "$sdl_root/LICENSE.txt" "${classes_root}/META-INF" + java_sourceslist_path="${prefabhome}/java_sources.txt" + + echo "Collecting sources for classes.jar" + find "$sdl_root/android-project/app/src/main/java" -name "*.java" >"${java_sourceslist_path}" + + echo "Compiling classes" + javac -encoding utf-8 -classpath "$android_platformdir/android.jar" -d "${classes_root}" "@${java_sourceslist_path}" + + java_classeslist_path="${prefabhome}/java_classes.txt" + pushd "${classes_root}" + find "." -name "*.class" >"${java_classeslist_path}" + find "META-INF" -name "*" >>"${java_classeslist_path}" + echo "Creating classes.jar" + jar -cf "${classes_jar_path}" "@${java_classeslist_path}" + popd +} + +pom_filename="SDL${sdl_major}-${sdl_version}.pom" +pom_filepath="${prefabhome}/${pom_filename}" +create_pom_xml() { + echo "Creating ${pom_filename}" + cat >"${pom_filepath}" < + 4.0.0 + org.libsdl.android + SDL${sdl_major} + ${sdl_version} + aar + SDL${sdl_major} + The AAR for SDL${sdl_major} + https://libsdl.org/ + + + zlib License + https://github.com/libsdl-org/SDL/blob/main/LICENSE.txt + repo + + + + scm:git:https://github.com/libsdl-org/SDL + https://github.com/libsdl-org/SDL + + +EOF +} + +create_aar_androidmanifest() { + echo "Creating AndroidManifest.xml" + cat >"${aar_root}/AndroidManifest.xml" < + + +EOF +} + +echo "Creating AAR root directory" +aar_root="${prefabhome}/SDL${sdl_major}-${sdl_version}" +mkdir -p "${aar_root}" + +aar_metainfdir_path=${aar_root}/META-INF +mkdir -p "${aar_metainfdir_path}" +cp "${sdl_root}/LICENSE.txt" "${aar_metainfdir_path}" + +prefabworkdir="${aar_root}/prefab" +mkdir -p "${prefabworkdir}" + +cat >"${prefabworkdir}/prefab.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" </dev/null ; + mv "${aar_filename}" "${prefabhome}" +popd + +maven_filename="SDL${sdl_major}-${sdl_version}.zip" + +pushd "${prefabhome}" + zip_filename="SDL${sdl_major}-${sdl_version}.zip" + zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null; + zip -Tv "${zip_filename}" 2>/dev/null; +popd + +echo "Prefab zip is ready at ${prefabhome}/${aar_filename}" +echo "Maven archive is ready at ${prefabhome}/${zip_filename}" From 0672dc8d8f6e22789351136a8addc730080797f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 08:48:38 -0700 Subject: [PATCH 016/459] Fixed combined Joy-Cons after https://github.com/libsdl-org/SDL/commit/aa2e2f4843567cfe4e6f2f4ffa3f0b74dd98f1ba (thanks @happyharryh!) --- src/joystick/hidapi/SDL_hidapijoystick.c | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 3fe935ef3..25db216e3 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -358,14 +358,16 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) } /* Make sure we can open the device and leave it open for the driver */ - device->dev = SDL_hid_open_path(device->path, 0); - if (!device->dev) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", - device->path, SDL_GetError()); - return; + if (device->num_children == 0) { + device->dev = SDL_hid_open_path(device->path, 0); + if (!device->dev) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", + device->path, SDL_GetError()); + return; + } + SDL_hid_set_nonblocking(device->dev, 1); } - SDL_hid_set_nonblocking(device->dev, 1); device->driver = HIDAPI_GetDeviceDriver(device); @@ -774,6 +776,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device) { SDL_HIDAPI_Device *curr, *last; + int i; #ifdef DEBUG_HIDAPI SDL_Log("Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); @@ -794,6 +797,10 @@ HIDAPI_DelDevice(SDL_HIDAPI_Device *device) SDL_Delay(10); } + for (i = 0; i < device->num_children; ++i) { + device->children[i]->parent = NULL; + } + SDL_DestroyMutex(device->dev_lock); SDL_free(device->serial); SDL_free(device->name); @@ -864,7 +871,9 @@ HIDAPI_CreateCombinedJoyCons() if (combined && combined->driver) { return SDL_TRUE; } else { - if (!combined) { + if (combined) { + HIDAPI_DelDevice(combined); + } else { SDL_free(children); } return SDL_FALSE; From 6c8bf3af4c57776cd8463bf7c2ee3058204fa99d Mon Sep 17 00:00:00 2001 From: Happy Harry <36951436+happyharryh@users.noreply.github.com> Date: Mon, 3 Oct 2022 00:19:34 +0800 Subject: [PATCH 017/459] Add vertical mode for Nintendo Joy-Con (#6303) * Added support for vertical mode for Joy-Con controllers * Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS for switching to this mode * Added support for SL/SR buttons in combined/vertical mode and L/ZL/R/ZR buttons in mini-gamepad mode --- include/SDL_hints.h | 11 +++++++++++ src/joystick/SDL_gamecontroller.c | 13 +++++++++++-- src/joystick/hidapi/SDL_hidapi_switch.c | 20 +++++++++++++++++--- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 10171c445..9e8295b48 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -672,6 +672,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" +/** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) + * "1" - Left and right Joy-Con controllers will be in vertical mode + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS" + /** * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. * diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index b764980e9..60446877d 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -606,8 +606,17 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI } break; default: - /* Mini gamepad mode */ - SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,leftshoulder:b9,leftstick:b7,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,", sizeof(mapping_string)); + if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE)) { + /* Vertical mode */ + if (guid.data[15] == k_eSwitchDeviceInfoControllerType_JoyConLeft) { + SDL_strlcat(mapping_string, "back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,", sizeof(mapping_string)); + } else { + SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", sizeof(mapping_string)); + } + } else { + /* Mini gamepad mode */ + SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,leftshoulder:b9,leftstick:b7,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,", sizeof(mapping_string)); + } break; } } else { diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index f441c79c9..ff2930c3d 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -262,6 +262,7 @@ typedef struct { Uint32 m_unIMUSamples; Uint32 m_unIMUUpdateIntervalUS; Uint64 m_ulTimestampUS; + SDL_bool m_bVerticalMode; SwitchInputOnlyControllerStatePacket_t m_lastInputOnlyState; SwitchSimpleStatePacket_t m_lastSimpleState; @@ -1410,7 +1411,7 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti SDL_PlayerLEDHintChanged, ctx); /* Initialize the joystick capabilities */ - joystick->nbuttons = 16; + joystick->nbuttons = 20; joystick->naxes = SDL_CONTROLLER_AXIS_MAX; joystick->epowerlevel = device->is_bluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED; @@ -1419,6 +1420,9 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti ctx->m_unLastIMUReset = ctx->m_unLastInput = SDL_GetTicks(); ctx->m_unIMUUpdateIntervalUS = 5 * 1000; /* Start off at 5 ms update rate */ + /* Set up for vertical mode */ + ctx->m_bVerticalMode = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE); + return SDL_TRUE; } @@ -1824,6 +1828,8 @@ static void HandleCombinedControllerStateL(SDL_Joystick *joystick, SDL_DriverSwi SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); axis = (data & 0x80) ? 32767 : -32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); @@ -1857,6 +1863,9 @@ static void HandleMiniControllerStateL(SDL_Joystick *joystick, SDL_DriverSwitch_ SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); } axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8); @@ -1878,6 +1887,8 @@ static void HandleCombinedControllerStateR(SDL_Joystick *joystick, SDL_DriverSwi SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); axis = (data & 0x80) ? 32767 : -32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); @@ -1911,6 +1922,9 @@ static void HandleMiniControllerStateR(SDL_Joystick *joystick, SDL_DriverSwitch_ SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); } if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { @@ -1932,13 +1946,13 @@ static void HandleMiniControllerStateR(SDL_Joystick *joystick, SDL_DriverSwitch_ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) { if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) { - if (ctx->device->parent) { + if (ctx->device->parent || ctx->m_bVerticalMode) { HandleCombinedControllerStateL(joystick, ctx, packet); } else { HandleMiniControllerStateL(joystick, ctx, packet); } } else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { - if (ctx->device->parent) { + if (ctx->device->parent || ctx->m_bVerticalMode) { HandleCombinedControllerStateR(joystick, ctx, packet); } else { HandleMiniControllerStateR(joystick, ctx, packet); From a00565b8ba13fd46c6708b68091ec6ad9cdd891c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 09:08:39 -0700 Subject: [PATCH 018/459] Fixed displaying more than 18 buttons --- test/testjoystick.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/testjoystick.c b/test/testjoystick.c index 91d02de5b..3fb004ff0 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -198,19 +198,25 @@ loop(void *arg) } if (joystick) { + const int BUTTONS_PER_LINE = ((SCREEN_WIDTH - 4) / 34); + int x, y; /* Update visual joystick state */ SDL_SetRenderDrawColor(screen, 0x00, 0xFF, 0x00, SDL_ALPHA_OPAQUE); + y = SCREEN_HEIGHT - ((((SDL_JoystickNumButtons(joystick) + (BUTTONS_PER_LINE - 1)) / BUTTONS_PER_LINE) + 1) * 34); for (i = 0; i < SDL_JoystickNumButtons(joystick); ++i) { + if ((i % BUTTONS_PER_LINE) == 0) { + y += 34; + } if (SDL_JoystickGetButton(joystick, i) == SDL_PRESSED) { - DrawRect(screen, (i%20) * 34, SCREEN_HEIGHT - 68 + (i/20) * 34, 32, 32); + x = 2 + (i % BUTTONS_PER_LINE) * 34; + DrawRect(screen, x, y, 32, 32); } } SDL_SetRenderDrawColor(screen, 0xFF, 0x00, 0x00, SDL_ALPHA_OPAQUE); for (i = 0; i < SDL_JoystickNumAxes(joystick); ++i) { /* Draw the X/Y axis */ - int x, y; x = (((int) SDL_JoystickGetAxis(joystick, i)) + 32768); x *= SCREEN_WIDTH; x /= 65535; @@ -239,8 +245,8 @@ loop(void *arg) SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0xFF, SDL_ALPHA_OPAQUE); for (i = 0; i < SDL_JoystickNumHats(joystick); ++i) { /* Derive the new position */ - int x = SCREEN_WIDTH/2; - int y = SCREEN_HEIGHT/2; + x = SCREEN_WIDTH/2; + y = SCREEN_HEIGHT/2; const Uint8 hat_pos = SDL_JoystickGetHat(joystick, i); if (hat_pos & SDL_HAT_UP) { From 37dfa2629b9871f9b45d365dae4e723b6a37a9dd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 09:36:50 -0700 Subject: [PATCH 019/459] Added paddle mapping for combined Joy-Cons --- src/joystick/hidapi/SDL_hidapi_switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index ff2930c3d..c00fdbad4 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1828,8 +1828,8 @@ static void HandleCombinedControllerStateL(SDL_Joystick *joystick, SDL_DriverSwi SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); axis = (data & 0x80) ? 32767 : -32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); @@ -1887,7 +1887,7 @@ static void HandleCombinedControllerStateR(SDL_Joystick *joystick, SDL_DriverSwi SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); axis = (data & 0x80) ? 32767 : -32768; From f58a6506a12ce7b086592fbf356710c5ca4e180c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 09:50:27 -0700 Subject: [PATCH 020/459] Added paddle mapping for combined Joy-Cons --- src/joystick/SDL_gamecontroller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 60446877d..7458e0df3 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -609,9 +609,9 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE)) { /* Vertical mode */ if (guid.data[15] == k_eSwitchDeviceInfoControllerType_JoyConLeft) { - SDL_strlcat(mapping_string, "back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,", sizeof(mapping_string)); + SDL_strlcat(mapping_string, "back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,paddle2:b17,paddle4:b19,", sizeof(mapping_string)); } else { - SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", sizeof(mapping_string)); + SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,paddle1:b16,paddle3:b18,", sizeof(mapping_string)); } } else { /* Mini gamepad mode */ @@ -633,8 +633,8 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI /* Steam controllers have 2 back paddle buttons */ SDL_strlcat(mapping_string, "paddle1:b16,paddle2:b15,", sizeof(mapping_string)); } else if (SDL_IsJoystickNintendoSwitchJoyConPair(vendor, product)) { - /* The Nintendo Switch Joy-Con combined controller has a share button */ - SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string)); + /* The Nintendo Switch Joy-Con combined controller has a share button and paddles */ + SDL_strlcat(mapping_string, "misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,", sizeof(mapping_string)); } else { switch (SDL_GetJoystickGameControllerTypeFromGUID(guid, NULL)) { case SDL_CONTROLLER_TYPE_PS4: From b4c25f57141c42e7d6022b5ca65f547f344a1b29 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 09:51:05 -0700 Subject: [PATCH 021/459] Remapped the side button and trigger as paddles for the mini-gamepad mode of the Joy-Cons This is the only case where the mapping differs between right and left Joy-Cons in mini-gamepad mode. The left Joy-Con will have the left paddles and the right Joy-Con will have the right paddles. This facilitates co-op gameplay with individual actions while still using the normal mini-gamepad mode. The paddles are used for this because conceptually they are more awkward to hit than the normal controls and they are in roughly the correct hand position. --- src/joystick/SDL_gamecontroller.c | 6 +++++- src/joystick/hidapi/SDL_hidapi_switch.c | 10 ++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 7458e0df3..89f590e23 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -615,7 +615,11 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI } } else { /* Mini gamepad mode */ - SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,leftshoulder:b9,leftstick:b7,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,", sizeof(mapping_string)); + if (guid.data[15] == k_eSwitchDeviceInfoControllerType_JoyConLeft) { + SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,leftshoulder:b9,leftstick:b7,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,paddle2:b17,paddle4:b19,", sizeof(mapping_string)); + } else { + SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,leftshoulder:b9,leftstick:b7,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,paddle1:b16,paddle3:b18,", sizeof(mapping_string)); + } } break; } diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index c00fdbad4..8a61031a5 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1863,9 +1863,8 @@ static void HandleMiniControllerStateL(SDL_Joystick *joystick, SDL_DriverSwitch_ SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); - axis = (data & 0x80) ? 32767 : -32768; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED); } axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8); @@ -1922,9 +1921,8 @@ static void HandleMiniControllerStateR(SDL_Joystick *joystick, SDL_DriverSwitch_ SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); - axis = (data & 0x80) ? 32767 : -32768; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED); } if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { From bd6afc2317b8f825c259b1593cda31a9f592408f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 10:15:39 -0700 Subject: [PATCH 022/459] Fixed sensor axes in vertical mode --- src/joystick/hidapi/SDL_hidapi_switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 8a61031a5..8eaadb31e 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1793,7 +1793,7 @@ static void SendSensorUpdate(SDL_Joystick *joystick, SDL_DriverSwitch_Context *c } if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft && - !ctx->device->parent) { + !ctx->device->parent && !ctx->m_bVerticalMode) { /* Mini-gamepad mode, swap some axes around */ float tmp = data[2]; data[2] = -data[0]; @@ -1801,7 +1801,7 @@ static void SendSensorUpdate(SDL_Joystick *joystick, SDL_DriverSwitch_Context *c } if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight && - !ctx->device->parent) { + !ctx->device->parent && !ctx->m_bVerticalMode) { /* Mini-gamepad mode, swap some axes around */ float tmp = data[2]; data[2] = data[0]; From 19ecb64e0dfea5616798f77d8262715f0d722038 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 10:18:57 -0700 Subject: [PATCH 023/459] Fixed build --- test/testjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testjoystick.c b/test/testjoystick.c index 3fb004ff0..96f4be180 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -245,9 +245,9 @@ loop(void *arg) SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0xFF, SDL_ALPHA_OPAQUE); for (i = 0; i < SDL_JoystickNumHats(joystick); ++i) { /* Derive the new position */ + const Uint8 hat_pos = SDL_JoystickGetHat(joystick, i); x = SCREEN_WIDTH/2; y = SCREEN_HEIGHT/2; - const Uint8 hat_pos = SDL_JoystickGetHat(joystick, i); if (hat_pos & SDL_HAT_UP) { y = 0; From 64ea6cefafb006799dedca0f11e937158ce60045 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 17:17:31 -0700 Subject: [PATCH 024/459] SDL_ResetHint() no longer clears the callbacks associated with a hint Also added SDL_ResetHints() to reset all callbacks, and clarified that SDL_ClearHints() is just used for cleanup at shutdown. Fixes https://github.com/libsdl-org/SDL/issues/6313 --- include/SDL_hints.h | 19 +++++++++++- src/SDL_hints.c | 35 ++++++++++++++++----- src/dynapi/SDL2.exports | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + test/testautomation_hints.c | 51 +++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 9 deletions(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 9e8295b48..b379dbad6 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -2423,6 +2423,19 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, */ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +/** + * Reset all hints to the default values. + * + * This will reset all hints to the value of the associated environment variable, or NULL if the environment isn't set. Callbacks will be called normally with this change. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + * \sa SDL_ResetHint + */ +extern DECLSPEC void SDLCALL SDL_ResetHints(void); + /** * Get the value of a hint. * @@ -2496,9 +2509,13 @@ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, /** * Clear all hints. * - * This function is automatically called during SDL_Quit(). + * This function is automatically called during SDL_Quit(), and deletes all callbacks without calling them and frees all memory associated with hints. If you're calling this from application code you probably want to call SDL_ResetHints() instead. + * + * This function will be removed from the API the next time we rev the ABI. * * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ResetHints */ extern DECLSPEC void SDLCALL SDL_ClearHints(void); diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 93bcc47ca..901c58b63 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -100,7 +100,6 @@ SDL_bool SDL_ResetHint(const char *name) { const char *env; - SDL_Hint *hint, *prev; SDL_HintWatch *entry; if (!name) { @@ -108,7 +107,7 @@ SDL_ResetHint(const char *name) } env = SDL_getenv(name); - for (prev = NULL, hint = SDL_hints; hint; prev = hint, hint = hint->next) { + for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { if ((env == NULL && hint->value != NULL) || (env != NULL && hint->value == NULL) || @@ -120,19 +119,39 @@ SDL_ResetHint(const char *name) entry = next; } } - if (prev) { - prev->next = hint->next; - } else { - SDL_hints = hint->next; - } SDL_free(hint->value); - SDL_free(hint); + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; return SDL_TRUE; } } return SDL_FALSE; } +void +SDL_ResetHints(void) +{ + const char *env; + SDL_HintWatch *entry; + + for (hint = SDL_hints; hint; hint = hint->next) { + env = SDL_getenv(hint->name); + if ((env == NULL && hint->value != NULL) || + (env != NULL && hint->value == NULL) || + (env && SDL_strcmp(env, hint->value) != 0)) { + for (entry = hint->callbacks; entry; ) { + /* Save the next entry in case this one is deleted */ + SDL_HintWatch *next = entry->next; + entry->callback(entry->userdata, name, hint->value, env); + entry = next; + } + } + SDL_free(hint->value); + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; + } +} + SDL_bool SDL_SetHint(const char *name, const char *value) { diff --git a/src/dynapi/SDL2.exports b/src/dynapi/SDL2.exports index c2e903ecb..8cc0c617b 100644 --- a/src/dynapi/SDL2.exports +++ b/src/dynapi/SDL2.exports @@ -865,3 +865,4 @@ ++'_SDL_HasPrimarySelectionText'.'SDL2.dll'.'SDL_HasPrimarySelectionText' ++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL2.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' ++'_SDL_SensorGetDataWithTimestamp'.'SDL2.dll'.'SDL_SensorGetDataWithTimestamp' +++'_SDL_ResetHints'.'SDL2.dll'.'SDL_ResetHints' diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index fc9255cdd..d5d782f34 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -891,3 +891,4 @@ #define SDL_HasPrimarySelectionText SDL_HasPrimarySelectionText_REAL #define SDL_GameControllerGetSensorDataWithTimestamp SDL_GameControllerGetSensorDataWithTimestamp_REAL #define SDL_SensorGetDataWithTimestamp SDL_SensorGetDataWithTimestamp_REAL +#define SDL_ResetHints SDL_ResetHints_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index f8d858ddc..435ccb46a 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -974,3 +974,4 @@ SDL_DYNAPI_PROC(char*,SDL_GetPrimarySelectionText,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasPrimarySelectionText,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorDataWithTimestamp,(SDL_GameController *a, SDL_SensorType b, Uint64 *c, float *d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SensorGetDataWithTimestamp,(SDL_Sensor *a, Uint64 *b, float *c, int d),(a,b,c,d),return) +SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),) diff --git a/test/testautomation_hints.c b/test/testautomation_hints.c index bbcc9fd21..c3f5ddfaa 100644 --- a/test/testautomation_hints.c +++ b/test/testautomation_hints.c @@ -92,6 +92,11 @@ hints_getHint(void *arg) return TEST_COMPLETED; } +static void SDLCALL hints_testHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + *(char **)userdata = hint ? SDL_strdup(hint) : NULL; +} + /** * @brief Call to SDL_SetHint */ @@ -102,6 +107,7 @@ hints_setHint(void *arg) const char *originalValue; char *value; const char *testValue; + char *callbackValue; SDL_bool result; int i, j; @@ -192,6 +198,51 @@ hints_setHint(void *arg) "testValue = %s, expected \"original\"", testValue); + /* Make sure callback functionality works past a reset */ + SDLTest_AssertPass("Call to SDL_AddHintCallback()"); + callbackValue = NULL; + SDL_AddHintCallback(testHint, hints_testHintChanged, &callbackValue); + SDLTest_AssertCheck( + callbackValue && SDL_strcmp(callbackValue, "original") == 0, + "callbackValue = %s, expected \"original\"", + callbackValue); + SDL_free(callbackValue); + + SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback"); + callbackValue = NULL; + SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE); + SDLTest_AssertCheck( + callbackValue && SDL_strcmp(callbackValue, "temp") == 0, + "callbackValue = %s, expected \"temp\"", + callbackValue); + SDL_free(callbackValue); + + SDLTest_AssertPass("Call to SDL_ResetHint(), using callback"); + callbackValue = NULL; + SDL_ResetHint(testHint); + SDLTest_AssertCheck( + callbackValue && SDL_strcmp(callbackValue, "original") == 0, + "callbackValue = %s, expected \"original\"", + callbackValue); + + SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback after reset"); + callbackValue = NULL; + SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE); + SDLTest_AssertCheck( + callbackValue && SDL_strcmp(callbackValue, "temp") == 0, + "callbackValue = %s, expected \"temp\"", + callbackValue); + SDL_free(callbackValue); + + SDLTest_AssertPass("Call to SDL_ResetHint(), after clearing callback"); + callbackValue = NULL; + SDL_DelHintCallback(testHint, hints_testHintChanged, &callbackValue); + SDL_ResetHint(testHint); + SDLTest_AssertCheck( + callbackValue == NULL, + "callbackValue = %s, expected \"(null)\"", + callbackValue); + return TEST_COMPLETED; } From 34b28002d9a2a2ae55710815bb1dcb0dc7870908 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 3 Oct 2022 00:20:15 +0000 Subject: [PATCH 025/459] Sync SDL wiki -> header --- include/SDL_hints.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index b379dbad6..c23925eeb 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -2426,7 +2426,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); /** * Reset all hints to the default values. * - * This will reset all hints to the value of the associated environment variable, or NULL if the environment isn't set. Callbacks will be called normally with this change. + * This will reset all hints to the value of the associated environment + * variable, or NULL if the environment isn't set. Callbacks will be called + * normally with this change. * * \since This function is available since SDL 2.26.0. * @@ -2509,7 +2511,10 @@ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, /** * Clear all hints. * - * This function is automatically called during SDL_Quit(), and deletes all callbacks without calling them and frees all memory associated with hints. If you're calling this from application code you probably want to call SDL_ResetHints() instead. + * This function is automatically called during SDL_Quit(), and deletes all + * callbacks without calling them and frees all memory associated with hints. + * If you're calling this from application code you probably want to call + * SDL_ResetHints() instead. * * This function will be removed from the API the next time we rev the ABI. * From cf331ef3f981e7d6c42f81d70dc5b453aae44989 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Oct 2022 17:25:36 -0700 Subject: [PATCH 026/459] Fixed build --- src/SDL_hints.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 901c58b63..4f2f5f61d 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -100,6 +100,7 @@ SDL_bool SDL_ResetHint(const char *name) { const char *env; + SDL_Hint *hint; SDL_HintWatch *entry; if (!name) { @@ -132,6 +133,7 @@ void SDL_ResetHints(void) { const char *env; + SDL_Hint *hint; SDL_HintWatch *entry; for (hint = SDL_hints; hint; hint = hint->next) { @@ -142,7 +144,7 @@ SDL_ResetHints(void) for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; - entry->callback(entry->userdata, name, hint->value, env); + entry->callback(entry->userdata, hint->name, hint->value, env); entry = next; } } From bbeacd72c438f7de499bbe2b778ab970b76b375e Mon Sep 17 00:00:00 2001 From: slime Date: Sun, 2 Oct 2022 22:57:03 -0300 Subject: [PATCH 027/459] Fix some credit comments. --- src/video/cocoa/SDL_cocoametalview.h | 4 ++-- src/video/cocoa/SDL_cocoametalview.m | 4 ++-- src/video/uikit/SDL_uikitmetalview.h | 4 ++-- src/video/uikit/SDL_uikitmetalview.m | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/video/cocoa/SDL_cocoametalview.h b/src/video/cocoa/SDL_cocoametalview.h index d8948b3d6..326c6a3ce 100644 --- a/src/video/cocoa/SDL_cocoametalview.h +++ b/src/video/cocoa/SDL_cocoametalview.h @@ -21,8 +21,8 @@ /* * @author Mark Callow, www.edgewise-consulting.com. * - * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing - * how to add a CAMetalLayer backed view. + * Thanks to @slime73 on GitHub for their gist showing how to add a CAMetalLayer + * backed view. */ #include "../../SDL_internal.h" diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m index c3f45279d..289848561 100644 --- a/src/video/cocoa/SDL_cocoametalview.m +++ b/src/video/cocoa/SDL_cocoametalview.m @@ -21,8 +21,8 @@ /* * @author Mark Callow, www.edgewise-consulting.com. * - * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing - * how to add a CAMetalLayer backed view. + * Thanks to @slime73 on GitHub for their gist showing how to add a CAMetalLayer + * backed view. */ #include "../../SDL_internal.h" diff --git a/src/video/uikit/SDL_uikitmetalview.h b/src/video/uikit/SDL_uikitmetalview.h index 91cd0b0a2..a4d7026d8 100644 --- a/src/video/uikit/SDL_uikitmetalview.h +++ b/src/video/uikit/SDL_uikitmetalview.h @@ -22,8 +22,8 @@ /* * @author Mark Callow, www.edgewise-consulting.com. * - * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing - * how to add a CAMetalLayer backed view. + * Thanks to @slime73 on GitHub for their gist showing how to add a CAMetalLayer + * backed view. */ #ifndef SDL_uikitmetalview_h_ diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index 8274eaff9..218b06427 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -22,8 +22,8 @@ /* * @author Mark Callow, www.edgewise-consulting.com. * - * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing - * how to add a CAMetalLayer backed view. + * Thanks to @slime73 on GitHub for their gist showing how to add a CAMetalLayer + * backed view. */ #include "../../SDL_internal.h" From f8f562dace406d48ca754dae5a95e2880cba492b Mon Sep 17 00:00:00 2001 From: slime Date: Sun, 2 Oct 2022 22:55:49 -0300 Subject: [PATCH 028/459] iOS: remove dead pre-iOS 8 codepaths. SDL hasn't supported those older iOS versions for a little while now. --- docs/README-ios.md | 2 +- src/video/uikit/SDL_uikitappdelegate.m | 20 ++---- src/video/uikit/SDL_uikitmessagebox.m | 80 ++--------------------- src/video/uikit/SDL_uikitmetalview.m | 6 +- src/video/uikit/SDL_uikitmodes.m | 10 --- src/video/uikit/SDL_uikitopengles.m | 11 +--- src/video/uikit/SDL_uikitopenglview.m | 10 +-- src/video/uikit/SDL_uikitvideo.m | 29 +++----- src/video/uikit/SDL_uikitviewcontroller.m | 20 ------ src/video/uikit/SDL_uikitwindow.m | 7 +- 10 files changed, 28 insertions(+), 167 deletions(-) diff --git a/docs/README-ios.md b/docs/README-ios.md index cae5f9cc8..e13f8baae 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -293,7 +293,7 @@ e.g. Deploying to older versions of iOS ============================================================================== -SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 6.1 +SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0 In order to do that you need to download an older version of Xcode: https://developer.apple.com/download/more/?name=Xcode diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 4c21d7336..635ed7615 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -141,10 +141,9 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) NSString *screenname = nibNameOrNil; NSBundle *bundle = nibBundleOrNil; - BOOL atleastiOS8 = UIKit_IsSystemVersionAtLeast(8.0); - /* Launch screens were added in iOS 8. Otherwise we use launch images. */ - if (screenname && atleastiOS8) { + /* A launch screen may not exist. Fall back to launch images in that case. */ + if (screenname) { @try { self.view = [bundle loadNibNamed:screenname owner:self options:nil][0]; } @@ -241,9 +240,9 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) UIImageOrientation imageorient = UIImageOrientationUp; #if !TARGET_OS_TV - /* Bugs observed / workaround tested in iOS 8.3, 7.1, and 6.1. */ + /* Bugs observed / workaround tested in iOS 8.3. */ if (UIInterfaceOrientationIsLandscape(curorient)) { - if (atleastiOS8 && image.size.width < image.size.height) { + if (image.size.width < image.size.height) { /* On iOS 8, portrait launch images displayed in forced- * landscape mode (e.g. a standard Default.png on an iPhone * when Info.plist only supports landscape orientations) need @@ -253,15 +252,6 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) } else if (curorient == UIInterfaceOrientationLandscapeRight) { imageorient = UIImageOrientationLeft; } - } else if (!atleastiOS8 && image.size.width > image.size.height) { - /* On iOS 7 and below, landscape launch images displayed in - * landscape mode (e.g. landscape iPad launch images) need - * to be rotated to display in the expected orientation. */ - if (curorient == UIInterfaceOrientationLandscapeLeft) { - imageorient = UIImageOrientationLeft; - } else if (curorient == UIInterfaceOrientationLandscapeRight) { - imageorient = UIImageOrientationRight; - } } } #endif @@ -378,7 +368,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) #if !TARGET_OS_TV screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"]; - if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) { + if (screenname) { @try { /* The launch storyboard is actually a nib in some older versions of * Xcode. We'll try to load it as a storyboard first, as it's more diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m index b6d56f350..2c42ba746 100644 --- a/src/video/uikit/SDL_uikitmessagebox.m +++ b/src/video/uikit/SDL_uikitmessagebox.m @@ -124,86 +124,16 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in return YES; } -/* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */ -#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 -@interface SDLAlertViewDelegate : NSObject - -@property (nonatomic, assign) int *clickedIndex; - -@end - -@implementation SDLAlertViewDelegate - -- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex -{ - if (_clickedIndex != NULL) { - *_clickedIndex = (int) buttonIndex; - } -} - -@end -#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */ - -static BOOL -UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *buttonid) -{ - /* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */ -#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 - int i; - int clickedindex = messageboxdata->numbuttons; - UIAlertView *alert = [[UIAlertView alloc] init]; - SDLAlertViewDelegate *delegate = [[SDLAlertViewDelegate alloc] init]; - - alert.delegate = delegate; - alert.title = @(messageboxdata->title); - alert.message = @(messageboxdata->message); - - for (i = 0; i < messageboxdata->numbuttons; i++) { - const SDL_MessageBoxButtonData *sdlButton; - if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) { - sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i]; - } else { - sdlButton = &messageboxdata->buttons[i]; - } - [alert addButtonWithTitle:@(sdlButton->text)]; - } - - delegate.clickedIndex = &clickedindex; - - [alert show]; - - UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex); - - alert.delegate = nil; - - if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) { - clickedindex = messageboxdata->numbuttons - 1 - clickedindex; - } - *buttonid = messageboxdata->buttons[clickedindex].buttonid; - return YES; -#else - return NO; -#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */ -} - static void UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue) +{ @autoreleasepool { - BOOL success = NO; - - @autoreleasepool { - success = UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid); - if (!success) { - success = UIKit_ShowMessageBoxAlertView(messageboxdata, buttonid); - } - } - - if (!success) { - *returnValue = SDL_SetError("Could not show message box."); - } else { + if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid)) { *returnValue = 0; + } else { + *returnValue = SDL_SetError("Could not show message box."); } -} +}} int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index 218b06427..8bc338095 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -87,11 +87,7 @@ UIKit_Metal_CreateView(_THIS, SDL_Window * window) * dimensions of the screen rather than the dimensions in points * yielding high resolution on retine displays. */ - if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { - scale = data.uiwindow.screen.nativeScale; - } else { - scale = data.uiwindow.screen.scale; - } + scale = data.uiwindow.screen.nativeScale; } metalview = [[SDL_uikitmetalview alloc] initWithFrame:data.uiwindow.bounds diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index bfd7a649b..322240d18 100644 --- a/src/video/uikit/SDL_uikitmodes.m +++ b/src/video/uikit/SDL_uikitmodes.m @@ -150,11 +150,7 @@ * Estimate the DPI based on the screen scale multiplied by the base DPI for the device * type (e.g. based on iPhone 1 and iPad 1) */ - #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 float scale = (float)screen.nativeScale; - #else - float scale = (float)screen.scale; - #endif float defaultDPI; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { defaultDPI = 132.0f; @@ -503,12 +499,6 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return -1; } -#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 - if (!UIKit_IsSystemVersionAtLeast(7.0)) { - frame = [data.uiscreen applicationFrame]; - } -#endif - rect->x += frame.origin.x; rect->y += frame.origin.y; rect->w = frame.size.width; diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 86fefd76c..15ea2e350 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -150,9 +150,8 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window) * versions. */ EAGLRenderingAPI api = major; - /* iOS currently doesn't support GLES >3.0. iOS 6 also only supports up - * to GLES 2.0. */ - if (major > 3 || (major == 3 && (minor > 0 || !UIKit_IsSystemVersionAtLeast(7.0)))) { + /* iOS currently doesn't support GLES >3.0. */ + if (major > 3 || (major == 3 && minor > 0)) { SDL_SetError("OpenGL ES %d.%d context could not be created", major, minor); return NULL; } @@ -170,11 +169,7 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window) /* Set the scale to the natural scale factor of the screen - the * backing dimensions of the OpenGL view will match the pixel * dimensions of the screen rather than the dimensions in points. */ - if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { - scale = data.uiwindow.screen.nativeScale; - } else { - scale = data.uiwindow.screen.scale; - } + scale = data.uiwindow.screen.nativeScale; } context = [[SDLEAGLContext alloc] initWithAPI:api sharegroup:sharegroup]; diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index ef5ca74e5..ea4db411a 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/src/video/uikit/SDL_uikitopenglview.m @@ -93,14 +93,8 @@ } if (sRGB) { - /* sRGB EAGL drawable support was added in iOS 7. */ - if (UIKit_IsSystemVersionAtLeast(7.0)) { - colorFormat = kEAGLColorFormatSRGBA8; - colorBufferFormat = GL_SRGB8_ALPHA8; - } else { - SDL_SetError("sRGB drawables are not supported."); - return nil; - } + colorFormat = kEAGLColorFormatSRGBA8; + colorBufferFormat = GL_SRGB8_ALPHA8; } else if (rBits >= 8 || gBits >= 8 || bBits >= 8 || aBits > 0) { /* if user specifically requests rbg888 or some color format higher than 16bpp */ colorFormat = kEAGLColorFormatRGBA8; diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 8afb66531..2b014bcca 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -209,15 +209,6 @@ UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) frame = data.uiwindow.bounds; } -#if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) - BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0); - - /* The view should always show behind the status bar in iOS 7+. */ - if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { - frame = screen.applicationFrame; - } -#endif - #if !TARGET_OS_TV /* iOS 10 seems to have a bug where, in certain conditions, putting the * device to sleep with the a landscape-only app open, re-orienting the @@ -227,18 +218,16 @@ UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) * https://bugzilla.libsdl.org/show_bug.cgi?id=3505 * https://bugzilla.libsdl.org/show_bug.cgi?id=3465 * https://forums.developer.apple.com/thread/65337 */ - if (UIKit_IsSystemVersionAtLeast(8.0)) { - UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation; - BOOL landscape = UIInterfaceOrientationIsLandscape(orient); - BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame); + UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation; + BOOL landscape = UIInterfaceOrientationIsLandscape(orient); + BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame); - /* The orientation flip doesn't make sense when the window is smaller - * than the screen (iPad Split View, for example). */ - if (fullscreen && (landscape != (frame.size.width > frame.size.height))) { - float height = frame.size.width; - frame.size.width = frame.size.height; - frame.size.height = height; - } + /* The orientation flip doesn't make sense when the window is smaller + * than the screen (iPad Split View, for example). */ + if (fullscreen && (landscape != (frame.size.width > frame.size.height))) { + float height = frame.size.width; + frame.size.width = frame.size.height; + frame.size.height = height; } #endif diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 4aa2d287e..ee7ee83b0 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -204,13 +204,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o return UIKit_GetSupportedOrientations(window); } -#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient -{ - return ([self supportedInterfaceOrientations] & (1 << orient)) != 0; -} -#endif - - (BOOL)prefersStatusBarHidden { BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; @@ -334,8 +327,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o } } -/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */ -#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; @@ -345,17 +336,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o self->rotatingOrientation = NO; }]; } -#else -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; - rotatingOrientation = YES; -} - -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - rotatingOrientation = NO; -} -#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */ - (void)deinitKeyboard { diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index b095c5d4c..8a923fb78 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -286,10 +286,7 @@ UIKit_UpdateWindowBorder(_THIS, SDL_Window * window) [UIApplication sharedApplication].statusBarHidden = NO; } - /* iOS 7+ won't update the status bar until we tell it to. */ - if ([viewcontroller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { - [viewcontroller setNeedsStatusBarAppearanceUpdate]; - } + [viewcontroller setNeedsStatusBarAppearanceUpdate]; } /* Update the view's frame to account for the status bar change. */ @@ -427,7 +424,7 @@ UIKit_GetSupportedOrientations(SDL_Window * window) * us, we get the orientations from Info.plist via UIApplication. */ if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) { validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow]; - } else if ([app respondsToSelector:@selector(supportedInterfaceOrientationsForWindow:)]) { + } else { validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow]; } From 01c5554f0e7d6ac18c8f85a84f35ffcf410f030c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 3 Oct 2022 11:57:10 -0400 Subject: [PATCH 029/459] opengles2: SDL_GL_BindTexture() should bind all YUV textures. This matches what the non-GLES OpenGL renderer does. Fixes #6070. --- src/render/opengles2/SDL_render_gles2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 8718f7964..923a0c6d9 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -2024,6 +2024,23 @@ static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, flo GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata; GLES2_ActivateRenderer(renderer); +#if SDL_HAVE_YUV + if (texturedata->yuv) { + data->glActiveTexture(GL_TEXTURE2); + data->glBindTexture(texturedata->texture_type, texturedata->texture_v); + + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(texturedata->texture_type, texturedata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } else if (texturedata->nv12) { + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(texturedata->texture_type, texturedata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } +#endif + data->glBindTexture(texturedata->texture_type, texturedata->texture); data->drawstate.texture = texture; From 321ca1091df9219fa0abab31f992a40141ae0e57 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 3 Oct 2022 12:00:38 -0400 Subject: [PATCH 030/459] opengles2: Texture names are GLuint, not GLenum. --- src/render/opengles2/SDL_render_gles2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 923a0c6d9..ac22c2b48 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -64,7 +64,7 @@ struct GLES2_FBOList typedef struct GLES2_TextureData { - GLenum texture; + GLuint texture; GLenum texture_type; GLenum pixel_format; GLenum pixel_type; @@ -74,8 +74,8 @@ typedef struct GLES2_TextureData /* YUV texture support */ SDL_bool yuv; SDL_bool nv12; - GLenum texture_v; - GLenum texture_u; + GLuint texture_v; + GLuint texture_u; #endif GLES2_FBOList *fbo; } GLES2_TextureData; From 3607f8316fb1624e08205a51b00acb6a5a779779 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Oct 2022 11:00:50 -0700 Subject: [PATCH 031/459] Find out if a controller is wireless using WGI (thanks @DJm00n!) Confirmed using an Xbox Series X controller over USB and Bluetooth Fixes https://github.com/libsdl-org/SDL/issues/6322 --- src/joystick/windows/SDL_windows_gaming_input.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c index 863b3f504..deec84bf5 100644 --- a/src/joystick/windows/SDL_windows_gaming_input.c +++ b/src/joystick/windows/SDL_windows_gaming_input.c @@ -265,6 +265,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde if (SUCCEEDED(hr)) { char *name = NULL; SDL_JoystickGUID guid; + Uint16 bus = SDL_HARDWARE_BUS_USB; Uint16 vendor = 0; Uint16 product = 0; Uint16 version = 0; @@ -315,6 +316,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde __x_ABI_CWindows_CGaming_CInput_CIFlightStick *flight_stick = NULL; __x_ABI_CWindows_CGaming_CInput_CIGamepad *gamepad = NULL; __x_ABI_CWindows_CGaming_CInput_CIRacingWheel *racing_wheel = NULL; + boolean wireless; if (wgi.gamepad_statics2 && SUCCEEDED(__x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2_FromGameController(wgi.gamepad_statics2, gamecontroller, &gamepad)) && gamepad) { type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; @@ -329,11 +331,16 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde type = SDL_JOYSTICK_TYPE_WHEEL; __x_ABI_CWindows_CGaming_CInput_CIRacingWheel_Release(racing_wheel); } + + hr = __x_ABI_CWindows_CGaming_CInput_CIGameController_get_IsWireless(gamecontroller, &wireless); + if (SUCCEEDED(hr) && wireless) { + bus = SDL_HARDWARE_BUS_BLUETOOTH; + } + __x_ABI_CWindows_CGaming_CInput_CIGameController_Release(gamecontroller); } - /* FIXME: Is there any way to tell whether this is a Bluetooth device? */ - guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, name, 'w', (Uint8)type); + guid = SDL_CreateJoystickGUID(bus, vendor, product, version, name, 'w', (Uint8) type); #ifdef SDL_JOYSTICK_HIDAPI if (!ignore_joystick && HIDAPI_IsDevicePresent(vendor, product, version, name)) { From 5291e5cb7649e0128b9d7274090e8b0b6cd6a745 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Oct 2022 17:36:17 -0700 Subject: [PATCH 032/459] Added version checking to SDLActivity.java Make sure the SDL java and C code match when updating SDL in a game. Right now we're assuming that we only have to make sure release versions match. We can extend the version string with an interface version if we need more fine grained sanity checking. Fixes https://github.com/libsdl-org/SDL/issues/1540 --- .../main/java/org/libsdl/app/SDLActivity.java | 18 ++++++++++++++++-- build-scripts/test-versioning.sh | 11 +++++++++++ build-scripts/update-version.sh | 4 ++++ src/core/android/SDL_android.c | 15 +++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index f65e93c06..6cf7611cc 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -59,6 +59,9 @@ import java.util.Locale; */ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; + private static final int SDL_MAJOR_VERSION = 2; + private static final int SDL_MINOR_VERSION = 25; + private static final int SDL_MICRO_VERSION = 0; /* // Display InputType.SOURCE/CLASS of events and devices // @@ -342,8 +345,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh errorMsgBrokenLib = e.getMessage(); } - if (mBrokenLibraries) - { + if (!mBrokenLibraries) { + String expected_version = String.valueOf(SDL_MAJOR_VERSION) + "." + + String.valueOf(SDL_MINOR_VERSION) + "." + + String.valueOf(SDL_MICRO_VERSION); + String version = nativeGetVersion(); + if (!version.equals(expected_version)) { + mBrokenLibraries = true; + errorMsgBrokenLib = "SDL C/Java version mismatch (expected " + expected_version + ", got " + version + ")"; + } + } + + if (mBrokenLibraries) { mSingleton = this; AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); dlgAlert.setMessage("An error occurred while trying to start the application. Please try again and/or reinstall." @@ -884,6 +897,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } // C functions we call + public static native String nativeGetVersion(); public static native int nativeSetupJNI(); public static native int nativeRunMain(String library, String function, Object arguments); public static native void nativeLowMemory(); diff --git a/build-scripts/test-versioning.sh b/build-scripts/test-versioning.sh index c1b6c3084..7d71c9e15 100755 --- a/build-scripts/test-versioning.sh +++ b/build-scripts/test-versioning.sh @@ -56,6 +56,17 @@ else not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version" fi +major=$(sed -ne 's/.*SDL_MAJOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) +minor=$(sed -ne 's/.*SDL_MINOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) +micro=$(sed -ne 's/.*SDL_MICRO_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) +version="${major}.${minor}.${micro}" + +if [ "$ref_version" = "$version" ]; then + ok "SDLActivity.java $version" +else + not_ok "android-project/app/src/main/java/org/libsdl/app/SDLActivity.java $version disagrees with SDL_version.h $ref_version" +fi + major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2) minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2) micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2) diff --git a/build-scripts/update-version.sh b/build-scripts/update-version.sh index fc247fd9d..82174becf 100755 --- a/build-scripts/update-version.sh +++ b/build-scripts/update-version.sh @@ -58,6 +58,10 @@ perl -w -pi -e 's/\A(set\(SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' CMakeLists.tx perl -w -pi -e 's/\A(set\(SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' CMakeLists.txt perl -w -pi -e 's/\A(set\(SDL_MICRO_VERSION\s+)\d+/${1}'$PATCH'/;' CMakeLists.txt +perl -w -pi -e 's/\A(.* SDL_MAJOR_VERSION = )\d+/${1}'$MAJOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +perl -w -pi -e 's/\A(.* SDL_MINOR_VERSION = )\d+/${1}'$MINOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +perl -w -pi -e 's/\A(.* SDL_MICRO_VERSION = )\d+/${1}'$PATCH'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java + perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.os2 perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.os2 perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.os2 diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index b0884eda8..83e631199 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -25,6 +25,7 @@ #include "SDL_hints.h" #include "SDL_main.h" #include "SDL_timer.h" +#include "SDL_version.h" #ifdef __ANDROID__ @@ -63,6 +64,9 @@ #define ENCODING_PCM_FLOAT 4 /* Java class SDLActivity */ +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)( + JNIEnv *env, jclass cls); + JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass cls); @@ -167,6 +171,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( jint requestCode, jboolean result); static JNINativeMethod SDLActivity_tab[] = { + { "nativeGetVersion", "()Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetVersion) }, { "nativeSetupJNI", "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) }, { "nativeRunMain", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) }, { "onNativeDropFile", "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) }, @@ -536,6 +541,16 @@ void checkJNIReady(void) SDL_SetMainReady(); } +/* Get SDL version -- called before SDL_main() to verify JNI bindings */ +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)(JNIEnv *env, jclass cls) +{ + char version[128]; + + SDL_snprintf(version, sizeof(version), "%d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); + + return (*env)->NewStringUTF(env, version); +} + /* Activity initialization -- called before SDL_main() to initialize JNI bindings */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { From 9e3c4b9f328bb3738ee8a8ec20055d7191702164 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Oct 2022 17:50:01 -0700 Subject: [PATCH 033/459] Use the correct platform defines --- src/video/SDL_video.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 297d595af..d245f5fcd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1239,7 +1239,7 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode) SDL_DisplayMode fullscreen_mode; if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { if (SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode) == 0) { -#ifndef ANDROID +#ifndef __ANDROID__ /* Android may not resize the window to exactly what our fullscreen mode is, especially on * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, @@ -1453,7 +1453,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) /* Generate a mode change event here */ if (resized) { -#if !defined(ANDROID) && !defined(WIN32) +#if !defined(__ANDROID__) && !defined(__WIN32__) /* Android may not resize the window to exactly what our fullscreen mode is, especially on * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, @@ -2637,16 +2637,16 @@ SDL_CreateWindowFramebuffer(SDL_Window * window) attempt_texture_framebuffer = SDL_FALSE; } - #if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ +#if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) { attempt_texture_framebuffer = SDL_FALSE; } - #endif - #if defined(__EMSCRIPTEN__) +#endif +#if defined(__EMSCRIPTEN__) else { attempt_texture_framebuffer = SDL_FALSE; } - #endif +#endif if (attempt_texture_framebuffer) { if (SDL_CreateWindowTexture(_this, window, &format, &pixels, &pitch) == -1) { From ad29875ee692deb9a3517f4d470bde4a83ff76ad Mon Sep 17 00:00:00 2001 From: David Gow Date: Mon, 18 Apr 2022 17:03:05 +0800 Subject: [PATCH 034/459] Wayland: Emulate mouse warp using relative mouse mode Several games (including Source and GoldSrc games, and Bioshock Infinite) attempt to "fake" relative mouse mode by repeatedly warping the cursor to the centre of the screen. Since mouse warping is not supported under Wayland, the viewport ends up "stuck" in a rectangular area. Detect this case (mouse warp while the cursor is not visible), and enable relative mouse mode, which tracks the cursor position independently, and so can Warp successfully. This is behind the SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP hint, which is enabled by default, unless the application enables relative mouse mode itself using SDL_SetRelativeMouseMode(SDL_TRUE). Note that there is a behavoural difference, in that relative mouse mode typically doesn't take mouse accelleration into account, but the repeated-warping technique does, so mouse movement can seem very slow with this (unless the game has its own mouse accelleration option, such as in Portal 2). --- include/SDL_hints.h | 17 +++++++ src/video/wayland/SDL_waylandevents.c | 4 ++ src/video/wayland/SDL_waylandevents_c.h | 5 ++ src/video/wayland/SDL_waylandmouse.c | 65 +++++++++++++++++++++++-- 4 files changed, 88 insertions(+), 3 deletions(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index c23925eeb..f7ff74836 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -1712,6 +1712,23 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" +/** + * \brief Enable or disable mouse pointer warp emulation, needed by some older games. + * + * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. + * This is required for some older games (such as Source engine games), which warp the + * mouse to the centre of the screen rather than using relative mouse motion. Note that + * relative mouse mode may have different mouse acceleration behaviour than pointer warps. + * + * This variable can be set to the following values: + * "0" - All mouse warps fail, as mouse warping is not available under wayland. + * "1" - Some mouse warps will be emulated by forcing relative mouse mode. + * + * If not set, this is automatically enabled unless an application uses relative mouse + * mode directly. + */ +#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP" + /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 94b13c13e..6b504e5ab 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2654,6 +2654,10 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi if (d->relative_mouse_mode) return 0; + /* Don't confine the pointer if it shouldn't be confined. */ + if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) + return 0; + if (SDL_RectEmpty(&window->mouse_rect)) { confine_rect = NULL; } else { diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index 9d240d7bd..7554a9e88 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -132,6 +132,11 @@ struct SDL_WaylandInput { SDL_WaylandKeyboardRepeat keyboard_repeat; struct SDL_WaylandTabletInput* tablet; + + /* are we forcing relative mouse mode? */ + SDL_bool cursor_visible; + SDL_bool relative_mode_override; + SDL_bool warp_emulation_prohibited; }; extern void Wayland_PumpEvents(_THIS); diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index a0f9d0e0c..a5a45e724 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -40,6 +40,11 @@ #include "wayland-cursor.h" #include "SDL_waylandmouse.h" +#include "SDL_hints.h" +#include "../../SDL_hints_c.h" + +static int +Wayland_SetRelativeMouseMode(SDL_bool enabled); typedef struct { struct wl_buffer *buffer; @@ -510,9 +515,18 @@ Wayland_ShowCursor(SDL_Cursor *cursor) wl_surface_attach(data->surface, data->buffer, 0, 0); wl_surface_damage(data->surface, 0, 0, data->w, data->h); wl_surface_commit(data->surface); + + input->cursor_visible = SDL_TRUE; + + if (input->relative_mode_override) { + Wayland_input_unlock_pointer(input); + input->relative_mode_override = SDL_FALSE; + } + } else { + input->cursor_visible = SDL_FALSE; wl_pointer_set_cursor(pointer, input->pointer_enter_serial, NULL, 0, 0); } @@ -522,7 +536,20 @@ Wayland_ShowCursor(SDL_Cursor *cursor) static void Wayland_WarpMouse(SDL_Window *window, int x, int y) { - SDL_Unsupported(); + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *d = vd->driverdata; + struct SDL_WaylandInput *input = d->input; + + if (input->cursor_visible == SDL_TRUE) { + SDL_Unsupported(); + } else if (input->warp_emulation_prohibited) { + SDL_Unsupported(); + } else { + if (!d->relative_mouse_mode) { + Wayland_input_lock_pointer(input); + input->relative_mode_override = SDL_TRUE; + } + } } static int @@ -537,16 +564,38 @@ Wayland_SetRelativeMouseMode(SDL_bool enabled) SDL_VideoDevice *vd = SDL_GetVideoDevice(); SDL_VideoData *data = (SDL_VideoData *) vd->driverdata; - if (enabled) + + if (enabled) { + /* Disable mouse warp emulation if it's enabled. */ + if (data->input->relative_mode_override) + data->input->relative_mode_override = SDL_FALSE; + + /* If the app has used relative mode before, it probably shouldn't + * also be emulating it using repeated mouse warps, so disable + * mouse warp emulation by default. + */ + data->input->warp_emulation_prohibited = SDL_TRUE; return Wayland_input_lock_pointer(data->input); - else + } else { return Wayland_input_unlock_pointer(data->input); + } +} + +static void SDLCALL +Wayland_EmulateMouseWarpChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + struct SDL_WaylandInput *input = (struct SDL_WaylandInput *)userdata; + + input->warp_emulation_prohibited = !SDL_GetStringBoolean(hint, !input->warp_emulation_prohibited); } void Wayland_InitMouse(void) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *d = vd->driverdata; + struct SDL_WaylandInput *input = d->input; mouse->CreateCursor = Wayland_CreateCursor; mouse->CreateSystemCursor = Wayland_CreateSystemCursor; @@ -556,17 +605,27 @@ Wayland_InitMouse(void) mouse->WarpMouseGlobal = Wayland_WarpMouseGlobal; mouse->SetRelativeMouseMode = Wayland_SetRelativeMouseMode; + input->relative_mode_override = SDL_FALSE; + input->cursor_visible = SDL_TRUE; + SDL_SetDefaultCursor(Wayland_CreateDefaultCursor()); + + SDL_AddHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP, + Wayland_EmulateMouseWarpChanged, input); } void Wayland_FiniMouse(SDL_VideoData *data) { + struct SDL_WaylandInput *input = data->input; int i; for (i = 0; i < data->num_cursor_themes; i += 1) { WAYLAND_wl_cursor_theme_destroy(data->cursor_themes[i].theme); } SDL_free(data->cursor_themes); + + SDL_DelHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP, + Wayland_EmulateMouseWarpChanged, input); } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ From eac3d6d3c003405af2cd12591c1750d742124ee3 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 4 Oct 2022 10:46:42 +0200 Subject: [PATCH 035/459] SDL_video.c: fix variable 'i' may be uninitialized when used here "_this->name = bootstrap[i]->name;" --- src/video/SDL_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index d245f5fcd..139c550c5 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -413,7 +413,7 @@ SDL_VideoInit(const char *driver_name) SDL_bool init_keyboard = SDL_FALSE; SDL_bool init_mouse = SDL_FALSE; SDL_bool init_touch = SDL_FALSE; - int i; + int i = 0; /* Check to make sure we don't overwrite '_this' */ if (_this != NULL) { From fdef96e2331700247a4caff0db576aa669c30188 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 4 Oct 2022 12:08:09 +0200 Subject: [PATCH 036/459] Android: remove "nativeSetComposingText" since it's not used anymore (and it may fail registering at init if code is cleaned with proguard) --- .../main/java/org/libsdl/app/SDLActivity.java | 5 +---- src/core/android/SDL_android.c | 18 +----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 6cf7611cc..af9265b84 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -2000,10 +2000,7 @@ class SDLInputConnection extends BaseInputConnection { public static native void nativeCommitText(String text, int newCursorPosition); - public native void nativeGenerateScancodeForUnichar(char c); - - public native void nativeSetComposingText(String text, int newCursorPosition); - + public static native void nativeGenerateScancodeForUnichar(char c); } class SDLClipboardHandler implements diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 83e631199..ebdd1041b 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -212,14 +212,9 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancod JNIEnv *env, jclass cls, jchar chUnicode); -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( - JNIEnv *env, jclass cls, - jstring text, jint newCursorPosition); - static JNINativeMethod SDLInputConnection_tab[] = { { "nativeCommitText", "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText) }, - { "nativeGenerateScancodeForUnichar", "(C)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar) }, - { "nativeSetComposingText", "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText) } + { "nativeGenerateScancodeForUnichar", "(C)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar) } }; /* Java class SDLAudioManager */ @@ -1286,17 +1281,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancod SDL_SendKeyboardUnicodeKey(chUnicode); } -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( - JNIEnv *env, jclass cls, - jstring text, jint newCursorPosition) -{ - const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); - - SDL_SendEditingText(utftext, 0, 0); - - (*env)->ReleaseStringUTFChars(env, text, utftext); -} - JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( JNIEnv *env, jclass cls, jstring name) From cbb1cf0c930602c4e0001fc1768f070334141fd9 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 4 Oct 2022 21:15:09 +0200 Subject: [PATCH 037/459] cmake+xcode: only create SDL2::SDL2main target when it does not exist again --- Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake index ca6bb3e92..e4294d90f 100644 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake @@ -58,10 +58,12 @@ if(NOT TARGET SDL2::SDL2) COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" INTERFACE_SDL2_SHARED "ON" ) - set(SDL2_SDL2_FOUND TRUE) endif() +set(SDL2_SDL2_FOUND TRUE) -add_library(SDL2::SDL2main INTERFACE IMPORTED) +if(NOT TARGET SDL2::SDL2main) + add_library(SDL2::SDL2main INTERFACE IMPORTED) +endif() set(SDL2_SDL2main_FOUND TRUE) check_required_components(SDL2) From f18fae4c689a68bd50ce34d6b9c1f014c2f220a2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Oct 2022 16:46:29 -0700 Subject: [PATCH 038/459] Use DWARF 4 debug information when building using mingw See this bug for more information: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 Fixes https://github.com/libsdl-org/SDL/issues/6139 --- configure | 36 ++++++++++++++++++++++++++++++++++++ configure.ac | 21 +++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/configure b/configure index f626d12e4..c592ce213 100755 --- a/configure +++ b/configure @@ -22773,6 +22773,41 @@ printf "%s\n" "$have_clang_objc_arc" >&6; } fi } +CheckGDwarf4() +{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -gdwarf-4 option" >&5 +printf %s "checking for GCC -gdwarf-4 option... " >&6; } + have_gcc_gdwarf4=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -gdwarf-4" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_gdwarf4=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_gdwarf4" >&5 +printf "%s\n" "$have_gcc_gdwarf4" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_gdwarf4 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4" + fi +} + CheckVisibilityHidden() { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 @@ -28503,6 +28538,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_loadso = xyes; then have_loadso=yes fi + CheckGDwarf4 CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo diff --git a/configure.ac b/configure.ac index 4a4023e19..b75a9e12f 100644 --- a/configure.ac +++ b/configure.ac @@ -1515,6 +1515,26 @@ CheckObjectiveCARC() fi } +dnl See if GCC's -gdwarf-4 is supported +dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows +CheckGDwarf4() +{ + AC_MSG_CHECKING(for GCC -gdwarf-4 option) + have_gcc_gdwarf4=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -gdwarf-4" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_gdwarf4=yes],[]) + AC_MSG_RESULT($have_gcc_gdwarf4) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_gdwarf4 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4" + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -3969,6 +3989,7 @@ case "$host" in if test x$enable_loadso = xyes; then have_loadso=yes fi + CheckGDwarf4 CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo From d0657fde30a265f353e3528db7c683aeb98ee315 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 02:15:22 +0200 Subject: [PATCH 039/459] cmake: Use DWARF 4 debug information when building using mingw See f18fae4c689a68bd50ce34d6b9c1f014c2f220a2 --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ec6bfb8..ae6d29a01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,6 +674,18 @@ if(USE_GCC OR USE_CLANG) endif() endif() + if(MINGW) + # See if GCC's -gdwarf-4 is supported + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows + cmake_push_check_state(RESET) + check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4) + if(HAVE_GDWARF_4) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-4") + endif() + cmake_pop_check_state() + endif() + # Force color diagnostics when one of these conditions are met if(DEFINED ENV{CI} OR DEFINED ENV{USE_CCACHE} OR CMAKE_GENERATOR MATCHES Ninja) if(EMSCRIPTEN OR (USE_GCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)) From e41942e8140566d76284bea61130de8e125a17d0 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 5 Oct 2022 13:36:25 +1000 Subject: [PATCH 040/459] fix compilation error SDL_coreaudio mixing declarations and code --- src/audio/coreaudio/SDL_coreaudio.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 63ce6a5d3..6cfc035e4 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -1177,6 +1177,7 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) char *devname; int usable; double sampleRate; + CFIndex len; AudioObjectPropertyAddress addr = { iscapture ? kAudioHardwarePropertyDefaultInputDevice @@ -1222,7 +1223,7 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) return SDL_SetError("%s: Default Device Name not found", "coreaudio"); } - CFIndex len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), kCFStringEncodingUTF8); devname = (char *) SDL_malloc(len + 1); usable = ((devname != NULL) && From c9f60cce40c02b2f69bb4674ca66e5679310841f Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 17:12:08 +0200 Subject: [PATCH 041/459] cmake+autotools: add option to enable/disable iconv --- CMakeLists.txt | 17 ++++++++++------- configure | 31 ++++++++++++++++++++++++++----- configure.ac | 24 +++++++++++++++++++----- 3 files changed, 55 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6d29a01..adbf9eb42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,6 +448,7 @@ set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF) dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON) dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF) +set_option(SDL_ICONV "Support character set conversion through libiconv" ON) set_option(SDL_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) @@ -1023,14 +1024,16 @@ if(SDL_LIBC) endif() endif() - check_library_exists(iconv iconv_open "" HAVE_LIBICONV) - if(HAVE_LIBICONV) - list(APPEND EXTRA_LIBS iconv) - set(HAVE_ICONV 1) - else() - check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) - if(HAVE_BUILTIN_ICONV) + if(SDL_ICONV) + check_library_exists(iconv iconv_open "" HAVE_LIBICONV) + if(HAVE_LIBICONV) + list(APPEND EXTRA_LIBS iconv) set(HAVE_ICONV 1) + else() + check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) + if(HAVE_BUILTIN_ICONV) + set(HAVE_ICONV 1) + endif() endif() endif() diff --git a/configure b/configure index c592ce213..3e0cadf0a 100755 --- a/configure +++ b/configure @@ -840,6 +840,7 @@ enable_largefile enable_assertions enable_dependency_tracking enable_libc +enable_iconv enable_gcc_atomics enable_atomic enable_audio @@ -1631,6 +1632,8 @@ Optional Features: --enable-dependency-tracking Use gcc -MMD -MT dependency tracking [default=yes] --enable-libc Use the system C library [default=yes] + --enable-iconv Enable character set conversion through iconv + [default=yes] --enable-gcc-atomics Use gcc builtin atomics [default=yes] --enable-atomic Enable the atomic operations subsystem [default=yes] --enable-audio Enable the audio subsystem [default=yes] @@ -18676,6 +18679,16 @@ else $as_nop enable_libc=yes fi + +# Check whether --enable-iconv was given. +if test ${enable_iconv+y} +then : + enableval=$enable_iconv; +else $as_nop + enable_iconv=yes +fi + + if test x$enable_libc = xyes; then printf "%s\n" "#define HAVE_LIBC 1" >>confdefs.h @@ -19883,7 +19896,8 @@ then : fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 + if test x$enable_iconv = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 printf %s "checking for iconv_open in -liconv... " >&6; } if test ${ac_cv_lib_iconv_iconv_open+y} then : @@ -19923,13 +19937,14 @@ then : LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi - ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" + ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" if test "x$ac_cv_func_iconv" = xyes then : printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi + fi ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " @@ -28967,7 +28982,11 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" SUMMARY_video="${SUMMARY_video} uikit" have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" + if test x$enable_iconv = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" @@ -29263,8 +29282,10 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" + if test x$enable_iconv = xyes; then + if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then + SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" + fi fi # Use the Unix locale APIs. if test x$enable_locale = xyes; then diff --git a/configure.ac b/configure.ac index b75a9e12f..6cd98df04 100644 --- a/configure.ac +++ b/configure.ac @@ -317,6 +317,12 @@ dnl See whether we are allowed to use the system C library AC_ARG_ENABLE(libc, [AS_HELP_STRING([--enable-libc], [Use the system C library [default=yes]])], , enable_libc=yes) + +dnl See whether we are allowed to use libiconv +AC_ARG_ENABLE(iconv, +[AS_HELP_STRING([--enable-iconv], [Enable character set conversion through iconv [default=yes]])], + , enable_iconv=yes) + if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) @@ -347,8 +353,10 @@ dnl Checks for library functions. AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) - AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) - AC_CHECK_FUNCS(iconv) + if test x$enable_iconv = xyes; then + AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) + AC_CHECK_FUNCS(iconv) + fi AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) @@ -4297,7 +4305,11 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" SUMMARY_video="${SUMMARY_video} uikit" have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" + if test x$enable_iconv = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" @@ -4559,8 +4571,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" + if test x$enable_iconv = xyes; then + if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then + SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" + fi fi # Use the Unix locale APIs. if test x$enable_locale = xyes; then From 5b13136471e36872741b35dca70ec6f6f0401a7a Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Sat, 6 Aug 2022 10:48:53 +0300 Subject: [PATCH 042/459] [UIKit] handle app lifecycle events in a custom object instead of AppDelegate removes the need to call SDL counterparts manually when custom AppDelegate is used --- src/video/uikit/SDL_uikitappdelegate.m | 37 ------------- src/video/uikit/SDL_uikitevents.m | 74 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 37 deletions(-) diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 635ed7615..37bd4c786 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -434,43 +434,6 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) /* Do nothing. */ } -#if !TARGET_OS_TV -- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation -{ - SDL_OnApplicationDidChangeStatusBarOrientation(); -} -#endif - -- (void)applicationWillTerminate:(UIApplication *)application -{ - SDL_OnApplicationWillTerminate(); -} - -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application -{ - SDL_OnApplicationDidReceiveMemoryWarning(); -} - -- (void)applicationWillResignActive:(UIApplication*)application -{ - SDL_OnApplicationWillResignActive(); -} - -- (void)applicationDidEnterBackground:(UIApplication*)application -{ - SDL_OnApplicationDidEnterBackground(); -} - -- (void)applicationWillEnterForeground:(UIApplication*)application -{ - SDL_OnApplicationWillEnterForeground(); -} - -- (void)applicationDidBecomeActive:(UIApplication*)application -{ - SDL_OnApplicationDidBecomeActive(); -} - - (void)sendDropFileForURL:(NSURL *)url { NSURL *fileURL = url.filePathURL; diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 286db8f33..61c57b253 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -41,10 +41,84 @@ static BOOL UIKit_EventPumpEnabled = YES; + +@interface SDL_LifecycleObserver : NSObject +@property (nonatomic, assign) BOOL isObservingNotifications; +@end + +@implementation SDL_LifecycleObserver + +- (void)eventPumpChanged +{ + NSNotificationCenter *notificationCenter = NSNotificationCenter.defaultCenter; + if (UIKit_EventPumpEnabled && !self.isObservingNotifications) { + self.isObservingNotifications = YES; + [notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(applicationWillResignActive) name:UIApplicationWillResignActiveNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(applicationDidEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(applicationWillEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(applicationWillTerminate) name:UIApplicationWillTerminateNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(applicationDidReceiveMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#if !TARGET_OS_TV + [notificationCenter addObserver:self selector:@selector(applicationDidChangeStatusBarOrientation) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; +#endif + } else if (!UIKit_EventPumpEnabled && self.isObservingNotifications) { + self.isObservingNotifications = NO; + [notificationCenter removeObserver:self]; + } +} + +- (void)applicationDidBecomeActive +{ + SDL_OnApplicationDidBecomeActive(); +} + +- (void)applicationWillResignActive +{ + SDL_OnApplicationWillResignActive(); +} + +- (void)applicationDidEnterBackground +{ + SDL_OnApplicationDidEnterBackground(); +} + +- (void)applicationWillEnterForeground +{ + SDL_OnApplicationWillEnterForeground(); +} + +- (void)applicationWillTerminate +{ + SDL_OnApplicationWillTerminate(); +} + +- (void)applicationDidReceiveMemoryWarning +{ + SDL_OnApplicationDidReceiveMemoryWarning(); +} + +#if !TARGET_OS_TV +- (void)applicationDidChangeStatusBarOrientation +{ + SDL_OnApplicationDidChangeStatusBarOrientation(); +} +#endif + +@end + + void SDL_iPhoneSetEventPump(SDL_bool enabled) { UIKit_EventPumpEnabled = enabled; + + static SDL_LifecycleObserver *lifecycleObserver; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + lifecycleObserver = [SDL_LifecycleObserver new]; + }); + [lifecycleObserver eventPumpChanged]; } void From 92c71ae385d9770e7ac3db4c9a072151e923012d Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Wed, 5 Oct 2022 21:59:08 +0300 Subject: [PATCH 043/459] [iOS] respect initial status bar configuration when displaying the launch storyboard --- src/video/uikit/SDL_uikitappdelegate.m | 58 +++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 37bd4c786..3186cc6e8 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -33,6 +33,14 @@ #include "../../events/SDL_events_c.h" +#if !TARGET_OS_TV +#include + +# ifndef __IPHONE_13_0 +# define __IPHONE_13_0 130000 +# endif +#endif + #ifdef main #undef main #endif @@ -116,6 +124,53 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) return image; } + +@interface SDLLaunchStoryboardViewController : UIViewController +@property (nonatomic, strong) UIViewController *storyboardViewController; +- (instancetype)initWithStoryboardViewController:(UIViewController *)storyboardViewController; +@end + +@implementation SDLLaunchStoryboardViewController + +- (instancetype)initWithStoryboardViewController:(UIViewController *)storyboardViewController { + self = [super init]; + self.storyboardViewController = storyboardViewController; + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self addChildViewController:self.storyboardViewController]; + [self.view addSubview:self.storyboardViewController.view]; + self.storyboardViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.storyboardViewController.view.frame = self.view.bounds; + [self.storyboardViewController didMoveToParentViewController:self]; + + UIApplication.sharedApplication.statusBarHidden = self.prefersStatusBarHidden; + UIApplication.sharedApplication.statusBarStyle = self.preferredStatusBarStyle; +} + +- (BOOL)prefersStatusBarHidden { + return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIStatusBarHidden"] boolValue]; +} + +- (UIStatusBarStyle)preferredStatusBarStyle { + NSString *statusBarStyle = [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIStatusBarStyle"]; + if ([statusBarStyle isEqualToString:@"UIStatusBarStyleLightContent"]) { + return UIStatusBarStyleLightContent; + } +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 + if (@available(iOS 13.0, *)) { + if ([statusBarStyle isEqualToString:@"UIStatusBarStyleDarkContent"]) { + return UIStatusBarStyleDarkContent; + } + } +#endif + return UIStatusBarStyleDefault; +} + +@end #endif /* !TARGET_OS_TV */ @interface SDLLaunchScreenController () @@ -374,7 +429,8 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) * Xcode. We'll try to load it as a storyboard first, as it's more * modern. */ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:screenname bundle:bundle]; - vc = [storyboard instantiateInitialViewController]; + __auto_type storyboardVc = [storyboard instantiateInitialViewController]; + vc = [[SDLLaunchStoryboardViewController alloc] initWithStoryboardViewController:storyboardVc]; } @catch (NSException *exception) { /* Do nothing (there's more code to execute below). */ From 294ccba0a23b37fffef62189423444f93732e565 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 5 Oct 2022 23:56:56 +0300 Subject: [PATCH 044/459] better wording for --enable-iconv description --- CMakeLists.txt | 2 +- configure | 2 +- configure.ac | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adbf9eb42..57bf37485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,7 +448,7 @@ set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF) dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON) dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF) -set_option(SDL_ICONV "Support character set conversion through libiconv" ON) +set_option(SDL_ICONV "Use iconv() from system-installed libraries" ON) set_option(SDL_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) diff --git a/configure b/configure index 3e0cadf0a..3eba8ebeb 100755 --- a/configure +++ b/configure @@ -1632,7 +1632,7 @@ Optional Features: --enable-dependency-tracking Use gcc -MMD -MT dependency tracking [default=yes] --enable-libc Use the system C library [default=yes] - --enable-iconv Enable character set conversion through iconv + --enable-iconv Use iconv() from system-installed libraries [default=yes] --enable-gcc-atomics Use gcc builtin atomics [default=yes] --enable-atomic Enable the atomic operations subsystem [default=yes] diff --git a/configure.ac b/configure.ac index 6cd98df04..c8921aad6 100644 --- a/configure.ac +++ b/configure.ac @@ -320,7 +320,7 @@ AC_ARG_ENABLE(libc, dnl See whether we are allowed to use libiconv AC_ARG_ENABLE(iconv, -[AS_HELP_STRING([--enable-iconv], [Enable character set conversion through iconv [default=yes]])], +[AS_HELP_STRING([--enable-iconv], [Use iconv() from system-installed libraries [default=yes]])], , enable_iconv=yes) if test x$enable_libc = xyes; then From 81afb3e30358bb9f815fd4998d2067d8f9da04f3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Oct 2022 16:18:09 -0700 Subject: [PATCH 045/459] Need to swap endianness when extracting the CRC from game controller mappings --- src/joystick/sort_controllers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/joystick/sort_controllers.py b/src/joystick/sort_controllers.py index af2421f59..f550df282 100755 --- a/src/joystick/sort_controllers.py +++ b/src/joystick/sort_controllers.py @@ -13,7 +13,7 @@ controllers = [] controller_guids = {} conditionals = [] split_pattern = re.compile(r'([^"]*")([^,]*,)([^,]*,)([^"]*)(".*)') -guid_crc_pattern = re.compile(r'^([0-9a-zA-Z]{4})([0-9a-zA-Z]{4})([0-9a-zA-Z]{24},)$') +guid_crc_pattern = re.compile(r'^([0-9a-zA-Z]{4})([0-9a-zA-Z]{2})([0-9a-zA-Z]{2})([0-9a-zA-Z]{24},)$') def find_element(prefix, bindings): i=0 @@ -40,10 +40,10 @@ def save_controller(line): # Look for CRC embedded in the GUID and convert to crc element crc_match = guid_crc_pattern.match(entry[1]) - if crc_match and crc_match.group(2) != '0000': + if crc_match and crc_match.group(2) != '00' and crc_match.group(3) != '00': print("Extracting CRC from GUID of " + entry[2]) - entry[1] = crc_match.group(1) + '0000' + crc_match.group(3) - crc = "crc:" + crc_match.group(2) + "," + entry[1] = crc_match.group(1) + '0000' + crc_match.group(4) + crc = "crc:" + crc_match.group(3) + crc_match.group(2) + "," pos = find_element("sdk", bindings) if pos >= 0: From ddc3de602e9249a7c75ed031a63dc574dfde8727 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Oct 2022 16:24:05 -0700 Subject: [PATCH 046/459] Added mapping for PS5 controller over Bluetooth on Android 12 Tested on Pixel 3a --- src/joystick/SDL_gamecontrollerdb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 3328d4382..5fbdf4ec5 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -912,6 +912,7 @@ static const char *s_ControllerMappings [] = "050000004c050000cc090000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", "050000004c050000cc090000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000004c050000e60c0000fffe3f00,PS5 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", + "050000004c050000e60c0000ffff3f00,PS5 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "05000000f8270000bf0b0000ffff3f00,Razer Kishi,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000003215000005070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000003215000007070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", From 4ca86dae2fca96e99d7bfa574e48904c30fc28e3 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 5 Oct 2022 23:26:14 +0000 Subject: [PATCH 047/459] Sync SDL wiki -> header --- include/SDL_clipboard.h | 6 +++--- include/SDL_gamecontroller.h | 2 +- include/SDL_hints.h | 2 +- include/SDL_joystick.h | 2 +- include/SDL_sensor.h | 2 +- include/SDL_video.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 783c7c251..9bc501b74 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -89,7 +89,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText @@ -108,7 +108,7 @@ extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * call SDL_free() on the returned pointer when done with it (even if * there was an error). * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText @@ -122,7 +122,7 @@ extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it * does not. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 05eeec0ce..09320cc2d 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -910,7 +910,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController * * \param num_values The number of values to write to data * \return 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); diff --git a/include/SDL_hints.h b/include/SDL_hints.h index f7ff74836..b387118be 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -2447,7 +2447,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); * variable, or NULL if the environment isn't set. Callbacks will be called * normally with this change. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_GetHint * \sa SDL_SetHint diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index 72c6604df..c5091458a 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -665,7 +665,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha * \param crc16 A pointer filled in with a CRC used to distinguish different * products with the same VID/PID, or 0 if not available * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_JoystickGetDeviceGUID */ diff --git a/include/SDL_sensor.h b/include/SDL_sensor.h index 684d2c6eb..7c9e4cc97 100644 --- a/include/SDL_sensor.h +++ b/include/SDL_sensor.h @@ -282,7 +282,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, i * \param num_values The number of values to write to data * \returns 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. */ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values); diff --git a/include/SDL_video.h b/include/SDL_video.h index c2f3e2f30..0b75c7d57 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1059,7 +1059,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, * \param h a pointer to variable for storing the height in pixels, may be * NULL * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 2.26.1. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize From fa7ffa4e8870bc572b6e09ae7f56444d971467ec Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 6 Oct 2022 03:37:50 +0300 Subject: [PATCH 048/459] change the iconv configuration option names to be more verbose. --- CMakeLists.txt | 6 ++++-- configure | 18 +++++++++--------- configure.ac | 12 ++++++------ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57bf37485..bc4510a27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,7 +448,7 @@ set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF) dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON) dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF) -set_option(SDL_ICONV "Use iconv() from system-installed libraries" ON) +set_option(SDL_SYSTEM_ICONV "Use iconv() from system-installed libraries" ON) set_option(SDL_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) @@ -1024,15 +1024,17 @@ if(SDL_LIBC) endif() endif() - if(SDL_ICONV) + if(SDL_SYSTEM_ICONV) check_library_exists(iconv iconv_open "" HAVE_LIBICONV) if(HAVE_LIBICONV) list(APPEND EXTRA_LIBS iconv) set(HAVE_ICONV 1) + set(HAVE_SYSTEM_ICONV TRUE) else() check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) if(HAVE_BUILTIN_ICONV) set(HAVE_ICONV 1) + set(HAVE_SYSTEM_ICONV TRUE) endif() endif() endif() diff --git a/configure b/configure index 3eba8ebeb..de1b13f72 100755 --- a/configure +++ b/configure @@ -840,7 +840,7 @@ enable_largefile enable_assertions enable_dependency_tracking enable_libc -enable_iconv +enable_system_iconv enable_gcc_atomics enable_atomic enable_audio @@ -1632,7 +1632,7 @@ Optional Features: --enable-dependency-tracking Use gcc -MMD -MT dependency tracking [default=yes] --enable-libc Use the system C library [default=yes] - --enable-iconv Use iconv() from system-installed libraries + --enable-system-iconv Use iconv() from system-installed libraries [default=yes] --enable-gcc-atomics Use gcc builtin atomics [default=yes] --enable-atomic Enable the atomic operations subsystem [default=yes] @@ -18680,12 +18680,12 @@ else $as_nop fi -# Check whether --enable-iconv was given. -if test ${enable_iconv+y} +# Check whether --enable-system-iconv was given. +if test ${enable_system_iconv+y} then : - enableval=$enable_iconv; + enableval=$enable_system_iconv; else $as_nop - enable_iconv=yes + enable_system_iconv=yes fi @@ -19896,7 +19896,7 @@ then : fi - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 printf %s "checking for iconv_open in -liconv... " >&6; } if test ${ac_cv_lib_iconv_iconv_open+y} @@ -28983,7 +28983,7 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} uikit" have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" @@ -29282,7 +29282,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi diff --git a/configure.ac b/configure.ac index c8921aad6..b9b10f499 100644 --- a/configure.ac +++ b/configure.ac @@ -319,9 +319,9 @@ AC_ARG_ENABLE(libc, , enable_libc=yes) dnl See whether we are allowed to use libiconv -AC_ARG_ENABLE(iconv, -[AS_HELP_STRING([--enable-iconv], [Use iconv() from system-installed libraries [default=yes]])], - , enable_iconv=yes) +AC_ARG_ENABLE(system-iconv, +[AS_HELP_STRING([--enable-system-iconv], [Use iconv() from system-installed libraries [default=yes]])], + , enable_system_iconv=yes) if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) @@ -353,7 +353,7 @@ dnl Checks for library functions. AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) AC_CHECK_FUNCS(iconv) fi @@ -4306,7 +4306,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. SUMMARY_video="${SUMMARY_video} uikit" have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" @@ -4571,7 +4571,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_iconv = xyes; then + if test x$enable_system_iconv = xyes; then if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi From d2160c29d139083c8c9ef0ab041c8bfa977d62a9 Mon Sep 17 00:00:00 2001 From: slime Date: Wed, 5 Oct 2022 21:42:26 -0300 Subject: [PATCH 049/459] iOS: implement SDL_GetWindowSizeInPixels. --- src/video/uikit/SDL_uikitvideo.m | 1 + src/video/uikit/SDL_uikitwindow.h | 1 + src/video/uikit/SDL_uikitwindow.m | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 2b014bcca..4e8a57755 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -98,6 +98,7 @@ UIKit_CreateDevice(void) device->GetWindowWMInfo = UIKit_GetWindowWMInfo; device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; device->GetDisplayDPI = UIKit_GetDisplayDPI; + device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels; #if SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; diff --git a/src/video/uikit/SDL_uikitwindow.h b/src/video/uikit/SDL_uikitwindow.h index 65dbc875b..7ca9b475e 100644 --- a/src/video/uikit/SDL_uikitwindow.h +++ b/src/video/uikit/SDL_uikitwindow.h @@ -36,6 +36,7 @@ extern void UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDispl extern void UIKit_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void UIKit_UpdatePointerLock(_THIS, SDL_Window * window); extern void UIKit_DestroyWindow(_THIS, SDL_Window * window); +extern void UIKit_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h); extern SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info); diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 8a923fb78..433c80ee1 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -369,6 +369,25 @@ UIKit_DestroyWindow(_THIS, SDL_Window * window) window->driverdata = NULL; } +void +UIKit_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h) +{ @autoreleasepool +{ + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + UIView *view = windata.viewcontroller.view; + CGSize size = view.bounds.size; + CGFloat scale = 1.0; + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + scale = windata.uiwindow.screen.nativeScale; + } + + /* Integer truncation of fractional values matches SDL_uikitmetalview and + * SDL_uikitopenglview. */ + *w = size.width * scale; + *h = size.height * scale; +}} + SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { From e3b2830f9949ecb9bb745b97c8e42df6a1879942 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 1 Oct 2022 11:11:10 +0300 Subject: [PATCH 050/459] updated VS project file --- VisualC/SDL/SDL.vcxproj.filters | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 7ab2f05ab..167e40d29 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -495,9 +495,6 @@ haptic - - hidapi - joystick @@ -832,6 +829,7 @@ render\direct3d12 + @@ -1354,6 +1352,7 @@ render\direct3d12 + From 8c587636dc0ae5d708c7b3ef86ca2bdabe3be311 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 08:25:54 -0700 Subject: [PATCH 051/459] GNU sort isn't available on older macOS and some BSD systems Don't prevent building entirely, just warn that we won't be able to find dynamic libraries in this case. Fixes https://github.com/libsdl-org/SDL/pull/6338 --- configure | 3 ++- configure.ac | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index de1b13f72..a7a6f3ea4 100755 --- a/configure +++ b/configure @@ -17955,7 +17955,8 @@ test -n "$SORT" || SORT="false" if ! "$SORT" -V /dev/null then : - as_fn_error $? "GNU sort(1) is required" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: GNU sort(1) is required to find dynamic libraries" >&5 +printf "%s\n" "$as_me: WARNING: GNU sort(1) is required to find dynamic libraries" >&2;} fi # Check whether --enable-largefile was given. diff --git a/configure.ac b/configure.ac index b9b10f499..ec9113534 100644 --- a/configure.ac +++ b/configure.ac @@ -71,7 +71,7 @@ if [ test -z "$AWK" ]; then fi AC_CHECK_PROGS([SORT], [gsort sort], [false]) -AS_IF([! "$SORT" -V /dev/null], [AC_MSG_ERROR([GNU sort(1) is required])]) +AS_IF([! "$SORT" -V /dev/null], [AC_MSG_WARN([GNU sort(1) is required to find dynamic libraries])]) dnl 64-bit file offsets if possible unless --disable-largefile is specified AC_SYS_LARGEFILE From f687cbd4c6277b27d342d71a694dbcb8d1275703 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 09:00:57 -0700 Subject: [PATCH 052/459] Clarified that GNU sort isn't required, we just need the -V option to be supported --- configure | 4 ++-- configure.ac | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index a7a6f3ea4..dddc42b0a 100755 --- a/configure +++ b/configure @@ -17955,8 +17955,8 @@ test -n "$SORT" || SORT="false" if ! "$SORT" -V /dev/null then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: GNU sort(1) is required to find dynamic libraries" >&5 -printf "%s\n" "$as_me: WARNING: GNU sort(1) is required to find dynamic libraries" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: sort(1) that supports the -V option is required to find dynamic libraries" >&5 +printf "%s\n" "$as_me: WARNING: sort(1) that supports the -V option is required to find dynamic libraries" >&2;} fi # Check whether --enable-largefile was given. diff --git a/configure.ac b/configure.ac index ec9113534..42ae7ab8c 100644 --- a/configure.ac +++ b/configure.ac @@ -71,7 +71,7 @@ if [ test -z "$AWK" ]; then fi AC_CHECK_PROGS([SORT], [gsort sort], [false]) -AS_IF([! "$SORT" -V /dev/null], [AC_MSG_WARN([GNU sort(1) is required to find dynamic libraries])]) +AS_IF([! "$SORT" -V /dev/null], [AC_MSG_WARN([sort(1) that supports the -V option is required to find dynamic libraries])]) dnl 64-bit file offsets if possible unless --disable-largefile is specified AC_SYS_LARGEFILE From a8cb7bbe2fd7ab230c7fdb9d98a7af6c1f9f6c4a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 1 Oct 2022 11:31:26 -0400 Subject: [PATCH 053/459] wayland: Add dedupe logic to window geometry configuration Adds deduplication logic to ConfigureWindowGeometry() to avoid setting redundant backbuffer, viewport and surface opaque region dimensions. State is now only set when the window and/or backbuffer dimensions change. This repurposes the viewport rect to always hold the actual size of the window, which can differ from the SDL size if things are being scaled. The SDL_Rect was removed in favor of two ints, as the x/y members of the struct were never used, so they just wasted space. Since the internal variables always have the true window size, the width/height getter functions are no longer required and can be removed. --- src/video/wayland/SDL_waylandwindow.c | 137 +++++++++++--------------- src/video/wayland/SDL_waylandwindow.h | 2 +- 2 files changed, 61 insertions(+), 78 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 4f015b03b..2abb2d54e 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -164,21 +164,6 @@ NeedViewport(SDL_Window *window) return SDL_FALSE; } -/* If a viewport is active, use the width and height for the window dimensions. */ -SDL_FORCE_INLINE int -GetWindowWidth(SDL_Window *window) -{ - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - return SDL_RectEmpty(&data->viewport_rect) ? window->w : data->viewport_rect.w; -} - -SDL_FORCE_INLINE int -GetWindowHeight(SDL_Window *window) -{ - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - return SDL_RectEmpty(&data->viewport_rect) ? window->h : data->viewport_rect.h; -} - static void GetBufferSize(SDL_Window *window, int *width, int *height) { @@ -247,11 +232,16 @@ ConfigureWindowGeometry(SDL_Window *window) SDL_VideoData *viddata = data->waylandData; SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; struct wl_region *region; + const int old_dw = data->drawable_width; + const int old_dh = data->drawable_height; + SDL_bool window_size_changed; + SDL_bool drawable_size_changed; /* Set the drawable backbuffer size. */ GetBufferSize(window, &data->drawable_width, &data->drawable_height); + drawable_size_changed = data->drawable_width != old_dw || data->drawable_height != old_dh; - if (data->egl_window) { + if (data->egl_window && drawable_size_changed) { WAYLAND_wl_egl_window_resize(data->egl_window, data->drawable_width, data->drawable_height, @@ -260,58 +250,63 @@ ConfigureWindowGeometry(SDL_Window *window) if (FullscreenModeEmulation(window) && NeedViewport(window)) { int fs_width, fs_height; - int src_width, src_height; const int output_width = data->fs_output_width ? data->fs_output_width : output->width; const int output_height = data->fs_output_height ? data->fs_output_height : output->height; - GetFullScreenDimensions(window, &fs_width, &fs_height, &src_width, &src_height); + window_size_changed = data->window_width != output_width || data->window_height != output_height; - /* Set the buffer scale to 1 since a viewport will be used. */ - wl_surface_set_buffer_scale(data->surface, 1); - SetDrawSurfaceViewport(window, src_width, src_height, output_width, output_height); + if (window_size_changed || drawable_size_changed) { + GetFullScreenDimensions(window, &fs_width, &fs_height, NULL, NULL); - data->viewport_rect.x = 0; - data->viewport_rect.y = 0; - data->viewport_rect.w = output_width; - data->viewport_rect.h = output_height; + /* Set the buffer scale to 1 since a viewport will be used. */ + wl_surface_set_buffer_scale(data->surface, 1); + SetDrawSurfaceViewport(window, data->drawable_width, data->drawable_height, + output_width, output_height); - data->pointer_scale_x = (float)fs_width / (float)output_width; - data->pointer_scale_y = (float)fs_height / (float)output_height; + data->window_width = output_width; + data->window_height = output_height; - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(viddata->compositor); - wl_region_add(region, data->viewport_rect.x, data->viewport_rect.y, - data->viewport_rect.w, data->viewport_rect.h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); + data->pointer_scale_x = (float) fs_width / (float) output_width; + data->pointer_scale_y = (float) fs_height / (float) output_height; } } else { - if (NeedViewport(window)) { - wl_surface_set_buffer_scale(data->surface, 1); - SetDrawSurfaceViewport(window, data->drawable_width, data->drawable_height, window->w, window->h); - } else { - UnsetDrawSurfaceViewport(window); + window_size_changed = data->window_width != window->w || data->window_height != window->h; - /* Round to the next integer in case of a fractional value. */ - wl_surface_set_buffer_scale(data->surface, (int32_t)SDL_ceilf(data->scale_factor)); - } + if (window_size_changed || drawable_size_changed) { + if (NeedViewport(window)) { + wl_surface_set_buffer_scale(data->surface, 1); + SetDrawSurfaceViewport(window, data->drawable_width, data->drawable_height, window->w, window->h); + } else { + UnsetDrawSurfaceViewport(window); - SDL_zero(data->viewport_rect); + /* Round to the next integer in case of a fractional value. */ + wl_surface_set_buffer_scale(data->surface, (int32_t) SDL_ceilf(data->scale_factor)); + } - data->pointer_scale_x = 1.0f; - data->pointer_scale_y = 1.0f; + data->window_width = window->w; + data->window_height = window->h; - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(viddata->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); + data->pointer_scale_x = 1.0f; + data->pointer_scale_y = 1.0f; } } - /* Recreate the pointer confinement region when the window geometry changes. */ - if (data->confined_pointer) { - Wayland_input_confine_pointer(viddata->input, window); + /* + * The opaque and pointer confinement regions only need to be recalculated + * if the output size has changed. + */ + if (window_size_changed) { + if (!EGLTransparencyEnabled()) { + region = wl_compositor_create_region(viddata->compositor); + wl_region_add(region, 0, 0, + data->window_width, data->window_height); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); + } + + if (data->confined_pointer) { + Wayland_input_confine_pointer(viddata->input, window); + } } } @@ -361,7 +356,7 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) max_height); if (commit) { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); wl_surface_commit(wind->surface); @@ -415,7 +410,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) libdecor_frame_set_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); } else { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); wl_surface_commit(wind->surface); @@ -430,7 +425,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) libdecor_frame_unset_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); } else { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); wl_surface_commit(wind->surface); @@ -509,14 +504,14 @@ CommitWindowGeometry(SDL_Window *window) #ifdef HAVE_LIBDECOR_H if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); } else #endif if (viddata->shell.xdg && wind->shell_surface.xdg.surface) { xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, - GetWindowWidth(window), GetWindowHeight(window)); + wind->window_width, wind->window_height); } } @@ -527,11 +522,9 @@ surface_damage_frame_done(void *data, struct wl_callback *cb, uint32_t time) { SDL_WindowData *wind = (SDL_WindowData *)data; - /* Manually set the damage region when using a viewport. */ - if (!SDL_RectEmpty(&wind->viewport_rect)) { - wl_surface_damage(wind->surface, wind->viewport_rect.x, wind->viewport_rect.y, - wind->viewport_rect.w, wind->viewport_rect.h); - } + /* Set the damage region. */ + wl_surface_damage(wind->surface, 0, 0, + wind->window_width, wind->window_height); wl_callback_destroy(cb); wind->surface_damage_frame_callback = wl_surface_frame(wind->surface); @@ -933,7 +926,7 @@ decoration_frame_configure(struct libdecor_frame *frame, wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE; /* ... then commit the changes on the libdecor side. */ - state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(frame, state, configuration); libdecor_state_free(state); @@ -1971,7 +1964,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) { SDL_WindowData *data; SDL_VideoData *c; - struct wl_region *region; data = SDL_calloc(1, sizeof *data); if (data == NULL) @@ -1998,8 +1990,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->sdlwindow = window; data->scale_factor = 1.0f; - data->pointer_scale_x = 1.0f; - data->pointer_scale_y = 1.0f; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { int i; @@ -2021,6 +2011,9 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) SDL_WAYLAND_register_surface(data->surface); + /* Must be called before EGL configuration to set the drawable backbuffer size. */ + ConfigureWindowGeometry(window); + /* Fire a callback when the compositor wants a new frame rendered. * Right now this only matters for OpenGL; we use this callback to add a * wait timeout that avoids getting deadlocked by the compositor when the @@ -2048,9 +2041,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - data->drawable_width = SDL_lroundf(window->w * data->scale_factor); - data->drawable_height = SDL_lroundf(window->h * data->scale_factor); - if (window->flags & SDL_WINDOW_OPENGL) { data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height); @@ -2072,13 +2062,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(c->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - } - if (c->relative_mouse_mode) { Wayland_input_lock_pointer(c->input); } @@ -2149,7 +2132,7 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) viddata->shell.xdg && data->shell_surface.xdg.surface) { xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, - GetWindowWidth(window), GetWindowHeight(window)); + data->window_width, data->window_height); } } diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index 0a37a2781..a14ba1364 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -105,7 +105,7 @@ typedef struct { float pointer_scale_y; int drawable_width, drawable_height; int fs_output_width, fs_output_height; - SDL_Rect viewport_rect; + int window_width, window_height; SDL_bool needs_resize_event; SDL_bool floating_resize_pending; SDL_bool is_fullscreen; From ea5958009cc2eb660952f018a6fdb1e335b8b062 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 3 Oct 2022 18:31:15 -0400 Subject: [PATCH 054/459] wayland: Set the damage buffer size when supported The preferred method for setting the damage region on compositor protocol versions 4 and above is to use wl_surface.damage_buffer. Use this when available and only fall back to wl_surface.damage on older versions. Bumps the highest supported version of wl_compositor to version 4. --- src/video/wayland/SDL_waylandvideo.c | 2 +- src/video/wayland/SDL_waylandwindow.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 97e5efbdd..b9b1ce251 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -849,7 +849,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, /*printf("WAYLAND INTERFACE: %s\n", interface);*/ if (SDL_strcmp(interface, "wl_compositor") == 0) { - d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, SDL_min(3, version)); + d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, SDL_min(4, version)); } else if (SDL_strcmp(interface, "wl_output") == 0) { Wayland_add_display(d, id); } else if (SDL_strcmp(interface, "wl_seat") == 0) { diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 2abb2d54e..a4e9f591e 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -522,9 +522,17 @@ surface_damage_frame_done(void *data, struct wl_callback *cb, uint32_t time) { SDL_WindowData *wind = (SDL_WindowData *)data; - /* Set the damage region. */ - wl_surface_damage(wind->surface, 0, 0, - wind->window_width, wind->window_height); + /* + * wl_surface.damage_buffer is the preferred method of setting the damage region + * on compositor version 4 and above. + */ + if (wl_compositor_get_version(wind->waylandData->compositor) >= 4) { + wl_surface_damage_buffer(wind->surface, 0, 0, + wind->drawable_width, wind->drawable_height); + } else { + wl_surface_damage(wind->surface, 0, 0, + wind->window_width, wind->window_height); + } wl_callback_destroy(cb); wind->surface_damage_frame_callback = wl_surface_frame(wind->surface); From c2b0c41c0af0b5fbc589dfc0469e0b0c0e4f564a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 4 Oct 2022 12:59:26 -0400 Subject: [PATCH 055/459] wayland: Set/unset the opaque regions on surfaces when transparency is toggled Caches the SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY hint at init time and registers a callback, which is fired when the hint is changed during runtime and toggles the opaque region for existing surfaces. --- src/video/wayland/SDL_waylandvideo.c | 2 ++ src/video/wayland/SDL_waylandvideo.h | 1 + src/video/wayland/SDL_waylandwindow.c | 51 +++++++++++++++++++++++---- src/video/wayland/SDL_waylandwindow.h | 3 ++ 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index b9b1ce251..2a54d28cb 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -992,6 +992,7 @@ Wayland_VideoInit(_THIS) WAYLAND_wl_display_flush(data->display); Wayland_InitKeyboard(_this); + Wayland_InitWin(data); data->initializing = SDL_FALSE; @@ -1033,6 +1034,7 @@ Wayland_VideoQuit(_THIS) SDL_VideoData *data = _this->driverdata; int i, j; + Wayland_QuitWin(data); Wayland_FiniMouse(data); for (i = 0; i < _this->num_displays; ++i) { diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h index 3e7b363c5..e1825cbae 100644 --- a/src/video/wayland/SDL_waylandvideo.h +++ b/src/video/wayland/SDL_waylandvideo.h @@ -95,6 +95,7 @@ typedef struct { char *classname; int relative_mouse_mode; + SDL_bool egl_transparency_enabled; } SDL_VideoData; struct SDL_WaylandOutputData { diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index a4e9f591e..f949c20bc 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -32,6 +32,7 @@ #include "SDL_waylandvideo.h" #include "SDL_waylandtouch.h" #include "SDL_hints.h" +#include "../../SDL_hints_c.h" #include "SDL_events.h" #include "xdg-shell-client-protocol.h" @@ -46,12 +47,6 @@ #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP) -SDL_FORCE_INLINE SDL_bool -EGLTransparencyEnabled() -{ - return SDL_GetHintBoolean(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, SDL_FALSE); -} - SDL_FORCE_INLINE SDL_bool FloatEqual(float a, float b) { @@ -296,7 +291,7 @@ ConfigureWindowGeometry(SDL_Window *window) * if the output size has changed. */ if (window_size_changed) { - if (!EGLTransparencyEnabled()) { + if (!viddata->egl_transparency_enabled) { region = wl_compositor_create_region(viddata->compositor); wl_region_add(region, 0, 0, data->window_width, data->window_height); @@ -2310,6 +2305,48 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) window->driverdata = NULL; } +static void +EGLTransparencyChangedCallback(void *userdata, const char *name, const char *oldValue, const char *newValue) +{ + const SDL_bool oldval = SDL_GetStringBoolean(oldValue, SDL_FALSE); + const SDL_bool newval = SDL_GetStringBoolean(newValue, SDL_FALSE); + + if (oldval != newval) { + SDL_Window *window; + SDL_VideoData *viddata = (SDL_VideoData *) userdata; + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + + viddata->egl_transparency_enabled = newval; + + /* Iterate over all windows and update the surface opaque regions */ + for (window = dev->windows; window != NULL; window = window->next) { + SDL_WindowData *wind = (SDL_WindowData *) window->driverdata; + + if (!newval) { + struct wl_region *region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, wind->window_width, wind->window_height); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + } else { + wl_surface_set_opaque_region(wind->surface, NULL); + } + } + } +} + +void +Wayland_InitWin(SDL_VideoData *data) +{ + data->egl_transparency_enabled = SDL_GetHintBoolean(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, SDL_FALSE); + SDL_AddHintCallback(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, EGLTransparencyChangedCallback, data); +} + +void +Wayland_QuitWin(SDL_VideoData *data) +{ + SDL_DelHintCallback(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, EGLTransparencyChangedCallback, data); +} + #endif /* SDL_VIDEO_DRIVER_WAYLAND */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index a14ba1364..87d10eb43 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -142,6 +142,9 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); extern int Wayland_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation); +extern void Wayland_InitWin(SDL_VideoData *data); +extern void Wayland_QuitWin(SDL_VideoData *data); + #endif /* SDL_waylandwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ From 69cf5fb0e1532dff4efa274e566c0cf9bed8a553 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 4 Oct 2022 13:09:35 -0400 Subject: [PATCH 056/459] wayland: Remove surface type helpers These were remnants of a time before the surface type was explicitly stored, so they can be removed per the TODO note. --- src/video/wayland/SDL_waylandwindow.c | 58 +++++++++++++-------------- src/video/wayland/SDL_waylandwindow.h | 6 --- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index f949c20bc..0d06bb0fd 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -313,7 +313,7 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) int min_width, min_height, max_width, max_height; /* Pop-ups don't get to change size */ - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { /* ... but we still want to commit, particularly for ShowWindow */ if (commit) { wl_surface_commit(wind->surface); @@ -339,7 +339,7 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -381,7 +381,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) SDL_VideoData *viddata = wind->waylandData; /* Pop-ups don't get to be fullscreened */ - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { /* ... but we still want to commit, particularly for ShowWindow */ wl_surface_commit(wind->surface); return; @@ -393,7 +393,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) SetMinMaxDimensions(window, SDL_FALSE); #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -498,7 +498,7 @@ CommitWindowGeometry(SDL_Window *window) SDL_VideoData *viddata = (SDL_VideoData *) wind->waylandData; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); @@ -1208,7 +1208,7 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.wl.egl_window = data->egl_window; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface.libdecor.frame != NULL) { info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); if (version >= SDL_VERSIONNUM(2, 0, 17)) { @@ -1227,7 +1227,7 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) { info->info.wl.xdg_surface = data->shell_surface.xdg.surface; if (version >= SDL_VERSIONNUM(2, 0, 17)) { - SDL_bool popup = WINDOW_IS_XDG_POPUP(window); + SDL_bool popup = data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP; info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel; if (version >= SDL_VERSIONNUM(2, 0, 22)) { if (popup) { @@ -1266,7 +1266,7 @@ Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_wi SDL_WindowData *modal_data = modal_window->driverdata; SDL_WindowData *parent_data = parent_window->driverdata; - if (WINDOW_IS_XDG_POPUP(modal_window) || WINDOW_IS_XDG_POPUP(parent_window)) { + if (modal_data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP || parent_data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return SDL_SetError("Modal/Parent was a popup, not a toplevel"); } @@ -1323,7 +1323,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) /* Create the shell surface and map the toplevel/popup */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface.libdecor.frame) { /* If the frame already exists, just set the visibility. */ libdecor_frame_set_visibility(data->shell_surface.libdecor.frame, true); @@ -1347,7 +1347,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); - if (WINDOW_IS_XDG_POPUP(window)) { + if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Window *focused = SDL_GetMouseFocus(); SDL_WindowData *focuseddata = focused->driverdata; @@ -1355,7 +1355,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) /* This popup may be a child of another popup! */ data->shell_surface.xdg.roleobj.popup.parentID = SDL_GetWindowID(focused); data->shell_surface.xdg.roleobj.popup.child = NULL; - if (WINDOW_IS_XDG_POPUP(focused)) { + if (focuseddata->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { SDL_assert(focuseddata->shell_surface.xdg.roleobj.popup.child == NULL); focuseddata->shell_surface.xdg.roleobj.popup.child = window; } @@ -1398,7 +1398,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) * this surface will fail. This is a new rule for xdg_shell. */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface.libdecor.frame) { while (!data->shell_surface.libdecor.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -1421,7 +1421,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } /* Create the window decorations */ - if (!WINDOW_IS_XDG_POPUP(window) && data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { + if (data->shell_surface_type != WAYLAND_SURFACE_XDG_POPUP && data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.roleobj.toplevel); zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, &decoration_listener, @@ -1437,7 +1437,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) * them immediately afterward. */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { /* ... but don't call it redundantly for libdecor, the decorator * may not interpret a redundant call nicely and cause weird stuff to happen */ @@ -1524,7 +1524,7 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) wl_surface_commit(wind->surface); #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(data, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame) { libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, false); libdecor_frame_set_app_id(wind->shell_surface.libdecor.frame, data->classname); @@ -1532,7 +1532,7 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) } else #endif if (data->shell.xdg) { - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { Wayland_ReleasePopup(_this, window); } else if (wind->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); @@ -1781,7 +1781,7 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } @@ -1791,7 +1791,7 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window) window->flags &= ~SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1815,12 +1815,12 @@ Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) SDL_WindowData *wind = window->driverdata; const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame) { libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered); } @@ -1838,7 +1838,7 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) #ifdef HAVE_LIBDECOR_H const SDL_WindowData *wind = window->driverdata; - if (WINDOW_IS_LIBDECOR(data, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1860,7 +1860,7 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } @@ -1874,7 +1874,7 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1897,12 +1897,12 @@ Wayland_MinimizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -2130,7 +2130,7 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) * Can be removed once SDL's resize logic becomes compliant. */ if ( #ifdef HAVE_LIBDECOR_H - !WINDOW_IS_LIBDECOR(viddata, window) && + data->shell_surface_type != WAYLAND_SURFACE_LIBDECOR && #endif viddata->shell.xdg && data->shell_surface.xdg.surface) { @@ -2157,7 +2157,7 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) #ifdef HAVE_LIBDECOR_H /* we must not resize the window while we have a static (non-floating) size */ - if (WINDOW_IS_LIBDECOR(data, window) && + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame && !libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) { /* Commit the resize when we re-enter floating state */ @@ -2191,12 +2191,12 @@ void Wayland_SetWindowTitle(_THIS, SDL_Window * window) SDL_VideoData *viddata = _this->driverdata; const char *title = window->title ? window->title : ""; - if (WINDOW_IS_XDG_POPUP(window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index 87d10eb43..b6a3aa28c 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -32,12 +32,6 @@ struct SDL_WaylandInput; -/* TODO: Remove these helpers, they're from before we had shell_surface_type */ -#define WINDOW_IS_XDG_POPUP(window) \ - (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) -#define WINDOW_IS_LIBDECOR(ignoreme, window) \ - (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) - typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; From 914a65e0982f9049b517a181f5956338e2bf1ed1 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 6 Oct 2022 12:39:36 -0400 Subject: [PATCH 057/459] wayland: Don't unset min/max values when entering fullscreen via a compositor event If the compositor is entering fullscreen and hasn't removed any constraints itself, it's already too late at this point. Remove the unnecessary call. Restoring the limits when exiting fullscreen is still required, though, as they may have been removed when entering fullscreen via an SDL request. --- src/video/wayland/SDL_waylandwindow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 0d06bb0fd..5d8be176c 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -474,7 +474,6 @@ UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen) wind->in_fullscreen_transition = SDL_TRUE; SDL_SetWindowFullscreen(window, wind->fullscreen_flags); wind->in_fullscreen_transition = SDL_FALSE; - SetMinMaxDimensions(window, SDL_FALSE); } } else { /* Don't change the fullscreen flags if the window is hidden or being hidden. */ From 893c87b27bb90cfd3038a611e400273fe8cb9cb5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 12:10:45 -0700 Subject: [PATCH 058/459] Fixed game controller buttons being unresponsive when the on-screen keyboard is up Also mapped controller A and B buttons to interact with messagebox dialogs --- .../main/java/org/libsdl/app/SDLActivity.java | 92 +++++++++++++++---- .../main/java/org/libsdl/app/SDLSurface.java | 70 +------------- 2 files changed, 78 insertions(+), 84 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index af9265b84..e44cc2d4e 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1232,8 +1232,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } // This method is called by SDLControllerManager's API 26 Generic Motion Handler. - public static View getContentView() - { + public static View getContentView() { return mLayout; } @@ -1304,6 +1303,77 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE; } + public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputConnection ic) { + int deviceId = event.getDeviceId(); + int source = event.getSource(); + + if (source == InputDevice.SOURCE_UNKNOWN) { + InputDevice device = InputDevice.getDevice(deviceId); + if (device != null) { + source = device.getSources(); + } + } + +// if (event.getAction() == KeyEvent.ACTION_DOWN) { +// Log.v("SDL", "key down: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); +// } else if (event.getAction() == KeyEvent.ACTION_UP) { +// Log.v("SDL", "key up: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); +// } + + // Dispatch the different events depending on where they come from + // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD + // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD + // + // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and + // SOURCE_JOYSTICK, while its key events arrive from the keyboard source + // So, retrieve the device itself and check all of its sources + if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { + // Note that we process events with specific key codes here + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { + return true; + } + } else if (event.getAction() == KeyEvent.ACTION_UP) { + if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { + return true; + } + } + } + + if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (isTextInputEvent(event)) { + if (ic != null) { + ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); + } else { + SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); + } + } + onNativeKeyDown(keyCode); + return true; + } else if (event.getAction() == KeyEvent.ACTION_UP) { + onNativeKeyUp(keyCode); + return true; + } + } + + if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { + // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses + // they are ignored here because sending them as mouse input to SDL is messy + if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { + switch (event.getAction()) { + case KeyEvent.ACTION_DOWN: + case KeyEvent.ACTION_UP: + // mark the event as handled or it will be handled by system + // handling KEYCODE_BACK by system will call onBackPressed() + return true; + } + } + } + + return false; + } + /** * This method is called by SDL using JNI. */ @@ -1486,9 +1556,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // see SDL_messagebox.h if ((buttonFlags[i] & 0x00000001) != 0) { mapping.put(KeyEvent.KEYCODE_ENTER, button); + mapping.put(KeyEvent.KEYCODE_BUTTON_A, button); } if ((buttonFlags[i] & 0x00000002) != 0) { mapping.put(KeyEvent.KEYCODE_ESCAPE, button); /* API 11 */ + mapping.put(KeyEvent.KEYCODE_BUTTON_B, button); } } button.setText(buttonTexts[i]); @@ -1841,21 +1913,7 @@ class DummyEdit extends View implements View.OnKeyListener { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { - /* - * This handles the hardware keyboard input - */ - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLActivity.isTextInputEvent(event)) { - ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); - return true; - } - SDLActivity.onNativeKeyDown(keyCode); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativeKeyUp(keyCode); - return true; - } - return false; + return SDLActivity.handleKeyEvent(v, keyCode, event, ic); } // diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java index 77cf1768b..dcd26d495 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java @@ -189,72 +189,8 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // Key events @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - - int deviceId = event.getDeviceId(); - int source = event.getSource(); - - if (source == InputDevice.SOURCE_UNKNOWN) { - InputDevice device = InputDevice.getDevice(deviceId); - if (device != null) { - source = device.getSources(); - } - } - -// if (event.getAction() == KeyEvent.ACTION_DOWN) { -// Log.v("SDL", "key down: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); -// } else if (event.getAction() == KeyEvent.ACTION_UP) { -// Log.v("SDL", "key up: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); -// } - - // Dispatch the different events depending on where they come from - // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD - // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD - // - // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and - // SOURCE_JOYSTICK, while its key events arrive from the keyboard source - // So, retrieve the device itself and check all of its sources - if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { - // Note that we process events with specific key codes here - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { - return true; - } - } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { - return true; - } - } - } - - if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLActivity.isTextInputEvent(event)) { - SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); - } - SDLActivity.onNativeKeyDown(keyCode); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativeKeyUp(keyCode); - return true; - } - } - - if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { - // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses - // they are ignored here because sending them as mouse input to SDL is messy - if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { - switch (event.getAction()) { - case KeyEvent.ACTION_DOWN: - case KeyEvent.ACTION_UP: - // mark the event as handled or it will be handled by system - // handling KEYCODE_BACK by system will call onBackPressed() - return true; - } - } - } - - return false; + public boolean onKey(View v, int keyCode, KeyEvent event) { + return SDLActivity.handleKeyEvent(v, keyCode, event, null); } // Touch events @@ -466,4 +402,4 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, return false; } -} \ No newline at end of file +} From b4aba10154f901fc36af0fb94742201c21ce7f74 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 12:10:46 -0700 Subject: [PATCH 059/459] Reverted game controller buttons from interacting with message box dialogs These would only work for non-HIDAPI controllers, and other controller input would leak past the dialog, both of which would be confusing. --- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index e44cc2d4e..666ea3164 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1556,11 +1556,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // see SDL_messagebox.h if ((buttonFlags[i] & 0x00000001) != 0) { mapping.put(KeyEvent.KEYCODE_ENTER, button); - mapping.put(KeyEvent.KEYCODE_BUTTON_A, button); } if ((buttonFlags[i] & 0x00000002) != 0) { mapping.put(KeyEvent.KEYCODE_ESCAPE, button); /* API 11 */ - mapping.put(KeyEvent.KEYCODE_BUTTON_B, button); } } button.setText(buttonTexts[i]); From 689409fd976f987e477ec85d4517dd4a5aea4600 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 17:34:24 -0700 Subject: [PATCH 060/459] Fixed the start button on the Nimbus+ controller on tvOS Also updated mappings for Nintendo Switch controllers on tvOS, to reflect the lack of guide/menu button availability --- src/joystick/SDL_gamecontrollerdb.h | 6 ++++++ src/joystick/iphoneos/SDL_mfijoystick.m | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 5fbdf4ec5..fd8534fa6 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -938,12 +938,18 @@ static const char *s_ControllerMappings [] = "05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "05000000ac05000001000000ff076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", "05000000ac050000020000004f066d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,", + "050000007e050000062000000f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000062000000f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e050000062000004f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e050000062000004f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e05000008200000df070000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e05000008200000df070000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000072000000f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000072000000f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e050000072000004f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e050000072000004f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000df870000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b10,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000df870000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b10,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e05000009200000ff870000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e05000009200000ff870000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000004c050000cc090000df070000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m index 3d21b6bfa..8f207afb2 100644 --- a/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/src/joystick/iphoneos/SDL_mfijoystick.m @@ -265,9 +265,6 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle BOOL is_ps5 = IsControllerPS5(controller); BOOL is_switch_pro = IsControllerSwitchPro(controller); BOOL is_switch_joycon_pair = IsControllerSwitchJoyConPair(controller); -#if TARGET_OS_TV - BOOL is_MFi = (!is_xbox && !is_ps4 && !is_ps5 && !is_switch_pro && !is_switch_joycon_pair); -#endif int nbuttons = 0; BOOL has_direct_menu; @@ -310,18 +307,19 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_GUIDE); ++nbuttons; } - has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu; -#if TARGET_OS_TV - /* On tvOS MFi controller menu button brings you to the home screen */ - if (is_MFi) { - has_direct_menu = FALSE; - } -#endif device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); ++nbuttons; + + has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu; if (!has_direct_menu) { device->uses_pause_handler = SDL_TRUE; } +#if TARGET_OS_TV + /* The single menu button isn't very reliable, at least as of tvOS 16.1 */ + if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) == 0) { + device->uses_pause_handler = SDL_TRUE; + } +#endif #ifdef ENABLE_PHYSICAL_INPUT_PROFILE if ([controller respondsToSelector:@selector(physicalInputProfile)]) { @@ -440,9 +438,14 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); +#if TARGET_OS_TV + /* The menu button is used by the OS and not available to applications */ + nbuttons += 6; +#else device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); nbuttons += 7; device->uses_pause_handler = SDL_TRUE; +#endif device->naxes = 0; /* no traditional analog inputs */ device->nhats = 1; /* d-pad */ From fc720321b32ff59ed9852a2cc5f133f3959b2b97 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Oct 2022 18:23:07 -0700 Subject: [PATCH 061/459] Fix rare deadlock when opening a HID controller on Android Fixes https://github.com/libsdl-org/SDL/issues/6347 --- src/joystick/hidapi/SDL_hidapijoystick.c | 60 ++++++++++++++++++++---- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 25db216e3..ee56e5669 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -330,8 +330,10 @@ HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device) } static void -HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) +HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) { + *removed = SDL_FALSE; + if (device->driver) { SDL_bool enabled; @@ -359,14 +361,44 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) /* Make sure we can open the device and leave it open for the driver */ if (device->num_children == 0) { - device->dev = SDL_hid_open_path(device->path, 0); - if (!device->dev) { + /* On Android we need to leave joysticks unlocked because it calls + * out to the main thread for permissions and the main thread can + * be in the process of handling controller input. + * + * See https://github.com/libsdl-org/SDL/issues/6347 for details + */ + SDL_HIDAPI_Device *curr; + SDL_hid_device *dev; + char *path; + + SDL_AssertJoysticksLocked(); + path = SDL_strdup(device->path); + SDL_UnlockJoysticks(); + dev = SDL_hid_open_path(path, 0); + SDL_LockJoysticks(); + SDL_free(path); + + /* Make sure the device didn't get removed while opening the HID path */ + for (curr = SDL_HIDAPI_devices; curr && curr != device; curr = curr->next) { + continue; + } + if (!curr) { + *removed = SDL_TRUE; + if (dev) { + SDL_hid_close(dev); + } + return; + } + + if (!dev) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", device->path, SDL_GetError()); return; } - SDL_hid_set_nonblocking(device->dev, 1); + SDL_hid_set_nonblocking(dev, 1); + + device->dev = dev; } device->driver = HIDAPI_GetDeviceDriver(device); @@ -388,6 +420,7 @@ SDL_HIDAPI_UpdateDrivers(void) { int i; SDL_HIDAPI_Device *device; + SDL_bool removed; SDL_HIDAPI_numdrivers = 0; for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { @@ -398,9 +431,15 @@ SDL_HIDAPI_UpdateDrivers(void) } } - for (device = SDL_HIDAPI_devices; device; device = device->next) { - HIDAPI_SetupDeviceDriver(device); - } + removed = SDL_FALSE; + do { + for (device = SDL_HIDAPI_devices; device; device = device->next) { + HIDAPI_SetupDeviceDriver(device, &removed); + if (removed) { + break; + } + } + } while (removed); } static void SDLCALL @@ -685,6 +724,7 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H { SDL_HIDAPI_Device *device; SDL_HIDAPI_Device *curr, *last = NULL; + SDL_bool removed; for (curr = SDL_HIDAPI_devices, last = NULL; curr; last = curr, curr = curr->next) { continue; @@ -762,7 +802,11 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H SDL_HIDAPI_devices = device; } - HIDAPI_SetupDeviceDriver(device); + removed = SDL_FALSE; + HIDAPI_SetupDeviceDriver(device, &removed); + if (removed) { + return NULL; + } #ifdef DEBUG_HIDAPI SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); From f48823181b5c62c5c7c49e9ec6f0b1e9637c04b8 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 29 Sep 2022 20:31:20 -0400 Subject: [PATCH 062/459] Use the pkg-config file when checking for sndio. --- cmake/sdlchecks.cmake | 8 +++----- configure.ac | 15 ++------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 040029db7..0043ed60e 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -293,16 +293,14 @@ macro(CheckNAS) endmacro() # Requires: -# - n/a +# - PkgCheckModules # Optional: # - SDL_SNDIO_SHARED opt # - HAVE_SDL_LOADSO opt macro(CheckSNDIO) if(SDL_SNDIO) - # TODO: set include paths properly, so the sndio headers are found - check_include_file(sndio.h HAVE_SNDIO_H) - find_library(D_SNDIO_LIB sndio) - if(HAVE_SNDIO_H AND D_SNDIO_LIB) + pkg_check_modules(PKG_SNDIO sndio) + if(PKG_SNDIO_FOUND) set(HAVE_SNDIO TRUE) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) diff --git a/configure.ac b/configure.ac index 42ae7ab8c..61f01047d 100644 --- a/configure.ac +++ b/configure.ac @@ -1288,20 +1288,9 @@ CheckSNDIO() [AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])], , enable_sndio=yes) if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes) - AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes) + PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no) - AC_MSG_CHECKING(for sndio audio support) - have_sndio=no - - if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then - have_sndio=yes - SNDIO_LIBS="-lsndio" - fi - - AC_MSG_RESULT($have_sndio) - - if test x$have_sndio = xyes; then + if test x$audio_sndio = xyes; then AC_ARG_ENABLE(sndio-shared, [AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])], , enable_sndio_shared=yes) From e714d4d72437fb76a7d2d1b3e5e745032c840e54 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 7 Oct 2022 05:24:20 +0300 Subject: [PATCH 063/459] regenerated configure script. --- configure | 118 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 49 deletions(-) diff --git a/configure b/configure index dddc42b0a..6a29da267 100755 --- a/configure +++ b/configure @@ -707,6 +707,8 @@ DECOR_LIBS DECOR_CFLAGS FUSIONSOUND_LIBS FUSIONSOUND_CFLAGS +SNDIO_LIBS +SNDIO_CFLAGS ARTSCONFIG PULSEAUDIO_LIBS PULSEAUDIO_CFLAGS @@ -977,6 +979,8 @@ PIPEWIRE_CFLAGS PIPEWIRE_LIBS PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS +SNDIO_CFLAGS +SNDIO_LIBS FUSIONSOUND_CFLAGS FUSIONSOUND_LIBS DECOR_CFLAGS @@ -1824,6 +1828,9 @@ Some influential environment variables: C compiler flags for PULSEAUDIO, overriding pkg-config PULSEAUDIO_LIBS linker flags for PULSEAUDIO, overriding pkg-config + SNDIO_CFLAGS + C compiler flags for SNDIO, overriding pkg-config + SNDIO_LIBS linker flags for SNDIO, overriding pkg-config FUSIONSOUND_CFLAGS C compiler flags for FUSIONSOUND, overriding pkg-config FUSIONSOUND_LIBS @@ -22334,66 +22341,79 @@ else $as_nop fi if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - ac_fn_c_check_header_compile "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" -if test "x$ac_cv_header_sndio_h" = xyes -then : - have_sndio_hdr=yes -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 -printf %s "checking for sio_open in -lsndio... " >&6; } -if test ${ac_cv_lib_sndio_sio_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsndio $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio" >&5 +printf %s "checking for sndio... " >&6; } -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char sio_open (); -int -main (void) -{ -return sio_open (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_sndio_sio_open=yes -else $as_nop - ac_cv_lib_sndio_sio_open=no +if test -n "$SNDIO_CFLAGS"; then + pkg_cv_SNDIO_CFLAGS="$SNDIO_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SNDIO_CFLAGS=`$PKG_CONFIG --cflags "sndio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 -printf "%s\n" "$ac_cv_lib_sndio_sio_open" >&6; } -if test "x$ac_cv_lib_sndio_sio_open" = xyes -then : - have_sndio_lib=yes +if test -n "$SNDIO_LIBS"; then + pkg_cv_SNDIO_LIBS="$SNDIO_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SNDIO_LIBS=`$PKG_CONFIG --libs "sndio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 -printf %s "checking for sndio audio support... " >&6; } - have_sndio=no - if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then - have_sndio=yes - SNDIO_LIBS="-lsndio" +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SNDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sndio" 2>&1` + else + SNDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sndio" 2>&1` fi + # Put the nasty error message in config.log where it belongs + echo "$SNDIO_PKG_ERRORS" >&5 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 -printf "%s\n" "$have_sndio" >&6; } + audio_sndio=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + audio_sndio=no +else + SNDIO_CFLAGS=$pkg_cv_SNDIO_CFLAGS + SNDIO_LIBS=$pkg_cv_SNDIO_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + audio_sndio=yes +fi - if test x$have_sndio = xyes; then + if test x$audio_sndio = xyes; then # Check whether --enable-sndio-shared was given. if test ${enable_sndio_shared+y} then : From 5ec1cef6b5c2d58c3cb90959de5d4ed979611d3e Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 6 Oct 2022 22:43:33 -0400 Subject: [PATCH 064/459] Further fixes for the sndio CMake detection --- cmake/sdlchecks.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 0043ed60e..316453020 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -305,6 +305,7 @@ macro(CheckSNDIO) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) set(SDL_AUDIO_DRIVER_SNDIO 1) + list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS}) if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") endif() @@ -313,7 +314,7 @@ macro(CheckSNDIO) set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") set(HAVE_SNDIO_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${D_SNDIO_LIB}) + list(APPEND EXTRA_LIBS ${PKG_SNDIO_LDFLAGS}) endif() set(HAVE_SDL_AUDIO TRUE) endif() From 484d5fd6cfaf7abdd6d20b9838bbdac8c97bba2d Mon Sep 17 00:00:00 2001 From: Nicolas Cian Date: Wed, 5 Oct 2022 13:19:38 +0200 Subject: [PATCH 065/459] audio open: ensure 2 devices don't get the same id --- src/audio/SDL_audio.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e2f7412c9..e33e41dbc 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1313,7 +1313,7 @@ open_audio_device(const char *devname, int iscapture, return 0; } - /* !!! FIXME: there is a race condition here if two devices open from two threads at once. */ + SDL_LockMutex(current_audio.detectionLock); /* Find an available device ID... */ for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { if (open_devices[id] == NULL) { @@ -1323,6 +1323,7 @@ open_audio_device(const char *devname, int iscapture, if (id == SDL_arraysize(open_devices)) { SDL_SetError("Too many open audio devices"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1330,6 +1331,7 @@ open_audio_device(const char *devname, int iscapture, obtained = &_obtained; } if (!prepare_audiospec(desired, obtained)) { + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1351,6 +1353,7 @@ open_audio_device(const char *devname, int iscapture, if ((iscapture) && (current_audio.impl.OnlyHasDefaultCaptureDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) { SDL_SetError("No such device"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } devname = NULL; @@ -1358,11 +1361,13 @@ open_audio_device(const char *devname, int iscapture, for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (open_devices[i]->iscapture)) { SDL_SetError("Audio device already open"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } } else if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) { + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("No such device"); return 0; } @@ -1370,6 +1375,7 @@ open_audio_device(const char *devname, int iscapture, for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (!open_devices[i]->iscapture)) { + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Audio device already open"); return 0; } @@ -1382,20 +1388,19 @@ open_audio_device(const char *devname, int iscapture, It might still need to open a device based on the string for, say, a network audio server, but this optimizes some cases. */ SDL_AudioDeviceItem *item; - SDL_LockMutex(current_audio.detectionLock); for (item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; item; item = item->next) { if ((item->handle != NULL) && (SDL_strcmp(item->name, devname) == 0)) { handle = item->handle; break; } } - SDL_UnlockMutex(current_audio.detectionLock); } if (!current_audio.impl.AllowsArbitraryDeviceNames) { /* has to be in our device list, or the default device. */ if ((handle == NULL) && (devname != NULL)) { SDL_SetError("No such device."); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1403,6 +1408,7 @@ open_audio_device(const char *devname, int iscapture, device = (SDL_AudioDevice *) SDL_calloc(1, sizeof (SDL_AudioDevice)); if (device == NULL) { SDL_OutOfMemory(); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } device->id = id + 1; @@ -1419,6 +1425,7 @@ open_audio_device(const char *devname, int iscapture, device->mixer_lock = SDL_CreateMutex(); if (device->mixer_lock == NULL) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create mixer lock"); return 0; } @@ -1433,6 +1440,7 @@ open_audio_device(const char *devname, int iscapture, if (current_audio.impl.OpenDevice(device, devname) < 0) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1488,6 +1496,7 @@ open_audio_device(const char *devname, int iscapture, if (!device->stream) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1497,6 +1506,7 @@ open_audio_device(const char *devname, int iscapture, device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); if (!device->buffer_queue) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create audio buffer queue"); return 0; } @@ -1514,6 +1524,7 @@ open_audio_device(const char *devname, int iscapture, device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len); if (device->work_buffer == NULL) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_OutOfMemory(); return 0; } @@ -1534,9 +1545,11 @@ open_audio_device(const char *devname, int iscapture, if (device->thread == NULL) { close_audio_device(device); SDL_SetError("Couldn't create audio thread"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } + SDL_UnlockMutex(current_audio.detectionLock); return device->id; } From 31991ab85185309a46b7a62e11ade196e1c86ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=A0eve=C4=8Dek?= Date: Fri, 7 Oct 2022 15:45:28 +0200 Subject: [PATCH 066/459] Fix \sa to a valid function in SDL_metal.h. --- include/SDL_metal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_metal.h b/include/SDL_metal.h index eb3082879..92854710e 100644 --- a/include/SDL_metal.h +++ b/include/SDL_metal.h @@ -82,7 +82,7 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); * * \since This function is available since SDL 2.0.14. * - * \sa SDL_MetalCreateView + * \sa SDL_Metal_CreateView */ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); From 33050fea3997c7d0c1cf709fa5a70f5462e35ad9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 7 Oct 2022 11:29:49 -0700 Subject: [PATCH 067/459] Only open HID devices that might have a HIDAPI driver available This prevents an OS prompt for every connected device when running on Android --- src/joystick/hidapi/SDL_hidapi_ps4.c | 2 +- src/joystick/hidapi/SDL_hidapi_ps5.c | 2 +- src/joystick/hidapi/SDL_hidapi_switch.c | 2 +- src/joystick/hidapi/SDL_hidapijoystick.c | 94 ++++++++++++------------ 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 40884dade..7bccd5fa0 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -194,7 +194,7 @@ HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, } if (SONY_THIRDPARTY_VENDOR(vendor_id)) { - if (device) { + if (device && device->dev) { if ((size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 && data[2] == 0x27) { /* Supported third party controller */ diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index 0e41d2e5a..4b2255d17 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -277,7 +277,7 @@ HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, } if (SONY_THIRDPARTY_VENDOR(vendor_id)) { - if (device) { + if (device && device->dev) { if ((size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 && data[2] == 0x28) { /* Supported third party controller */ diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 8eaadb31e..0bf66d856 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1106,7 +1106,7 @@ static SDL_bool HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) { if (vendor_id == USB_VENDOR_NINTENDO) { - if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device) { + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device && device->dev) { /* This might be a Kinvoca Joy-Con that reports VID/PID as a Switch Pro controller */ ESwitchDeviceInfoControllerType eControllerType = ReadJoyConControllerType(device); if (eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index ee56e5669..8cf9596bb 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -359,59 +359,61 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) return; /* Already setup */ } - /* Make sure we can open the device and leave it open for the driver */ - if (device->num_children == 0) { - /* On Android we need to leave joysticks unlocked because it calls - * out to the main thread for permissions and the main thread can - * be in the process of handling controller input. - * - * See https://github.com/libsdl-org/SDL/issues/6347 for details - */ - SDL_HIDAPI_Device *curr; - SDL_hid_device *dev; - char *path; + if (HIDAPI_GetDeviceDriver(device)) { + /* We might have a device driver for this device, try opening it and see */ + if (device->num_children == 0) { + /* On Android we need to leave joysticks unlocked because it calls + * out to the main thread for permissions and the main thread can + * be in the process of handling controller input. + * + * See https://github.com/libsdl-org/SDL/issues/6347 for details + */ + SDL_HIDAPI_Device *curr; + SDL_hid_device *dev; + char *path; - SDL_AssertJoysticksLocked(); - path = SDL_strdup(device->path); - SDL_UnlockJoysticks(); - dev = SDL_hid_open_path(path, 0); - SDL_LockJoysticks(); - SDL_free(path); + SDL_AssertJoysticksLocked(); + path = SDL_strdup(device->path); + SDL_UnlockJoysticks(); + dev = SDL_hid_open_path(path, 0); + SDL_LockJoysticks(); + SDL_free(path); - /* Make sure the device didn't get removed while opening the HID path */ - for (curr = SDL_HIDAPI_devices; curr && curr != device; curr = curr->next) { - continue; - } - if (!curr) { - *removed = SDL_TRUE; - if (dev) { - SDL_hid_close(dev); + /* Make sure the device didn't get removed while opening the HID path */ + for (curr = SDL_HIDAPI_devices; curr && curr != device; curr = curr->next) { + continue; } - return; + if (!curr) { + *removed = SDL_TRUE; + if (dev) { + SDL_hid_close(dev); + } + return; + } + + if (!dev) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", + device->path, SDL_GetError()); + return; + } + SDL_hid_set_nonblocking(dev, 1); + + device->dev = dev; } - if (!dev) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", - device->path, SDL_GetError()); - return; + device->driver = HIDAPI_GetDeviceDriver(device); + + /* Initialize the device, which may cause a connected event */ + if (device->driver && !device->driver->InitDevice(device)) { + HIDAPI_CleanupDeviceDriver(device); } - SDL_hid_set_nonblocking(dev, 1); - device->dev = dev; - } - - device->driver = HIDAPI_GetDeviceDriver(device); - - /* Initialize the device, which may cause a connected event */ - if (device->driver && !device->driver->InitDevice(device)) { - HIDAPI_CleanupDeviceDriver(device); - } - - if (!device->driver && device->dev) { - /* No driver claimed this device, go ahead and close it */ - SDL_hid_close(device->dev); - device->dev = NULL; + if (!device->driver && device->dev) { + /* No driver claimed this device, go ahead and close it */ + SDL_hid_close(device->dev); + device->dev = NULL; + } } } From 17b43b0fdd38733889edd8124b96285b1eae0e74 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 8 Oct 2022 09:32:09 -0700 Subject: [PATCH 068/459] Don't try to create a semaphore for the mutex implementation if threads are disabled Fixes https://github.com/libsdl-org/SDL/issues/6344 --- src/thread/generic/SDL_sysmutex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/thread/generic/SDL_sysmutex.c b/src/thread/generic/SDL_sysmutex.c index 42965aa8b..12cc58041 100644 --- a/src/thread/generic/SDL_sysmutex.c +++ b/src/thread/generic/SDL_sysmutex.c @@ -40,7 +40,9 @@ SDL_CreateMutex(void) SDL_mutex *mutex; /* Allocate mutex memory */ - mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); + mutex = (SDL_mutex *) SDL_calloc(1, sizeof(*mutex)); + +#if !SDL_THREADS_DISABLED if (mutex) { /* Create the mutex semaphore, with initial value 1 */ mutex->sem = SDL_CreateSemaphore(1); @@ -53,6 +55,8 @@ SDL_CreateMutex(void) } else { SDL_OutOfMemory(); } +#endif /* !SDL_THREADS_DISABLED */ + return mutex; } From 5490505a2ba633146d4c41538fde300830cf3d39 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 8 Oct 2022 09:41:10 -0700 Subject: [PATCH 069/459] Added a note to update the website after a stable release --- docs/release_checklist.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index a5c1d1780..37d8b6d94 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -16,6 +16,8 @@ mechanical work. * Do the release +* Update the website file include/header.inc.php to reflect the new version + ## New bugfix release * Check that no new API/ABI was added @@ -28,6 +30,8 @@ mechanical work. * Do the release +* Update the website file include/header.inc.php to reflect the new version + ## After a feature release * Create a branch like `release-2.24.x` From 4f318c904a3d19b4d292675d6969319dffdc0d42 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 8 Oct 2022 12:01:42 -0700 Subject: [PATCH 070/459] Add cursor position to mouse wheel event (thanks @meyraud705!) Fixes https://github.com/libsdl-org/SDL/pull/6351 --- include/SDL_events.h | 2 ++ src/events/SDL_mouse.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/SDL_events.h b/include/SDL_events.h index 240a8a8ba..c2db57a94 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -318,6 +318,8 @@ typedef struct SDL_MouseWheelEvent Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */ float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */ + Sint32 mouse_x; /**< X coordinate, relative to window (added in 2.26.0) */ + Sint32 mouse_y; /**< Y coordinate, relative to window (added in 2.26.0) */ } SDL_MouseWheelEvent; /** diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index ffdda9154..53937c4fa 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -868,6 +868,8 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, S event.wheel.preciseX = x; event.wheel.preciseY = y; event.wheel.direction = (Uint32)direction; + event.wheel.mouse_x = mouse->x; + event.wheel.mouse_y = mouse->y; posted = (SDL_PushEvent(&event) > 0); } return posted; From b18c361b0fe28e30e3bea459b5c10c58c71dbb85 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 8 Oct 2022 13:18:00 -0700 Subject: [PATCH 071/459] Updated variable name for mouse coordinates in mouse wheel events --- include/SDL_events.h | 4 ++-- src/events/SDL_mouse.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SDL_events.h b/include/SDL_events.h index c2db57a94..55a343e08 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -318,8 +318,8 @@ typedef struct SDL_MouseWheelEvent Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */ float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */ - Sint32 mouse_x; /**< X coordinate, relative to window (added in 2.26.0) */ - Sint32 mouse_y; /**< Y coordinate, relative to window (added in 2.26.0) */ + Sint32 mouseX; /**< X coordinate, relative to window (added in 2.26.0) */ + Sint32 mouseY; /**< Y coordinate, relative to window (added in 2.26.0) */ } SDL_MouseWheelEvent; /** diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 53937c4fa..f315674ff 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -868,8 +868,8 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, S event.wheel.preciseX = x; event.wheel.preciseY = y; event.wheel.direction = (Uint32)direction; - event.wheel.mouse_x = mouse->x; - event.wheel.mouse_y = mouse->y; + event.wheel.mouseX = mouse->x; + event.wheel.mouseY = mouse->y; posted = (SDL_PushEvent(&event) > 0); } return posted; From 68e20501d6e5bf9ebba04fd2a159c86a5424c38a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 23:41:13 +0200 Subject: [PATCH 072/459] autotools: by default, disable x11 on MacOS/iOS --- configure | 11 +++++++++-- configure.ac | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6a29da267..f3390df52 100755 --- a/configure +++ b/configure @@ -1713,7 +1713,7 @@ Optional Features: --enable-libdecor-shared dynamically load libdecor [default=yes] --enable-video-rpi use Raspberry Pi 2/3 video driver [default=yes] - --enable-video-x11 use X11 video driver [default=yes] + --enable-video-x11 use X11 video driver [default=maybe] --enable-x11-shared dynamically load X11 support [default=maybe] --enable-video-x11-xcursor enable X11 Xcursor support [default=yes] @@ -23478,9 +23478,16 @@ if test ${enable_video_x11+y} then : enableval=$enable_video_x11; else $as_nop - enable_video_x11=yes + + enable_video_x11=yes + case "$host" in + *-*-darwin*|*-ios-*) + enable_video_x11=no + ;; + esac fi + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then case "$host" in *-*-darwin*) diff --git a/configure.ac b/configure.ac index 61f01047d..f8bc77d21 100644 --- a/configure.ac +++ b/configure.ac @@ -1849,8 +1849,15 @@ dnl Find the X11 include and library directories CheckX11() { AC_ARG_ENABLE(video-x11, -[AS_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]])], - , enable_video_x11=yes) +[AS_HELP_STRING([--enable-video-x11], [use X11 video driver [default=maybe]])], + ,[ + enable_video_x11=yes + case "$host" in + *-*-darwin*|*-ios-*) + enable_video_x11=no + ;; + esac]) + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then case "$host" in *-*-darwin*) From 1064fdee8c071faad48c6a26289161fec5da02b5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 05:04:51 +0200 Subject: [PATCH 073/459] cmake: append to COMPILE_FLAGS property --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc4510a27..5867e5ba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2004,7 +2004,7 @@ elseif(APPLE) set(SDL_FRAMEWORK_COREHAPTICS 1) else() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) - set_source_files_properties(${MFI_JOYSTICK_SOURCES} PROPERTIES COMPILE_FLAGS -fobjc-weak) + set_property(SOURCE ${MFI_JOYSTICK_SOURCES} APPEND_STRING PROPERTY COMPILE_FLAGS " -fobjc-weak") check_objc_source_compiles(" #include #include From 77822ed1664a4e58915826001c401e8cadafb995 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 15:14:08 +0200 Subject: [PATCH 074/459] cmake: add SDL_WERROR to conditionally enable/disable -Werror --- CMakeLists.txt | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5867e5ba0..aba7bf9ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -509,6 +509,8 @@ dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" O dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) +option(SDL_WERROR "Enable -Werror" OFF) + option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_ENABLED_BY_DEFAULT}) option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_ENABLED_BY_DEFAULT}) option(SDL_TEST "Build the SDL2_test library" ${SDL_TEST_ENABLED_BY_DEFAULT}) @@ -519,6 +521,26 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF) set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}") +if(SDL_WERROR) + if(MSVC) + cmake_push_check_state(RESET) + check_c_compiler_flag(/WX HAVE_WX) + if(HAVE_WX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() + elseif(USE_GCC OR USE_CLANG) + cmake_push_check_state(RESET) + check_c_compiler_flag(-Werror HAVE_WERROR) + if(HAVE_WERROR) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror") + endif() + cmake_pop_check_state() + endif() +endif() + if(SDL_HIDAPI) if(HIDAPI_ONLY_LIBUSB) set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE) @@ -606,9 +628,11 @@ if(USE_GCC OR USE_CLANG) check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) - check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + if(SDL_WERROR) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() endif() list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") endif() From 335c6724980119efda901ede64137d72905981be Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 19:17:18 +0200 Subject: [PATCH 075/459] autotools: add --enable-werror option --- configure | 91 +++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 52 +++++++++++++++++++++++++++ test/configure | 78 ++++++++++++++++++++++++++++++++++++++++ test/configure.ac | 38 ++++++++++++++++++++ 4 files changed, 259 insertions(+) diff --git a/configure b/configure index f3390df52..cf415a596 100755 --- a/configure +++ b/configure @@ -902,6 +902,7 @@ enable_libsamplerate enable_libsamplerate_shared enable_arm_simd enable_arm_neon +enable_werror enable_video_wayland enable_video_wayland_qt_touch enable_wayland_shared @@ -1703,6 +1704,7 @@ Optional Features: dynamically load libsamplerate [default=yes] --enable-arm-simd use SIMD assembly blitters on ARM [default=no] --enable-arm-neon use NEON assembly blitters on ARM [default=no] + --enable-werror treat warnings as errors [default=no] --enable-video-wayland use Wayland video driver [default=yes] --enable-video-wayland-qt-touch QtWayland server support for Wayland video driver @@ -22952,6 +22954,86 @@ printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; } fi } +CheckWerror() +{ + # Check whether --enable-werror was given. +if test ${enable_werror+y} +then : + enableval=$enable_werror; enable_werror=$enableval +else $as_nop + enable_werror=no +fi + + if test x$enable_werror = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 +printf %s "checking for GCC -Werror option... " >&6; } + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_werror=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Werror" + fi + fi +} + +CheckNoErrorDeprecatedDeclarationsWerror() +{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 +printf %s "checking for GCC -Werror option... " >&6; } + have_gcc_no_werror_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_no_werror_deprecated_declarations=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_werror_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi +} + CheckDeclarationAfterStatement() { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 @@ -28315,6 +28397,7 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h ;; esac CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -28582,6 +28665,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h have_loadso=yes fi CheckGDwarf4 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -28905,6 +28989,8 @@ printf "%s\n" "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h ARCH=ios CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29042,6 +29128,8 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckObjectiveCARC CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29187,6 +29275,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h fi CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29246,6 +29335,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h *-*-riscos*) ARCH=riscos CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29302,6 +29392,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h enable_static=no # disable static builds EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" CheckOS2 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio diff --git a/configure.ac b/configure.ac index f8bc77d21..34942b0dc 100644 --- a/configure.ac +++ b/configure.ac @@ -1595,6 +1595,49 @@ CheckStackBoundary() fi } +dnl See if GCC's -Werror is supported. +CheckWerror() +{ + AC_ARG_ENABLE(werror, +[AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])], + enable_werror=$enableval, enable_werror=no) + if test x$enable_werror = xyes; then + AC_MSG_CHECKING(for GCC -Werror option) + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_werror=yes],[]) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Werror" + fi + fi +} + +dnl See if GCC's -Wno-error=deprecated-declarations is supported. +CheckNoErrorDeprecatedDeclarationsWerror() +{ + AC_MSG_CHECKING(for GCC -Werror option) + have_gcc_no_werror_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_no_werror_deprecated_declarations=yes],[]) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_werror_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi +} + dnl See if GCC's -Wdeclaration-after-statement is supported. dnl This lets us catch things that would fail on a C89 compiler when using dnl a modern GCC. @@ -3761,6 +3804,7 @@ case "$host" in ;; esac CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -3994,6 +4038,7 @@ case "$host" in have_loadso=yes fi CheckGDwarf4 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4218,6 +4263,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. ARCH=ios CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4333,6 +4380,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckObjectiveCARC CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4458,6 +4507,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. fi CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4509,6 +4559,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. *-*-riscos*) ARCH=riscos CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4559,6 +4610,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. enable_static=no # disable static builds EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" CheckOS2 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio diff --git a/test/configure b/test/configure index b598ebe08..9c1e90a86 100755 --- a/test/configure +++ b/test/configure @@ -701,6 +701,7 @@ with_sdl_prefix with_sdl_exec_prefix enable_sdltest with_x +enable_werror ' ac_precious_vars='build_alias host_alias @@ -1344,6 +1345,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-sdltest Do not try to compile and run a test SDL program + --enable-werror treat warnings as errors [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -4662,6 +4664,82 @@ if test x$have_opengl = xyes; then OPENGL_TARGETS="TARGETS" fi +# Check whether --enable-werror was given. +if test ${enable_werror+y} +then : + enableval=$enable_werror; enable_werror=$enableval +else $as_nop + enable_werror=no +fi + +if test x$enable_werror = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 +printf %s "checking for GCC -Werror option... " >&6; } + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int x = 0; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_werror=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + CFLAGS="$CFLAGS -Werror" + fi +fi + +case "$host" in + *-ios-*|*-*-darwin* ) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 +printf %s "checking for GCC -Werror option... " >&6; } + have_gcc_wno_error_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_wno_error_deprecated_declarations=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_wno_error_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi + ;; +esac + diff --git a/test/configure.ac b/test/configure.ac index 694551c61..d31565dfd 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -184,6 +184,44 @@ if test x$have_opengl = xyes; then OPENGL_TARGETS="TARGETS" fi +AC_ARG_ENABLE(werror, +[AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])], + enable_werror=$enableval, enable_werror=no) +if test x$enable_werror = xyes; then + AC_MSG_CHECKING(for GCC -Werror option) + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])], + [have_gcc_werror=yes], []) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + CFLAGS="$CFLAGS -Werror" + fi +fi + +case "$host" in + *-ios-*|*-*-darwin* ) + AC_MSG_CHECKING(for GCC -Werror option) + have_gcc_wno_error_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_wno_error_deprecated_declarations=yes],[]) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_wno_error_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi + ;; +esac + AC_SUBST(OPENGLES1_TARGETS) AC_SUBST(OPENGLES2_TARGETS) AC_SUBST(OPENGL_TARGETS) From be5f55c47e0ce8bf0f6f6dc95269b22b93fa7b8a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 7 Oct 2022 00:17:25 +0200 Subject: [PATCH 076/459] watcom: add ENABLE_WERROR option to makefiles --- Makefile.os2 | 5 +++++ Makefile.w32 | 5 +++++ test/Makefile.os2 | 5 +++++ test/Makefile.w32 | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/Makefile.os2 b/Makefile.os2 index b9096c929..76b2b398d 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -9,6 +9,8 @@ # can compile hidapi joystick support against it (experimental) # by specifying HIDAPI=1, e.g.: # wmake -f Makefile.os2 HIDAPI=1 +# +# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 LIBNAME = SDL2 MAJOR_VERSION = 2 @@ -40,6 +42,9 @@ CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei # max warnings: CFLAGS+= -wx +!ifeq ENABLE_WERROR 1 +CFLAGS+= -we +!endif # newer OpenWatcom versions enable W303 by default CFLAGS+= -wcd=303 # the include paths : diff --git a/Makefile.w32 b/Makefile.w32 index 22ec0cd92..68c3a3731 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -1,5 +1,7 @@ # Open Watcom makefile to build SDL2.dll for Win32 # wmake -f Makefile.w32 +# +# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 LIBNAME = SDL2 MAJOR_VERSION = 2 @@ -26,6 +28,9 @@ LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.l CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei # max warnings: CFLAGS+= -wx +!ifeq ENABLE_WERROR 1 +CFLAGS+= -we +!endif # newer OpenWatcom versions enable W303 by default CFLAGS+= -wcd=303 # new vulkan headers result in lots of W202 warnings diff --git a/test/Makefile.os2 b/test/Makefile.os2 index 75aaeedfd..ee66409b0 100644 --- a/test/Makefile.os2 +++ b/test/Makefile.os2 @@ -1,5 +1,7 @@ # Open Watcom makefile to build SDL2 tests for OS/2 # wmake -f Makefile.os2 +# +# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 SYSTEM = os2v2 @@ -7,6 +9,9 @@ INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei CFLAGS+= -wx -wcd=303 +!ifeq ENABLE_WERROR 1 +CFLAGS+= -we +!endif TNSRCS = testnative.c testnativeos2.c diff --git a/test/Makefile.w32 b/test/Makefile.w32 index 51ca7eafc..02e68e865 100644 --- a/test/Makefile.w32 +++ b/test/Makefile.w32 @@ -1,5 +1,7 @@ # Open Watcom makefile to build SDL2 tests for Win32 # wmake -f Makefile.w32 +# +# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 SYSTEM = nt @@ -7,6 +9,9 @@ INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos" CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei CFLAGS+= -wx -wcd=303 +!ifeq ENABLE_WERROR 1 +CFLAGS+= -we +!endif CFLAGS+= -DSDL_MAIN_HANDLED CFLAGS+= -DHAVE_OPENGL GLLIBS = opengl32.lib From 57c886551f650f1e602ed06c1f6a6ec04b80c1f7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 23:55:59 +0200 Subject: [PATCH 077/459] automation_main.c: fix -Wformat-zero-length warning due to SDL_SetError("") --- test/CMakeLists.txt | 4 +++- test/testautomation_main.c | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8b2738a7d..133c79752 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.0) project(SDL2_test) +include(CheckCCompilerFlag) +include(CMakePushCheckState) + if(NOT TARGET SDL2::SDL2-static) find_package(SDL2 2.0.23 REQUIRED COMPONENTS SDL2-static SDL2test) endif() @@ -79,7 +82,6 @@ add_executable(testaudioinfo testaudioinfo.c) file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) - add_executable(testmultiaudio testmultiaudio.c testutils.c) add_executable(testaudiohotplug testaudiohotplug.c testutils.c) add_executable(testaudiocapture testaudiocapture.c) diff --git a/test/testautomation_main.c b/test/testautomation_main.c index f267789b8..97d235231 100644 --- a/test/testautomation_main.c +++ b/test/testautomation_main.c @@ -125,6 +125,11 @@ static int main_testImpliedJoystickQuit (void *arg) #endif } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#endif + static int main_testSetError(void *arg) { @@ -145,6 +150,10 @@ main_testSetError(void *arg) return TEST_COMPLETED; } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + static const SDLTest_TestCaseReference mainTest1 = { (SDLTest_TestCaseFp)main_testInitQuitJoystickHaptic, "main_testInitQuitJoystickHaptic", "Tests SDL_Init/Quit of Joystick and Haptic subsystem", TEST_ENABLED}; From bb527678a32fa815588c6d32c51e9347e484b202 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 23:56:27 +0200 Subject: [PATCH 078/459] testgamecontroller: fix -Wshadow warning by renaming global axis+button textures --- test/testgamecontroller.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 93942b16e..682788465 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -86,7 +86,7 @@ static SDL_bool retval = SDL_FALSE; static SDL_bool done = SDL_FALSE; static SDL_bool set_LED = SDL_FALSE; static int trigger_effect = 0; -static SDL_Texture *background_front, *background_back, *button, *axis; +static SDL_Texture *background_front, *background_back, *button_texture, *axis_texture; static SDL_GameController *gamecontroller; static SDL_GameController **gamecontrollers; static int num_controllers = 0; @@ -696,7 +696,7 @@ loop(void *arg) dst.y = button_positions[i].y; dst.w = BUTTON_SIZE; dst.h = BUTTON_SIZE; - SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE); + SDL_RenderCopyEx(screen, button_texture, NULL, &dst, 0, NULL, SDL_FLIP_NONE); } } } @@ -712,7 +712,7 @@ loop(void *arg) dst.y = axis_positions[i].y; dst.w = AXIS_SIZE; dst.h = AXIS_SIZE; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); + SDL_RenderCopyEx(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } else if (value > deadzone) { const double angle = axis_positions[i].angle + 180.0; SDL_Rect dst; @@ -720,7 +720,7 @@ loop(void *arg) dst.y = axis_positions[i].y; dst.w = AXIS_SIZE; dst.h = AXIS_SIZE; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); + SDL_RenderCopyEx(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } } } @@ -910,16 +910,16 @@ main(int argc, char *argv[]) background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); - button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); + button_texture = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); + axis_texture = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); - if (!background_front || !background_back || !button || !axis) { + if (!background_front || !background_back || !button_texture || !axis_texture) { SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); return 2; } - SDL_SetTextureColorMod(button, 10, 255, 21); - SDL_SetTextureColorMod(axis, 10, 255, 21); + SDL_SetTextureColorMod(button_texture, 10, 255, 21); + SDL_SetTextureColorMod(axis_texture, 10, 255, 21); /* !!! FIXME: */ /*SDL_RenderSetLogicalSize(screen, background->w, background->h);*/ From a905db9d65dac2b72b794ef417d56e5dea5a152c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Oct 2022 23:59:01 +0200 Subject: [PATCH 079/459] testcustomcursor: fix Wswitch warning by casting the arg to an int --- test/testcustomcursor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index 698d31f9b..b3ffdbc42 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -169,7 +169,7 @@ loop() SDL_SetCursor(cursors[current_cursor]); - switch (cursor_types[current_cursor]) { + switch ((int)cursor_types[current_cursor]) { case (SDL_SystemCursor)-1: SDL_Log("Custom cursor"); break; case SDL_SYSTEM_CURSOR_ARROW: SDL_Log("Arrow"); break; case SDL_SYSTEM_CURSOR_IBEAM: SDL_Log("I-beam"); break; From d04fa0ef7665aad63b687b324a76fad3be485e4d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 00:30:11 +0200 Subject: [PATCH 080/459] controllermap: use enum to avoid '-Wmaybe-uninitialized' Emitted by MinGW: In function 'WatchJoystick', inlined from 'SDL_main' at D:/a/SDL/SDL/test/controllermap.c:802:9: D:/a/SDL/SDL/test/controllermap.c:437:9: warning: 'marker' may be used uninitialized [-Wmaybe-uninitialized] 437 | SDL_SetTextureAlphaMod(marker, alpha); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/a/SDL/SDL/test/controllermap.c: In function 'SDL_main': D:/a/SDL/SDL/test/controllermap.c:355:71: note: 'marker' was declared here 355 | SDL_Texture *background_front, *background_back, *button, *axis, *marker; --- test/controllermap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/controllermap.c b/test/controllermap.c index c2bee4016..43bf79390 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -28,8 +28,10 @@ #define SCREEN_WIDTH 512 #define SCREEN_HEIGHT 320 -#define MARKER_BUTTON 1 -#define MARKER_AXIS 2 +enum marker_type { + MARKER_BUTTON, + MARKER_AXIS, +}; enum { @@ -48,11 +50,11 @@ enum #define BINDING_COUNT (SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_MAX) -static struct +static struct { int x, y; double angle; - int marker; + enum marker_type marker; } s_arrBindingDisplay[] = { { 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */ @@ -352,7 +354,7 @@ BMergeAxisBindings(int iIndex) static void WatchJoystick(SDL_Joystick * joystick) { - SDL_Texture *background_front, *background_back, *button, *axis, *marker; + SDL_Texture *background_front, *background_back, *button, *axis, *marker=NULL; const char *name = NULL; SDL_Event event; SDL_Rect dst; @@ -407,8 +409,6 @@ WatchJoystick(SDL_Joystick * joystick) case MARKER_BUTTON: marker = button; break; - default: - break; } dst.x = s_arrBindingDisplay[iElement].x; From 274ec025819a24eeaa13cca2b4869fbdef1dc876 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 00:31:00 +0200 Subject: [PATCH 081/459] testautomation: avoid format related warnings by using a few pragma's ci: enable -Werror to a few platforms --- test/CMakeLists.txt | 19 ++++++++ test/configure | 84 ++++++++++++++++++++++++++++++++++ test/configure.ac | 36 +++++++++++++++ test/testautomation_platform.c | 11 ++++- test/testautomation_stdlib.c | 29 +++++++++++- 5 files changed, 177 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 133c79752..d7c19f175 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -160,6 +160,25 @@ add_executable(controllermap controllermap.c testutils.c) add_executable(testvulkan testvulkan.c) add_executable(testoffscreen testoffscreen.c) +cmake_push_check_state(RESET) + +check_c_compiler_flag(-Wformat-overflow HAVE_WFORMAT_OVERFLOW) +if(HAVE_WFORMAT_OVERFLOW) + target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT_OVERFLOW) +endif() + +check_c_compiler_flag(-Wformat HAVE_WFORMAT) +if(HAVE_WFORMAT) + target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT) +endif() + +check_c_compiler_flag(-Wformat-extra-args HAVE_WFORMAT_EXTRA_ARGS) +if(HAVE_WFORMAT_EXTRA_ARGS) + target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT_EXTRA_ARGS) +endif() + +cmake_pop_check_state() + SET(ALL_TESTS checkkeys checkkeysthreads diff --git a/test/configure b/test/configure index 9c1e90a86..8b7afb01e 100755 --- a/test/configure +++ b/test/configure @@ -4664,6 +4664,90 @@ if test x$have_opengl = xyes; then OPENGL_TARGETS="TARGETS" fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wformat" >&5 +printf %s "checking for GCC -Wformat... " >&6; } +have_wformat=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int x = 0; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_wformat=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wformat" >&5 +printf "%s\n" "$have_wformat" >&6; } +CFLAGS="$save_CFLAGS" +if test x$have_wformat = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT" +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wformat-overflow" >&5 +printf %s "checking for GCC -Wformat-overflow... " >&6; } +have_wformat_overflow=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat-overflow" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int x = 0; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_wformat_overflow=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wformat_overflow" >&5 +printf "%s\n" "$have_wformat_overflow" >&6; } +CFLAGS="$save_CFLAGS" +if test x$have_wformat_overflow = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT_OVERFLOW" +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wformat-extra-args" >&5 +printf %s "checking for GCC -Wformat-extra-args... " >&6; } +have_wformat_extra_args=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat-extra-args" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int x = 0; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_wformat_extra_args=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wformat_extra_args" >&5 +printf "%s\n" "$have_wformat_extra_args" >&6; } +CFLAGS="$save_CFLAGS" +if test x$have_wformat_extra_args = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT_EXTRA_ARGS" +fi + # Check whether --enable-werror was given. if test ${enable_werror+y} then : diff --git a/test/configure.ac b/test/configure.ac index d31565dfd..e0dd1c463 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -184,6 +184,42 @@ if test x$have_opengl = xyes; then OPENGL_TARGETS="TARGETS" fi +AC_MSG_CHECKING(for GCC -Wformat) +have_wformat=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])], + [have_wformat=yes], []) +AC_MSG_RESULT($have_wformat) +CFLAGS="$save_CFLAGS" +if test x$have_wformat = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT" +fi + +AC_MSG_CHECKING(for GCC -Wformat-overflow) +have_wformat_overflow=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat-overflow" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])], + [have_wformat_overflow=yes], []) +AC_MSG_RESULT($have_wformat_overflow) +CFLAGS="$save_CFLAGS" +if test x$have_wformat_overflow = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT_OVERFLOW" +fi + +AC_MSG_CHECKING(for GCC -Wformat-extra-args) +have_wformat_extra_args=no +save_CFLAGS="$CFLAGS" +CFLAGS="$save_CFLAGS -Wformat-extra-args" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])], + [have_wformat_extra_args=yes], []) +AC_MSG_RESULT($have_wformat_extra_args) +CFLAGS="$save_CFLAGS" +if test x$have_wformat_extra_args = xyes; then + CFLAGS="$CFLAGS -DHAVE_WFORMAT_EXTRA_ARGS" +fi + AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])], enable_werror=$enableval, enable_werror=no) diff --git a/test/testautomation_platform.c b/test/testautomation_platform.c index 5eb37b332..0b37dd931 100644 --- a/test/testautomation_platform.c +++ b/test/testautomation_platform.c @@ -376,6 +376,11 @@ int platform_testSetErrorEmptyInput(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT_OVERFLOW) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-overflow" +#endif + /* ! * \brief Tests SDL_SetError with invalid input * \sa @@ -451,7 +456,7 @@ int platform_testSetErrorInvalidInput(void *arg) probeError, lastError); } - + /* Clean up */ SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); @@ -459,6 +464,10 @@ int platform_testSetErrorInvalidInput(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT_OVERFLOW) +#pragma GCC diagnostic pop +#endif + /* ! * \brief Tests SDL_GetPowerInfo * \sa diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index a89ec1e0b..7abad3625 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -7,7 +7,6 @@ #include "SDL.h" #include "SDL_test.h" - /* Test case functions */ /** @@ -36,6 +35,16 @@ stdlib_strlcpy(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic push +#if defined(HAVE_WFORMAT) +#pragma GCC diagnostic ignored "-Wformat" +#endif +#if defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic ignored "-Wformat-extra-args" +#endif +#endif + /** * @brief Call to SDL_snprintf */ @@ -159,6 +168,10 @@ stdlib_snprintf(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic pop +#endif + /** * @brief Call to SDL_getenv and SDL_setenv */ @@ -293,6 +306,16 @@ stdlib_getsetenv(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic push +#if defined(HAVE_WFORMAT) +#pragma GCC diagnostic ignored "-Wformat" +#endif +#if defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic ignored "-Wformat-extra-args" +#endif +#endif + /** * @brief Call to SDL_sscanf */ @@ -375,6 +398,10 @@ stdlib_sscanf(void *arg) return TEST_COMPLETED; } +#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS) +#pragma GCC diagnostic pop +#endif + #if defined(_WIN64) # define SIZE_FORMAT "I64u" #elif defined(__WIN32__) From 45da133999d5946cbb5eabc20dfa55b0aef41e77 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 00:39:47 +0200 Subject: [PATCH 082/459] cmake: don't error on apple when using deprecated declarations --- CMakeLists.txt | 8 ++++++++ configure | 4 ++-- configure.ac | 2 +- test/CMakeLists.txt | 7 +++++++ test/configure | 4 ++-- test/configure.ac | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aba7bf9ca..4ace59161 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -686,6 +686,14 @@ if(USE_GCC OR USE_CLANG) endif() if(APPLE) + cmake_push_check_state(RESET) + # FIXME: don't use deprecated declarations + check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + target_compile_options(sdl-build-options INTERFACE "-Wno-error=deprecated-declarations") + endif() + cmake_pop_check_state() + # FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") diff --git a/configure b/configure index cf415a596..8e139dd08 100755 --- a/configure +++ b/configure @@ -23001,8 +23001,8 @@ printf "%s\n" "$have_gcc_werror" >&6; } CheckNoErrorDeprecatedDeclarationsWerror() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 -printf %s "checking for GCC -Werror option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5 +printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; } have_gcc_no_werror_deprecated_declarations=no save_CFLAGS="$CFLAGS" diff --git a/configure.ac b/configure.ac index 34942b0dc..2708c1f76 100644 --- a/configure.ac +++ b/configure.ac @@ -1622,7 +1622,7 @@ CheckWerror() dnl See if GCC's -Wno-error=deprecated-declarations is supported. CheckNoErrorDeprecatedDeclarationsWerror() { - AC_MSG_CHECKING(for GCC -Werror option) + AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option) have_gcc_no_werror_deprecated_declarations=no save_CFLAGS="$CFLAGS" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d7c19f175..9f372bc77 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -123,6 +123,13 @@ if(APPLE) testnativecocoa.m testnativex11.c testutils.c) + + cmake_push_check_state(RESET) + check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + cmake_pop_check_state() + if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + set_property(SOURCE "testnativecocoa.m" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-error=deprecated-declarations") + endif() elseif(WINDOWS) add_executable(testnative testnative.c testnativew32.c testutils.c) elseif(HAVE_X11) diff --git a/test/configure b/test/configure index 8b7afb01e..c71abe489 100755 --- a/test/configure +++ b/test/configure @@ -4790,8 +4790,8 @@ fi case "$host" in *-ios-*|*-*-darwin* ) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 -printf %s "checking for GCC -Werror option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5 +printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; } have_gcc_wno_error_deprecated_declarations=no save_CFLAGS="$CFLAGS" diff --git a/test/configure.ac b/test/configure.ac index e0dd1c463..e9890163e 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -241,7 +241,7 @@ fi case "$host" in *-ios-*|*-*-darwin* ) - AC_MSG_CHECKING(for GCC -Werror option) + AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option) have_gcc_wno_error_deprecated_declarations=no save_CFLAGS="$CFLAGS" From 07225d2e26a279f7bc54e3c37c02d9e299c7a0ff Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 00:55:37 +0200 Subject: [PATCH 083/459] cmake: fix check for -marm This fixes the following warning: clang: warning: argument unused during compilation: '-marm' [-Wunused-command-line-argument] --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ace59161..8bad4e746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1187,10 +1187,13 @@ if(ANDROID) # There seems to be no better way currently to set the ARM mode. # see: https://issuetracker.google.com/issues/62264618 # Another option would be to set ARM mode to all compiled files + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + set_property(SOURCE "${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() + cmake_pop_check_state() file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) list(APPEND SDLMAIN_SOURCES ${ANDROID_MAIN_SOURCES}) @@ -2373,10 +2376,13 @@ elseif(RISCOS) elseif(VITA) # SDL_spinlock.c Needs to be compiled in ARM mode. + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + set_property(SOURCE "${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() + cmake_pop_check_state() if(SDL_MISC) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) From 2105c7f6edde487d5e2281d1c4efede963490d96 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 00:58:26 +0200 Subject: [PATCH 084/459] SDL_thread.c: fix unused function SDL_FreeErrBuf when building without thread support (emscripten) --- src/thread/SDL_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 65610339c..4e51be68b 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -211,6 +211,7 @@ SDL_GetStaticErrBuf() return &SDL_global_error; } +#if !SDL_THREADS_DISABLED static void SDLCALL SDL_FreeErrBuf(void *data) { @@ -221,6 +222,7 @@ SDL_FreeErrBuf(void *data) } errbuf->free_func(errbuf); } +#endif /* Routine to get the thread-specific error variable */ SDL_error * From f3389f13efe72b887400290ccd3b69905dc564ab Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:00:58 +0200 Subject: [PATCH 085/459] testgeometry: fix conversion from 'double' to 'float', possible loss of data emitted by MSVC --- test/testgeometry.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/testgeometry.c b/test/testgeometry.c index f0f07eed6..fa8de7542 100644 --- a/test/testgeometry.c +++ b/test/testgeometry.c @@ -27,7 +27,7 @@ static SDLTest_CommonState *state; static SDL_bool use_texture = SDL_FALSE; static SDL_Texture **sprites; static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; -static double angle = 0.0; +static float angle = 0.0f; static int sprite_w, sprite_h; int done; @@ -107,8 +107,8 @@ loop() { SDL_Rect viewport; SDL_Vertex verts[3]; - double a; - double d; + float a; + float d; int cx, cy; /* Query the sizes */ @@ -116,39 +116,39 @@ loop() SDL_zeroa(verts); cx = viewport.x + viewport.w / 2; cy = viewport.y + viewport.h / 2; - d = (viewport.w + viewport.h) / 5; + d = (viewport.w + viewport.h) / 5.f; - a = (angle * 3.1415) / 180.0; - verts[0].position.x = cx + d * SDL_cos(a); - verts[0].position.y = cy + d * SDL_sin(a); + a = (angle * 3.1415f) / 180.0f; + verts[0].position.x = cx + d * SDL_cosf(a); + verts[0].position.y = cy + d * SDL_sinf(a); verts[0].color.r = 0xFF; verts[0].color.g = 0; verts[0].color.b = 0; verts[0].color.a = 0xFF; - a = ((angle + 120) * 3.1415) / 180.0; - verts[1].position.x = cx + d * SDL_cos(a); - verts[1].position.y = cy + d * SDL_sin(a); + a = ((angle + 120) * 3.1415f) / 180.0f; + verts[1].position.x = cx + d * SDL_cosf(a); + verts[1].position.y = cy + d * SDL_sinf(a); verts[1].color.r = 0; verts[1].color.g = 0xFF; verts[1].color.b = 0; verts[1].color.a = 0xFF; - a = ((angle + 240) * 3.1415) / 180.0; - verts[2].position.x = cx + d * SDL_cos(a); - verts[2].position.y = cy + d * SDL_sin(a); + a = ((angle + 240) * 3.1415f) / 180.0f; + verts[2].position.x = cx + d * SDL_cosf(a); + verts[2].position.y = cy + d * SDL_sinf(a); verts[2].color.r = 0; verts[2].color.g = 0; verts[2].color.b = 0xFF; verts[2].color.a = 0xFF; if (use_texture) { - verts[0].tex_coord.x = 0.5; - verts[0].tex_coord.y = 0.0; - verts[1].tex_coord.x = 1.0; - verts[1].tex_coord.y = 1.0; - verts[2].tex_coord.x = 0.0; - verts[2].tex_coord.y = 1.0; + verts[0].tex_coord.x = 0.5f; + verts[0].tex_coord.y = 0.0f; + verts[1].tex_coord.x = 1.0f; + verts[1].tex_coord.y = 1.0f; + verts[2].tex_coord.x = 0.0f; + verts[2].tex_coord.y = 1.0f; } SDL_RenderGeometry(renderer, sprites[i], verts, 3, NULL, 0); From 18c776e155c7da7d2ce8e36c9687bb66db033493 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:02:17 +0200 Subject: [PATCH 086/459] testspriteminimal: fix conversion from `time_t` to `unsigned int` Emitted by MSVC --- test/testspriteminimal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c index 36ea373b0..6be99fd4a 100644 --- a/test/testspriteminimal.c +++ b/test/testspriteminimal.c @@ -117,7 +117,7 @@ main(int argc, char *argv[]) } /* Initialize the sprite positions */ - srand(time(NULL)); + srand((unsigned int)time(NULL)); for (i = 0; i < NUM_SPRITES; ++i) { positions[i].x = rand() % (WINDOW_WIDTH - sprite_w); positions[i].y = rand() % (WINDOW_HEIGHT - sprite_h); From ebae142aa48a3b28ee331e656168f70a4471cbce Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:05:59 +0200 Subject: [PATCH 087/459] testhaptic: fix conversion from `size_t` to `int` Emitted by MSVC --- test/testhaptic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testhaptic.c b/test/testhaptic.c index 9b73ce293..34da19f96 100644 --- a/test/testhaptic.c +++ b/test/testhaptic.c @@ -59,7 +59,7 @@ main(int argc, char **argv) return 0; } - i = SDL_strlen(name); + i = (int)SDL_strlen(name); if ((i < 3) && SDL_isdigit(name[0]) && ((i == 1) || SDL_isdigit(name[1]))) { index = SDL_atoi(name); name = NULL; From b771d9beeccf47ee1d8d0d9f7b2c1577b5830a38 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:09:32 +0200 Subject: [PATCH 088/459] tests: avoid MSVC preaching about unsafe functions --- test/testautomation_audio.c | 4 +++- test/testautomation_rwops.c | 4 +++- test/testiconv.c | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index 96c174f5c..dd7ef3f11 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -4,7 +4,9 @@ */ /* quiet windows compiler warnings */ -#define _CRT_SECURE_NO_WARNINGS +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif #include #include diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c index 44e0086bb..f2d5627e5 100644 --- a/test/testautomation_rwops.c +++ b/test/testautomation_rwops.c @@ -10,7 +10,9 @@ */ /* quiet windows compiler warnings */ -#define _CRT_SECURE_NO_WARNINGS +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif #include diff --git a/test/testiconv.c b/test/testiconv.c index 883f8eedf..fc0806618 100644 --- a/test/testiconv.c +++ b/test/testiconv.c @@ -10,6 +10,11 @@ freely. */ +/* quiet windows compiler warnings */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif + #include #include "SDL.h" From 3c251ec41e7b2847efc846a31d4a01fd20d0bf99 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:10:22 +0200 Subject: [PATCH 089/459] testintersections: fix conversion from `time_t` to `unsigned int` Emitted by MSVC --- test/testintersections.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testintersections.c b/test/testintersections.c index ff629f526..29af8e21f 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -333,7 +333,7 @@ main(int argc, char *argv[]) SDL_RenderClear(renderer); } - srand(time(NULL)); + srand((unsigned int)time(NULL)); /* Main render loop */ frames = 0; From 8770689525a3788bfd6b8ecae2207b00e3f71e23 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:12:18 +0200 Subject: [PATCH 090/459] testmouse: add explicit int-cast to avoid warning about converting `float` to `int` Emitted by MSVC --- test/testmouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testmouse.c b/test/testmouse.c index 27b34f315..b8fc440b9 100644 --- a/test/testmouse.c +++ b/test/testmouse.c @@ -202,10 +202,10 @@ loop(void *arg) /* Mouse wheel */ SDL_SetRenderDrawColor(renderer, 0, 255, 128, 255); if (wheel_x_active) { - SDL_RenderDrawLine(renderer, wheel_x, 0, wheel_x, SCREEN_HEIGHT); + SDL_RenderDrawLine(renderer, (int)wheel_x, 0, (int)wheel_x, SCREEN_HEIGHT); } if (wheel_y_active) { - SDL_RenderDrawLine(renderer, 0, wheel_y, SCREEN_WIDTH, wheel_y); + SDL_RenderDrawLine(renderer, 0, (int)wheel_y, SCREEN_WIDTH, (int)wheel_y); } /* Objects from mouse clicks */ From 7a7980fafaa3a447c7ba64f7a014d4d0e2f3e755 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:12:42 +0200 Subject: [PATCH 091/459] testnative: fix conversion from `time_t` to `unsigned int` Emitted by MSVC --- test/testnative.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testnative.c b/test/testnative.c index 34ee661f9..e115089d5 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -164,7 +164,7 @@ main(int argc, char *argv[]) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } - srand(time(NULL)); + srand((unsigned int)time(NULL)); for (i = 0; i < NUM_SPRITES; ++i) { positions[i].x = rand() % (window_w - sprite_w); positions[i].y = rand() % (window_h - sprite_h); From 02b200ef08628673b1865793d4126beedfea1b0e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:14:28 +0200 Subject: [PATCH 092/459] testoffscreen: fix '<': signed/unsigned mismatch Emitted by MSVC --- test/testoffscreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testoffscreen.c b/test/testoffscreen.c index 3738e9603..e6abb35c3 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -30,7 +30,7 @@ static int done = SDL_FALSE; static int frame_number = 0; static int width = 640; static int height = 480; -static int max_frames = 200; +static unsigned int max_frames = 200; void draw() @@ -140,7 +140,7 @@ main(int argc, char *argv[]) then = SDL_GetTicks(); done = 0; - SDL_Log("Rendering %i frames offscreen\n", max_frames); + SDL_Log("Rendering %u frames offscreen\n", max_frames); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); From 7ae5d8d406713782be4c3c5d4d0c0cb0754c7fbc Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 01:15:49 +0200 Subject: [PATCH 093/459] testmessage: fix conversion from `intptr_t` to `Uint32` Emitted by MSVC --- test/testmessage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testmessage.c b/test/testmessage.c index 5dd0155f7..c30c18df4 100644 --- a/test/testmessage.c +++ b/test/testmessage.c @@ -62,7 +62,7 @@ button_messagebox(void *eventNumber) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); if (eventNumber) { SDL_Event event; - event.type = (intptr_t)eventNumber; + event.type = (Uint32)(intptr_t)eventNumber; SDL_PushEvent(&event); return 1; } else { @@ -73,7 +73,7 @@ button_messagebox(void *eventNumber) if (eventNumber) { SDL_Event event; - event.type = (intptr_t)eventNumber; + event.type = (Uint32)(intptr_t)eventNumber; SDL_PushEvent(&event); } From 85fd40fafdccb027dcc0d9fbec61c6fe12b941ff Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:04:24 +0200 Subject: [PATCH 094/459] Fix -Wunused-const-variable warning when using clang-cl --- src/render/direct3d12/SDL_render_d3d12.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index e5cbd4c4f..1e57b8e01 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -234,7 +234,7 @@ typedef struct /* Define D3D GUIDs here so we don't have to include uuid.lib. */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-const-variable" #endif @@ -259,7 +259,7 @@ static const GUID SDL_IID_ID3D12PipelineState = { 0x765a30f3, 0xf624, 0x4c6f, { static const GUID SDL_IID_ID3D12Heap = { 0x6b3b2502, 0x6e51, 0x45b3, { 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3 } }; static const GUID SDL_IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58 } }; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif From 37beabd11c5999e38632151850fd564cc199261e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:16:07 +0200 Subject: [PATCH 095/459] SDL_mslib.c: clang-cl does not support `/GL-` --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bad4e746..954c77a96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -739,10 +739,10 @@ if(MSVC) endif() endif() -if(MSVC) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # Due to a limitation of Microsoft's LTO implementation, LTO must be disabled for memcpy and memset. # The same applies to various functions normally belonging in the C library (for x86 architecture). - set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND PROPERTY COMPILE_FLAGS /GL-) + set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND_STRING PROPERTY COMPILE_FLAGS " /GL-") endif() if(SDL_ASSEMBLY) From 5c150ddc2f2a95af6ca78a2c91376e03fd6a97e3 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:21:49 +0200 Subject: [PATCH 096/459] SDL_mslibc.c: fix unknown pragma ignored [-Wunknown-pragmas] Emitted by clang-cl --- src/stdlib/SDL_mslibc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c index 37aa00937..02eeb0f1d 100644 --- a/src/stdlib/SDL_mslibc.c +++ b/src/stdlib/SDL_mslibc.c @@ -44,7 +44,9 @@ __declspec(selectany) int _fltused = 1; extern void *memcpy(void* dst, const void* src, size_t len); #pragma intrinsic(memcpy) +#if !defined(__clang__) #pragma function(memcpy) +#endif void * memcpy(void *dst, const void *src, size_t len) { @@ -54,7 +56,9 @@ memcpy(void *dst, const void *src, size_t len) extern void *memset(void* dst, int c, size_t len); #pragma intrinsic(memset) +#if !defined(__clang__) #pragma function(memset) +#endif void * memset(void *dst, int c, size_t len) { From b51a88a95c27823cccdc02d96d7bc05ce912bd8d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:23:57 +0200 Subject: [PATCH 097/459] SDL_malloc.c: fix variable 'used' set but not used Emitted by clang-cl --- src/stdlib/SDL_malloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 1e986f615..093a2a0e9 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -3017,6 +3017,8 @@ internal_malloc_stats(mstate m) (unsigned long) (maxfp)); fprintf(stderr, "system bytes = %10lu\n", (unsigned long) (fp)); fprintf(stderr, "in use bytes = %10lu\n", (unsigned long) (used)); +#else + (void)used; #endif POSTACTION(m); From b8a4b8d1cdccc8c8210f546de320e33971ade260 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:51:50 +0200 Subject: [PATCH 098/459] testautomation_mouse: fix format '%i' expecting 'int' instead of 'Uint32' Emitted by Nintendo 3DS's gcc --- test/testautomation_mouse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/testautomation_mouse.c b/test/testautomation_mouse.c index b99afc1ce..b9e74cb35 100644 --- a/test/testautomation_mouse.c +++ b/test/testautomation_mouse.c @@ -41,21 +41,21 @@ mouse_getMouseState(void *arg) /* Case where x, y pointer is NULL */ state = SDL_GetMouseState(NULL, NULL); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, NULL)"); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where x pointer is not NULL */ x = INT_MIN; state = SDL_GetMouseState(&x, NULL); SDLTest_AssertPass("Call to SDL_GetMouseState(&x, NULL)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where y pointer is not NULL */ y = INT_MIN; state = SDL_GetMouseState(NULL, &y); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, &y)"); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where x and y pointer is not NULL */ x = INT_MIN; @@ -64,7 +64,7 @@ mouse_getMouseState(void *arg) SDLTest_AssertPass("Call to SDL_GetMouseState(&x, &y)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); return TEST_COMPLETED; } @@ -87,21 +87,21 @@ mouse_getRelativeMouseState(void *arg) /* Case where x, y pointer is NULL */ state = SDL_GetRelativeMouseState(NULL, NULL); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, NULL)"); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where x pointer is not NULL */ x = INT_MIN; state = SDL_GetRelativeMouseState(&x, NULL); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, NULL)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where y pointer is not NULL */ y = INT_MIN; state = SDL_GetRelativeMouseState(NULL, &y); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, &y)"); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); /* Case where x and y pointer is not NULL */ x = INT_MIN; @@ -110,7 +110,7 @@ mouse_getRelativeMouseState(void *arg) SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, &y)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); return TEST_COMPLETED; } From 4298e79887875b487b85e08ce65ebc25fa087497 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 02:55:30 +0200 Subject: [PATCH 099/459] SDL_offscreenframebuffer.c: fix format '%d' expecting int instead of Uint32 Emitted by Nintendo 3DS's gcc (fix is same as used by ngage) --- src/video/offscreen/SDL_offscreenframebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/offscreen/SDL_offscreenframebuffer.c b/src/video/offscreen/SDL_offscreenframebuffer.c index c2d99e51e..376058856 100644 --- a/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/src/video/offscreen/SDL_offscreenframebuffer.c @@ -66,7 +66,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_ if (SDL_getenv("SDL_VIDEO_OFFSCREEN_SAVE_FRAMES")) { char file[128]; SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", - SDL_GetWindowID(window), ++frame_number); + (int)SDL_GetWindowID(window), ++frame_number); SDL_SaveBMP(surface, file); } return 0; From 01498d3acf8a9b4c5b5ccb66b54d8975d1cb848b Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 03:19:28 +0200 Subject: [PATCH 100/459] SDL_render_psp.c: fix -Wshadow Emitted by PSP's gcc --- src/render/psp/SDL_render_psp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 6f0844054..6cfb43a99 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -404,14 +404,14 @@ TextureSpillToSram(PSP_RenderData* data, PSP_TextureData* psp_texture) // Assumes the texture is in VRAM if(psp_texture->swizzled) { //Texture was swizzled in vram, just copy to system memory - void* data = SDL_malloc(psp_texture->size); - if(!data) { + void* sdata = SDL_malloc(psp_texture->size); + if(!sdata) { return SDL_OutOfMemory(); } - SDL_memcpy(data, psp_texture->data, psp_texture->size); + SDL_memcpy(sdata, psp_texture->data, psp_texture->size); vfree(psp_texture->data); - psp_texture->data = data; + psp_texture->data = sdata; return 0; } else { return TextureSwizzle(psp_texture, NULL); //Will realloc in sysram From eb8eb621b1bbde49be4fc7b5bef7942adf052746 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 22:49:17 +0200 Subject: [PATCH 101/459] SDL_x11modes: fix -Wunused-variable --- src/video/x11/SDL_x11modes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 8e3884715..da63afdcb 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -833,6 +833,8 @@ freeInfo: return SDL_SetError("X11_XRRSetCrtcConfig failed"); } } +#else + (void)data; #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ return 0; From 151c23415eec9761b0c5612bbccbd3e2641b5b4d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Oct 2022 05:27:37 +0200 Subject: [PATCH 102/459] ci: Add SDL_WERROR to a few configurations --- .github/workflows/android.yml | 1 + .github/workflows/emscripten.yml | 1 + .github/workflows/main.yml | 3 +++ .github/workflows/msvc.yml | 3 ++- .github/workflows/watcom.yml | 4 ++-- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 5c83312be..8864400b2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -34,6 +34,7 @@ jobs: run: | cmake -B build \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ + -DSDL_WERROR=ON \ -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ -DANDROID_ABI=${{ matrix.platform.android_abi }} \ -DSDL_STATIC_PIC=ON \ diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 3e8647c41..fae9f9a1a 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -13,6 +13,7 @@ jobs: - name: Configure CMake run: | emcmake cmake -S . -B build \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6837aee9c..8a2042b3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,6 +70,7 @@ jobs: run: | cmake -S . -B build -G Ninja \ -DSDL_TESTS=ON \ + -DSDL_WERROR=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_BUILD_TYPE=Release \ @@ -101,6 +102,7 @@ jobs: ( cd build-autotools ${{ github.workspace }}/configure \ + --enable-werror \ --prefix=${{ github.workspace }}/autotools_prefix \ ) if test "${{ runner.os }}" != "macOS" ; then @@ -110,6 +112,7 @@ jobs: mkdir -p build-autotools/test cd build-autotools/test ${{ github.workspace }}/test/configure \ + --enable-werror \ --x-includes=/usr/include \ --x-libraries="/usr/lib/${multiarch}" \ --prefix=${{ github.workspace }}/autotools_prefix \ diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 9be53548c..78468f08c 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -19,7 +19,7 @@ jobs: - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 } - { name: Windows (ARM), flags: -A ARM } - { name: Windows (ARM64), flags: -A ARM64 } - - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, + - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true, project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } steps: @@ -40,6 +40,7 @@ jobs: """)) - name: Configure (CMake) run: cmake -S build -B build ` + -DSDL_WERROR=${{ !matrix.platform.nowerror }} ` -DSDL_TESTS=ON ` -DSDL_INSTALL_TESTS=ON ` -DSDL2_DISABLE_INSTALL=OFF ` diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml index ead7c4724..f36b73e9a 100644 --- a/.github/workflows/watcom.yml +++ b/.github/workflows/watcom.yml @@ -18,10 +18,10 @@ jobs: - uses: open-watcom/setup-watcom@v0 - name: Build SDL2 run: | - wmake -f ${{ matrix.platform.makefile }} + wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - name: Build tests run: | - cd test && wmake -f ${{ matrix.platform.makefile }} + cd test && wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 cd .. - name: Run tests if: "matrix.platform.makefile == 'Makefile.w32'" From d0220395294b63fc542e1cfac68289a77a09fb86 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 9 Oct 2022 12:01:02 +0300 Subject: [PATCH 103/459] testhaptic: fix watcom "&array may not produce intended result" warning --- test/testhaptic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testhaptic.c b/test/testhaptic.c index 34da19f96..8e92da347 100644 --- a/test/testhaptic.c +++ b/test/testhaptic.c @@ -106,7 +106,7 @@ main(int argc, char **argv) SDL_ClearError(); /* Create effects. */ - SDL_memset(&efx, 0, sizeof(efx)); + SDL_memset(efx, 0, sizeof(efx)); nefx = 0; supported = SDL_HapticQuery(haptic); From 9df1af352f4c8bbd07b1fb046a7696412935be14 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 9 Oct 2022 15:44:07 +0000 Subject: [PATCH 104/459] Sync SDL wiki -> header --- include/SDL_video.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/SDL_video.h b/include/SDL_video.h index 0b75c7d57..d9dce43a9 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1811,6 +1811,9 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); * If you disable the screensaver, it is automatically re-enabled when SDL * quits. * + * The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2 + * the screensaver was enabled by default. + * * \since This function is available since SDL 2.0.0. * * \sa SDL_EnableScreenSaver From b91ddbc3e2cd7e798750c3d99bbcc93ec98b1a8b Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sun, 9 Oct 2022 06:15:18 +0200 Subject: [PATCH 105/459] wayland: null-terminate drop data --- src/video/wayland/SDL_waylandevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 6b504e5ab..8b53424fc 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1683,7 +1683,7 @@ data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) /* TODO: SDL Support more mime types */ size_t length; void *buffer = Wayland_data_offer_receive(data_device->drag_offer, - &length, FILE_MIME, SDL_FALSE); + &length, FILE_MIME, SDL_TRUE); if (buffer) { char *saveptr = NULL; char *token = SDL_strtokr((char *) buffer, "\r\n", &saveptr); From b0a9396b00e42fa68fceb6e986e43611b3b3b5fa Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 9 Oct 2022 11:06:20 -0400 Subject: [PATCH 106/459] wayland: Remove XDG surface geometry calls These were needed to fix some buggy behavior regarding committing old buffer sizes when entering fullscreen that has since been corrected. Remove them. --- src/video/wayland/SDL_waylandwindow.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 5d8be176c..c72575f84 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -493,20 +493,15 @@ UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen) static void CommitWindowGeometry(SDL_Window *window) { - SDL_WindowData *wind = (SDL_WindowData *) window->driverdata; - SDL_VideoData *viddata = (SDL_VideoData *) wind->waylandData; - #ifdef HAVE_LIBDECOR_H + SDL_WindowData *wind = (SDL_WindowData *) window->driverdata; + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); - } else -#endif - if (viddata->shell.xdg && wind->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, - wind->window_width, wind->window_height); } +#endif } static const struct wl_callback_listener surface_damage_frame_listener; @@ -2098,7 +2093,6 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - SDL_VideoData *viddata = data->waylandData; const int old_w = window->w, old_h = window->h; const int old_drawable_width = data->drawable_width; const int old_drawable_height = data->drawable_height; @@ -2121,21 +2115,6 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) window->h = height; data->needs_resize_event = SDL_FALSE; } - - /* XXX: This workarounds issues with commiting buffers with old size after - * already acknowledging the new size, which can cause protocol violations. - * It doesn't fix the first frames after resize being glitched visually, - * but at least lets us not be terminated by the compositor. - * Can be removed once SDL's resize logic becomes compliant. */ - if ( -#ifdef HAVE_LIBDECOR_H - data->shell_surface_type != WAYLAND_SURFACE_LIBDECOR && -#endif - viddata->shell.xdg && - data->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, - data->window_width, data->window_height); - } } void From 6391ad970c6b54e706f38e78182701b034ae77ef Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 9 Oct 2022 11:11:55 -0400 Subject: [PATCH 107/459] wayland: Factor out common libdecor frame commit code The pattern of: libdecor_state_new() libdecor_frame_commit() libdecor_state_free() was used in several places. Factor it out into a common function. --- src/video/wayland/SDL_waylandwindow.c | 46 ++++++++++++--------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index c72575f84..8d7beb3c6 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -305,6 +305,20 @@ ConfigureWindowGeometry(SDL_Window *window) } } +static void +CommitLibdecorFrame(SDL_Window *window) +{ +#ifdef HAVE_LIBDECOR_H + SDL_WindowData *wind = (SDL_WindowData *) window->driverdata; + + if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { + struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); + libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); + libdecor_state_free(state); + } +#endif +} + static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) { @@ -351,9 +365,7 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) max_height); if (commit) { - struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); + CommitLibdecorFrame(window); wl_surface_commit(wind->surface); } } else @@ -405,9 +417,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) libdecor_frame_set_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); } else { - struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); + CommitLibdecorFrame(window); wl_surface_commit(wind->surface); } @@ -420,9 +430,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) libdecor_frame_unset_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); } else { - struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); + CommitLibdecorFrame(window); wl_surface_commit(wind->surface); } } @@ -490,20 +498,6 @@ UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen) } } -static void -CommitWindowGeometry(SDL_Window *window) -{ -#ifdef HAVE_LIBDECOR_H - SDL_WindowData *wind = (SDL_WindowData *) window->driverdata; - - if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { - struct libdecor_state *state = libdecor_state_new(wind->window_width, wind->window_height); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); - } -#endif -} - static const struct wl_callback_listener surface_damage_frame_listener; static void @@ -1086,7 +1080,7 @@ Wayland_move_window(SDL_Window *window, if (fs_display_changed && (!wind->fs_output_width || !wind->fs_output_height)) { ConfigureWindowGeometry(window); - CommitWindowGeometry(window); + CommitLibdecorFrame(window); } break; @@ -1762,7 +1756,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, * geometry and trigger a commit. */ ConfigureWindowGeometry(window); - CommitWindowGeometry(window); + CommitLibdecorFrame(window); /* Roundtrip required to receive the updated window dimensions */ WAYLAND_wl_display_roundtrip(viddata->display); @@ -2146,7 +2140,7 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) /* Update the window geometry. */ ConfigureWindowGeometry(window); - CommitWindowGeometry(window); + CommitLibdecorFrame(window); /* windowed is unconditionally set, so we can trust it here */ wind->floating_width = window->windowed.w; From efdb390caa1b3f9b0cd8370d7ce0eb4301b8055c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 9 Oct 2022 09:11:33 -0700 Subject: [PATCH 108/459] Disable the HIDAPI Wii driver by default as it doesn't work with the dolphinbar --- include/SDL_hints.h | 2 +- src/joystick/hidapi/SDL_hidapi_wii.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index b387118be..4d445b35c 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -872,7 +872,7 @@ extern "C" { * "0" - HIDAPI driver is not used * "1" - HIDAPI driver is used * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. */ #define SDL_HINT_JOYSTICK_HIDAPI_WII "SDL_JOYSTICK_HIDAPI_WII" diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c index 3f40fcc44..3b4e79411 100644 --- a/src/joystick/hidapi/SDL_hidapi_wii.c +++ b/src/joystick/hidapi/SDL_hidapi_wii.c @@ -170,9 +170,13 @@ HIDAPI_DriverWii_UnregisterHints(SDL_HintCallback callback, void *userdata) static SDL_bool HIDAPI_DriverWii_IsEnabled(void) { +#if 1 /* This doesn't work with the dolphinbar, so don't enable by default right now */ + return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_WII, SDL_FALSE); +#else return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_WII, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)); +#endif } static SDL_bool From 490c20f93f85a4e4275bdf96bcb8ffd7f266590c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 9 Oct 2022 09:57:55 -0700 Subject: [PATCH 109/459] d3d12: reset the vertex buffer size when it is released --- src/render/direct3d12/SDL_render_d3d12.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 1e57b8e01..90b79af3f 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -352,6 +352,7 @@ D3D12_ReleaseAll(SDL_Renderer * renderer) for (i = 0; i < SDL_D3D12_NUM_VERTEX_BUFFERS; ++i) { SAFE_RELEASE(data->vertexBuffers[i].resource); + data->vertexBuffers[i].size = 0; } data->swapEffect = (DXGI_SWAP_EFFECT) 0; From f99fc3268e84a89650f3808558f811cb623fc8d8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 9 Oct 2022 11:42:39 -0700 Subject: [PATCH 110/459] d3d12: fixed window resize handling Fixes https://github.com/libsdl-org/SDL/issues/6355 --- src/render/direct3d12/SDL_render_d3d12.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 90b79af3f..ad014979b 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -173,6 +173,7 @@ typedef struct ID3D12CommandQueue *commandQueue; ID3D12GraphicsCommandList2 *commandList; DXGI_SWAP_EFFECT swapEffect; + UINT swapFlags; /* Descriptor heaps */ ID3D12DescriptorHeap* rtvDescriptorHeap; @@ -356,6 +357,7 @@ D3D12_ReleaseAll(SDL_Renderer * renderer) } data->swapEffect = (DXGI_SWAP_EFFECT) 0; + data->swapFlags = 0; data->currentRenderTargetView.ptr = 0; data->currentSampler.ptr = 0; @@ -1231,6 +1233,7 @@ D3D12_CreateSwapChain(SDL_Renderer * renderer, int w, int h) } data->swapEffect = swapChainDesc.SwapEffect; + data->swapFlags = swapChainDesc.Flags; done: SAFE_RELEASE(swapChain); @@ -1281,10 +1284,16 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer) D3D12_RENDER_TARGET_VIEW_DESC rtvDesc; D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor; + /* Release resources in the current command list */ + D3D_CALL(data->commandList, Close); + D3D12_ResetCommandList(data); + D3D_CALL(data->commandList, OMSetRenderTargets, 0, NULL, FALSE, NULL); + /* Release render targets */ for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { SAFE_RELEASE(data->renderTargets[i]); } + /* The width and height of the swap chain must be based on the display's * non-rotated size. */ @@ -1303,7 +1312,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer) 0, w, h, DXGI_FORMAT_UNKNOWN, - 0 + data->swapFlags ); if (result == DXGI_ERROR_DEVICE_REMOVED) { /* If the device was removed for any reason, a new device and swap chain will need to be created. */ From ec1137dfbd90972319ee1432057e75c8ea88ced1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 9 Oct 2022 15:19:47 -0500 Subject: [PATCH 111/459] cmake: Apply CETCOMPAT fix from ef988fe1 to tests --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9f372bc77..ebea6deff 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,7 +51,7 @@ if(WINDOWS) endif() # CET support was added in VS 16.7 - if(MSVC_VERSION GREATER 1926 AND NOT CMAKE_GENERATOR_PLATFORM MATCHES ARM) + if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64") link_libraries(-CETCOMPAT) endif() From 6ffc45b0ed6340a828aa29b632c1a81fe06f950b Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Sun, 9 Oct 2022 17:22:31 -0700 Subject: [PATCH 112/459] Removed "undefined" argument for Apple platforms. This is incompatible with enabling bitcode, such as with iOS builds. The default value for "undefined" is "error" so this option should be redundant. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 954c77a96..15a6cbf28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -695,7 +695,6 @@ if(USE_GCC OR USE_CLANG) cmake_pop_check_state() # FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") elseif(NOT OPENBSD) From 61b5360e17107c13749eba8be83f31695e5632cf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Oct 2022 08:27:42 -0700 Subject: [PATCH 113/459] Only check to see if the ICC profile changes when the display changes or we gain focus Fixes https://github.com/libsdl-org/SDL/issues/6366 --- src/video/windows/SDL_windowsevents.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 20acb8ff4..e5903fdd3 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -449,6 +449,7 @@ WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0); + WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } else { RECT rect; @@ -697,7 +698,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) actually being the foreground window, but this appears to get called in all cases where the global foreground window changes to and from this window. */ WIN_UpdateFocus(data->window, !!wParam); - WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } break; @@ -1171,6 +1171,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rect; int x, y; int w, h; + int display_index = data->window->display_index; if (data->initializing || data->in_border_change) { break; @@ -1211,7 +1212,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Forces a WM_PAINT event */ InvalidateRect(hwnd, NULL, FALSE); - WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); + if (data->window->display_index != display_index) { + /* Display changed, check ICC profile */ + WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); + } } break; From 655275378d22acbef4685d8992a5c7b370bab4fa Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 30 Mar 2021 04:32:39 -0400 Subject: [PATCH 114/459] N3DS port (squashed) A dedicated renderer using Citro3D would likely allow for better much better graphical performances. --- .github/workflows/n3ds.yml | 40 +++ CMakeLists.txt | 74 ++++- docs/README-n3ds.md | 27 ++ include/SDL_config.h.cmake | 7 + include/SDL_main.h | 9 + include/SDL_platform.h | 5 + include/SDL_stdinc.h | 2 +- include/SDL_video.h | 1 + src/SDL.c | 2 + src/SDL_log.c | 7 + src/audio/SDL_audio.c | 3 + src/audio/SDL_sysaudio.h | 1 + src/audio/n3ds/SDL_n3dsaudio.c | 363 +++++++++++++++++++++++ src/audio/n3ds/SDL_n3dsaudio.h | 50 ++++ src/cpuinfo/SDL_cpuinfo.c | 2 + src/dynapi/SDL_dynapi.h | 2 + src/file/SDL_rwops.c | 6 + src/file/n3ds/SDL_rwopsromfs.c | 56 ++++ src/file/n3ds/SDL_rwopsromfs.h | 30 ++ src/filesystem/n3ds/SDL_sysfilesystem.c | 86 ++++++ src/joystick/SDL_gamecontrollerdb.h | 3 + src/joystick/SDL_joystick.c | 3 + src/joystick/SDL_sysjoystick.h | 1 + src/joystick/n3ds/SDL_sysjoystick.c | 367 ++++++++++++++++++++++++ src/libm/math_private.h | 2 +- src/locale/n3ds/SDL_syslocale.c | 59 ++++ src/main/n3ds/SDL_n3ds_main.c | 82 ++++++ src/power/SDL_power.c | 3 + src/power/SDL_syspower.h | 1 + src/power/n3ds/SDL_syspower.c | 111 +++++++ src/thread/SDL_thread_c.h | 2 + src/thread/n3ds/SDL_syscond.c | 133 +++++++++ src/thread/n3ds/SDL_sysmutex.c | 93 ++++++ src/thread/n3ds/SDL_sysmutex_c.h | 37 +++ src/thread/n3ds/SDL_syssem.c | 134 +++++++++ src/thread/n3ds/SDL_systhread.c | 148 ++++++++++ src/thread/n3ds/SDL_systhread_c.h | 32 +++ src/timer/n3ds/SDL_systimer.c | 81 ++++++ src/video/SDL_sysvideo.h | 1 + src/video/SDL_video.c | 5 +- src/video/n3ds/SDL_n3dsevents.c | 45 +++ src/video/n3ds/SDL_n3dsevents_c.h | 31 ++ src/video/n3ds/SDL_n3dsframebuffer.c | 148 ++++++++++ src/video/n3ds/SDL_n3dsframebuffer_c.h | 33 +++ src/video/n3ds/SDL_n3dsswkb.c | 76 +++++ src/video/n3ds/SDL_n3dsswkb.h | 38 +++ src/video/n3ds/SDL_n3dsvideo.c | 163 +++++++++++ src/video/n3ds/SDL_n3dsvideo.h | 38 +++ test/CMakeLists.txt | 25 ++ test/n3ds/logo48x48.png | Bin 0 -> 3069 bytes 50 files changed, 2663 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/n3ds.yml create mode 100644 docs/README-n3ds.md create mode 100644 src/audio/n3ds/SDL_n3dsaudio.c create mode 100644 src/audio/n3ds/SDL_n3dsaudio.h create mode 100644 src/file/n3ds/SDL_rwopsromfs.c create mode 100644 src/file/n3ds/SDL_rwopsromfs.h create mode 100644 src/filesystem/n3ds/SDL_sysfilesystem.c create mode 100644 src/joystick/n3ds/SDL_sysjoystick.c create mode 100644 src/locale/n3ds/SDL_syslocale.c create mode 100644 src/main/n3ds/SDL_n3ds_main.c create mode 100644 src/power/n3ds/SDL_syspower.c create mode 100644 src/thread/n3ds/SDL_syscond.c create mode 100644 src/thread/n3ds/SDL_sysmutex.c create mode 100644 src/thread/n3ds/SDL_sysmutex_c.h create mode 100644 src/thread/n3ds/SDL_syssem.c create mode 100644 src/thread/n3ds/SDL_systhread.c create mode 100644 src/thread/n3ds/SDL_systhread_c.h create mode 100644 src/timer/n3ds/SDL_systimer.c create mode 100644 src/video/n3ds/SDL_n3dsevents.c create mode 100644 src/video/n3ds/SDL_n3dsevents_c.h create mode 100644 src/video/n3ds/SDL_n3dsframebuffer.c create mode 100644 src/video/n3ds/SDL_n3dsframebuffer_c.h create mode 100644 src/video/n3ds/SDL_n3dsswkb.c create mode 100644 src/video/n3ds/SDL_n3dsswkb.h create mode 100644 src/video/n3ds/SDL_n3dsvideo.c create mode 100644 src/video/n3ds/SDL_n3dsvideo.h create mode 100644 test/n3ds/logo48x48.png diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml new file mode 100644 index 000000000..af985e4e3 --- /dev/null +++ b/.github/workflows/n3ds.yml @@ -0,0 +1,40 @@ +name: Build (Nintendo 3DS) + +on: [push, pull_request] + +jobs: + n3ds: + runs-on: ubuntu-latest + container: + image: devkitpro/devkitarm:latest + steps: + - uses: actions/checkout@v2 + - name: Install build requirements + run: | + apt update + apt install ninja-build + - name: Configure CMake + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=prefix + - name: Build + run: cmake --build build --verbose + - name: Install CMake + run: | + echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + cmake --install build/ + ( cd prefix; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ + -DTEST_SHARED=FALSE \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_BUILD_TYPE=Release + cmake --build cmake_config_build --verbose + # Not running test_pkgconfig.sh and test_sdlconfig.sh + # as invoking the compiler manually is not supported diff --git a/CMakeLists.txt b/CMakeLists.txt index 15a6cbf28..48cbb6174 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") message_error("BeOS support has been removed as of SDL 2.0.2.") elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*") set(HAIKU TRUE) +elseif(NINTENDO_3DS) + set(N3DS TRUE) endif() # Don't mistake osx for unix @@ -277,7 +279,7 @@ if(APPLE OR ARCH_64 OR MSVC_CLANG) set(OPT_DEF_SSEMATH ON) endif() endif() -if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2) +if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS) set(OPT_DEF_LIBC ON) endif() @@ -381,7 +383,7 @@ if(EMSCRIPTEN) set(SDL_TEST_ENABLED_BY_DEFAULT OFF) endif() -if(VITA OR PSP OR PS2) +if(VITA OR PSP OR PS2 OR N3DS) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) endif() @@ -2734,6 +2736,74 @@ elseif(OS2) if(SDL_HIDAPI) CheckHIDAPI() endif() + +elseif(N3DS) + file(GLOB N3DS_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/n3ds/*.c) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${N3DS_MAIN_SOURCES}) + + if(SDL_AUDIO) + set(SDL_AUDIO_DRIVER_N3DS 1) + file(GLOB N3DS_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_AUDIO_SOURCES}) + set(HAVE_SDL_AUDIO TRUE) + endif() + + if(SDL_FILESYSTEM) + set(SDL_FILESYSTEM_N3DS 1) + file(GLOB N3DS_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_FILESYSTEM_SOURCES}) + set(HAVE_SDL_FILESYSTEM TRUE) + endif() + + if(SDL_JOYSTICK) + set(SDL_JOYSTICK_N3DS 1) + file(GLOB N3DS_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_JOYSTICK_SOURCES}) + set(HAVE_SDL_JOYSTICK TRUE) + endif() + + if(SDL_POWER) + set(SDL_POWER_N3DS 1) + file(GLOB N3DS_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_POWER_SOURCES}) + set(HAVE_SDL_POWER TRUE) + endif() + + if(SDL_THREADS) + set(SDL_THREAD_N3DS 1) + file(GLOB N3DS_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) + set(HAVE_SDL_THREADS TRUE) + endif() + + if(SDL_TIMERS) + set(SDL_TIMER_N3DS 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/n3ds/*.c) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + endif() + + if(SDL_VIDEO) + set(SDL_VIDEO_DRIVER_N3DS 1) + file(GLOB N3DS_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_VIDEO_SOURCES}) + set(HAVE_SDL_VIDEO TRUE) + endif() + + if(SDL_LOCALE) + file(GLOB N3DS_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_LOCALE_SOURCES}) + set(HAVE_SDL_LOCALE TRUE) + endif() + + # Requires the n3ds file implementation + if(SDL_FILE) + file(GLOB N3DS_FILE_SOURCES ${SDL2_SOURCE_DIR}/src/file/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_FILE_SOURCES}) + set(HAVE_SDL_FILE TRUE) + else() + message_error("SDL_FILE must be enabled to build on N3DS") + endif() endif() if(HAVE_VULKAN AND NOT SDL_LOADSO) diff --git a/docs/README-n3ds.md b/docs/README-n3ds.md new file mode 100644 index 000000000..761c76dd6 --- /dev/null +++ b/docs/README-n3ds.md @@ -0,0 +1,27 @@ +# Nintendo 3DS + +SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by: + +- [Pierre Wendling](https://github.com/FtZPetruska) + +Credits to: + +- The awesome people who ported SDL to other homebrew platforms. +- The Devkitpro team for making all the tools necessary to achieve this. + +## Building + +To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run: + +```bash +cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release +cmake --build build +cmake --install build +``` + +## Notes + +- Currently only software rendering is supported. +- Window are created on the top screen by default, use the `SDL_WINDOW_N3DS_BOTTOM` flag to put them on the bottom screen. +- SDL2main should be used to ensure all the necessary services are initialised. +- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, [use the PTMSYSM service](https://libctru.devkitpro.org/ptmsysm_8h.html#ae3a437bfd0de05fbc5ba9a460d148430) to turn it off in your program. diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 15c5c9e1d..6dc89a4a3 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -325,6 +325,7 @@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ #cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ +#cmakedefine SDL_AUDIO_DRIVER_N3DS @SDL_AUDIO_DRIVER_N3DS@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -349,6 +350,7 @@ #cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ #cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ #cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ +#cmakedefine SDL_JOYSTICK_N3DS @SDL_JOYSTICK_N3DS@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ @@ -381,6 +383,7 @@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ #cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ +#cmakedefine SDL_THREAD_N3DS @SDL_THREAD_N3DS@ /* Enable various timer systems */ #cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ @@ -391,6 +394,7 @@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ #cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ +#cmakedefine SDL_TIMER_N3DS @SDL_TIMER_N3DS@ /* Enable various video drivers */ #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ @@ -444,6 +448,7 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ #cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@ +#cmakedefine SDL_VIDEO_DRIVER_N3DS @SDL_VIDEO_DRIVER_N3DS@ #cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ #cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ @@ -487,6 +492,7 @@ #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ #cmakedefine SDL_POWER_VITA @SDL_POWER_VITA@ #cmakedefine SDL_POWER_PSP @SDL_POWER_PSP@ +#cmakedefine SDL_POWER_N3DS @SDL_POWER_N3DS@ /* Enable system filesystem support */ #cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@ @@ -501,6 +507,7 @@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ #cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ +#cmakedefine SDL_FILESYSTEM_N3DS @SDL_FILESYSTEM_N3DS@ /* Enable misc subsystem */ #cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@ diff --git a/include/SDL_main.h b/include/SDL_main.h index 8b267082f..113d11de0 100644 --- a/include/SDL_main.h +++ b/include/SDL_main.h @@ -108,6 +108,15 @@ void reset_IOP(); \ void reset_IOP() {} +#elif defined(__3DS__) +/* + On N3DS, SDL provides a main function that sets up the screens + and storage. + + If you provide this yourself, you may define SDL_MAIN_HANDLED +*/ +#define SDL_MAIN_AVAILABLE + #endif #endif /* SDL_MAIN_HANDLED */ diff --git a/include/SDL_platform.h b/include/SDL_platform.h index f1f6f8b06..a8e3ac225 100644 --- a/include/SDL_platform.h +++ b/include/SDL_platform.h @@ -221,6 +221,11 @@ #define __VITA__ 1 #endif +#if defined(__3DS__) +#undef __3DS__ +#define __3DS__ 1 +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 5f79c95b3..c60d6eebb 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -410,7 +410,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS -#if !defined(__ANDROID__) && !defined(__VITA__) +#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { diff --git a/include/SDL_video.h b/include/SDL_video.h index d9dce43a9..60afda22a 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -126,6 +126,7 @@ typedef enum SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */ SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */ + SDL_WINDOW_N3DS_BOTTOM = 0x40000000, /**< window should be on the bottom screen (N3DS only) */ SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED /**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility */ } SDL_WindowFlags; diff --git a/src/SDL.c b/src/SDL.c index 0e1c32a92..93f7a7f6d 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -609,6 +609,8 @@ SDL_GetPlatform(void) return "PlayStation Vita"; #elif __NGAGE__ return "Nokia N-Gage"; +#elif __3DS__ + return "Nintendo 3DS"; #else return "Unknown (see SDL_platform.h)"; #endif diff --git a/src/SDL_log.c b/src/SDL_log.c index 34c6fe8ae..66191d2b4 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -485,6 +485,13 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); fclose (pFile); } +#elif defined(__3DS__) + { + FILE* pFile; + pFile = fopen ("/SDL_Log.txt", "a"); + fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); + fclose (pFile); + } #endif #if HAVE_STDIO_H && \ !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e33e41dbc..11700d497 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -105,6 +105,9 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_VITA &VITAAUD_bootstrap, #endif +#if SDL_AUDIO_DRIVER_N3DS + &N3DSAUDIO_bootstrap, +#endif #if SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, #endif diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index 6afaae195..a911de041 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -209,6 +209,7 @@ extern AudioBootStrap ANDROIDAUDIO_bootstrap; extern AudioBootStrap PS2AUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; +extern AudioBootStrap N3DSAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; extern AudioBootStrap OS2AUDIO_bootstrap; diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c new file mode 100644 index 000000000..484bec8ae --- /dev/null +++ b/src/audio/n3ds/SDL_n3dsaudio.c @@ -0,0 +1,363 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_AUDIO_DRIVER_N3DS + +#include "SDL_audio.h" + +/* N3DS Audio driver */ + +#include "../SDL_sysaudio.h" +#include "SDL_n3dsaudio.h" +#include "SDL_timer.h" + +#define N3DSAUDIO_DRIVER_NAME "n3ds" + +static dspHookCookie dsp_hook; +static SDL_AudioDevice *audio_device; + +static void FreePrivateData(_THIS); +static int FindAudioFormat(_THIS); + +static SDL_INLINE void +contextLock(_THIS) +{ + LightLock_Lock(&this->hidden->lock); +} + +static SDL_INLINE void +contextUnlock(_THIS) +{ + LightLock_Unlock(&this->hidden->lock); +} + +static void +N3DSAUD_LockAudio(_THIS) +{ + contextLock(this); +} + +static void +N3DSAUD_UnlockAudio(_THIS) +{ + contextUnlock(this); +} + +static void +N3DSAUD_DspHook(DSP_HookType hook) +{ + if (hook == DSPHOOK_ONCANCEL) { + contextLock(audio_device); + audio_device->hidden->isCancelled = SDL_TRUE; + SDL_AtomicSet(&audio_device->enabled, SDL_FALSE); + CondVar_Broadcast(&audio_device->hidden->cv); + contextUnlock(audio_device); + } +} + +static void +AudioFrameFinished(void *device) +{ + bool shouldBroadcast = false; + unsigned i; + SDL_AudioDevice *this = (SDL_AudioDevice *) device; + + contextLock(this); + + for (i = 0; i < NUM_BUFFERS; i++) { + if (this->hidden->waveBuf[i].status == NDSP_WBUF_DONE) { + this->hidden->waveBuf[i].status = NDSP_WBUF_FREE; + shouldBroadcast = SDL_TRUE; + } + } + + if (shouldBroadcast) { + CondVar_Broadcast(&this->hidden->cv); + } + + contextUnlock(this); +} + +static int +N3DSAUDIO_OpenDevice(_THIS, const char *devname) +{ + Result ndsp_init_res; + Uint8 *data_vaddr; + float mix[12]; + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof *this->hidden); + + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + /* Initialise the DSP service */ + ndsp_init_res = ndspInit(); + if (R_FAILED(ndsp_init_res)) { + if ((R_SUMMARY(ndsp_init_res) == RS_NOTFOUND) && (R_MODULE(ndsp_init_res) == RM_DSP)) { + SDL_SetError("DSP init failed: dspfirm.cdc missing!"); + } else { + SDL_SetError("DSP init failed. Error code: 0x%lX", ndsp_init_res); + } + return -1; + } + + /* Initialise internal state */ + LightLock_Init(&this->hidden->lock); + CondVar_Init(&this->hidden->cv); + + if (this->spec.channels > 2) { + this->spec.channels = 2; + } + + /* Should not happen but better be safe. */ + if (FindAudioFormat(this) < 0) { + return SDL_SetError("No supported audio format found."); + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + /* Allocate mixing buffer */ + if (this->spec.size >= SDL_MAX_UINT32 / 2) { + return SDL_SetError("Mixing buffer is too large."); + } + + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); + + data_vaddr = (Uint8 *) linearAlloc(this->hidden->mixlen * NUM_BUFFERS); + if (data_vaddr == NULL) { + return SDL_OutOfMemory(); + } + + SDL_memset(data_vaddr, 0, this->hidden->mixlen * NUM_BUFFERS); + DSP_FlushDataCache(data_vaddr, this->hidden->mixlen * NUM_BUFFERS); + + this->hidden->nextbuf = 0; + this->hidden->channels = this->spec.channels; + this->hidden->samplerate = this->spec.freq; + + ndspChnReset(0); + + ndspChnSetInterp(0, NDSP_INTERP_LINEAR); + ndspChnSetRate(0, this->spec.freq); + ndspChnSetFormat(0, this->hidden->format); + + SDL_memset(mix, 0, sizeof(mix)); + mix[0] = 1.0; + mix[1] = 1.0; + ndspChnSetMix(0, mix); + + SDL_memset(this->hidden->waveBuf, 0, sizeof(ndspWaveBuf) * NUM_BUFFERS); + + for (unsigned i = 0; i < NUM_BUFFERS; i++) { + this->hidden->waveBuf[i].data_vaddr = data_vaddr; + this->hidden->waveBuf[i].nsamples = this->hidden->mixlen / this->hidden->bytePerSample; + data_vaddr += this->hidden->mixlen; + } + + /* Setup callback */ + audio_device = this; + ndspSetCallback(AudioFrameFinished, this); + dspHook(&dsp_hook, N3DSAUD_DspHook); + + return 0; +} + +static int +N3DSAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + /* Delay to make this sort of simulate real audio input. */ + SDL_Delay((this->spec.samples * 1000) / this->spec.freq); + + /* always return a full buffer of silence. */ + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; +} + +static void +N3DSAUDIO_PlayDevice(_THIS) +{ + size_t nextbuf; + size_t sampleLen; + contextLock(this); + + nextbuf = this->hidden->nextbuf; + sampleLen = this->hidden->mixlen; + + if (this->hidden->isCancelled || + this->hidden->waveBuf[nextbuf].status != NDSP_WBUF_FREE) { + contextUnlock(this); + return; + } + + this->hidden->nextbuf = (nextbuf + 1) % NUM_BUFFERS; + + contextUnlock(this); + + memcpy((void *) this->hidden->waveBuf[nextbuf].data_vaddr, + this->hidden->mixbuf, sampleLen); + DSP_FlushDataCache(this->hidden->waveBuf[nextbuf].data_vaddr, sampleLen); + + ndspChnWaveBufAdd(0, &this->hidden->waveBuf[nextbuf]); +} + +static void +N3DSAUDIO_WaitDevice(_THIS) +{ + contextLock(this); + while (!this->hidden->isCancelled && + this->hidden->waveBuf[this->hidden->nextbuf].status != NDSP_WBUF_FREE) { + CondVar_Wait(&this->hidden->cv, &this->hidden->lock); + } + contextUnlock(this); +} + +static Uint8 * +N3DSAUDIO_GetDeviceBuf(_THIS) +{ + return this->hidden->mixbuf; +} + +static void +N3DSAUDIO_CloseDevice(_THIS) +{ + contextLock(this); + + dspUnhook(&dsp_hook); + ndspSetCallback(NULL, NULL); + + if (!this->hidden->isCancelled) { + ndspChnReset(0); + memset(this->hidden->waveBuf, 0, sizeof(ndspWaveBuf) * NUM_BUFFERS); + CondVar_Broadcast(&this->hidden->cv); + } + + contextUnlock(this); + + ndspExit(); + + FreePrivateData(this); +} + +static void +N3DSAUDIO_ThreadInit(_THIS) +{ + s32 current_priority; + svcGetThreadPriority(¤t_priority, CUR_THREAD_HANDLE); + current_priority--; + /* 0x18 is reserved for video, 0x30 is the default for main thread */ + current_priority = SDL_clamp(current_priority, 0x19, 0x2F); + svcSetThreadPriority(CUR_THREAD_HANDLE, current_priority); +} + +static SDL_bool +N3DSAUDIO_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->OpenDevice = N3DSAUDIO_OpenDevice; + impl->PlayDevice = N3DSAUDIO_PlayDevice; + impl->WaitDevice = N3DSAUDIO_WaitDevice; + impl->GetDeviceBuf = N3DSAUDIO_GetDeviceBuf; + impl->CloseDevice = N3DSAUDIO_CloseDevice; + impl->ThreadInit = N3DSAUDIO_ThreadInit; + impl->LockDevice = N3DSAUD_LockAudio; + impl->UnlockDevice = N3DSAUD_UnlockAudio; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + + /* Should be possible, but micInit would fail */ + impl->HasCaptureSupport = SDL_FALSE; + impl->CaptureFromDevice = N3DSAUDIO_CaptureFromDevice; + + return SDL_TRUE; /* this audio target is available. */ +} + +AudioBootStrap N3DSAUDIO_bootstrap = { + N3DSAUDIO_DRIVER_NAME, + "SDL N3DS audio driver", + N3DSAUDIO_Init, + 0 +}; + +/** + * Cleans up all allocated memory, safe to call with null pointers + */ +static void +FreePrivateData(_THIS) +{ + if (!this->hidden) { + return; + } + + if (this->hidden->waveBuf[0].data_vaddr) { + linearFree((void *) this->hidden->waveBuf[0].data_vaddr); + } + + if (this->hidden->mixbuf) { + SDL_free(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + + SDL_free(this->hidden); + this->hidden = NULL; +} + +static int +FindAudioFormat(_THIS) +{ + SDL_bool found_valid_format = SDL_FALSE; + Uint16 test_format = SDL_FirstAudioFormat(this->spec.format); + + while (!found_valid_format && test_format) { + this->spec.format = test_format; + switch (test_format) { + case AUDIO_S8: + /* Signed 8-bit audio supported */ + this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM8 : NDSP_FORMAT_MONO_PCM8; + this->hidden->isSigned = 1; + this->hidden->bytePerSample = this->spec.channels; + found_valid_format = SDL_TRUE; + break; + case AUDIO_S16: + /* Signed 16-bit audio supported */ + this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM16 : NDSP_FORMAT_MONO_PCM16; + this->hidden->isSigned = 1; + this->hidden->bytePerSample = this->spec.channels * 2; + found_valid_format = SDL_TRUE; + break; + default: + test_format = SDL_NextAudioFormat(); + break; + } + } + + return found_valid_format ? 0 : -1; +} + +#endif /* SDL_AUDIO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/audio/n3ds/SDL_n3dsaudio.h b/src/audio/n3ds/SDL_n3dsaudio.h new file mode 100644 index 000000000..d01f17f53 --- /dev/null +++ b/src/audio/n3ds/SDL_n3dsaudio.h @@ -0,0 +1,50 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_n3dsaudio_h_ +#define _SDL_n3dsaudio_h_ + +#include <3ds.h> + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +#define NUM_BUFFERS 2 /* -- Don't lower this! */ + +struct SDL_PrivateAudioData +{ + /* Speaker data */ + Uint8 *mixbuf; + Uint32 mixlen; + Uint32 format; + Uint32 samplerate; + Uint32 channels; + Uint8 bytePerSample; + Uint32 isSigned; + Uint32 nextbuf; + ndspWaveBuf waveBuf[NUM_BUFFERS]; + LightLock lock; + CondVar cv; + SDL_bool isCancelled; +}; + +#endif /* _SDL_n3dsaudio_h_ */ +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 8221f7796..6ba5c85eb 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -468,6 +468,8 @@ CPU_haveNEON(void) return 1; /* ARMv8 always has non-optional NEON support. */ #elif __VITA__ return 1; +#elif __3DS__ + return 1; #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ return 1; /* all Apple ARMv7 chips and later have NEON. */ diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index dc53e58b2..e3268697c 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/src/dynapi/SDL_dynapi.h @@ -63,6 +63,8 @@ #define SDL_DYNAMIC_API 0 /* vitasdk doesn't support dynamic linking */ #elif defined(__NGAGE__) #define SDL_DYNAMIC_API 0 /* The N-Gage doesn't support dynamic linking either */ +#elif defined(__3DS__) +#define SDL_DYNAMIC_API 0 /* devkitARM doesn't support dynamic linking */ #elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN) #define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */ #endif diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index a93c2fb3c..ead504c10 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -53,6 +53,10 @@ #include "cocoa/SDL_rwopsbundlesupport.h" #endif /* __APPLE__ */ +#ifdef __3DS__ +#include "n3ds/SDL_rwopsromfs.h" +#endif /* __3DS__ */ + #ifdef __ANDROID__ #include "../core/android/SDL_android.h" #include "SDL_system.h" @@ -601,6 +605,8 @@ SDL_RWFromFile(const char *file, const char *mode) #elif __WINRT__ FILE *fp = NULL; fopen_s(&fp, file, mode); + #elif __3DS__ + FILE *fp = N3DS_FileOpen(file, mode); #else FILE *fp = fopen(file, mode); #endif diff --git a/src/file/n3ds/SDL_rwopsromfs.c b/src/file/n3ds/SDL_rwopsromfs.c new file mode 100644 index 000000000..fe92c3d3b --- /dev/null +++ b/src/file/n3ds/SDL_rwopsromfs.c @@ -0,0 +1,56 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "SDL_rwopsromfs.h" + +/* Nintendo 3DS applications may embed resources in the executable. The + resources are stored in a special read-only partition prefixed with + 'romfs:/'. As such, when opening a file, we should first try the romfs + unless sdmc is specifically mentionned. +*/ +FILE * +N3DS_FileOpen(const char *file, const char *mode) +{ + FILE *fp = NULL; + char romfs_path[4096]; + + /* romfs are read-only */ + if (SDL_strchr(mode, 'r') == NULL) { + return fopen(file, mode); + } + + /* If the path has an explicit prefix, we skip the guess work */ + if (SDL_strncmp("romfs:/", file, 7) == 0 || + SDL_strncmp("sdmc:/", file, 6) == 0) { + return fopen(file, mode); + } + + SDL_snprintf(romfs_path, 4096, "romfs:/%s", file); + + fp = fopen(romfs_path, mode); + if (fp == NULL) { + fp = fopen(file, mode); + } + + return fp; +} + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/file/n3ds/SDL_rwopsromfs.h b/src/file/n3ds/SDL_rwopsromfs.h new file mode 100644 index 000000000..9a6a73472 --- /dev/null +++ b/src/file/n3ds/SDL_rwopsromfs.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_rwopsromfs_h_ +#define SDL_rwopsromfs_h_ + +FILE *N3DS_FileOpen(const char *file, const char *mode); + +#endif /* SDL_rwopsromfs_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/filesystem/n3ds/SDL_sysfilesystem.c b/src/filesystem/n3ds/SDL_sysfilesystem.c new file mode 100644 index 000000000..e402e037c --- /dev/null +++ b/src/filesystem/n3ds/SDL_sysfilesystem.c @@ -0,0 +1,86 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_FILESYSTEM_N3DS + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* System dependent filesystem routines */ + +#include <3ds.h> +#include +#include + +#include "SDL_error.h" +#include "SDL_filesystem.h" + +SDL_FORCE_INLINE char *MakePrefPath(const char *app); +SDL_FORCE_INLINE int CreatePrefPathDir(const char *pref); + +char * +SDL_GetBasePath(void) +{ + char *base_path = SDL_strdup("romfs:/"); + return base_path; +} + +char * +SDL_GetPrefPath(const char *org, const char *app) +{ + char *pref_path = NULL; + if (app == NULL) { + SDL_InvalidParamError("app"); + return NULL; + } + + pref_path = MakePrefPath(app); + if (CreatePrefPathDir(pref_path) < 0) { + SDL_free(pref_path); + return NULL; + } + + return pref_path; +} + +SDL_FORCE_INLINE char * +MakePrefPath(const char *app) +{ + static const char *FMT = "/3ds/%s/"; + size_t length = SDL_snprintf(NULL, 0, FMT, app) + 1; + char *pref_path = (char *) SDL_calloc(length, sizeof(char)); + SDL_snprintf(pref_path, length, FMT, app); + return pref_path; +} + +SDL_FORCE_INLINE int +CreatePrefPathDir(const char *pref) +{ + int result = mkdir(pref, 0666); + + if (result == -1 && errno != EEXIST) { + return SDL_SetError("Failed to create '%s' (%s)", pref, strerror(errno)); + } + return 0; +} + +#endif /* SDL_FILESYSTEM_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index fd8534fa6..a39a46d37 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -977,6 +977,9 @@ static const char *s_ControllerMappings [] = #endif #if SDL_JOYSTICK_VITA "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", +#endif +#if SDL_JOYSTICK_N3DS + "4e696e74656e646f20334453206d6170,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,leftstick:b14,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index a42951ce1..b22c8783a 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -102,6 +102,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #ifdef SDL_JOYSTICK_VITA &SDL_VITA_JoystickDriver, #endif +#ifdef SDL_JOYSTICK_N3DS + &SDL_N3DS_JoystickDriver +#endif #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) &SDL_DUMMY_JoystickDriver #endif diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index a0400c6ff..707ab4ae3 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -238,6 +238,7 @@ extern SDL_JoystickDriver SDL_OS2_JoystickDriver; extern SDL_JoystickDriver SDL_PS2_JoystickDriver; extern SDL_JoystickDriver SDL_PSP_JoystickDriver; extern SDL_JoystickDriver SDL_VITA_JoystickDriver; +extern SDL_JoystickDriver SDL_N3DS_JoystickDriver; /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c new file mode 100644 index 000000000..f2f15c16b --- /dev/null +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -0,0 +1,367 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_N3DS + +/* This is the N3DS implementation of the SDL joystick API */ + +#include <3ds.h> + +#include "../SDL_sysjoystick.h" +#include "SDL_events.h" + +#define NB_BUTTONS 23 + +/* + N3DS sticks values are roughly within +/-160 + which is too small to pass the jitter tolerance. + This correction factor is applied to axis values + so they fit better in SDL's value range. +*/ +#define CORRECTION_FACTOR_X SDL_JOYSTICK_AXIS_MAX / 160 + +/* + The Y axis needs to be flipped because SDL's "up" + is reversed compared to libctru's "up" +*/ +#define CORRECTION_FACTOR_Y -CORRECTION_FACTOR_X + +/* + Factors used to convert touchscreen coordinates to + SDL's 0-1 values. Note that the N3DS's screen is + internally in a portrait disposition so the + GSP_SCREEN constants are flipped. +*/ +#define TOUCHPAD_SCALE_X 1.0f / GSP_SCREEN_HEIGHT_BOTTOM +#define TOUCHPAD_SCALE_Y 1.0f / GSP_SCREEN_WIDTH + +typedef struct N3DSJoystickState +{ + u32 kDown; + u32 kUp; + circlePosition circlePos; + circlePosition cStickPos; + accelVector acceleration; + angularRate rate; +} N3DSJoystickState; + +SDL_FORCE_INLINE void UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state); +SDL_FORCE_INLINE void UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state); +SDL_FORCE_INLINE void UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state); +SDL_FORCE_INLINE void UpdateTouch(SDL_Joystick *joystick); + +static N3DSJoystickState current_state; +static SDL_bool sensors_enabled = SDL_FALSE; + +static int +N3DS_JoystickInit(void) +{ + hidInit(); + HIDUSER_EnableAccelerometer(); + HIDUSER_EnableGyroscope(); + return 0; +} + +static const char * +N3DS_JoystickGetDeviceName(int device_index) +{ + return "Nintendo 3DS"; +} + +static int +N3DS_JoystickGetCount(void) +{ + return 1; +} + +static SDL_JoystickGUID +N3DS_JoystickGetDeviceGUID(int device_index) +{ + /* GUID corresponds to the name "Nintendo 3DS map" */ + SDL_JoystickGUID guid = { { 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x6f, 0x20, 0x33, 0x44, 0x53, 0x20, 0x6d, 0x61, 0x70 } }; + return guid; +} + +static SDL_JoystickID +N3DS_JoystickGetDeviceInstanceID(int device_index) +{ + return device_index; +} + +static int +N3DS_JoystickOpen(SDL_Joystick *joystick, int device_index) +{ + joystick->nbuttons = NB_BUTTONS; + joystick->naxes = 4; + joystick->nhats = 0; + joystick->instance_id = device_index; + + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f); + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f); + SDL_PrivateJoystickAddTouchpad(joystick, 1); + + return 0; +} + +static int +N3DS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) +{ + sensors_enabled = enabled; + return 0; +} + +static void +N3DS_JoystickUpdate(SDL_Joystick *joystick) +{ + N3DSJoystickState previous_state = current_state; + hidScanInput(); + + UpdateAxis(joystick, &previous_state); + UpdateButtons(joystick, &previous_state); + UpdateTouch(joystick); + + if (sensors_enabled) { + UpdateSensors(joystick, &previous_state); + } +} + +SDL_FORCE_INLINE void +UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state) +{ + hidCircleRead(¤t_state.circlePos); + if (previous_state->circlePos.dx != current_state.circlePos.dx) { + SDL_PrivateJoystickAxis(joystick, + 0, + current_state.circlePos.dx * CORRECTION_FACTOR_X); + } + if (previous_state->circlePos.dy != current_state.circlePos.dy) { + SDL_PrivateJoystickAxis(joystick, + 1, + current_state.circlePos.dy * CORRECTION_FACTOR_Y); + } + + hidCstickRead(¤t_state.cStickPos); + if (previous_state->cStickPos.dx != current_state.cStickPos.dx) { + SDL_PrivateJoystickAxis(joystick, + 2, + current_state.cStickPos.dx * CORRECTION_FACTOR_X); + } + if (previous_state->cStickPos.dy != current_state.cStickPos.dy) { + SDL_PrivateJoystickAxis(joystick, + 3, + current_state.cStickPos.dy * CORRECTION_FACTOR_Y); + } +} + +SDL_FORCE_INLINE void +UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state) +{ + u32 updated_down, updated_up; + + current_state.kDown = hidKeysDown(); + updated_down = previous_state->kDown ^ current_state.kDown; + if (updated_down) { + for (Uint8 i = 0; i < joystick->nbuttons; i++) { + if (current_state.kDown & BIT(i) & updated_down) { + SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED); + } + } + } + + current_state.kUp = hidKeysUp(); + updated_up = previous_state->kUp ^ current_state.kUp; + if (updated_up) { + for (Uint8 i = 0; i < joystick->nbuttons; i++) { + if (current_state.kUp & BIT(i) & updated_up) { + SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED); + } + } + } +} + +SDL_FORCE_INLINE void +UpdateTouch(SDL_Joystick *joystick) +{ + touchPosition touch; + Uint8 state; + hidTouchRead(&touch); + state = (touch.px == 0 && touch.py == 0) ? SDL_RELEASED : SDL_PRESSED; + + SDL_PrivateJoystickTouchpad(joystick, + 0, + 0, + state, + touch.px * TOUCHPAD_SCALE_X, + touch.py * TOUCHPAD_SCALE_Y, + state == SDL_PRESSED ? 1.0f : 0.0f); +} + +SDL_FORCE_INLINE void +UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state) +{ + float data[3]; + + hidAccelRead(¤t_state.acceleration); + if (SDL_memcmp(&previous_state->acceleration, ¤t_state.acceleration, sizeof(accelVector)) != 0) { + SDL_memcpy(&previous_state->acceleration, ¤t_state.acceleration, sizeof(accelVector)); + data[0] = (float) current_state.acceleration.x * SDL_STANDARD_GRAVITY; + data[1] = (float) current_state.acceleration.y * SDL_STANDARD_GRAVITY; + data[2] = (float) current_state.acceleration.z * SDL_STANDARD_GRAVITY; + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, data, sizeof data); + } + + hidGyroRead(¤t_state.rate); + if (SDL_memcmp(&previous_state->rate, ¤t_state.rate, sizeof(angularRate)) != 0) { + SDL_memcpy(&previous_state->rate, ¤t_state.rate, sizeof(angularRate)); + data[0] = (float) current_state.rate.y; + data[1] = (float) current_state.rate.z; + data[2] = (float) current_state.rate.x; + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, data, sizeof data); + } +} + +static void +N3DS_JoystickClose(SDL_Joystick *joystick) +{ +} + +static void +N3DS_JoystickQuit(void) +{ + HIDUSER_DisableGyroscope(); + HIDUSER_DisableAccelerometer(); + hidExit(); +} + +static SDL_bool +N3DS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) +{ + /* There is only one possible mapping. */ + *out = (SDL_GamepadMapping){ + .a = { EMappingKind_Button, 0 }, + .b = { EMappingKind_Button, 1 }, + .x = { EMappingKind_Button, 10 }, + .y = { EMappingKind_Button, 11 }, + .back = { EMappingKind_Button, 2 }, + .guide = { EMappingKind_None, 255 }, + .start = { EMappingKind_Button, 3 }, + .leftstick = { EMappingKind_None, 255 }, + .rightstick = { EMappingKind_None, 255 }, + .leftshoulder = { EMappingKind_Button, 9 }, + .rightshoulder = { EMappingKind_Button, 8 }, + .dpup = { EMappingKind_Button, 6 }, + .dpdown = { EMappingKind_Button, 7 }, + .dpleft = { EMappingKind_Button, 5 }, + .dpright = { EMappingKind_Button, 4 }, + .misc1 = { EMappingKind_None, 255 }, + .paddle1 = { EMappingKind_None, 255 }, + .paddle2 = { EMappingKind_None, 255 }, + .paddle3 = { EMappingKind_None, 255 }, + .paddle4 = { EMappingKind_None, 255 }, + .leftx = { EMappingKind_Axis, 0 }, + .lefty = { EMappingKind_Axis, 1 }, + .rightx = { EMappingKind_Axis, 2 }, + .righty = { EMappingKind_Axis, 3 }, + .lefttrigger = { EMappingKind_Button, 14 }, + .righttrigger = { EMappingKind_Button, 15 }, + }; + return SDL_TRUE; +} + +static void +N3DS_JoystickDetect(void) +{ +} + +static const char * +N3DS_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + +static int +N3DS_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static void +N3DS_JoystickSetDevicePlayerIndex(int device_index, int player_index) +{ +} + +static Uint32 +N3DS_JoystickGetCapabilities(SDL_Joystick *joystick) +{ + return 0; +} + +static int +N3DS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + return SDL_Unsupported(); +} + +static int +N3DS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) +{ + return SDL_Unsupported(); +} + +static int +N3DS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + return SDL_Unsupported(); +} + +static int +N3DS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) +{ + return SDL_Unsupported(); +} + +SDL_JoystickDriver SDL_N3DS_JoystickDriver = { + N3DS_JoystickInit, + N3DS_JoystickGetCount, + N3DS_JoystickDetect, + N3DS_JoystickGetDeviceName, + N3DS_JoystickGetDevicePath, + N3DS_JoystickGetDevicePlayerIndex, + N3DS_JoystickSetDevicePlayerIndex, + N3DS_JoystickGetDeviceGUID, + N3DS_JoystickGetDeviceInstanceID, + N3DS_JoystickOpen, + N3DS_JoystickRumble, + N3DS_JoystickRumbleTriggers, + N3DS_JoystickGetCapabilities, + N3DS_JoystickSetLED, + N3DS_JoystickSendEffect, + N3DS_JoystickSetSensorsEnabled, + N3DS_JoystickUpdate, + N3DS_JoystickClose, + N3DS_JoystickQuit, + N3DS_JoystickGetGamepadMapping +}; + +#endif /* SDL_JOYSTICK_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/libm/math_private.h b/src/libm/math_private.h index f560cca6a..ee67c444e 100644 --- a/src/libm/math_private.h +++ b/src/libm/math_private.h @@ -27,7 +27,7 @@ #define libm_hidden_def(x) #define strong_alias(x, y) -#if !defined(__HAIKU__) && !defined(__PSP__) && !defined(__PS2__) /* already defined in a system header. */ +#if !defined(__HAIKU__) && !defined(__PSP__) && !defined(__3DS__) && !defined(__PS2__) /* already defined in a system header. */ typedef unsigned int u_int32_t; #endif diff --git a/src/locale/n3ds/SDL_syslocale.c b/src/locale/n3ds/SDL_syslocale.c new file mode 100644 index 000000000..bcfec8f1d --- /dev/null +++ b/src/locale/n3ds/SDL_syslocale.c @@ -0,0 +1,59 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../SDL_syslocale.h" +#include "../../SDL_internal.h" + +#include <3ds.h> + +/* Used when the CFGU fails to work. */ +#define BAD_LOCALE 255 + +SDL_FORCE_INLINE u8 GetLocaleIndex(void); + +void +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) +{ + /* The 3DS only supports these 12 languages, only one can be active at a time */ + static const char AVAILABLE_LOCALES[][6] = { "ja_JP", "en_US", "fr_FR", "de_DE", + "it_IT", "es_ES", "zn_CN", "ko_KR", + "nl_NL", "pt_PT", "ru_RU", "zh_TW" }; + u8 current_locale = GetLocaleIndex(); + if (current_locale != BAD_LOCALE) { + SDL_strlcpy(buf, AVAILABLE_LOCALES[current_locale], buflen); + } +} + +SDL_FORCE_INLINE u8 +GetLocaleIndex(void) +{ + u8 current_locale; + if (R_FAILED(cfguInit())) { + return BAD_LOCALE; + } + if (R_FAILED(CFGU_GetSystemLanguage(¤t_locale))) { + return BAD_LOCALE; + } + cfguExit(); + return current_locale; +} + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/main/n3ds/SDL_n3ds_main.c b/src/main/n3ds/SDL_n3ds_main.c new file mode 100644 index 000000000..982dcb3c6 --- /dev/null +++ b/src/main/n3ds/SDL_n3ds_main.c @@ -0,0 +1,82 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../../SDL_internal.h" + +#ifdef __3DS__ + +#include "SDL_main.h" +#include <3ds.h> + +#ifdef main +#undef main +#endif + +SDL_FORCE_INLINE void N3DS_Init(void); +SDL_FORCE_INLINE void N3DS_SetCPUSpeed(void); +SDL_FORCE_INLINE void N3DS_Quit(void); + +#define HIGH_CLOCK 1 +#define L2_CACHE 2 + +int +main(int argc, char *argv[]) +{ + int result; + N3DS_Init(); + SDL_SetMainReady(); + result = SDL_main(argc, argv); + N3DS_Quit(); + return result; +} + +SDL_FORCE_INLINE void +N3DS_Init(void) +{ + N3DS_SetCPUSpeed(); + romfsInit(); + gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false); + hidInit(); +} + +/* If available, enable L2 cache and high CPU clock */ +SDL_FORCE_INLINE void +N3DS_SetCPUSpeed(void) +{ + if (R_SUCCEEDED(ptmSysmInit())) { + if (R_SUCCEEDED(PTMSYSM_CheckNew3DS())) { + PTMSYSM_ConfigureNew3DSCPU(HIGH_CLOCK | L2_CACHE); + } + ptmSysmExit(); + } +} + +SDL_FORCE_INLINE void +N3DS_Quit(void) +{ + hidExit(); + gfxExit(); + romfsExit(); +} + +#endif /* __3DS__ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/power/SDL_power.c b/src/power/SDL_power.c index 625a8fa08..fbf8d5a65 100644 --- a/src/power/SDL_power.c +++ b/src/power/SDL_power.c @@ -71,6 +71,9 @@ static SDL_GetPowerInfo_Impl implementations[] = { #ifdef SDL_POWER_VITA /* handles PSVita. */ SDL_GetPowerInfo_VITA, #endif +#ifdef SDL_POWER_N3DS /* handles N3DS. */ + SDL_GetPowerInfo_N3DS, +#endif #ifdef SDL_POWER_WINRT /* handles WinRT */ SDL_GetPowerInfo_WinRT, #endif diff --git a/src/power/SDL_syspower.h b/src/power/SDL_syspower.h index d66e50f9c..2f81756c4 100644 --- a/src/power/SDL_syspower.h +++ b/src/power/SDL_syspower.h @@ -39,6 +39,7 @@ SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_VITA(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_N3DS(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); diff --git a/src/power/n3ds/SDL_syspower.c b/src/power/n3ds/SDL_syspower.c new file mode 100644 index 000000000..fe167aff6 --- /dev/null +++ b/src/power/n3ds/SDL_syspower.c @@ -0,0 +1,111 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../../SDL_internal.h" + +#if !defined(SDL_POWER_DISABLED) && defined(SDL_POWER_N3DS) + +#include <3ds.h> + +#include "SDL_error.h" +#include "SDL_power.h" + +SDL_FORCE_INLINE SDL_PowerState GetPowerState(void); +SDL_FORCE_INLINE int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging); +SDL_FORCE_INLINE int GetBatteryPercentage(void); + +#define BATTERY_PERCENT_REG 0xB +#define BATTERY_PERCENT_REG_SIZE 2 + +SDL_bool +SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent) +{ + *state = GetPowerState(); + *percent = GetBatteryPercentage(); + *seconds = -1; /* libctru doesn't provide a way to estimate battery life */ + + return SDL_TRUE; +} + +SDL_FORCE_INLINE SDL_PowerState +GetPowerState(void) +{ + bool is_plugged; + u8 is_charging; + + if (ReadStateFromPTMU(&is_plugged, &is_charging) < 0) { + return SDL_POWERSTATE_UNKNOWN; + } + + if (is_charging) { + return SDL_POWERSTATE_CHARGING; + } + + if (is_plugged) { + return SDL_POWERSTATE_CHARGED; + } + + return SDL_POWERSTATE_ON_BATTERY; +} + +SDL_FORCE_INLINE int +ReadStateFromPTMU(bool *is_plugged, u8 *is_charging) +{ + if (R_FAILED(ptmuInit())) { + return SDL_SetError("Failed to initialise PTMU service"); + } + + if (R_FAILED(PTMU_GetAdapterState(is_plugged))) { + ptmuExit(); + return SDL_SetError("Failed to read adapter state"); + } + + if (R_FAILED(PTMU_GetBatteryChargeState(is_charging))) { + ptmuExit(); + return SDL_SetError("Failed to read battery charge state"); + } + + ptmuExit(); + return 0; +} + +SDL_FORCE_INLINE int +GetBatteryPercentage(void) +{ + u8 data[BATTERY_PERCENT_REG_SIZE]; + + if (R_FAILED(mcuHwcInit())) { + return SDL_SetError("Failed to initialise mcuHwc service"); + } + + if (R_FAILED(MCUHWC_ReadRegister(BATTERY_PERCENT_REG, data, BATTERY_PERCENT_REG_SIZE))) { + mcuHwcExit(); + return SDL_SetError("Failed to read battery register"); + } + + mcuHwcExit(); + + return (int) SDL_round(data[0] + data[1] / 256.0); +} + +#endif /* !SDL_POWER_DISABLED && SDL_POWER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 55a4a8875..f3348eaa9 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -38,6 +38,8 @@ #include "psp/SDL_systhread_c.h" #elif SDL_THREAD_VITA #include "vita/SDL_systhread_c.h" +#elif SDL_THREAD_N3DS +#include "n3ds/SDL_systhread_c.h" #elif SDL_THREAD_STDCPP #include "stdcpp/SDL_systhread_c.h" #elif SDL_THREAD_OS2 diff --git a/src/thread/n3ds/SDL_syscond.c b/src/thread/n3ds/SDL_syscond.c new file mode 100644 index 000000000..9c671f554 --- /dev/null +++ b/src/thread/n3ds/SDL_syscond.c @@ -0,0 +1,133 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_THREAD_N3DS + +/* An implementation of condition variables using libctru's CondVar */ + +#include "SDL_sysmutex_c.h" + +struct SDL_cond +{ + CondVar cond_variable; +}; + +/* Create a condition variable */ +SDL_cond * +SDL_CreateCond(void) +{ + SDL_cond *cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); + if (cond) { + CondVar_Init(&cond->cond_variable); + } else { + SDL_OutOfMemory(); + } + return cond; +} + +/* Destroy a condition variable */ +void +SDL_DestroyCond(SDL_cond *cond) +{ + if (cond) { + SDL_free(cond); + } +} + +/* Restart one of the threads that are waiting on the condition variable */ +int +SDL_CondSignal(SDL_cond *cond) +{ + if (!cond) { + return SDL_SetError("Passed a NULL condition variable"); + } + + CondVar_Signal(&cond->cond_variable); + return 0; +} + +/* Restart all threads that are waiting on the condition variable */ +int +SDL_CondBroadcast(SDL_cond *cond) +{ + if (!cond) { + return SDL_SetError("Passed a NULL condition variable"); + } + + CondVar_Broadcast(&cond->cond_variable); + return 0; +} + +/* Wait on the condition variable for at most 'ms' milliseconds. + The mutex must be locked before entering this function! + The mutex is unlocked during the wait, and locked again after the wait. + +Typical use: + +Thread A: + SDL_LockMutex(lock); + while ( ! condition ) { + SDL_CondWait(cond, lock); + } + SDL_UnlockMutex(lock); + +Thread B: + SDL_LockMutex(lock); + ... + condition = true; + ... + SDL_CondSignal(cond); + SDL_UnlockMutex(lock); + */ +int +SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) +{ + Result res; + + if (!cond) { + return SDL_SetError("Passed a NULL condition variable"); + } + if (!mutex) { + return SDL_SetError("Passed a NULL mutex"); + } + + res = 0; + if (ms == SDL_MUTEX_MAXWAIT) { + CondVar_Wait(&cond->cond_variable, &mutex->lock.lock); + } else { + res = CondVar_WaitTimeout(&cond->cond_variable, &mutex->lock.lock, + (s64) ms * 1000000LL); + } + + return R_SUCCEEDED(res) ? 0 : SDL_MUTEX_TIMEDOUT; +} + +/* Wait on the condition variable forever */ +int +SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex) +{ + return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT); +} + +#endif /* SDL_THREAD_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/n3ds/SDL_sysmutex.c b/src/thread/n3ds/SDL_sysmutex.c new file mode 100644 index 000000000..59fa8a801 --- /dev/null +++ b/src/thread/n3ds/SDL_sysmutex.c @@ -0,0 +1,93 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_THREAD_N3DS + +/* An implementation of mutexes using libctru's RecursiveLock */ + +#include "SDL_sysmutex_c.h" + +/* Create a mutex */ +SDL_mutex * +SDL_CreateMutex(void) +{ + SDL_mutex *mutex; + + /* Allocate mutex memory */ + mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); + if (mutex) { + RecursiveLock_Init(&mutex->lock); + } else { + SDL_OutOfMemory(); + } + return mutex; +} + +/* Free the mutex */ +void +SDL_DestroyMutex(SDL_mutex *mutex) +{ + if (mutex) { + SDL_free(mutex); + } +} + +/* Lock the mutex */ +int +SDL_LockMutex(SDL_mutex *mutex) +{ + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + RecursiveLock_Lock(&mutex->lock); + + return 0; +} + +/* try Lock the mutex */ +int +SDL_TryLockMutex(SDL_mutex *mutex) +{ + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + return RecursiveLock_TryLock(&mutex->lock); +} + +/* Unlock the mutex */ +int +SDL_mutexV(SDL_mutex *mutex) +{ + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + RecursiveLock_Unlock(&mutex->lock); + + return 0; +} + +#endif /* SDL_THREAD_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/n3ds/SDL_sysmutex_c.h b/src/thread/n3ds/SDL_sysmutex_c.h new file mode 100644 index 000000000..d7658e1fd --- /dev/null +++ b/src/thread/n3ds/SDL_sysmutex_c.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_sysmutex_c_h_ +#define SDL_sysmutex_c_h_ + +#include <3ds.h> + +#include "SDL_mutex.h" + +struct SDL_mutex +{ + RecursiveLock lock; +}; + +#endif /* SDL_sysmutex_c_h */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/n3ds/SDL_syssem.c b/src/thread/n3ds/SDL_syssem.c new file mode 100644 index 000000000..08fbb6f42 --- /dev/null +++ b/src/thread/n3ds/SDL_syssem.c @@ -0,0 +1,134 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_THREAD_N3DS + +/* An implementation of semaphores using libctru's LightSemaphore */ + +#include <3ds.h> + +#include "SDL_thread.h" + +struct SDL_semaphore +{ + LightSemaphore semaphore; +}; + +SDL_sem * +SDL_CreateSemaphore(Uint32 initial_value) +{ + SDL_sem *sem; + + if (initial_value > SDL_MAX_SINT16) { + SDL_SetError("Initial semaphore value too high for this platform"); + return NULL; + } + + sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); + if (!sem) { + SDL_OutOfMemory(); + return NULL; + } + + LightSemaphore_Init(&sem->semaphore, initial_value, SDL_MAX_SINT16); + + return sem; +} + +/* WARNING: + You cannot call this function when another thread is using the semaphore. +*/ +void +SDL_DestroySemaphore(SDL_sem *sem) +{ + if (sem) { + SDL_free(sem); + } +} + +int +SDL_SemTryWait(SDL_sem *sem) +{ + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + + return SDL_SemWaitTimeout(sem, 0); +} + +int +SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) +{ + int retval; + + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + + if (timeout == SDL_MUTEX_MAXWAIT) { + LightSemaphore_Acquire(&sem->semaphore, 1); + retval = 0; + } else { + int return_code = LightSemaphore_TryAcquire(&sem->semaphore, 1); + if (return_code != 0) { + for (u32 i = 0; i < timeout; i++) { + svcSleepThread(1000000LL); + return_code = LightSemaphore_TryAcquire(&sem->semaphore, 1); + if (return_code == 0) { + break; + } + } + } + retval = return_code != 0 ? SDL_MUTEX_TIMEDOUT : 0; + } + + return retval; +} + +int +SDL_SemWait(SDL_sem *sem) +{ + return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); +} + +Uint32 +SDL_SemValue(SDL_sem *sem) +{ + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + return sem->semaphore.current_count; +} + +int +SDL_SemPost(SDL_sem *sem) +{ + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + LightSemaphore_Release(&sem->semaphore, 1); + return 0; +} + +#endif /* SDL_THREAD_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/n3ds/SDL_systhread.c b/src/thread/n3ds/SDL_systhread.c new file mode 100644 index 000000000..a588400ad --- /dev/null +++ b/src/thread/n3ds/SDL_systhread.c @@ -0,0 +1,148 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_THREAD_N3DS + +/* Thread management routines for SDL */ + +#include "../SDL_systhread.h" + +/* N3DS has very limited RAM (128MB), so we put a limit on thread stack size. */ +#define N3DS_THREAD_STACK_SIZE_MAX (16 * 1024) +#define N3DS_THREAD_STACK_SIZE_DEFAULT (4 * 1024) + +#define N3DS_THREAD_PRIORITY_LOW 0x3F /**< Minimum priority */ +#define N3DS_THREAD_PRIORITY_MEDIUM 0x2F /**< Slightly higher than main thread (0x30) */ +#define N3DS_THREAD_PRIORITY_HIGH 0x19 /**< High priority for non-video work */ +#define N3DS_THREAD_PRIORITY_TIME_CRITICAL 0x18 /**< Highest priority */ + +static size_t GetStackSize(size_t requested_size); + +static void +ThreadEntry(void *arg) +{ + SDL_RunThread((SDL_Thread *) arg); + threadExit(0); +} + +#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD +#error "SDL_PASSED_BEGINTHREAD_ENDTHREAD is not supported on N3DS" +#endif + +int +SDL_SYS_CreateThread(SDL_Thread *thread) +{ + s32 priority = N3DS_THREAD_PRIORITY_MEDIUM; + size_t stack_size = GetStackSize(thread->stacksize); + + thread->handle = threadCreate(ThreadEntry, + thread, + stack_size, + priority, + -1, + false); + + if (thread->handle == NULL) { + return SDL_SetError("Couldn't create thread"); + } + + return 0; +} + +static size_t +GetStackSize(size_t requested_size) +{ + if (requested_size == 0) { + return N3DS_THREAD_STACK_SIZE_DEFAULT; + } + + if (requested_size > N3DS_THREAD_STACK_SIZE_MAX) { + SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, + "Requested a thread size of %zu," + " falling back to the maximum supported of %zu\n", + requested_size, + N3DS_THREAD_STACK_SIZE_MAX); + requested_size = N3DS_THREAD_STACK_SIZE_MAX; + } + return requested_size; +} + +void +SDL_SYS_SetupThread(const char *name) +{ + return; +} + +SDL_threadID +SDL_ThreadID(void) +{ + u32 thread_ID = 0; + svcGetThreadId(&thread_ID, CUR_THREAD_HANDLE); + return (SDL_threadID) thread_ID; +} + +int +SDL_SYS_SetThreadPriority(SDL_ThreadPriority sdl_priority) +{ + s32 svc_priority; + switch (sdl_priority) { + case SDL_THREAD_PRIORITY_LOW: + svc_priority = N3DS_THREAD_PRIORITY_LOW; + break; + case SDL_THREAD_PRIORITY_NORMAL: + svc_priority = N3DS_THREAD_PRIORITY_MEDIUM; + break; + case SDL_THREAD_PRIORITY_HIGH: + svc_priority = N3DS_THREAD_PRIORITY_HIGH; + break; + case SDL_THREAD_PRIORITY_TIME_CRITICAL: + svc_priority = N3DS_THREAD_PRIORITY_TIME_CRITICAL; + break; + default: + svc_priority = N3DS_THREAD_PRIORITY_MEDIUM; + } + return (int) svcSetThreadPriority(CUR_THREAD_HANDLE, svc_priority); +} + +void +SDL_SYS_WaitThread(SDL_Thread *thread) +{ + Result res = threadJoin(thread->handle, U64_MAX); + + /* + Detached threads can be waited on, but should NOT be cleaned manually + as it would result in a fatal error. + */ + if (R_SUCCEEDED(res) && SDL_AtomicGet(&thread->state) != SDL_THREAD_STATE_DETACHED) { + threadFree(thread->handle); + } +} + +void +SDL_SYS_DetachThread(SDL_Thread *thread) +{ + threadDetach(thread->handle); +} + +#endif /* SDL_THREAD_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/thread/n3ds/SDL_systhread_c.h b/src/thread/n3ds/SDL_systhread_c.h new file mode 100644 index 000000000..71b9a27eb --- /dev/null +++ b/src/thread/n3ds/SDL_systhread_c.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_systhread_c_h_ +#define SDL_systhread_c_h_ + +#include <3ds.h> + +typedef Thread SYS_ThreadHandle; + +#endif /* SDL_systhread_c_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/timer/n3ds/SDL_systimer.c b/src/timer/n3ds/SDL_systimer.c new file mode 100644 index 000000000..6a4d29b04 --- /dev/null +++ b/src/timer/n3ds/SDL_systimer.c @@ -0,0 +1,81 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_TIMER_N3DS + +#include <3ds.h> + +static SDL_bool ticks_started = SDL_FALSE; +static u64 start_tick; + +#define NSEC_PER_MSEC 1000000ULL + +void +SDL_TicksInit(void) +{ + if (ticks_started) { + return; + } + ticks_started = SDL_TRUE; + + start_tick = svcGetSystemTick(); +} + +void +SDL_TicksQuit(void) +{ + ticks_started = SDL_FALSE; +} + +Uint64 +SDL_GetTicks64(void) +{ + u64 elapsed; + if (!ticks_started) { + SDL_TicksInit(); + } + + elapsed = svcGetSystemTick() - start_tick; + return elapsed / CPU_TICKS_PER_MSEC; +} + +Uint64 +SDL_GetPerformanceCounter(void) +{ + return svcGetSystemTick(); +} + +Uint64 +SDL_GetPerformanceFrequency(void) +{ + return SYSCLOCK_ARM11; +} + +void +SDL_Delay(Uint32 ms) +{ + svcSleepThread(ms * NSEC_PER_MSEC); +} + +#endif /* SDL_TIMER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 7202f1d6b..4bc1f111f 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -461,6 +461,7 @@ extern VideoBootStrap PS2_bootstrap; extern VideoBootStrap PSP_bootstrap; extern VideoBootStrap VITA_bootstrap; extern VideoBootStrap RISCOS_bootstrap; +extern VideoBootStrap N3DS_bootstrap; extern VideoBootStrap RPI_bootstrap; extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap KMSDRM_LEGACY_bootstrap; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 139c550c5..fbeaaaaee 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -100,6 +100,9 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_VITA &VITA_bootstrap, #endif +#if SDL_VIDEO_DRIVER_N3DS + &N3DS_bootstrap, +#endif #if SDL_VIDEO_DRIVER_KMSDRM &KMSDRM_bootstrap, #endif @@ -1498,7 +1501,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_N3DS_BOTTOM) static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void) diff --git a/src/video/n3ds/SDL_n3dsevents.c b/src/video/n3ds/SDL_n3dsevents.c new file mode 100644 index 000000000..f54d68ee7 --- /dev/null +++ b/src/video/n3ds/SDL_n3dsevents.c @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_N3DS + +/* Pumping the events for the Home and Power buttons. */ + +#include <3ds.h> + +#include "../../events/SDL_events_c.h" +#include "SDL_n3dsevents_c.h" + +void +N3DS_PumpEvents(_THIS) +{ + if (!aptMainLoop()) { + SDL_Event ev; + ev.type = SDL_QUIT; + SDL_PushEvent(&ev); + return; + } +} + +#endif /* SDL_VIDEO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsevents_c.h b/src/video/n3ds/SDL_n3dsevents_c.h new file mode 100644 index 000000000..418368c2b --- /dev/null +++ b/src/video/n3ds/SDL_n3dsevents_c.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_n3dsevents_c_h_ +#define SDL_n3dsevents_c_h_ + +#include "../../SDL_internal.h" + +extern void N3DS_PumpEvents(_THIS); + +#endif /* SDL_n3dsevents_c_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsframebuffer.c b/src/video/n3ds/SDL_n3dsframebuffer.c new file mode 100644 index 000000000..ba4ec51bf --- /dev/null +++ b/src/video/n3ds/SDL_n3dsframebuffer.c @@ -0,0 +1,148 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_N3DS + +#include "../SDL_sysvideo.h" +#include "SDL_n3dsframebuffer_c.h" +#include "SDL_n3dsvideo.h" + +#define N3DS_SURFACE "_SDL_N3DSSurface" + +typedef struct +{ + int width, height; +} Dimensions; + +SDL_FORCE_INLINE void FreePreviousWindowFramebuffer(SDL_Window *window); +SDL_FORCE_INLINE SDL_Surface *CreateNewWindowFramebuffer(SDL_Window *window); +SDL_FORCE_INLINE void CopyFramebuffertoN3DS(u32 *dest, const Dimensions dest_dim, const u32 *source, const Dimensions source_dim); +SDL_FORCE_INLINE int GetDestOffset(int x, int y, int dest_width); +SDL_FORCE_INLINE int GetSourceOffset(int x, int y, int source_width); +SDL_FORCE_INLINE void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen); + +int +SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch) +{ + SDL_Surface *framebuffer; + + FreePreviousWindowFramebuffer(window); + framebuffer = CreateNewWindowFramebuffer(window); + + if (!framebuffer) { + return SDL_OutOfMemory(); + } + + SDL_SetWindowData(window, N3DS_SURFACE, framebuffer); + *format = FRAMEBUFFER_FORMAT; + *pixels = framebuffer->pixels; + *pitch = framebuffer->pitch; + return 0; +} + +SDL_FORCE_INLINE void +FreePreviousWindowFramebuffer(SDL_Window *window) +{ + SDL_Surface *surface = (SDL_Surface *) SDL_GetWindowData(window, N3DS_SURFACE); + SDL_FreeSurface(surface); +} + +SDL_FORCE_INLINE SDL_Surface * +CreateNewWindowFramebuffer(SDL_Window *window) +{ + int w, h, bpp; + Uint32 Rmask, Gmask, Bmask, Amask; + SDL_PixelFormatEnumToMasks(FRAMEBUFFER_FORMAT, &bpp, &Rmask, &Gmask, &Bmask, &Amask); + SDL_GetWindowSize(window, &w, &h); + return SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); +} + +int +SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects) +{ + SDL_WindowData *drv_data = (SDL_WindowData *) window->driverdata; + SDL_Surface *surface; + u16 width, height; + u32 *framebuffer; + u32 bufsize; + + surface = (SDL_Surface *) SDL_GetWindowData(window, N3DS_SURFACE); + if (!surface) { + return SDL_SetError("%s: Unable to get the window surface.", __func__); + } + + /* Get the N3DS internal framebuffer and its size */ + framebuffer = (u32 *) gfxGetFramebuffer(drv_data->screen, GFX_LEFT, &width, &height); + bufsize = width * height * 4; + + CopyFramebuffertoN3DS(framebuffer, (Dimensions){ width, height }, + surface->pixels, (Dimensions){ surface->w, surface->h }); + FlushN3DSBuffer(framebuffer, bufsize, drv_data->screen); + + return 0; +} + +SDL_FORCE_INLINE void +CopyFramebuffertoN3DS(u32 *dest, const Dimensions dest_dim, const u32 *source, const Dimensions source_dim) +{ + int rows = SDL_min(dest_dim.width, source_dim.height); + int cols = SDL_min(dest_dim.height, source_dim.width); + for (int y = 0; y < rows; ++y) { + for (int x = 0; x < cols; ++x) { + SDL_memcpy( + dest + GetDestOffset(x, y, dest_dim.width), + source + GetSourceOffset(x, y, source_dim.width), + 4); + } + } +} + +SDL_FORCE_INLINE int +GetDestOffset(int x, int y, int dest_width) +{ + return dest_width - y - 1 + dest_width * x; +} + +SDL_FORCE_INLINE int +GetSourceOffset(int x, int y, int source_width) +{ + return x + y * source_width; +} + +SDL_FORCE_INLINE void +FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen) +{ + GSPGPU_FlushDataCache(buffer, bufsize); + gfxScreenSwapBuffers(screen, false); +} + +void +SDL_N3DS_DestroyWindowFramebuffer(_THIS, SDL_Window *window) +{ + SDL_Surface *surface; + surface = (SDL_Surface *) SDL_SetWindowData(window, N3DS_SURFACE, NULL); + SDL_FreeSurface(surface); +} + +#endif /* SDL_VIDEO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsframebuffer_c.h b/src/video/n3ds/SDL_n3dsframebuffer_c.h new file mode 100644 index 000000000..3a4750c9d --- /dev/null +++ b/src/video/n3ds/SDL_n3dsframebuffer_c.h @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_n3dsframebuffer_c_h_ +#define SDL_n3dsframebuffer_c_h_ + +#include "../../SDL_internal.h" + +int SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch); +int SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects); +void SDL_N3DS_DestroyWindowFramebuffer(_THIS, SDL_Window *window); + +#endif /* SDL_n3dsframebuffer_c_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsswkb.c b/src/video/n3ds/SDL_n3dsswkb.c new file mode 100644 index 000000000..b577a3639 --- /dev/null +++ b/src/video/n3ds/SDL_n3dsswkb.c @@ -0,0 +1,76 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../../SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_N3DS + +#include <3ds.h> + +#include "SDL_n3dsswkb.h" + +static SwkbdState sw_keyboard; +const static size_t BUFFER_SIZE = 256; + +void +N3DS_SwkbInit() +{ + swkbdInit(&sw_keyboard, SWKBD_TYPE_NORMAL, 2, -1); +} + +void +N3DS_SwkbPoll() +{ + return; +} + +void +N3DS_SwkbQuit() +{ + return; +} + +SDL_bool +N3DS_HasScreenKeyboardSupport(_THIS) +{ + return SDL_TRUE; +} + +void +N3DS_StartTextInput(_THIS) +{ + char buffer[BUFFER_SIZE]; + SwkbdButton button_pressed; + button_pressed = swkbdInputText(&sw_keyboard, buffer, BUFFER_SIZE); + if (button_pressed == SWKBD_BUTTON_CONFIRM) { + SDL_SendKeyboardText(buffer); + } +} + +void +N3DS_StopTextInput(_THIS) +{ + return; +} + +#endif /* SDL_VIDEO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsswkb.h b/src/video/n3ds/SDL_n3dsswkb.h new file mode 100644 index 000000000..6a48ae8de --- /dev/null +++ b/src/video/n3ds/SDL_n3dsswkb.h @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_n3dskeyboard_h_ +#define SDL_n3dskeyboard_h_ + +#include "../../events/SDL_events_c.h" + +void N3DS_SwkbInit(); +void N3DS_SwkbPoll(); +void N3DS_SwkbQuit(); + +SDL_bool N3DS_HasScreenKeyboardSupport(_THIS); + +void N3DS_StartTextInput(_THIS); +void N3DS_StopTextInput(_THIS); + +#endif /* SDL_n3dskeyboard_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c new file mode 100644 index 000000000..6d3babd2d --- /dev/null +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -0,0 +1,163 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_N3DS + +#include "../SDL_sysvideo.h" +#include "SDL_n3dsevents_c.h" +#include "SDL_n3dsframebuffer_c.h" +#include "SDL_n3dsswkb.h" +#include "SDL_n3dsvideo.h" + +#define N3DSVID_DRIVER_NAME "n3ds" + +SDL_FORCE_INLINE void AddN3DSDisplay(gfxScreen_t screen); + +static int N3DS_VideoInit(_THIS); +static void N3DS_VideoQuit(_THIS); +static void N3DS_GetDisplayModes(_THIS, SDL_VideoDisplay *display); +static int N3DS_CreateWindow(_THIS, SDL_Window *window); +static void N3DS_DestroyWindow(_THIS, SDL_Window *window); + +/* N3DS driver bootstrap functions */ + +static void +N3DS_DeleteDevice(SDL_VideoDevice *device) +{ + SDL_free(device->displays); + SDL_free(device->driverdata); + SDL_free(device); +} + +static SDL_VideoDevice * +N3DS_CreateDevice(void) +{ + SDL_VideoDevice *device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (!device) { + SDL_OutOfMemory(); + return (0); + } + + device->VideoInit = N3DS_VideoInit; + device->VideoQuit = N3DS_VideoQuit; + + device->GetDisplayModes = N3DS_GetDisplayModes; + + device->CreateSDLWindow = N3DS_CreateWindow; + device->DestroyWindow = N3DS_DestroyWindow; + + device->HasScreenKeyboardSupport = N3DS_HasScreenKeyboardSupport; + device->StartTextInput = N3DS_StartTextInput; + device->StopTextInput = N3DS_StopTextInput; + + device->PumpEvents = N3DS_PumpEvents; + + device->CreateWindowFramebuffer = SDL_N3DS_CreateWindowFramebuffer; + device->UpdateWindowFramebuffer = SDL_N3DS_UpdateWindowFramebuffer; + device->DestroyWindowFramebuffer = SDL_N3DS_DestroyWindowFramebuffer; + + device->num_displays = 2; + + device->free = N3DS_DeleteDevice; + + return device; +} + +VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice }; + +static int +N3DS_VideoInit(_THIS) +{ + AddN3DSDisplay(GFX_TOP); + AddN3DSDisplay(GFX_BOTTOM); + + N3DS_SwkbInit(); + + return 0; +} + +SDL_FORCE_INLINE void +AddN3DSDisplay(gfxScreen_t screen) +{ + SDL_DisplayMode mode; + SDL_VideoDisplay display; + + SDL_zero(mode); + SDL_zero(display); + + mode.w = (screen == GFX_TOP) ? GSP_SCREEN_HEIGHT_TOP : GSP_SCREEN_HEIGHT_BOTTOM; + mode.h = GSP_SCREEN_WIDTH; + mode.refresh_rate = 60; + mode.format = FRAMEBUFFER_FORMAT; + mode.driverdata = NULL; + + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = NULL; + + SDL_AddVideoDisplay(&display, SDL_FALSE); +} + +static void +N3DS_VideoQuit(_THIS) +{ + N3DS_SwkbQuit(); + return; +} + +static void +N3DS_GetDisplayModes(_THIS, SDL_VideoDisplay *display) +{ + /* Each display only has a single mode */ + SDL_AddDisplayMode(display, &display->current_mode); +} + +static int +N3DS_CreateWindow(_THIS, SDL_Window *window) +{ + SDL_WindowData *drv_data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (drv_data == NULL) { + return SDL_OutOfMemory(); + } + + if (window->flags & SDL_WINDOW_N3DS_BOTTOM) { + drv_data->screen = GFX_BOTTOM; + } else { + drv_data->screen = GFX_TOP; + } + + window->driverdata = drv_data; + return 0; +} + +static void +N3DS_DestroyWindow(_THIS, SDL_Window *window) +{ + if (window == NULL) { + return; + } + SDL_free(window->driverdata); +} + +#endif /* SDL_VIDEO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsvideo.h b/src/video/n3ds/SDL_n3dsvideo.h new file mode 100644 index 000000000..c1b15f712 --- /dev/null +++ b/src/video/n3ds/SDL_n3dsvideo.h @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_n3dsvideo_h_ +#define SDL_n3dsvideo_h_ + +#include <3ds.h> + +#include "../SDL_sysvideo.h" +typedef struct SDL_WindowData +{ + gfxScreen_t screen; /**< Keeps track of which N3DS screen is targetted */ +} SDL_WindowData; + +#define FRAMEBUFFER_FORMAT SDL_PIXELFORMAT_RGBA8888 + +#endif /* SDL_n3dsvideo_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ebea6deff..578a422be 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,6 +14,10 @@ if(SDL_INSTALL_TESTS) include(GNUInstallDirs) endif() +if(N3DS) + link_libraries(SDL2::SDL2main) +endif() + if(PSP) link_libraries( SDL2::SDL2main @@ -430,6 +434,27 @@ if(PSP) endforeach() endif() +if(N3DS) + set(ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/romfs") + file(COPY ${RESOURCE_FILES} DESTINATION "${ROMFS_DIR}") + + foreach(APP IN LISTS ALL_TESTS) + get_target_property(TARGET_BINARY_DIR ${APP} BINARY_DIR) + set(SMDH_FILE "${TARGET_BINARY_DIR}/${APP}.smdh") + ctr_generate_smdh("${SMDH_FILE}" + NAME "SDL-${APP}" + DESCRIPTION "SDL2 Test suite" + AUTHOR "SDL2 Contributors" + ICON "${CMAKE_CURRENT_SOURCE_DIR}/n3ds/logo48x48.png" + ) + ctr_create_3dsx( + ${APP} + ROMFS "${ROMFS_DIR}" + SMDH "${SMDH_FILE}" + ) + endforeach() +endif() + if(RISCOS) set(ALL_TESTS_AIF "") foreach(APP IN LISTS ALL_TESTS) diff --git a/test/n3ds/logo48x48.png b/test/n3ds/logo48x48.png new file mode 100644 index 0000000000000000000000000000000000000000..fb3338dfab87de5ac4409fa8d3dc2a7405ee3764 GIT binary patch literal 3069 zcmVEX>4Tx04R}tkv&MmKpe$iQ^gOe4i*$~$WWauh>AFB6^c+H)C#RSm|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1le0HIc5n$h+`2;kRU=q1x1u#BTB1IiiITY$9()lu3sXTLarhh zITlcc2HEw4|H1EWt=!~e#0`;ond>=bb{R9X;16O*}U#*53X-)9CL9L#%R?mf_02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{014GeL_t(&-tC!da8%_P$A9m+?0vJ@gd~JO1O$TI6K{Zc zfvHxcsH0Y=ReBknwzOKO9jA`B550{YwYB|(t=1{lONC0sq9~w&<7*JWAb>#t zg8&8r{C@)wuIsu0j^m(;yZN zGj8N?ezM?3{{40%ue|v_CDAaBorq4O_VUy-hr@@b+Hj zGTA(x$uxeSi6+i0E>Xy~&*$f|X?3h={DftP+PP_VLocgB2#occK4$T<)kMP~lyWGI zhWYxei>R(FqbHkV=bmOZZ~q)66=s2Q0SFf~A*dTQ97EU19~OL_J*xkwvEp;uq>PV z?!1Lrmp1g_(qZ?$X8!QkrP#KONGVZLo!eDekX)oB#&_pm#@^NhyY{ys1Zd^)67qQ)r4+8~^1DSZ zvEbfc@%U3O@aEb^+77pSnISxuWj2|P@G!7l^ z;M3jv&@|!IlkM$2*X6n{hG8(Ys)Az&_VDbocf2B=H+u$4R=i6pl_41Pqa25iw(VlW zmK_+nPDNRaD=wMJ!UZ={JG>et9ca$6)V4hNNGWmqin&mjKGW=FsCbJh$HA5Z>^ny$uADxN$|0p}+OY@2aa?Yle>D@w zj$-NSYuWh8XSB3-(0;TNP16X60+hv~?AX1ZMb9tCXPQ{HjcrQ=eY#m6HWFP)th|l1 zJ-r8f1wgjM*1sGBeVbS|XVG!E4O2K6Mf)&u{1_&VA44jYrn&VnyY@8m((*NY`0-AH z0Y9d$^Vt^%7(b>KStw$Gz;T>H4JdR?2cU8Dc3fO?c?+LuFmCj4R=>XmX-lM`dki=p zTE}sZTLi&rdqlC{yua~3tXua1H(Y-;+A}Y_%Knx^y$?mB5hm7+;pTaBSp4KeRF%i+ z$>dNpFe&9CnAX^eiDYJVZ8Y2Y94>;A3S*X?OZ#1233_qdLP`fZ5Kxq-DpCP z$>tbVRgSI~uS10p(A3)c0_J_~ zvR(nWj)S4=9PLbU(_IhaxSsqpA+T&oMR_SJ7C**_n(9+}qD2K3^(DED}c7v;nLg zgaQF_QZk~pnrmk@FeD!9KM!b;{#0N=suWWa8|cSlp4E{l*fDU`s>kkPZ5jTcWPrmkAEf$ zU0jaifbitCWceyyeC-_)nH*EboyWr4<}$pdnpiA`CWJsM&{jn26h6IxPBCzZzRl}+ z(8cR;z_HUEfCJZs!YEoyf~IL`LeO@kgQah+XJ^wPX4GH6k8YbwtRzA-8a;WWJR3O- zRA66a73XL#aDi=E>^pFf<|7H7d+lAi(mh-=eKOb1oQke%46Cjt5D1(eKq{3co6l2L z8aqLg$LsH_23;ia#0Iu&MbiSBu}&Q7+UB^D^I;^)pJyaU70zr|IZSlkUk~Uvs70O!8CM~wCTxYD2>Iir6QH?p{co*_>c;YC9^cOwzFd8 zTIwcE#&KOrLndQ~mouU~LOkL}6QCRjhJuvE%LoMg{mk5ezYCp95odCFj&)}^mduby zX6Q(C;}3>#5%gqo9BJ=h=&))mOOnmyIMQ~QVKvp@C_;Xn(x5>+;wK*V5%L?JtTYW> zHwlG8M57VR0>kcUI>=c8=&$(!ZXHLF&Sc2uEOL1Z={V%Fxx(`h@cVEbiJ=wUr|$J0 zO-DBj{C+#tg8&8reEIcX7`hg!C*4Au00000 LNkvXXu0mjfKflN! literal 0 HcmV?d00001 From 2b2693ae9008df5d212e268d3241cef7cb5bfe48 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 08:49:56 -0400 Subject: [PATCH 115/459] N3DS: Use asprintf instead of snprintf. --- src/file/n3ds/SDL_rwopsromfs.c | 9 +++++++-- src/filesystem/n3ds/SDL_sysfilesystem.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/file/n3ds/SDL_rwopsromfs.c b/src/file/n3ds/SDL_rwopsromfs.c index fe92c3d3b..c75323f61 100644 --- a/src/file/n3ds/SDL_rwopsromfs.c +++ b/src/file/n3ds/SDL_rwopsromfs.c @@ -20,6 +20,7 @@ */ #include "SDL_rwopsromfs.h" +#include "SDL_error.h" /* Nintendo 3DS applications may embed resources in the executable. The resources are stored in a special read-only partition prefixed with @@ -30,7 +31,7 @@ FILE * N3DS_FileOpen(const char *file, const char *mode) { FILE *fp = NULL; - char romfs_path[4096]; + char *romfs_path; /* romfs are read-only */ if (SDL_strchr(mode, 'r') == NULL) { @@ -43,13 +44,17 @@ N3DS_FileOpen(const char *file, const char *mode) return fopen(file, mode); } - SDL_snprintf(romfs_path, 4096, "romfs:/%s", file); + if (SDL_asprintf(&romfs_path, "romfs:/%s", file) < 0) { + SDL_OutOfMemory(); + return NULL; + } fp = fopen(romfs_path, mode); if (fp == NULL) { fp = fopen(file, mode); } + SDL_free(romfs_path); return fp; } diff --git a/src/filesystem/n3ds/SDL_sysfilesystem.c b/src/filesystem/n3ds/SDL_sysfilesystem.c index e402e037c..06b4cd65b 100644 --- a/src/filesystem/n3ds/SDL_sysfilesystem.c +++ b/src/filesystem/n3ds/SDL_sysfilesystem.c @@ -52,6 +52,10 @@ SDL_GetPrefPath(const char *org, const char *app) } pref_path = MakePrefPath(app); + if (pref_path == NULL) { + return NULL; + } + if (CreatePrefPathDir(pref_path) < 0) { SDL_free(pref_path); return NULL; @@ -63,10 +67,11 @@ SDL_GetPrefPath(const char *org, const char *app) SDL_FORCE_INLINE char * MakePrefPath(const char *app) { - static const char *FMT = "/3ds/%s/"; - size_t length = SDL_snprintf(NULL, 0, FMT, app) + 1; - char *pref_path = (char *) SDL_calloc(length, sizeof(char)); - SDL_snprintf(pref_path, length, FMT, app); + char *pref_path; + if (SDL_asprintf(&pref_path, "/3ds/%s/", app) < 0) { + SDL_OutOfMemory(); + return NULL; + } return pref_path; } From 03bbbcd85e503d7f142abf8981330dc993ebe6ac Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 09:06:36 -0400 Subject: [PATCH 116/459] N3DS: Use CreateJoystickGUIDForName. --- src/joystick/SDL_gamecontrollerdb.h | 2 +- src/joystick/n3ds/SDL_sysjoystick.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index a39a46d37..28afddb53 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -979,7 +979,7 @@ static const char *s_ControllerMappings [] = "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif #if SDL_JOYSTICK_N3DS - "4e696e74656e646f20334453206d6170,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,leftstick:b14,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", + "000010324e696e74656e646f20334400,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,leftstick:b14,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index f2f15c16b..f65626290 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -96,8 +96,7 @@ N3DS_JoystickGetCount(void) static SDL_JoystickGUID N3DS_JoystickGetDeviceGUID(int device_index) { - /* GUID corresponds to the name "Nintendo 3DS map" */ - SDL_JoystickGUID guid = { { 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x6f, 0x20, 0x33, 0x44, 0x53, 0x20, 0x6d, 0x61, 0x70 } }; + SDL_JoystickGUID guid = SDL_CreateJoystickGUIDForName("Nintendo 3DS"); return guid; } From af2bc2ed0e3a2c131f40aaec8acfc43a0ec759d5 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 10:52:35 -0400 Subject: [PATCH 117/459] N3DS: Use osSetSpeedupEnable instead of PTMSYSM. --- src/main/n3ds/SDL_n3ds_main.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/main/n3ds/SDL_n3ds_main.c b/src/main/n3ds/SDL_n3ds_main.c index 982dcb3c6..244d73c39 100644 --- a/src/main/n3ds/SDL_n3ds_main.c +++ b/src/main/n3ds/SDL_n3ds_main.c @@ -31,12 +31,8 @@ #endif SDL_FORCE_INLINE void N3DS_Init(void); -SDL_FORCE_INLINE void N3DS_SetCPUSpeed(void); SDL_FORCE_INLINE void N3DS_Quit(void); -#define HIGH_CLOCK 1 -#define L2_CACHE 2 - int main(int argc, char *argv[]) { @@ -51,24 +47,12 @@ main(int argc, char *argv[]) SDL_FORCE_INLINE void N3DS_Init(void) { - N3DS_SetCPUSpeed(); + osSetSpeedupEnable(true); romfsInit(); gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false); hidInit(); } -/* If available, enable L2 cache and high CPU clock */ -SDL_FORCE_INLINE void -N3DS_SetCPUSpeed(void) -{ - if (R_SUCCEEDED(ptmSysmInit())) { - if (R_SUCCEEDED(PTMSYSM_CheckNew3DS())) { - PTMSYSM_ConfigureNew3DSCPU(HIGH_CLOCK | L2_CACHE); - } - ptmSysmExit(); - } -} - SDL_FORCE_INLINE void N3DS_Quit(void) { From 46a13ad97a3ef552c0e5cdde7bf9f94970d4198e Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 12:35:32 -0400 Subject: [PATCH 118/459] N3DS: NEON is likely not supported. --- src/cpuinfo/SDL_cpuinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 6ba5c85eb..c05c88cd4 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -469,7 +469,7 @@ CPU_haveNEON(void) #elif __VITA__ return 1; #elif __3DS__ - return 1; + return 0; #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ return 1; /* all Apple ARMv7 chips and later have NEON. */ From f9785702a687b2f1b726517209c2360996d8f460 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 13:22:07 -0400 Subject: [PATCH 119/459] N3DS: Deduce screen from window's display. This removes the need for a dedicated window creation flag. --- include/SDL_video.h | 1 - src/video/SDL_video.c | 2 +- src/video/n3ds/SDL_n3dsvideo.c | 48 ++++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/include/SDL_video.h b/include/SDL_video.h index 60afda22a..d9dce43a9 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -126,7 +126,6 @@ typedef enum SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */ SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */ - SDL_WINDOW_N3DS_BOTTOM = 0x40000000, /**< window should be on the bottom screen (N3DS only) */ SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED /**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility */ } SDL_WindowFlags; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index fbeaaaaee..bb2036108 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1501,7 +1501,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_N3DS_BOTTOM) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL) static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void) diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c index 6d3babd2d..ebcb9de2e 100644 --- a/src/video/n3ds/SDL_n3dsvideo.c +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -35,9 +35,15 @@ SDL_FORCE_INLINE void AddN3DSDisplay(gfxScreen_t screen); static int N3DS_VideoInit(_THIS); static void N3DS_VideoQuit(_THIS); static void N3DS_GetDisplayModes(_THIS, SDL_VideoDisplay *display); +static int N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect); static int N3DS_CreateWindow(_THIS, SDL_Window *window); static void N3DS_DestroyWindow(_THIS, SDL_Window *window); +typedef struct +{ + gfxScreen_t screen; +} DisplayDriverData; + /* N3DS driver bootstrap functions */ static void @@ -61,6 +67,7 @@ N3DS_CreateDevice(void) device->VideoQuit = N3DS_VideoQuit; device->GetDisplayModes = N3DS_GetDisplayModes; + device->GetDisplayBounds = N3DS_GetDisplayBounds; device->CreateSDLWindow = N3DS_CreateWindow; device->DestroyWindow = N3DS_DestroyWindow; @@ -100,19 +107,27 @@ AddN3DSDisplay(gfxScreen_t screen) { SDL_DisplayMode mode; SDL_VideoDisplay display; + DisplayDriverData *display_driver_data = SDL_calloc(1, sizeof(DisplayDriverData)); + if (display_driver_data == NULL) { + SDL_OutOfMemory(); + return; + } SDL_zero(mode); SDL_zero(display); + display_driver_data->screen = screen; + mode.w = (screen == GFX_TOP) ? GSP_SCREEN_HEIGHT_TOP : GSP_SCREEN_HEIGHT_BOTTOM; mode.h = GSP_SCREEN_WIDTH; mode.refresh_rate = 60; mode.format = FRAMEBUFFER_FORMAT; mode.driverdata = NULL; + display.name = (screen == GFX_TOP) ? "N3DS top screen" : "N3DS bottom screen"; display.desktop_mode = mode; display.current_mode = mode; - display.driverdata = NULL; + display.driverdata = display_driver_data; SDL_AddVideoDisplay(&display, SDL_FALSE); } @@ -131,21 +146,32 @@ N3DS_GetDisplayModes(_THIS, SDL_VideoDisplay *display) SDL_AddDisplayMode(display, &display->current_mode); } +static int +N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) +{ + DisplayDriverData *driver_data = (DisplayDriverData *) display->driverdata; + if (driver_data == NULL) { + return -1; + } + rect->x = 0; + rect->y = (driver_data->screen == GFX_TOP) ? 0 : GSP_SCREEN_WIDTH; + rect->w = display->current_mode.w; + rect->h = display->current_mode.h; + + return 0; +} + static int N3DS_CreateWindow(_THIS, SDL_Window *window) { - SDL_WindowData *drv_data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); - if (drv_data == NULL) { + DisplayDriverData *display_data; + SDL_WindowData *window_data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (window_data == NULL) { return SDL_OutOfMemory(); } - - if (window->flags & SDL_WINDOW_N3DS_BOTTOM) { - drv_data->screen = GFX_BOTTOM; - } else { - drv_data->screen = GFX_TOP; - } - - window->driverdata = drv_data; + display_data = (DisplayDriverData *) SDL_GetDisplayDriverData(window->display_index); + window_data->screen = display_data->screen; + window->driverdata = window_data; return 0; } From 266014faa74fb33cc2dd3a8e7c5c536097d66c9e Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 13:38:26 -0400 Subject: [PATCH 120/459] N3DS: Use SDL_Touch instead of the Joystick touch. --- src/joystick/n3ds/SDL_sysjoystick.c | 30 ----------- src/video/n3ds/SDL_n3dsevents.c | 6 ++- src/video/n3ds/SDL_n3dstouch.c | 84 +++++++++++++++++++++++++++++ src/video/n3ds/SDL_n3dstouch.h | 31 +++++++++++ src/video/n3ds/SDL_n3dsvideo.c | 3 ++ 5 files changed, 122 insertions(+), 32 deletions(-) create mode 100644 src/video/n3ds/SDL_n3dstouch.c create mode 100644 src/video/n3ds/SDL_n3dstouch.h diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index f65626290..3f2d5a262 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -45,15 +45,6 @@ */ #define CORRECTION_FACTOR_Y -CORRECTION_FACTOR_X -/* - Factors used to convert touchscreen coordinates to - SDL's 0-1 values. Note that the N3DS's screen is - internally in a portrait disposition so the - GSP_SCREEN constants are flipped. -*/ -#define TOUCHPAD_SCALE_X 1.0f / GSP_SCREEN_HEIGHT_BOTTOM -#define TOUCHPAD_SCALE_Y 1.0f / GSP_SCREEN_WIDTH - typedef struct N3DSJoystickState { u32 kDown; @@ -67,7 +58,6 @@ typedef struct N3DSJoystickState SDL_FORCE_INLINE void UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state); SDL_FORCE_INLINE void UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state); SDL_FORCE_INLINE void UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state); -SDL_FORCE_INLINE void UpdateTouch(SDL_Joystick *joystick); static N3DSJoystickState current_state; static SDL_bool sensors_enabled = SDL_FALSE; @@ -116,7 +106,6 @@ N3DS_JoystickOpen(SDL_Joystick *joystick, int device_index) SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f); SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f); - SDL_PrivateJoystickAddTouchpad(joystick, 1); return 0; } @@ -132,11 +121,9 @@ static void N3DS_JoystickUpdate(SDL_Joystick *joystick) { N3DSJoystickState previous_state = current_state; - hidScanInput(); UpdateAxis(joystick, &previous_state); UpdateButtons(joystick, &previous_state); - UpdateTouch(joystick); if (sensors_enabled) { UpdateSensors(joystick, &previous_state); @@ -197,23 +184,6 @@ UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state) } } -SDL_FORCE_INLINE void -UpdateTouch(SDL_Joystick *joystick) -{ - touchPosition touch; - Uint8 state; - hidTouchRead(&touch); - state = (touch.px == 0 && touch.py == 0) ? SDL_RELEASED : SDL_PRESSED; - - SDL_PrivateJoystickTouchpad(joystick, - 0, - 0, - state, - touch.px * TOUCHPAD_SCALE_X, - touch.py * TOUCHPAD_SCALE_Y, - state == SDL_PRESSED ? 1.0f : 0.0f); -} - SDL_FORCE_INLINE void UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state) { diff --git a/src/video/n3ds/SDL_n3dsevents.c b/src/video/n3ds/SDL_n3dsevents.c index f54d68ee7..6b2126b1b 100644 --- a/src/video/n3ds/SDL_n3dsevents.c +++ b/src/video/n3ds/SDL_n3dsevents.c @@ -22,16 +22,18 @@ #ifdef SDL_VIDEO_DRIVER_N3DS -/* Pumping the events for the Home and Power buttons. */ - #include <3ds.h> #include "../../events/SDL_events_c.h" #include "SDL_n3dsevents_c.h" +#include "SDL_n3dstouch.h" void N3DS_PumpEvents(_THIS) { + hidScanInput(); + N3DS_PollTouch(); + if (!aptMainLoop()) { SDL_Event ev; ev.type = SDL_QUIT; diff --git a/src/video/n3ds/SDL_n3dstouch.c b/src/video/n3ds/SDL_n3dstouch.c new file mode 100644 index 000000000..fca0ae30f --- /dev/null +++ b/src/video/n3ds/SDL_n3dstouch.c @@ -0,0 +1,84 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../../SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_N3DS + +#include <3ds.h> + +#include "../../events/SDL_touch_c.h" +#include "SDL_n3dstouch.h" + +#define N3DS_TOUCH_ID 0 + +/* + Factors used to convert touchscreen coordinates to + SDL's 0-1 values. Note that the N3DS's screen is + internally in a portrait disposition so the + GSP_SCREEN constants are flipped. +*/ +#define TOUCHSCREEN_SCALE_X 1.0f / GSP_SCREEN_HEIGHT_BOTTOM +#define TOUCHSCREEN_SCALE_Y 1.0f / GSP_SCREEN_WIDTH + +void +N3DS_InitTouch(void) +{ + SDL_AddTouch(N3DS_TOUCH_ID, SDL_TOUCH_DEVICE_DIRECT, "Touchscreen"); +} + +void +N3DS_QuitTouch(void) +{ + SDL_DelTouch(N3DS_TOUCH_ID); +} + +void +N3DS_PollTouch(void) +{ + touchPosition touch; + static SDL_bool was_pressed = SDL_FALSE; + SDL_bool pressed; + hidTouchRead(&touch); + pressed = (touch.px != 0 || touch.py != 0); + + if (pressed != was_pressed) { + was_pressed = pressed; + SDL_SendTouch(N3DS_TOUCH_ID, + 0, + NULL, + pressed, + touch.px * TOUCHSCREEN_SCALE_X, + touch.py * TOUCHSCREEN_SCALE_Y, + pressed ? 1.0f : 0.0f); + } else if (pressed) { + SDL_SendTouchMotion(N3DS_TOUCH_ID, + 0, + NULL, + touch.px * TOUCHSCREEN_SCALE_X, + touch.py * TOUCHSCREEN_SCALE_Y, + 1.0f); + } +} + +#endif /* SDL_VIDEO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dstouch.h b/src/video/n3ds/SDL_n3dstouch.h new file mode 100644 index 000000000..4cc7a0533 --- /dev/null +++ b/src/video/n3ds/SDL_n3dstouch.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_n3dstouch_h_ +#define SDL_n3dstouch_h_ + +void N3DS_InitTouch(void); +void N3DS_QuitTouch(void); +void N3DS_PollTouch(void); + +#endif /* SDL_n3dstouch_h_ */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c index ebcb9de2e..cd5e01068 100644 --- a/src/video/n3ds/SDL_n3dsvideo.c +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -26,6 +26,7 @@ #include "SDL_n3dsevents_c.h" #include "SDL_n3dsframebuffer_c.h" #include "SDL_n3dsswkb.h" +#include "SDL_n3dstouch.h" #include "SDL_n3dsvideo.h" #define N3DSVID_DRIVER_NAME "n3ds" @@ -97,6 +98,7 @@ N3DS_VideoInit(_THIS) AddN3DSDisplay(GFX_TOP); AddN3DSDisplay(GFX_BOTTOM); + N3DS_InitTouch(); N3DS_SwkbInit(); return 0; @@ -136,6 +138,7 @@ static void N3DS_VideoQuit(_THIS) { N3DS_SwkbQuit(); + N3DS_QuitTouch(); return; } From 83ec6062af5434d1f0fc5bf9eca9a5403f4e003f Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 13:46:09 -0400 Subject: [PATCH 121/459] N3DS: Move gfxInit and hidInit from main to video. --- src/main/n3ds/SDL_n3ds_main.c | 4 ---- src/video/n3ds/SDL_n3dsvideo.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/n3ds/SDL_n3ds_main.c b/src/main/n3ds/SDL_n3ds_main.c index 244d73c39..1ccd01480 100644 --- a/src/main/n3ds/SDL_n3ds_main.c +++ b/src/main/n3ds/SDL_n3ds_main.c @@ -49,15 +49,11 @@ N3DS_Init(void) { osSetSpeedupEnable(true); romfsInit(); - gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false); - hidInit(); } SDL_FORCE_INLINE void N3DS_Quit(void) { - hidExit(); - gfxExit(); romfsExit(); } diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c index cd5e01068..e3f79cb63 100644 --- a/src/video/n3ds/SDL_n3dsvideo.c +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -95,6 +95,9 @@ VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS static int N3DS_VideoInit(_THIS) { + gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false); + hidInit(); + AddN3DSDisplay(GFX_TOP); AddN3DSDisplay(GFX_BOTTOM); @@ -139,7 +142,9 @@ N3DS_VideoQuit(_THIS) { N3DS_SwkbQuit(); N3DS_QuitTouch(); - return; + + hidExit(); + gfxExit(); } static void From c7c0e81c1ccfd63d3d3bbc59c95f8c489b4e6f2a Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 14:01:36 -0400 Subject: [PATCH 122/459] N3DS: Update README. --- docs/README-n3ds.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/README-n3ds.md b/docs/README-n3ds.md index 761c76dd6..991eaa07f 100644 --- a/docs/README-n3ds.md +++ b/docs/README-n3ds.md @@ -22,6 +22,5 @@ cmake --install build ## Notes - Currently only software rendering is supported. -- Window are created on the top screen by default, use the `SDL_WINDOW_N3DS_BOTTOM` flag to put them on the bottom screen. -- SDL2main should be used to ensure all the necessary services are initialised. -- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, [use the PTMSYSM service](https://libctru.devkitpro.org/ptmsysm_8h.html#ae3a437bfd0de05fbc5ba9a460d148430) to turn it off in your program. +- SDL2main should be used to ensure ROMFS is enabled. +- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function. From efc93e68514851475beb700bf8d250e11bb32117 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 18 Sep 2022 15:17:08 -0400 Subject: [PATCH 123/459] N3DS: Don't set `num_display` by hand. Doing so creates 2 empty displays at the beginning of the list. --- src/video/n3ds/SDL_n3dsvideo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c index e3f79cb63..73486e653 100644 --- a/src/video/n3ds/SDL_n3dsvideo.c +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -83,8 +83,6 @@ N3DS_CreateDevice(void) device->UpdateWindowFramebuffer = SDL_N3DS_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = SDL_N3DS_DestroyWindowFramebuffer; - device->num_displays = 2; - device->free = N3DS_DeleteDevice; return device; From 27557b62b6940f3280de323bb0fb23dd8c3498f6 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 20 Sep 2022 19:53:45 -0400 Subject: [PATCH 124/459] N3DS: Prefix timer sources with `N3DS_`. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48cbb6174..dd131af5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2778,8 +2778,8 @@ elseif(N3DS) if(SDL_TIMERS) set(SDL_TIMER_N3DS 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/n3ds/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + file(GLOB N3DS_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() From 392f3882d03c7cb7c920b43bb7f94a206d77f737 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 20 Sep 2022 22:45:24 -0400 Subject: [PATCH 125/459] N3DS: Use SDL_Sensor instead of Joystick sensors. --- CMakeLists.txt | 7 + include/SDL_config.h.cmake | 1 + src/joystick/n3ds/SDL_sysjoystick.c | 42 +----- src/sensor/SDL_sensor.c | 9 +- src/sensor/SDL_syssensor.h | 1 + src/sensor/n3ds/SDL_n3dssensor.c | 218 ++++++++++++++++++++++++++++ 6 files changed, 234 insertions(+), 44 deletions(-) create mode 100644 src/sensor/n3ds/SDL_n3dssensor.c diff --git a/CMakeLists.txt b/CMakeLists.txt index dd131af5c..badb86182 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2783,6 +2783,13 @@ elseif(N3DS) set(HAVE_SDL_TIMERS TRUE) endif() + if(SDL_SENSOR) + set(SDL_SENSOR_N3DS 1) + file(GLOB N3DS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_SENSOR_SOURCES}) + set(HAVE_SDL_SENSORS TRUE) + endif() + if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_N3DS 1) file(GLOB N3DS_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/n3ds/*.c) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 6dc89a4a3..6daeadfa0 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -365,6 +365,7 @@ #cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@ #cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@ #cmakedefine SDL_SENSOR_VITA @SDL_SENSOR_VITA@ +#cmakedefine SDL_SENSOR_N3DS @SDL_SENSOR_N3DS@ /* Enable various shared object loading systems */ #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index 3f2d5a262..1b98462ad 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -51,23 +51,17 @@ typedef struct N3DSJoystickState u32 kUp; circlePosition circlePos; circlePosition cStickPos; - accelVector acceleration; - angularRate rate; } N3DSJoystickState; SDL_FORCE_INLINE void UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state); SDL_FORCE_INLINE void UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state); -SDL_FORCE_INLINE void UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state); static N3DSJoystickState current_state; -static SDL_bool sensors_enabled = SDL_FALSE; static int N3DS_JoystickInit(void) { hidInit(); - HIDUSER_EnableAccelerometer(); - HIDUSER_EnableGyroscope(); return 0; } @@ -104,17 +98,13 @@ N3DS_JoystickOpen(SDL_Joystick *joystick, int device_index) joystick->nhats = 0; joystick->instance_id = device_index; - SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f); - SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f); - return 0; } static int N3DS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) { - sensors_enabled = enabled; - return 0; + return SDL_Unsupported(); } static void @@ -124,10 +114,6 @@ N3DS_JoystickUpdate(SDL_Joystick *joystick) UpdateAxis(joystick, &previous_state); UpdateButtons(joystick, &previous_state); - - if (sensors_enabled) { - UpdateSensors(joystick, &previous_state); - } } SDL_FORCE_INLINE void @@ -184,30 +170,6 @@ UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state) } } -SDL_FORCE_INLINE void -UpdateSensors(SDL_Joystick *joystick, N3DSJoystickState *previous_state) -{ - float data[3]; - - hidAccelRead(¤t_state.acceleration); - if (SDL_memcmp(&previous_state->acceleration, ¤t_state.acceleration, sizeof(accelVector)) != 0) { - SDL_memcpy(&previous_state->acceleration, ¤t_state.acceleration, sizeof(accelVector)); - data[0] = (float) current_state.acceleration.x * SDL_STANDARD_GRAVITY; - data[1] = (float) current_state.acceleration.y * SDL_STANDARD_GRAVITY; - data[2] = (float) current_state.acceleration.z * SDL_STANDARD_GRAVITY; - SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, data, sizeof data); - } - - hidGyroRead(¤t_state.rate); - if (SDL_memcmp(&previous_state->rate, ¤t_state.rate, sizeof(angularRate)) != 0) { - SDL_memcpy(&previous_state->rate, ¤t_state.rate, sizeof(angularRate)); - data[0] = (float) current_state.rate.y; - data[1] = (float) current_state.rate.z; - data[2] = (float) current_state.rate.x; - SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, data, sizeof data); - } -} - static void N3DS_JoystickClose(SDL_Joystick *joystick) { @@ -216,8 +178,6 @@ N3DS_JoystickClose(SDL_Joystick *joystick) static void N3DS_JoystickQuit(void) { - HIDUSER_DisableGyroscope(); - HIDUSER_DisableAccelerometer(); hidExit(); } diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index ba86528e4..6db4c633f 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -41,12 +41,15 @@ static SDL_SensorDriver *SDL_sensor_drivers[] = { #ifdef SDL_SENSOR_WINDOWS &SDL_WINDOWS_SensorDriver, #endif +#ifdef SDL_SENSOR_VITA + &SDL_VITA_SensorDriver, +#endif +#ifdef SDL_SENSOR_N3DS + &SDL_N3DS_SensorDriver, +#endif #if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED) &SDL_DUMMY_SensorDriver #endif -#if defined(SDL_SENSOR_VITA) - &SDL_VITA_SensorDriver -#endif }; static SDL_Sensor *SDL_sensors = NULL; static SDL_bool SDL_updating_sensor = SDL_FALSE; diff --git a/src/sensor/SDL_syssensor.h b/src/sensor/SDL_syssensor.h index 6e601a278..30d44009a 100644 --- a/src/sensor/SDL_syssensor.h +++ b/src/sensor/SDL_syssensor.h @@ -102,6 +102,7 @@ extern SDL_SensorDriver SDL_COREMOTION_SensorDriver; extern SDL_SensorDriver SDL_WINDOWS_SensorDriver; extern SDL_SensorDriver SDL_DUMMY_SensorDriver; extern SDL_SensorDriver SDL_VITA_SensorDriver; +extern SDL_SensorDriver SDL_N3DS_SensorDriver; #endif /* SDL_syssensor_h_ */ diff --git a/src/sensor/n3ds/SDL_n3dssensor.c b/src/sensor/n3ds/SDL_n3dssensor.c new file mode 100644 index 000000000..7204fcc78 --- /dev/null +++ b/src/sensor/n3ds/SDL_n3dssensor.c @@ -0,0 +1,218 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../../SDL_internal.h" + +#ifdef SDL_SENSOR_N3DS + +#include <3ds.h> + +#include "../SDL_syssensor.h" + +/* 1 accelerometer and 1 gyroscope */ +#define N3DS_SENSOR_COUNT 2 + +typedef struct +{ + SDL_SensorType type; + SDL_SensorID instance_id; +} SDL_N3DSSensor; + +static SDL_N3DSSensor N3DS_sensors[N3DS_SENSOR_COUNT]; + +SDL_FORCE_INLINE int InitN3DSServices(void); +SDL_FORCE_INLINE void UpdateN3DSAccelerometer(SDL_Sensor *sensor); +SDL_FORCE_INLINE void UpdateN3DSGyroscope(SDL_Sensor *sensor); + +SDL_FORCE_INLINE SDL_bool +IsDeviceIndexValid(int device_index) +{ + return device_index >= 0 && device_index < N3DS_SENSOR_COUNT; +} + +static int +N3DS_SensorInit(void) +{ + if (InitN3DSServices() < 0) { + return SDL_SetError("Failed to initialise N3DS services"); + } + + N3DS_sensors[0].type = SDL_SENSOR_ACCEL; + N3DS_sensors[0].instance_id = SDL_GetNextSensorInstanceID(); + N3DS_sensors[1].type = SDL_SENSOR_GYRO; + N3DS_sensors[1].instance_id = SDL_GetNextSensorInstanceID(); + return 0; +} + +SDL_FORCE_INLINE int +InitN3DSServices(void) +{ + if (R_FAILED(hidInit())) { + return -1; + } + + if (R_FAILED(HIDUSER_EnableAccelerometer())) { + return -1; + } + + if (R_FAILED(HIDUSER_EnableGyroscope())) { + return -1; + } + return 0; +} + +static int +N3DS_SensorGetCount(void) +{ + return N3DS_SENSOR_COUNT; +} + +static void +N3DS_SensorDetect(void) +{ +} + +static const char * +N3DS_SensorGetDeviceName(int device_index) +{ + if (IsDeviceIndexValid(device_index)) { + switch (N3DS_sensors[device_index].type) { + case SDL_SENSOR_ACCEL: + return "Accelerometer"; + case SDL_SENSOR_GYRO: + return "Gyroscope"; + default: + return "Unknown"; + } + } + + return NULL; +} + +static SDL_SensorType +N3DS_SensorGetDeviceType(int device_index) +{ + if (IsDeviceIndexValid(device_index)) { + return N3DS_sensors[device_index].type; + } + return SDL_SENSOR_INVALID; +} + +static int +N3DS_SensorGetDeviceNonPortableType(int device_index) +{ + return (int) N3DS_SensorGetDeviceType(device_index); +} + +static SDL_SensorID +N3DS_SensorGetDeviceInstanceID(int device_index) +{ + if (IsDeviceIndexValid(device_index)) { + return N3DS_sensors[device_index].instance_id; + } + return -1; +} + +static int +N3DS_SensorOpen(SDL_Sensor *sensor, int device_index) +{ + return 0; +} + +static void +N3DS_SensorUpdate(SDL_Sensor *sensor) +{ + switch (sensor->type) { + case SDL_SENSOR_ACCEL: + UpdateN3DSAccelerometer(sensor); + break; + case SDL_SENSOR_GYRO: + UpdateN3DSGyroscope(sensor); + break; + default: + break; + } +} + +SDL_FORCE_INLINE void +UpdateN3DSAccelerometer(SDL_Sensor *sensor) +{ + static accelVector previous_state = { 0, 0, 0 }; + accelVector current_state; + float data[3]; + + hidAccelRead(¤t_state); + if (SDL_memcmp(&previous_state, ¤t_state, sizeof(accelVector)) != 0) { + SDL_memcpy(&previous_state, ¤t_state, sizeof(accelVector)); + data[0] = (float) current_state.x * SDL_STANDARD_GRAVITY; + data[1] = (float) current_state.y * SDL_STANDARD_GRAVITY; + data[2] = (float) current_state.z * SDL_STANDARD_GRAVITY; + SDL_PrivateSensorUpdate(sensor, data, sizeof data); + } +} + +SDL_FORCE_INLINE void +UpdateN3DSGyroscope(SDL_Sensor *sensor) +{ + static angularRate previous_state = { 0, 0, 0 }; + angularRate current_state; + float data[3]; + + hidGyroRead(¤t_state); + if (SDL_memcmp(&previous_state, ¤t_state, sizeof(angularRate)) != 0) { + SDL_memcpy(&previous_state, ¤t_state, sizeof(angularRate)); + data[0] = (float) current_state.x; + data[1] = (float) current_state.y; + data[2] = (float) current_state.z; + SDL_PrivateSensorUpdate(sensor, data, sizeof data); + } +} + +static void +N3DS_SensorClose(SDL_Sensor *sensor) +{ +} + +static void +N3DS_SensorQuit(void) +{ + HIDUSER_DisableGyroscope(); + HIDUSER_DisableAccelerometer(); + hidExit(); +} + +SDL_SensorDriver SDL_N3DS_SensorDriver = { + N3DS_SensorInit, + N3DS_SensorGetCount, + N3DS_SensorDetect, + N3DS_SensorGetDeviceName, + N3DS_SensorGetDeviceType, + N3DS_SensorGetDeviceNonPortableType, + N3DS_SensorGetDeviceInstanceID, + N3DS_SensorOpen, + N3DS_SensorUpdate, + N3DS_SensorClose, + N3DS_SensorQuit, +}; + +#endif /* SDL_SENSOR_N3DS */ + +/* vi: set ts=4 sw=4 expandtab: */ From 86a8714feab1a93be67da1eae8a406f9e158bf0f Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 20 Sep 2022 23:04:20 -0400 Subject: [PATCH 126/459] N3DS: Refactor joystick module to avoid globals. --- src/joystick/n3ds/SDL_sysjoystick.c | 116 +++++++++++++++------------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index 1b98462ad..6525d5100 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -45,18 +45,10 @@ */ #define CORRECTION_FACTOR_Y -CORRECTION_FACTOR_X -typedef struct N3DSJoystickState -{ - u32 kDown; - u32 kUp; - circlePosition circlePos; - circlePosition cStickPos; -} N3DSJoystickState; - -SDL_FORCE_INLINE void UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state); -SDL_FORCE_INLINE void UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state); - -static N3DSJoystickState current_state; +SDL_FORCE_INLINE void UpdateN3DSPressedButtons(SDL_Joystick *joystick); +SDL_FORCE_INLINE void UpdateN3DSReleasedButtons(SDL_Joystick *joystick); +SDL_FORCE_INLINE void UpdateN3DSCircle(SDL_Joystick *joystick); +SDL_FORCE_INLINE void UpdateN3DSCStick(SDL_Joystick *joystick); static int N3DS_JoystickInit(void) @@ -110,64 +102,82 @@ N3DS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) static void N3DS_JoystickUpdate(SDL_Joystick *joystick) { - N3DSJoystickState previous_state = current_state; - - UpdateAxis(joystick, &previous_state); - UpdateButtons(joystick, &previous_state); + UpdateN3DSPressedButtons(joystick); + UpdateN3DSReleasedButtons(joystick); + UpdateN3DSCircle(joystick); + UpdateN3DSCStick(joystick); } SDL_FORCE_INLINE void -UpdateAxis(SDL_Joystick *joystick, N3DSJoystickState *previous_state) +UpdateN3DSPressedButtons(SDL_Joystick *joystick) { - hidCircleRead(¤t_state.circlePos); - if (previous_state->circlePos.dx != current_state.circlePos.dx) { - SDL_PrivateJoystickAxis(joystick, - 0, - current_state.circlePos.dx * CORRECTION_FACTOR_X); - } - if (previous_state->circlePos.dy != current_state.circlePos.dy) { - SDL_PrivateJoystickAxis(joystick, - 1, - current_state.circlePos.dy * CORRECTION_FACTOR_Y); - } - - hidCstickRead(¤t_state.cStickPos); - if (previous_state->cStickPos.dx != current_state.cStickPos.dx) { - SDL_PrivateJoystickAxis(joystick, - 2, - current_state.cStickPos.dx * CORRECTION_FACTOR_X); - } - if (previous_state->cStickPos.dy != current_state.cStickPos.dy) { - SDL_PrivateJoystickAxis(joystick, - 3, - current_state.cStickPos.dy * CORRECTION_FACTOR_Y); - } -} - -SDL_FORCE_INLINE void -UpdateButtons(SDL_Joystick *joystick, N3DSJoystickState *previous_state) -{ - u32 updated_down, updated_up; - - current_state.kDown = hidKeysDown(); - updated_down = previous_state->kDown ^ current_state.kDown; + static u32 previous_state = 0; + u32 updated_down; + u32 current_state = hidKeysDown(); + updated_down = previous_state ^ current_state; if (updated_down) { for (Uint8 i = 0; i < joystick->nbuttons; i++) { - if (current_state.kDown & BIT(i) & updated_down) { + if (current_state & BIT(i) & updated_down) { SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED); } } } + previous_state = current_state; +} - current_state.kUp = hidKeysUp(); - updated_up = previous_state->kUp ^ current_state.kUp; +SDL_FORCE_INLINE void +UpdateN3DSReleasedButtons(SDL_Joystick *joystick) +{ + static u32 previous_state = 0; + u32 updated_up; + u32 current_state = hidKeysUp(); + updated_up = previous_state ^ current_state; if (updated_up) { for (Uint8 i = 0; i < joystick->nbuttons; i++) { - if (current_state.kUp & BIT(i) & updated_up) { + if (current_state & BIT(i) & updated_up) { SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED); } } } + previous_state = current_state; +} + +SDL_FORCE_INLINE void +UpdateN3DSCircle(SDL_Joystick *joystick) +{ + static circlePosition previous_state = { 0, 0 }; + circlePosition current_state; + hidCircleRead(¤t_state); + if (previous_state.dx != current_state.dx) { + SDL_PrivateJoystickAxis(joystick, + 0, + current_state.dx * CORRECTION_FACTOR_X); + } + if (previous_state.dy != current_state.dy) { + SDL_PrivateJoystickAxis(joystick, + 1, + current_state.dy * CORRECTION_FACTOR_Y); + } + previous_state = current_state; +} + +SDL_FORCE_INLINE void +UpdateN3DSCStick(SDL_Joystick *joystick) +{ + static circlePosition previous_state = { 0, 0 }; + circlePosition current_state; + hidCstickRead(¤t_state); + if (previous_state.dx != current_state.dx) { + SDL_PrivateJoystickAxis(joystick, + 2, + current_state.dx * CORRECTION_FACTOR_X); + } + if (previous_state.dy != current_state.dy) { + SDL_PrivateJoystickAxis(joystick, + 3, + current_state.dy * CORRECTION_FACTOR_Y); + } + previous_state = current_state; } static void From cb1972b3ba37fa7930764e462bc64fb20a4a9112 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 20 Sep 2022 23:07:04 -0400 Subject: [PATCH 127/459] N3DS: ZL and ZR should be considered as triggers. Previously they were considered as clicking stick. --- src/joystick/SDL_gamecontrollerdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 28afddb53..b261dad5e 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -979,7 +979,7 @@ static const char *s_ControllerMappings [] = "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif #if SDL_JOYSTICK_N3DS - "000010324e696e74656e646f20334400,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,leftstick:b14,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", + "000010324e696e74656e646f20334400,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL From 49c25b1dafc207498a79ffba16ce46ae7680c3e1 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 9 Oct 2022 23:49:00 -0400 Subject: [PATCH 128/459] N3DS: Fix PrivateSensorUpdate call. A new timestamp parameter was added in 2c51874. --- src/sensor/n3ds/SDL_n3dssensor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sensor/n3ds/SDL_n3dssensor.c b/src/sensor/n3ds/SDL_n3dssensor.c index 7204fcc78..a435ae236 100644 --- a/src/sensor/n3ds/SDL_n3dssensor.c +++ b/src/sensor/n3ds/SDL_n3dssensor.c @@ -165,7 +165,7 @@ UpdateN3DSAccelerometer(SDL_Sensor *sensor) data[0] = (float) current_state.x * SDL_STANDARD_GRAVITY; data[1] = (float) current_state.y * SDL_STANDARD_GRAVITY; data[2] = (float) current_state.z * SDL_STANDARD_GRAVITY; - SDL_PrivateSensorUpdate(sensor, data, sizeof data); + SDL_PrivateSensorUpdate(sensor, 0, data, sizeof data); } } @@ -182,7 +182,7 @@ UpdateN3DSGyroscope(SDL_Sensor *sensor) data[0] = (float) current_state.x; data[1] = (float) current_state.y; data[2] = (float) current_state.z; - SDL_PrivateSensorUpdate(sensor, data, sizeof data); + SDL_PrivateSensorUpdate(sensor, 0, data, sizeof data); } } From 43a2b0b1e5637409f93a5763e6704f87012def07 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 00:00:52 -0400 Subject: [PATCH 129/459] N3DS: Use macro to correct axis. Using `(value * SDL max) / 3DS max` allows for marginally better accuracy compared to `value * (SDL max / 3DS max)`. --- src/joystick/n3ds/SDL_sysjoystick.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index 6525d5100..ea00a6d69 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -34,16 +34,16 @@ /* N3DS sticks values are roughly within +/-160 which is too small to pass the jitter tolerance. - This correction factor is applied to axis values + This correction is applied to axis values so they fit better in SDL's value range. */ -#define CORRECTION_FACTOR_X SDL_JOYSTICK_AXIS_MAX / 160 +#define CORRECT_AXIS_X(X) ((X * SDL_JOYSTICK_AXIS_MAX) / 160) /* The Y axis needs to be flipped because SDL's "up" is reversed compared to libctru's "up" */ -#define CORRECTION_FACTOR_Y -CORRECTION_FACTOR_X +#define CORRECT_AXIS_Y(Y) CORRECT_AXIS_X(-Y) SDL_FORCE_INLINE void UpdateN3DSPressedButtons(SDL_Joystick *joystick); SDL_FORCE_INLINE void UpdateN3DSReleasedButtons(SDL_Joystick *joystick); @@ -151,12 +151,12 @@ UpdateN3DSCircle(SDL_Joystick *joystick) if (previous_state.dx != current_state.dx) { SDL_PrivateJoystickAxis(joystick, 0, - current_state.dx * CORRECTION_FACTOR_X); + CORRECT_AXIS_X(current_state.dx)); } if (previous_state.dy != current_state.dy) { SDL_PrivateJoystickAxis(joystick, 1, - current_state.dy * CORRECTION_FACTOR_Y); + CORRECT_AXIS_Y(current_state.dy)); } previous_state = current_state; } @@ -170,12 +170,12 @@ UpdateN3DSCStick(SDL_Joystick *joystick) if (previous_state.dx != current_state.dx) { SDL_PrivateJoystickAxis(joystick, 2, - current_state.dx * CORRECTION_FACTOR_X); + CORRECT_AXIS_X(current_state.dx)); } if (previous_state.dy != current_state.dy) { SDL_PrivateJoystickAxis(joystick, 3, - current_state.dy * CORRECTION_FACTOR_Y); + CORRECT_AXIS_Y(current_state.dy)); } previous_state = current_state; } From 6784d84c9dec5177b26f71ea6cd7ebb396a195af Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 01:31:14 -0400 Subject: [PATCH 130/459] N3DS: Fix `-Wformat` warnings in tests. All warnings were about invalid specifiers. Since U/Sint32 is a long, using `%d` emits a -Wformat warning. --- test/checkkeysthreads.c | 3 ++- test/controllermap.c | 6 +++--- test/testautomation_audio.c | 10 ++++----- test/testautomation_guid.c | 2 +- test/testautomation_keyboard.c | 26 +++++++++++------------ test/testautomation_math.c | 12 +++++------ test/testautomation_mouse.c | 16 +++++++------- test/testautomation_pixels.c | 24 ++++++++++----------- test/testautomation_platform.c | 2 +- test/testautomation_rwops.c | 28 ++++++++++++------------- test/testautomation_sdltest.c | 28 ++++++++++++------------- test/testautomation_timer.c | 10 ++++----- test/testautomation_video.c | 10 ++++----- test/testgamecontroller.c | 38 ++++++++++++++++------------------ test/testhotplug.c | 4 ++-- test/testime.c | 17 ++++++++------- test/testjoystick.c | 26 +++++++++++------------ test/testoffscreen.c | 6 +++--- test/testplatform.c | 5 +++-- test/testrendertarget.c | 2 +- test/testsem.c | 12 +++++------ test/testsensor.c | 12 +++++------ test/testtimer.c | 2 +- test/testvulkan.c | 2 +- test/testwm2.c | 18 ++++++++-------- test/testyuv.c | 2 +- 26 files changed, 162 insertions(+), 161 deletions(-) diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c index 62d522609..0716d0f7c 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -162,7 +162,8 @@ loop() fprintf(stderr, "starting loop\n"); fflush(stderr); // while (SDL_PollEvent(&event)) { while (!done && SDL_WaitEvent(&event)) { - fprintf(stderr, "got event type: %d\n", event.type); fflush(stderr); + fprintf(stderr, "got event type: %" SDL_PRIu32 "\n", event.type); + fflush(stderr); switch (event.type) { case SDL_KEYDOWN: case SDL_KEYUP: diff --git a/test/controllermap.c b/test/controllermap.c index 43bf79390..5905b8a58 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -373,8 +373,8 @@ WatchJoystick(SDL_Joystick * joystick) /* Print info about the joystick we are watching */ name = SDL_JoystickName(joystick); - SDL_Log("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick), - name ? name : "Unknown Joystick"); + SDL_Log("Watching joystick %" SDL_PRIs32 ": (%s)\n", SDL_JoystickInstanceID(joystick), + name ? name : "Unknown Joystick"); SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n", SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick), SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick)); @@ -781,7 +781,7 @@ main(int argc, char *argv[]) SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); - SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); + SDL_Log("instance id: %" SDL_PRIu32 "\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index dd7ef3f11..e6127b573 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -725,7 +725,7 @@ int audio_openCloseAndGetAudioStatus() /* Open device */ id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); - SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id); + SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %" SDL_PRIu32, id); if (id > 1) { /* Check device audio status */ @@ -783,11 +783,11 @@ int audio_lockUnlockOpenAudioDevice() /* Open device */ id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); - SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id); + SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %" SDL_PRIu32, id); if (id > 1) { /* Lock to protect callback */ SDL_LockAudioDevice(id); - SDLTest_AssertPass("SDL_LockAudioDevice(%i)", id); + SDLTest_AssertPass("SDL_LockAudioDevice(%" SDL_PRIu32 ")", id); /* Simulate callback processing */ SDL_Delay(10); @@ -795,7 +795,7 @@ int audio_lockUnlockOpenAudioDevice() /* Unlock again */ SDL_UnlockAudioDevice(id); - SDLTest_AssertPass("SDL_UnlockAudioDevice(%i)", id); + SDLTest_AssertPass("SDL_UnlockAudioDevice(%" SDL_PRIu32 ")", id); /* Close device again */ SDL_CloseAudioDevice(id); @@ -945,7 +945,7 @@ int audio_openCloseAudioDeviceConnected() /* Open device */ id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); - SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %i", id); + SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %" SDL_PRIu32, id); if (id > 1) { /* TODO: enable test code when function is available in SDL2 */ diff --git a/test/testautomation_guid.c b/test/testautomation_guid.c index 0bfedebde..bab2b9fd5 100644 --- a/test/testautomation_guid.c +++ b/test/testautomation_guid.c @@ -108,7 +108,7 @@ TestGuidToString(void *arg) /* Check bytes before guid_str_buf */ expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24); SDL_memcpy(&actual_prefix, guid_str_buf, 4); - SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %i, got: %i, at size=%d", expected_prefix, actual_prefix, size); + SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32 ", at size=%d", expected_prefix, actual_prefix, size); /* Check that we did not overwrite too much */ written_size = 0; diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index 84a763589..a83f536dd 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -67,37 +67,37 @@ keyboard_getKeyFromName(void *arg) /* Case where Key is known, 1 character input */ result = SDL_GetKeyFromName("A"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)"); - SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %i", SDLK_a, result); + SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_a, result); /* Case where Key is known, 2 character input */ result = SDL_GetKeyFromName("F1"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)"); - SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %i, got: %i", SDLK_F1, result); + SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_F1, result); /* Case where Key is known, 3 character input */ result = SDL_GetKeyFromName("End"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)"); - SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %i, got: %i", SDLK_END, result); + SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_END, result); /* Case where Key is known, 4 character input */ result = SDL_GetKeyFromName("Find"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)"); - SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %i, got: %i", SDLK_FIND, result); + SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_FIND, result); /* Case where Key is known, multiple character input */ result = SDL_GetKeyFromName("AudioStop"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)"); - SDLTest_AssertCheck(result == SDLK_AUDIOSTOP, "Verify result from call, expected: %i, got: %i", SDLK_AUDIOSTOP, result); + SDLTest_AssertCheck(result == SDLK_AUDIOSTOP, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_AUDIOSTOP, result); /* Case where Key is unknown */ result = SDL_GetKeyFromName("NotThere"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); /* Case where input is NULL/invalid */ result = SDL_GetKeyFromName(NULL); SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); return TEST_COMPLETED; } @@ -134,12 +134,12 @@ keyboard_getKeyFromScancode(void *arg) /* Case where input is valid */ result = SDL_GetKeyFromScancode(SDL_SCANCODE_A); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); - SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %i", SDLK_a, result); + SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_a, result); /* Case where input is zero */ result = SDL_GetKeyFromScancode(0); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); /* Clear error message */ SDL_ClearError(); @@ -148,13 +148,13 @@ keyboard_getKeyFromScancode(void *arg) /* Case where input is invalid (too small) */ result = SDL_GetKeyFromScancode(-999); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); _checkInvalidScancodeError(); /* Case where input is invalid (too big) */ result = SDL_GetKeyFromScancode(999); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); _checkInvalidScancodeError(); return TEST_COMPLETED; @@ -258,7 +258,7 @@ keyboard_getKeyNameNegative(void *arg) /* Unknown keycode */ keycode = SDLK_UNKNOWN; result = (char *)SDL_GetKeyName(keycode); - SDLTest_AssertPass("Call to SDL_GetKeyName(%d/unknown)", keycode); + SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/unknown)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); @@ -269,7 +269,7 @@ keyboard_getKeyNameNegative(void *arg) /* Negative keycode */ keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1); result = (char *)SDL_GetKeyName(keycode); - SDLTest_AssertPass("Call to SDL_GetKeyName(%d/negative)", keycode); + SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/negative)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); _checkInvalidScancodeError(); diff --git a/test/testautomation_math.c b/test/testautomation_math.c index eee05dab2..bdf5703a2 100644 --- a/test/testautomation_math.c +++ b/test/testautomation_math.c @@ -183,7 +183,7 @@ helper_range(const char *func_name, d_to_d_func func) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("%s: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("%s: Testing a range of %u values with steps of %" SDL_PRIu32, func_name, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); @@ -770,7 +770,7 @@ copysign_rangeTest(void *args) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("Copysign: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("Copysign: Testing a range of %u values with steps of %" SDL_PRIu32, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); @@ -973,7 +973,7 @@ fmod_rangeTest(void *args) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("Fmod: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("Fmod: Testing a range of %u values with steps of %" SDL_PRIu32, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); @@ -1684,7 +1684,7 @@ pow_rangeTest(void *args) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("Pow: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("Pow: Testing a range of %u values with steps of %" SDL_PRIu32, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); @@ -2011,7 +2011,7 @@ cos_rangeTest(void *args) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("Cos: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("Cos: Testing a range of %u values with steps of %" SDL_PRIu32, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); @@ -2129,7 +2129,7 @@ sin_rangeTest(void *args) Uint32 i; double test_value = 0.0; - SDLTest_AssertPass("Sin: Testing a range of %u values with steps of %u", + SDLTest_AssertPass("Sin: Testing a range of %u values with steps of %" SDL_PRIu32, RANGE_TEST_ITERATIONS, RANGE_TEST_STEP); diff --git a/test/testautomation_mouse.c b/test/testautomation_mouse.c index b9e74cb35..f8334803e 100644 --- a/test/testautomation_mouse.c +++ b/test/testautomation_mouse.c @@ -41,21 +41,21 @@ mouse_getMouseState(void *arg) /* Case where x, y pointer is NULL */ state = SDL_GetMouseState(NULL, NULL); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, NULL)"); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where x pointer is not NULL */ x = INT_MIN; state = SDL_GetMouseState(&x, NULL); SDLTest_AssertPass("Call to SDL_GetMouseState(&x, NULL)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where y pointer is not NULL */ y = INT_MIN; state = SDL_GetMouseState(NULL, &y); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, &y)"); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where x and y pointer is not NULL */ x = INT_MIN; @@ -64,7 +64,7 @@ mouse_getMouseState(void *arg) SDLTest_AssertPass("Call to SDL_GetMouseState(&x, &y)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); return TEST_COMPLETED; } @@ -87,21 +87,21 @@ mouse_getRelativeMouseState(void *arg) /* Case where x, y pointer is NULL */ state = SDL_GetRelativeMouseState(NULL, NULL); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, NULL)"); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where x pointer is not NULL */ x = INT_MIN; state = SDL_GetRelativeMouseState(&x, NULL); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, NULL)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where y pointer is not NULL */ y = INT_MIN; state = SDL_GetRelativeMouseState(NULL, &y); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, &y)"); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); /* Case where x and y pointer is not NULL */ x = INT_MIN; @@ -110,7 +110,7 @@ mouse_getRelativeMouseState(void *arg) SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, &y)"); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); - SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); + SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state); return TEST_COMPLETED; } diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c index 0f6870c9a..63b177f18 100644 --- a/test/testautomation_pixels.c +++ b/test/testautomation_pixels.c @@ -137,18 +137,18 @@ pixels_allocFreeFormat(void *arg) /* Blank/unknown format */ format = 0; - SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format); + SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format); /* Allocate format */ result = SDL_AllocFormat(format); SDLTest_AssertPass("Call to SDL_AllocFormat()"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); if (result != NULL) { - SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format); + SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format); SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel); SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel); masks = result->Rmask | result->Gmask | result->Bmask | result->Amask; - SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %u", masks); + SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %" SDL_PRIu32, masks); /* Deallocate again */ SDL_FreeFormat(result); @@ -158,19 +158,19 @@ pixels_allocFreeFormat(void *arg) /* RGB formats */ for (i = 0; i < _numRGBPixelFormats; i++) { format = _RGBPixelFormats[i]; - SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format); + SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", _RGBPixelFormatsVerbose[i], format); /* Allocate format */ result = SDL_AllocFormat(format); SDLTest_AssertPass("Call to SDL_AllocFormat()"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); if (result != NULL) { - SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format); + SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format); SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel); SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel); if (result->palette != NULL) { masks = result->Rmask | result->Gmask | result->Bmask | result->Amask; - SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %u", masks); + SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks); } /* Deallocate again */ @@ -182,7 +182,7 @@ pixels_allocFreeFormat(void *arg) /* Non-RGB formats */ for (i = 0; i < _numNonRGBPixelFormats; i++) { format = _nonRGBPixelFormats[i]; - SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format); + SDLTest_Log("non-RGB Format: %s (%" SDL_PRIu32 ")", _nonRGBPixelFormatsVerbose[i], format); /* Try to allocate format */ result = SDL_AllocFormat(format); @@ -198,7 +198,7 @@ pixels_allocFreeFormat(void *arg) SDLTest_AssertPass("Call to SDL_ClearError()"); format = _invalidPixelFormats[i]; result = SDL_AllocFormat(format); - SDLTest_AssertPass("Call to SDL_AllocFormat(%u)", format); + SDLTest_AssertPass("Call to SDL_AllocFormat(%" SDL_PRIu32 ")", format); SDLTest_AssertCheck(result == NULL, "Verify result is NULL"); error = SDL_GetError(); SDLTest_AssertPass("Call to SDL_GetError()"); @@ -241,7 +241,7 @@ pixels_getPixelFormatName(void *arg) /* Blank/undefined format */ format = 0; - SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format); + SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format); /* Get name of format */ result = SDL_GetPixelFormatName(format); @@ -256,7 +256,7 @@ pixels_getPixelFormatName(void *arg) /* RGB formats */ for (i = 0; i < _numRGBPixelFormats; i++) { format = _RGBPixelFormats[i]; - SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format); + SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", _RGBPixelFormatsVerbose[i], format); /* Get name of format */ result = SDL_GetPixelFormatName(format); @@ -272,7 +272,7 @@ pixels_getPixelFormatName(void *arg) /* Non-RGB formats */ for (i = 0; i < _numNonRGBPixelFormats; i++) { format = _nonRGBPixelFormats[i]; - SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format); + SDLTest_Log("non-RGB Format: %s (%" SDL_PRIu32 ")", _nonRGBPixelFormatsVerbose[i], format); /* Get name of format */ result = SDL_GetPixelFormatName(format); @@ -293,7 +293,7 @@ pixels_getPixelFormatName(void *arg) for (i = 0; i < _numInvalidPixelFormats; i++) { format = _invalidPixelFormats[i]; result = SDL_GetPixelFormatName(format); - SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format); + SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%" SDL_PRIu32 ")", format); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); if (result != NULL) { SDLTest_AssertCheck(result[0] != '\0', diff --git a/test/testautomation_platform.c b/test/testautomation_platform.c index 0b37dd931..e86614884 100644 --- a/test/testautomation_platform.c +++ b/test/testautomation_platform.c @@ -106,7 +106,7 @@ int platform_testEndianessAndSwap(void *arg) /* Test 32 swap. */ SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32, - "SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X", + "SDL_Swap32(): 32 bit swapped: 0x%" SDL_PRIX32 " => 0x%" SDL_PRIX32, value32, SDL_Swap32(value32) ); /* Test 64 swap. */ diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c index f2d5627e5..16d540752 100644 --- a/test/testautomation_rwops.c +++ b/test/testautomation_rwops.c @@ -239,7 +239,7 @@ rwops_testMem (void) if (rw == NULL) return TEST_ABORTED; /* Check type */ - SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %d", SDL_RWOPS_MEMORY, rw->type); + SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY, rw->type); /* Run generic tests */ _testGenericRWopsValidations(rw, 1); @@ -275,7 +275,7 @@ rwops_testConstMem (void) if (rw == NULL) return TEST_ABORTED; /* Check type */ - SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %d", SDL_RWOPS_MEMORY_RO, rw->type); + SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY_RO, rw->type); /* Run generic tests */ _testGenericRWopsValidations( rw, 0 ); @@ -321,8 +321,8 @@ rwops_testFileRead(void) "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type); #else SDLTest_AssertCheck( - rw->type == SDL_RWOPS_STDFILE, - "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); + rw->type == SDL_RWOPS_STDFILE, + "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type); #endif /* Run generic tests */ @@ -368,8 +368,8 @@ rwops_testFileWrite(void) "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type); #else SDLTest_AssertCheck( - rw->type == SDL_RWOPS_STDFILE, - "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); + rw->type == SDL_RWOPS_STDFILE, + "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type); #endif /* Run generic tests */ @@ -420,8 +420,8 @@ rwops_testFPRead(void) /* Check type */ SDLTest_AssertCheck( - rw->type == SDL_RWOPS_STDFILE, - "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); + rw->type == SDL_RWOPS_STDFILE, + "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type); /* Run generic tests */ _testGenericRWopsValidations( rw, 0 ); @@ -473,8 +473,8 @@ rwops_testFPWrite(void) /* Check type */ SDLTest_AssertCheck( - rw->type == SDL_RWOPS_STDFILE, - "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); + rw->type == SDL_RWOPS_STDFILE, + "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type); /* Run generic tests */ _testGenericRWopsValidations( rw, 1 ); @@ -506,8 +506,8 @@ rwops_testAllocFree (void) /* Check type */ SDLTest_AssertCheck( - rw->type == SDL_RWOPS_UNKNOWN, - "Verify RWops type is SDL_RWOPS_UNKNOWN; expected: %d, got: %d", SDL_RWOPS_UNKNOWN, rw->type); + rw->type == SDL_RWOPS_UNKNOWN, + "Verify RWops type is SDL_RWOPS_UNKNOWN; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_UNKNOWN, rw->type); /* Free context again */ SDL_FreeRW(rw); @@ -684,7 +684,7 @@ rwops_testFileWriteReadEndian(void) SDLTest_AssertCheck(BE16test == BE16value, "Validate return value from SDL_ReadBE16, expected: %hu, got: %hu", BE16value, BE16test); BE32test = SDL_ReadBE32(rw); SDLTest_AssertPass("Call to SDL_ReadBE32()"); - SDLTest_AssertCheck(BE32test == BE32value, "Validate return value from SDL_ReadBE32, expected: %u, got: %u", BE32value, BE32test); + SDLTest_AssertCheck(BE32test == BE32value, "Validate return value from SDL_ReadBE32, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, BE32value, BE32test); BE64test = SDL_ReadBE64(rw); SDLTest_AssertPass("Call to SDL_ReadBE64()"); SDLTest_AssertCheck(BE64test == BE64value, "Validate return value from SDL_ReadBE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, BE64value, BE64test); @@ -693,7 +693,7 @@ rwops_testFileWriteReadEndian(void) SDLTest_AssertCheck(LE16test == LE16value, "Validate return value from SDL_ReadLE16, expected: %hu, got: %hu", LE16value, LE16test); LE32test = SDL_ReadLE32(rw); SDLTest_AssertPass("Call to SDL_ReadLE32()"); - SDLTest_AssertCheck(LE32test == LE32value, "Validate return value from SDL_ReadLE32, expected: %u, got: %u", LE32value, LE32test); + SDLTest_AssertCheck(LE32test == LE32value, "Validate return value from SDL_ReadLE32, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, LE32value, LE32test); LE64test = SDL_ReadLE64(rw); SDLTest_AssertPass("Call to SDL_ReadLE64()"); SDLTest_AssertCheck(LE64test == LE64value, "Validate return value from SDL_ReadLE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, LE64value, LE64test); diff --git a/test/testautomation_sdltest.c b/test/testautomation_sdltest.c index 809664dc3..9c97e6013 100644 --- a/test/testautomation_sdltest.c +++ b/test/testautomation_sdltest.c @@ -891,8 +891,8 @@ sdltest_randomBoundaryNumberSint32(void *arg) sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min + 1, long_max, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertCheck( - sresult == long_min, - "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult); + sresult == long_min, + "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_min, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -901,8 +901,8 @@ sdltest_randomBoundaryNumberSint32(void *arg) sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertCheck( - sresult == long_max, - "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_max, sresult); + sresult == long_max, + "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_max, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -911,8 +911,8 @@ sdltest_randomBoundaryNumberSint32(void *arg) sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertCheck( - sresult == long_min, - "Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult); + sresult == long_min, + "Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_min, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -1058,56 +1058,56 @@ sdltest_randomIntegerInRange(void *arg) max = min + (Sint32)SDLTest_RandomUint8() + 2; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,max)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); /* One Range */ min = (Sint32)SDLTest_RandomSint16(); max = min + 1; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min+1)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); /* Zero range */ min = (Sint32)SDLTest_RandomSint16(); max = min; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min)"); - SDLTest_AssertCheck(min == result, "Validated returned value; expected: %d, got: %d", min, result); + SDLTest_AssertCheck(min == result, "Validated returned value; expected: %" SDL_PRIs32 ", got: %" SDL_PRIs32, min, result); /* Zero range at zero */ min = 0; max = 0; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(0,0)"); - SDLTest_AssertCheck(result == 0, "Validated returned value; expected: 0, got: %d", result); + SDLTest_AssertCheck(result == 0, "Validated returned value; expected: 0, got: %" SDL_PRIs32, result); /* Swapped min-max */ min = (Sint32)SDLTest_RandomSint16(); max = min + (Sint32)SDLTest_RandomUint8() + 2; result = SDLTest_RandomIntegerInRange(max, min); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(max,min)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); /* Range with min at integer limit */ min = long_min; max = long_max + (Sint32)SDLTest_RandomSint16(); result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); /* Range with max at integer limit */ min = long_min - (Sint32)SDLTest_RandomSint16(); max = long_max; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); /* Full integer range */ min = long_min; max = long_max; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,SINT32_MAX)"); - SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); + SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); return TEST_COMPLETED; } diff --git a/test/testautomation_timer.c b/test/testautomation_timer.c index a42eb37ac..3cb160ae1 100644 --- a/test/testautomation_timer.c +++ b/test/testautomation_timer.c @@ -88,17 +88,17 @@ timer_delayAndGetTicks(void *arg) /* Get ticks count - should be non-zero by now */ result = SDL_GetTicks(); SDLTest_AssertPass("Call to SDL_GetTicks()"); - SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %d", result); + SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, result); /* Delay a bit longer and measure ticks and verify difference */ SDL_Delay(testDelay); - SDLTest_AssertPass("Call to SDL_Delay(%d)", testDelay); + SDLTest_AssertPass("Call to SDL_Delay(%" SDL_PRIu32 ")", testDelay); result2 = SDL_GetTicks(); SDLTest_AssertPass("Call to SDL_GetTicks()"); - SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %d", result2); + SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, result2); difference = result2 - result; - SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %d", testDelay - marginOfError, difference); - SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %d", testDelay + marginOfError, difference); + SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay - marginOfError, difference); + SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay + marginOfError, difference); return TEST_COMPLETED; } diff --git a/test/testautomation_video.c b/test/testautomation_video.c index c5b648cfd..bf0283b80 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -346,7 +346,7 @@ video_getWindowFlags(void *arg) if (window != NULL) { actualFlags = SDL_GetWindowFlags(window); SDLTest_AssertPass("Call to SDL_GetWindowFlags()"); - SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags); + SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %" SDL_PRIu32, flags, actualFlags); } /* Clean up */ @@ -985,13 +985,13 @@ video_getWindowId(void *arg) /* Get window from ID */ result = SDL_GetWindowFromID(id); - SDLTest_AssertPass("Call to SDL_GetWindowID(%d)", id); + SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 ")", id); SDLTest_AssertCheck(result == window, "Verify result matches window pointer"); /* Get window from random large ID, no result check */ randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX); result = SDL_GetWindowFromID(randomId); - SDLTest_AssertPass("Call to SDL_GetWindowID(%d/random_large)", randomId); + SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/random_large)", randomId); /* Get window from 0 and Uint32 max ID, no result check */ result = SDL_GetWindowFromID(0); @@ -1004,7 +1004,7 @@ video_getWindowId(void *arg) /* Get window from ID for closed window */ result = SDL_GetWindowFromID(id); - SDLTest_AssertPass("Call to SDL_GetWindowID(%d/closed_window)", id); + SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/closed_window)", id); SDLTest_AssertCheck(result == NULL, "Verify result is NULL"); /* Negative test */ @@ -1036,7 +1036,7 @@ video_getWindowPixelFormat(void *arg) /* Get format */ format = SDL_GetWindowPixelFormat(window); SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()"); - SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %d", SDL_PIXELFORMAT_UNKNOWN, format); + SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %" SDL_PRIu32, SDL_PIXELFORMAT_UNKNOWN, format); /* Clean up */ _destroyVideoSuiteTestWindow(window); diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 682788465..5d87b7a2c 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -577,28 +577,26 @@ loop(void *arg) case SDL_CONTROLLERTOUCHPADDOWN: case SDL_CONTROLLERTOUCHPADMOTION: case SDL_CONTROLLERTOUCHPADUP: - SDL_Log("Controller %d touchpad %d finger %d %s %.2f, %.2f, %.2f\n", - event.ctouchpad.which, - event.ctouchpad.touchpad, - event.ctouchpad.finger, - (event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : - (event.type == SDL_CONTROLLERTOUCHPADUP ? "released at" : - "moved to")), - event.ctouchpad.x, - event.ctouchpad.y, - event.ctouchpad.pressure); + SDL_Log("Controller %" SDL_PRIs32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n", + event.ctouchpad.which, + event.ctouchpad.touchpad, + event.ctouchpad.finger, + (event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : (event.type == SDL_CONTROLLERTOUCHPADUP ? "released at" : "moved to")), + event.ctouchpad.x, + event.ctouchpad.y, + event.ctouchpad.pressure); break; #define VERBOSE_SENSORS #ifdef VERBOSE_SENSORS case SDL_CONTROLLERSENSORUPDATE: - SDL_Log("Controller %d sensor %s: %.2f, %.2f, %.2f (%"SDL_PRIu64")\n", - event.csensor.which, - GetSensorName((SDL_SensorType)event.csensor.sensor), - event.csensor.data[0], - event.csensor.data[1], - event.csensor.data[2], - event.csensor.timestamp_us); + SDL_Log("Controller %" SDL_PRIs32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n", + event.csensor.which, + GetSensorName((SDL_SensorType) event.csensor.sensor), + event.csensor.data[0], + event.csensor.data[1], + event.csensor.data[2], + event.csensor.timestamp_us); break; #endif /* VERBOSE_SENSORS */ @@ -608,7 +606,7 @@ loop(void *arg) if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { SetController(event.caxis.which); } - SDL_Log("Controller %d axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); + SDL_Log("Controller %" SDL_PRIs32 " axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis) event.caxis.axis), event.caxis.value); break; #endif /* VERBOSE_AXES */ @@ -617,7 +615,7 @@ loop(void *arg) if (event.type == SDL_CONTROLLERBUTTONDOWN) { SetController(event.cbutton.which); } - SDL_Log("Controller %d button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + SDL_Log("Controller %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton) event.cbutton.button), event.cbutton.state ? "pressed" : "released"); /* Cycle PS5 trigger effects when the microphone button is pressed */ if (event.type == SDL_CONTROLLERBUTTONDOWN && @@ -628,7 +626,7 @@ loop(void *arg) break; case SDL_JOYBATTERYUPDATED: - SDL_Log("Controller %d battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]); + SDL_Log("Controller %" SDL_PRIs32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]); break; case SDL_MOUSEBUTTONDOWN: diff --git a/test/testhotplug.c b/test/testhotplug.c index 465fb5680..a2fb37b55 100644 --- a/test/testhotplug.c +++ b/test/testhotplug.c @@ -79,7 +79,7 @@ main(int argc, char *argv[]) { joystick = SDL_JoystickOpen(event.jdevice.which); instance = SDL_JoystickInstanceID(joystick); - SDL_Log("Joy Added : %d : %s\n", event.jdevice.which, SDL_JoystickName(joystick)); + SDL_Log("Joy Added : %" SDL_PRIs32 " : %s\n", event.jdevice.which, SDL_JoystickName(joystick)); if (enable_haptic) { if (SDL_JoystickIsHaptic(joystick)) @@ -108,7 +108,7 @@ main(int argc, char *argv[]) case SDL_JOYDEVICEREMOVED: if (instance == event.jdevice.which) { - SDL_Log("Joy Removed: %d\n", event.jdevice.which); + SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which); instance = -1; if(enable_haptic && haptic) { diff --git a/test/testime.c b/test/testime.c index 155834229..9a0b5259e 100644 --- a/test/testime.c +++ b/test/testime.c @@ -213,7 +213,7 @@ static int unifont_init(const char *fontname) if (codepoint <= UNIFONT_MAX_CODEPOINT) { if (unifontGlyph[codepoint].width > 0) - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08x in hex file on line %d.\n", codepoint, lineNumber); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08" SDL_PRIx32 " in hex file on line %d.\n", codepoint, lineNumber); else { unifontGlyph[codepoint].width = glyphWidth; @@ -228,7 +228,7 @@ static int unifont_init(const char *fontname) } while (bytesRead > 0); SDL_RWclose(hexFile); - SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); + SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs); return 0; } @@ -275,7 +275,7 @@ static int unifont_load_texture(Uint32 textureID) if (textureID >= UNIFONT_NUM_TEXTURES) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %" SDL_PRIu32 "\n", textureID); return -1; } @@ -309,14 +309,14 @@ static int unifont_load_texture(Uint32 textureID) tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH); if (tex == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %" SDL_PRIu32 " for renderer %d.\n", textureID, i); return -1; } unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0) { - SDL_Log("unifont error: Failed to update texture %u data for renderer %d.\n", textureID, i); + SDL_Log("unifont error: Failed to update texture %" SDL_PRIu32 " data for renderer %d.\n", textureID, i); } } @@ -762,10 +762,11 @@ int main(int argc, char *argv[]) break; } - SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n", + SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s\n", event.key.keysym.scancode, SDL_GetScancodeName(event.key.keysym.scancode), - event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym)); + SDL_static_cast(Uint32, event.key.keysym.sym), + SDL_GetKeyName(event.key.keysym.sym)); break; case SDL_TEXTINPUT: @@ -787,7 +788,7 @@ int main(int argc, char *argv[]) break; case SDL_TEXTEDITING: - SDL_Log("text editing \"%s\", selected range (%d, %d)\n", + SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n", event.edit.text, event.edit.start, event.edit.length); SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE); diff --git a/test/testjoystick.c b/test/testjoystick.c index 96f4be180..f058979dd 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -87,7 +87,7 @@ PrintJoystick(SDL_Joystick *joy) SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joy)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joy)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joy)); - SDL_Log(" instance id: %d\n", SDL_JoystickInstanceID(joy)); + SDL_Log(" instance id: %" SDL_PRIs32 "\n", SDL_JoystickInstanceID(joy)); SDL_Log(" guid: %s\n", guid); SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joy), SDL_JoystickGetProduct(joy)); } @@ -137,13 +137,13 @@ loop(void *arg) break; case SDL_JOYAXISMOTION: - SDL_Log("Joystick %d axis %d value: %d\n", - event.jaxis.which, - event.jaxis.axis, event.jaxis.value); + SDL_Log("Joystick %" SDL_PRIs32 " axis %d value: %d\n", + event.jaxis.which, + event.jaxis.axis, event.jaxis.value); break; case SDL_JOYHATMOTION: - SDL_Log("Joystick %d hat %d value:", - event.jhat.which, event.jhat.hat); + SDL_Log("Joystick %" SDL_PRIs32 " hat %d value:", + event.jhat.which, event.jhat.hat); if (event.jhat.value == SDL_HAT_CENTERED) SDL_Log(" centered"); if (event.jhat.value & SDL_HAT_UP) @@ -157,21 +157,21 @@ loop(void *arg) SDL_Log("\n"); break; case SDL_JOYBALLMOTION: - SDL_Log("Joystick %d ball %d delta: (%d,%d)\n", - event.jball.which, - event.jball.ball, event.jball.xrel, event.jball.yrel); + SDL_Log("Joystick %" SDL_PRIs32 " ball %d delta: (%d,%d)\n", + event.jball.which, + event.jball.ball, event.jball.xrel, event.jball.yrel); break; case SDL_JOYBUTTONDOWN: - SDL_Log("Joystick %d button %d down\n", - event.jbutton.which, event.jbutton.button); + SDL_Log("Joystick %" SDL_PRIs32 " button %d down\n", + event.jbutton.which, event.jbutton.button); /* First button triggers a 0.5 second full strength rumble */ if (event.jbutton.button == 0) { SDL_JoystickRumble(joystick, 0xFFFF, 0xFFFF, 500); } break; case SDL_JOYBUTTONUP: - SDL_Log("Joystick %d button %d up\n", - event.jbutton.which, event.jbutton.button); + SDL_Log("Joystick %" SDL_PRIs32 " button %d up\n", + event.jbutton.which, event.jbutton.button); break; case SDL_KEYDOWN: /* Press the L key to lag for 3 seconds, to see what happens diff --git a/test/testoffscreen.c b/test/testoffscreen.c index e6abb35c3..e5fd72107 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -66,8 +66,8 @@ save_surface_to_bmp() surface = SDL_CreateRGBSurface(0, width, height, bbp, r_mask, g_mask, b_mask, a_mask); SDL_RenderReadPixels(renderer, NULL, pixel_format, (void*)surface->pixels, surface->pitch); - SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", - SDL_GetWindowID(window), ++frame_number); + SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.bmp", + SDL_GetWindowID(window), ++frame_number); SDL_SaveBMP(surface, file); SDL_FreeSurface(surface); @@ -154,7 +154,7 @@ main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double) frames * 1000) / (now - then); - SDL_Log("Frames remaining: %i rendering at %2.2f frames per second\n", max_frames - frames, fps); + SDL_Log("Frames remaining: %" SDL_PRIu32 " rendering at %2.2f frames per second\n", max_frames - frames, fps); } } } diff --git a/test/testplatform.c b/test/testplatform.c index 0ee4ede13..5eec9f9d1 100644 --- a/test/testplatform.c +++ b/test/testplatform.c @@ -149,8 +149,9 @@ TestEndian(SDL_bool verbose) ++error; } if (verbose) { - SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32, - SDL_Swap32(value32)); + SDL_Log("Value 32 = 0x%" SDL_PRIX32 ", swapped = 0x%" SDL_PRIX32 "\n", + value32, + SDL_Swap32(value32)); } if (SDL_Swap32(value32) != swapped32) { if (verbose) { diff --git a/test/testrendertarget.c b/test/testrendertarget.c index 98ceb1607..0848beb36 100644 --- a/test/testrendertarget.c +++ b/test/testrendertarget.c @@ -72,7 +72,7 @@ DrawComposite(DrawState *s) SDL_RenderCopy(s->renderer, A, NULL, NULL); SDL_RenderReadPixels(s->renderer, NULL, SDL_PIXELFORMAT_ARGB8888, &P, sizeof(P)); - SDL_Log("Blended pixel: 0x%8.8X\n", P); + SDL_Log("Blended pixel: 0x%8.8" SDL_PRIX32 "\n", P); SDL_DestroyTexture(A); SDL_DestroyTexture(B); diff --git a/test/testsem.c b/test/testsem.c index eaa28642a..bac51279d 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -47,11 +47,11 @@ ThreadFuncRealWorld(void *data) Thread_State *state = (Thread_State *) data; while (alive) { SDL_SemWait(sem); - SDL_Log("Thread number %d has got the semaphore (value = %d)!\n", + SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!\n", state->number, SDL_SemValue(sem)); SDL_Delay(200); SDL_SemPost(sem); - SDL_Log("Thread number %d has released the semaphore (value = %d)!\n", + SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!\n", state->number, SDL_SemValue(sem)); ++state->loop_count; SDL_Delay(1); /* For the scheduler */ @@ -114,7 +114,7 @@ TestWaitTimeout(void) /* Accept a little offset in the effective wait */ SDL_assert(duration > 1900 && duration < 2050); - SDL_Log("Wait took %d milliseconds\n\n", duration); + SDL_Log("Wait took %" SDL_PRIu32 " milliseconds\n\n", duration); /* Check to make sure the return value indicates timed out */ if (retval != SDL_MUTEX_TIMEDOUT) @@ -146,7 +146,7 @@ TestOverheadUncontended(void) end_ticks = SDL_GetTicks(); duration = end_ticks - start_ticks; - SDL_Log("Took %d milliseconds\n\n", duration); + SDL_Log("Took %" SDL_PRIu32 " milliseconds\n\n", duration); SDL_DestroySemaphore(sem); } @@ -221,9 +221,9 @@ TestOverheadContended(SDL_bool try_wait) SDL_assert_release((loop_count - content_count) == NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT); duration = end_ticks - start_ticks; - SDL_Log("Took %d milliseconds, threads %s %d out of %d times in total (%.2f%%)\n", + SDL_Log("Took %" SDL_PRIu32 " milliseconds, threads %s %d out of %d times in total (%.2f%%)\n", duration, try_wait ? "where contended" : "timed out", content_count, - loop_count, ((float)content_count * 100) / loop_count); + loop_count, ((float) content_count * 100) / loop_count); /* Print how many semaphores where consumed per thread */ SDL_snprintf(textBuffer, sizeof(textBuffer), "{ "); for (i = 0; i < NUM_THREADS; ++i) { diff --git a/test/testsensor.c b/test/testsensor.c index 658a65be8..73dd317f9 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -72,16 +72,16 @@ main(int argc, char **argv) SDL_Log("There are %d sensors available\n", num_sensors); for (i = 0; i < num_sensors; ++i) { - SDL_Log("Sensor %d: %s, type %s, platform type %d\n", - SDL_SensorGetDeviceInstanceID(i), - SDL_SensorGetDeviceName(i), - GetSensorTypeString(SDL_SensorGetDeviceType(i)), - SDL_SensorGetDeviceNonPortableType(i)); + SDL_Log("Sensor %" SDL_PRIs32 ": %s, type %s, platform type %d\n", + SDL_SensorGetDeviceInstanceID(i), + SDL_SensorGetDeviceName(i), + GetSensorTypeString(SDL_SensorGetDeviceType(i)), + SDL_SensorGetDeviceNonPortableType(i)); if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) { SDL_Sensor *sensor = SDL_SensorOpen(i); if (sensor == NULL) { - SDL_Log("Couldn't open sensor %d: %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); + SDL_Log("Couldn't open sensor %" SDL_PRIs32 ": %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); } else { ++num_opened; } diff --git a/test/testtimer.c b/test/testtimer.c index 62c5cd5f9..126ba3be2 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -33,7 +33,7 @@ ticktock(Uint32 interval, void *param) static Uint32 SDLCALL callback(Uint32 interval, void *param) { - SDL_Log("Timer %d : param = %d\n", interval, (int) (uintptr_t) param); + SDL_Log("Timer %" SDL_PRIu32 " : param = %d\n", interval, (int) (uintptr_t) param); return interval; } diff --git a/test/testvulkan.c b/test/testvulkan.c index 3fe047f3f..4b65179c1 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -1101,7 +1101,7 @@ int main(int argc, char **argv) } SDL_GetCurrentDisplayMode(0, &mode); - SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); + SDL_Log("Screen BPP : %" SDL_PRIu32 "\n", SDL_BITSPERPIXEL(mode.format)); SDL_GetWindowSize(state->windows[0], &dw, &dh); SDL_Log("Window Size : %d,%d\n", dw, dh); SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh); diff --git a/test/testwm2.c b/test/testwm2.c index 93bedf47b..eeb8d8e51 100644 --- a/test/testwm2.c +++ b/test/testwm2.c @@ -156,20 +156,20 @@ loop() if (event.window.event == SDL_WINDOWEVENT_RESIZED) { SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); if (window) { - SDL_Log("Window %d resized to %dx%d\n", - event.window.windowID, - event.window.data1, - event.window.data2); + SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n", + event.window.windowID, + event.window.data1, + event.window.data2); } } if (event.window.event == SDL_WINDOWEVENT_MOVED) { SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); if (window) { - SDL_Log("Window %d moved to %d,%d (display %s)\n", - event.window.windowID, - event.window.data1, - event.window.data2, - SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window))); + SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n", + event.window.windowID, + event.window.data1, + event.window.data2, + SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window))); } } if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) { diff --git a/test/testyuv.c b/test/testyuv.c index 9c89c3140..df0d94381 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -354,7 +354,7 @@ main(int argc, char **argv) SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); } now = SDL_GetTicks(); - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%" SDL_PRIu32 " iterations in %" SDL_PRIu32 " ms, %.2fms each\n", iterations, (now - then), (float) (now - then) / iterations); window = SDL_CreateWindow("YUV test", SDL_WINDOWPOS_UNDEFINED, From b737833d3cc6934a071c9ed0b2c50e8aa45e11db Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 11:07:03 -0400 Subject: [PATCH 131/459] N3DS: Turn on SDL_WERROR in CI. --- .github/workflows/n3ds.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml index af985e4e3..e5569ba12 100644 --- a/.github/workflows/n3ds.yml +++ b/.github/workflows/n3ds.yml @@ -17,6 +17,7 @@ jobs: run: | cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ From 680d0f043a8a3defec3ad7a2c8f64e0c6d6c636c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Oct 2022 09:26:49 -0700 Subject: [PATCH 132/459] Added support for undefined or centered position for shaped windows Fixes https://github.com/libsdl-org/SDL/issues/6359 --- src/video/SDL_shape.c | 46 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index 919ae9598..c099ae179 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -257,20 +257,54 @@ SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) { + SDL_VideoDevice *_this = SDL_GetVideoDevice(); int result; - if(window == NULL || !SDL_IsShapedWindow(window)) + + if (window == NULL || !SDL_IsShapedWindow(window)) { /* The window given was not a shapeable window. */ return SDL_NONSHAPEABLE_WINDOW; - if(shape == NULL) + } + if (shape == NULL) { /* Invalid shape argument. */ return SDL_INVALID_SHAPE_ARGUMENT; + } - if(shape_mode != NULL) + if (shape_mode != NULL) { window->shaper->mode = *shape_mode; - result = SDL_GetVideoDevice()->shape_driver.SetWindowShape(window->shaper,shape,shape_mode); + } + result = _this->shape_driver.SetWindowShape(window->shaper, shape, shape_mode); window->shaper->hasshape = SDL_TRUE; - if(window->shaper->userx != 0 && window->shaper->usery != 0) { - SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery); + if (window->shaper->userx != 0 && window->shaper->usery != 0) { + int x = window->shaper->userx; + int y = window->shaper->usery; + + if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISUNDEFINED(y) || + SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) { + int displayIndex; + SDL_Rect bounds; + + if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) { + displayIndex = (x & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + } else if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { + displayIndex = (y & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + + SDL_GetDisplayBounds(displayIndex, &bounds); + if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) { + window->x = bounds.x + (bounds.w - window->w) / 2; + } + if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { + window->y = bounds.y + (bounds.h - window->h) / 2; + } + } + SDL_SetWindowPosition(window, x, y); window->shaper->userx = 0; window->shaper->usery = 0; } From 4507083503021c2ddbaa38aa7808938c6a91b7e6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Oct 2022 09:39:55 -0700 Subject: [PATCH 133/459] Fixed build --- src/video/SDL_shape.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index c099ae179..ef4cc6045 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -288,12 +288,11 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh if (displayIndex >= _this->num_displays) { displayIndex = 0; } - } else if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { + } else { displayIndex = (y & 0xFFFF); if (displayIndex >= _this->num_displays) { displayIndex = 0; } - return displayIndex; } SDL_GetDisplayBounds(displayIndex, &bounds); From 17322e2be649eefaf6a02e2fcaefc444722ccfbb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 10 Oct 2022 13:07:52 -0400 Subject: [PATCH 134/459] dynapi: Optionally log every call into the SDL API. This will only log things going through dynapi, which means it won't do anything if dynapi is disabled for a given build, but also things that call the `*_REAL` version of an API won't log either (which is to say, if an internal piece of SDL calls a public API, it won't log it, but if an application calls that same entry point, it will). Since this just inserts a different function pointer, unless you explicitly request this at runtime, it won't add any overhead, and, of course, the entire thing can be turned off with a single #define so it doesn't even add extra unused code to the shared library if the kill switch is flipped. --- src/dynapi/SDL_dynapi.c | 96 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 4 deletions(-) diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index d3f7f612b..13b0a5551 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -50,7 +50,6 @@ static void SDL_InitDynamicAPI(void); - /* BE CAREFUL CALLING ANY SDL CODE IN HERE, IT WILL BLOW UP. Even self-contained stuff might call SDL_Error and break everything. */ @@ -191,6 +190,79 @@ SDL_DYNAPI_VARARGS(,,) #error Write me. #endif +#define ENABLE_SDL_CALL_LOGGING 1 +#if ENABLE_SDL_CALL_LOGGING +static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { + char buf[512]; /* !!! FIXME: dynamic allocation */ \ + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_SetError"); + va_start(ap, fmt); + SDL_vsnprintf_REAL(buf, sizeof (buf), fmt, ap); + va_end(ap); + return SDL_SetError_REAL("%s", buf); +} +static int SDLCALL SDL_sscanf_LOGSDLCALLS(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { + int retval; + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_sscanf"); + va_start(ap, fmt); + retval = SDL_vsscanf_REAL(buf, fmt, ap); + va_end(ap); + return retval; +} +static int SDLCALL SDL_snprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { + int retval; + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_snprintf"); + va_start(ap, fmt); + retval = SDL_vsnprintf_REAL(buf, maxlen, fmt, ap); + va_end(ap); + return retval; +} +static int SDLCALL SDL_asprintf_LOGSDLCALLS(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { + int retval; + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_asprintf"); + va_start(ap, fmt); + retval = SDL_vasprintf_REAL(strp, fmt, ap); + va_end(ap); + return retval; +} +static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_Log"); + va_start(ap, fmt); + SDL_LogMessageV_REAL(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ + va_end(ap); +} +static void SDLCALL SDL_LogMessage_LOGSDLCALLS(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { + va_list ap; + SDL_Log_REAL("SDL2CALL SDL_LogMessage"); + va_start(ap, fmt); + SDL_LogMessageV_REAL(category, priority, fmt, ap); + va_end(ap); +} +#define SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(logname, prio) \ + static void SDLCALL SDL_Log##logname##_LOGSDLCALLS(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + va_list ap; va_start(ap, fmt); \ + SDL_Log_REAL("SDL2CALL SDL_Log%s", #logname); \ + SDL_LogMessageV_REAL(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ + va_end(ap); \ + } +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Verbose, VERBOSE) +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Debug, DEBUG) +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Info, INFO) +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Warn, WARN) +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR) +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL) +#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ + rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; } +#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#include "SDL_dynapi_procs.h" +#undef SDL_DYNAPI_PROC +#undef SDL_DYNAPI_PROC_NO_VARARGS +#endif + /* we make this a static function so we can call the correct one without the system's dynamic linker resolving to the wrong version of this. */ static Sint32 @@ -206,9 +278,25 @@ initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize) } /* Init our jump table first. */ - #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL; - #include "SDL_dynapi_procs.h" - #undef SDL_DYNAPI_PROC + #if ENABLE_SDL_CALL_LOGGING + { + const char *env = SDL_getenv_REAL("SDL_DYNAPI_LOG_CALLS"); + const SDL_bool log_calls = (env && SDL_atoi_REAL(env)); + if (log_calls) { + #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_LOGSDLCALLS; + #include "SDL_dynapi_procs.h" + #undef SDL_DYNAPI_PROC + } else { + #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL; + #include "SDL_dynapi_procs.h" + #undef SDL_DYNAPI_PROC + } + } + #else + #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL; + #include "SDL_dynapi_procs.h" + #undef SDL_DYNAPI_PROC + #endif /* Then the external table... */ if (output_jump_table != &jump_table) { From 669532d52916d072e099fa7d952e0edb57fba15f Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:01:49 -0400 Subject: [PATCH 135/459] PSP: Remove dead code. Fixes unused variable warning. --- src/video/psp/SDL_pspevents.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c index 3d3f8ba42..33395dcbb 100644 --- a/src/video/psp/SDL_pspevents.c +++ b/src/video/psp/SDL_pspevents.c @@ -92,14 +92,6 @@ void PSP_PumpEvents(_THIS) if(changed) { for(i=0; i Date: Mon, 10 Oct 2022 22:02:17 -0400 Subject: [PATCH 136/459] PSP: Fix `Wformat` warnings. --- src/thread/psp/SDL_sysmutex.c | 8 ++++---- test/testgl2.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/thread/psp/SDL_sysmutex.c b/src/thread/psp/SDL_sysmutex.c index 9e391629a..d672ec516 100644 --- a/src/thread/psp/SDL_sysmutex.c +++ b/src/thread/psp/SDL_sysmutex.c @@ -57,7 +57,7 @@ SDL_CreateMutex(void) ); if (res < 0) { - SDL_SetError("Error trying to create mutex: %x", res); + SDL_SetError("Error trying to create mutex: %lx", res); } } else { SDL_OutOfMemory(); @@ -96,7 +96,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) return SDL_MUTEX_TIMEDOUT; break; default: - return SDL_SetError("Error trying to lock mutex: %x", res); + return SDL_SetError("Error trying to lock mutex: %lx", res); break; } @@ -119,7 +119,7 @@ SDL_mutexP(SDL_mutex * mutex) res = sceKernelLockLwMutex(&mutex->lock, 1, NULL); if (res != SCE_KERNEL_ERROR_OK) { - return SDL_SetError("Error trying to lock mutex: %x", res); + return SDL_SetError("Error trying to lock mutex: %lx", res); } return 0; @@ -141,7 +141,7 @@ SDL_mutexV(SDL_mutex * mutex) res = sceKernelUnlockLwMutex(&mutex->lock, 1); if (res != 0) { - return SDL_SetError("Error trying to unlock mutex: %x", res); + return SDL_SetError("Error trying to unlock mutex: %lx", res); } return 0; diff --git a/test/testgl2.c b/test/testgl2.c index 6eb439cb1..f259ddc93 100644 --- a/test/testgl2.c +++ b/test/testgl2.c @@ -302,7 +302,7 @@ main(int argc, char *argv[]) } SDL_GetCurrentDisplayMode(0, &mode); - SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); + SDL_Log("Screen BPP : %" SDL_PRIu32 "\n", SDL_BITSPERPIXEL(mode.format)); SDL_Log("Swap Interval : %d\n", SDL_GL_GetSwapInterval()); SDL_GetWindowSize(state->windows[0], &dw, &dh); SDL_Log("Window Size : %d,%d\n", dw, dh); From 5ddac7e026083db407112fb360a595b00d157344 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:04:02 -0400 Subject: [PATCH 137/459] PSP: Fix type mismatch warnings. --- src/thread/psp/SDL_syssem.c | 2 +- src/video/psp/SDL_pspevents.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c index 640619cd9..293354e08 100644 --- a/src/thread/psp/SDL_syssem.c +++ b/src/thread/psp/SDL_syssem.c @@ -101,7 +101,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) pTimeout = &timeout; } - res = sceKernelWaitSema(sem->semid, 1, pTimeout); + res = sceKernelWaitSema(sem->semid, 1, (SceUInt *) pTimeout); switch (res) { case SCE_KERNEL_ERROR_OK: return 0; diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c index 33395dcbb..dd2c67f17 100644 --- a/src/video/psp/SDL_pspevents.c +++ b/src/video/psp/SDL_pspevents.c @@ -62,16 +62,17 @@ static struct { { PSP_HPRM_HOLD, SDLK_F15 } }; -int EventUpdate(void *data) +int +EventUpdate(void *data) { while (running) { - SDL_SemWait(event_sem); - sceHprmPeekCurrentKey(&hprm); - SDL_SemPost(event_sem); - /* Delay 1/60th of a second */ - sceKernelDelayThread(1000000 / 60); - } - return 0; + SDL_SemWait(event_sem); + sceHprmPeekCurrentKey((u32 *) &hprm); + SDL_SemPost(event_sem); + /* Delay 1/60th of a second */ + sceKernelDelayThread(1000000 / 60); + } + return 0; } void PSP_PumpEvents(_THIS) @@ -80,7 +81,6 @@ void PSP_PumpEvents(_THIS) enum PspHprmKeys keys; enum PspHprmKeys changed; static enum PspHprmKeys old_keys = 0; - SDL_Keysym sym; SDL_SemWait(event_sem); keys = hprm; From 04727946096e5845011c22bffee4c5b20074bc73 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:04:15 -0400 Subject: [PATCH 138/459] PSP: Turn on `SDL_WERROR` in CI. --- .github/workflows/psp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/psp.yaml b/.github/workflows/psp.yaml index 9a9267730..1d82899c5 100644 --- a/.github/workflows/psp.yaml +++ b/.github/workflows/psp.yaml @@ -16,6 +16,7 @@ jobs: run: | cmake -S . -B build \ -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ From 8117bfe5d1bba5ad22e2133326ff0ef696026c2f Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:29:31 -0400 Subject: [PATCH 139/459] PS2: Ignore warnings from toolchain headers. The `gsInline.h` header creates `Wdeclaration-after-statement` warnings. --- src/render/ps2/SDL_render_ps2.c | 4 ++++ src/video/ps2/SDL_ps2video.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index ad2530676..5d4f318b8 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -30,7 +30,11 @@ #include #include #include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeclaration-after-statement" #include +#pragma GCC diagnostic pop /* turn black GS Screen */ #define GS_BLACK GS_SETREG_RGBA(0x00, 0x00, 0x00, 0x80) diff --git a/src/video/ps2/SDL_ps2video.h b/src/video/ps2/SDL_ps2video.h index 3a380fab0..7f981bf00 100644 --- a/src/video/ps2/SDL_ps2video.h +++ b/src/video/ps2/SDL_ps2video.h @@ -31,7 +31,11 @@ #include #include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeclaration-after-statement" #include +#pragma GCC diagnostic pop #endif /* SDL_ps2video_h_ */ From fefd48eb9eec12f6e573a8ef79e07920d9e6c6a6 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:30:05 -0400 Subject: [PATCH 140/459] PS2: Turn on `SDL_WERROR` in CI. --- .github/workflows/ps2.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ps2.yaml b/.github/workflows/ps2.yaml index 04be4ad10..26b6a48e1 100644 --- a/.github/workflows/ps2.yaml +++ b/.github/workflows/ps2.yaml @@ -24,8 +24,9 @@ jobs: - name: Configure (CMake) run: | - cmake -S . -B build -G Ninja\ + cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_BUILD_TYPE=Release From e99b05d6c4bd0fde3e82c6b666ebae4f755c3386 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:36:21 -0400 Subject: [PATCH 141/459] Vita: Install bash in CI. The wrapper `arm-vita-eabi-pkg-config` fails without it with the error: `env: can't execute 'bash': No such file or directory` --- .github/workflows/vita.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index 9b27370ba..e7bcd727c 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -16,7 +16,7 @@ jobs: - name: Install build requirements run: | apk update - apk add cmake ninja pkgconf + apk add cmake ninja pkgconf bash - name: Configure CMake run: | cmake -S . -B build -G Ninja \ From 4227a0b4f330027ab96e35b0832a396b56d45566 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 10 Oct 2022 22:44:48 -0400 Subject: [PATCH 142/459] Vita: Turn on `SDL_WERROR` in CI. --- .github/workflows/vita.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index e7bcd727c..3aed2bd29 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -21,6 +21,7 @@ jobs: run: | cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ + -DSDL_ERRORS=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ From 6f224e4d9f224bbbef36213eb8cecbc6dc5ca061 Mon Sep 17 00:00:00 2001 From: happyharryh Date: Tue, 11 Oct 2022 10:44:20 +0800 Subject: [PATCH 143/459] Made timestamp_us of sensor events increase monotonically for Nintendo controllers --- src/joystick/hidapi/SDL_hidapi_switch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 0bf66d856..1970a9d43 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -2062,32 +2062,35 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C if (!ctx->device->parent || ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, timestamp[0], &packet->imuState[2].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, timestamp[1], &packet->imuState[1].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, timestamp[2], &packet->imuState[0].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, timestamp[0], &packet->imuState[2].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, timestamp[1], &packet->imuState[1].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, timestamp[1], &packet->imuState[1].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, timestamp[2], &packet->imuState[0].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, timestamp[2], &packet->imuState[0].sAccelX); } if (ctx->device->parent && ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) { SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_L, timestamp[0], &packet->imuState[2].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_L, timestamp[1], &packet->imuState[1].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_L, timestamp[2], &packet->imuState[0].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_L, timestamp[0], &packet->imuState[2].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_L, timestamp[1], &packet->imuState[1].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_L, timestamp[1], &packet->imuState[1].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_L, timestamp[2], &packet->imuState[0].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_L, timestamp[2], &packet->imuState[0].sAccelX); } if (ctx->device->parent && ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_R, timestamp[0], &packet->imuState[2].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_R, timestamp[1], &packet->imuState[1].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_R, timestamp[2], &packet->imuState[0].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_R, timestamp[0], &packet->imuState[2].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_R, timestamp[1], &packet->imuState[1].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_R, timestamp[1], &packet->imuState[1].sAccelX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO_R, timestamp[2], &packet->imuState[0].sGyroX); SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL_R, timestamp[2], &packet->imuState[0].sAccelX); } From 41c718edcaf7a3f7efc9705c76b986f475153632 Mon Sep 17 00:00:00 2001 From: zhailiangliang Date: Tue, 11 Oct 2022 10:07:32 +0800 Subject: [PATCH 144/459] Fix memory leak in PSP_CreateTexture --- src/render/psp/SDL_render_psp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 6cfb43a99..3e176463d 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -525,6 +525,7 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) break; default: + SDL_free(psp_texture); return -1; } @@ -532,6 +533,7 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) psp_texture->size = psp_texture->textureHeight*psp_texture->pitch; if(texture->access & SDL_TEXTUREACCESS_TARGET) { if(TextureSpillTargetsForSpace(renderer->driverdata, psp_texture->size) < 0){ + SDL_free(psp_texture); return -1; } psp_texture->data = valloc(psp_texture->size); @@ -1372,10 +1374,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->driverdata = data; renderer->window = window; - if (data->initialized != SDL_FALSE) - return 0; data->initialized = SDL_TRUE; - data->most_recent_target = NULL; data->least_recent_target = NULL; From 0b88e609bc5b0cdb4218d02c8a03403b067fffa8 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 11 Oct 2022 07:40:35 -0400 Subject: [PATCH 145/459] wayland: Raise wl_seat maximum version to 8 Version 8 is required for supporting axis_value120 high-resolution scroll events. --- src/video/wayland/SDL_waylandevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 8b53424fc..54ffdaf04 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2350,7 +2350,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) return; input->display = d; - input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(5, version)); + input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(8, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); input->xkb.current_group = ~0; From df1bd07dee4e167bec5ac8b606461f2007bc7b10 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 11 Oct 2022 07:25:27 -0700 Subject: [PATCH 146/459] d3d12: actually execute the pending commands before processing resize This makes sure all the resources are in the expected state Fix the D3D12 case in https://github.com/libsdl-org/SDL/issues/6376 --- src/render/direct3d12/SDL_render_d3d12.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index ad014979b..79cf30ef0 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -1285,8 +1285,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer) D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor; /* Release resources in the current command list */ - D3D_CALL(data->commandList, Close); - D3D12_ResetCommandList(data); + D3D12_IssueBatch(data); D3D_CALL(data->commandList, OMSetRenderTargets, 0, NULL, FALSE, NULL); /* Release render targets */ From be2cb0006644cb17cafca449f2d69c989e18ed2f Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Tue, 11 Oct 2022 11:16:52 -0400 Subject: [PATCH 147/459] wayland: Check for the input handle before checking the keyboard handle --- src/video/wayland/SDL_waylandkeyboard.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c index 8fcf67857..6f6115d22 100644 --- a/src/video/wayland/SDL_waylandkeyboard.c +++ b/src/video/wayland/SDL_waylandkeyboard.c @@ -145,8 +145,9 @@ Wayland_HasScreenKeyboardSupport(_THIS) * input protocol, make sure we don't have any physical keyboards either. */ SDL_VideoData *driverdata = _this->driverdata; - return (driverdata->input->keyboard == NULL && - driverdata->text_input_manager != NULL); + SDL_bool haskeyboard = (driverdata->input != NULL) && (driverdata->input->keyboard != NULL); + SDL_bool hastextmanager = (driverdata->text_input_manager != NULL); + return (!haskeyboard && hastextmanager); } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ From e710440f588fd1265b8daca7c764bf1ac800bece Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 11 Oct 2022 11:23:16 -0400 Subject: [PATCH 148/459] Vita: Fix typo in CI CMake command. --- .github/workflows/vita.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index 3aed2bd29..7b3d76957 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -21,7 +21,7 @@ jobs: run: | cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DSDL_ERRORS=ON \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ From fb32effd15a52097de985558a14e3851681d0ae1 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 9 Oct 2022 12:13:23 +0200 Subject: [PATCH 149/459] testevdev: Fix detection of word size The check for whether to use a 32- or 64-bit swap for an array of long values always took the 64-bit path, because wasn't included and therefore ULONG_MAX wasn't defined. Turn this into a runtime check, which a reasonable compiler will optimize into a constant. This fixes testevdev failures on 32-bit big-endian platforms such as hppa and older powerpc. Little-endian and/or 64-bit platforms are unaffected. [smcv: Added commit message] Bug-Debian: https://bugs.debian.org/1021310 Co-authored-by: Simon McVittie --- test/testevdev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/testevdev.c b/test/testevdev.c index 938a9a504..fe9e367ee 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -935,12 +935,8 @@ static const GuessTest guess_tests[] = } }; -#if ULONG_MAX == 0xFFFFFFFFUL -# define SwapLongLE(X) SDL_SwapLE32(X) -#else - /* assume 64-bit */ -# define SwapLongLE(X) SDL_SwapLE64(X) -#endif +#define SwapLongLE(X) \ + ((sizeof(unsigned long) == 4) ? SDL_SwapLE32(X) : SDL_SwapLE64(X)) static int run_test(void) From 6836273d14734ade8938ea6834a9cb8db4a37650 Mon Sep 17 00:00:00 2001 From: Desour Date: Wed, 12 Oct 2022 00:17:50 +0200 Subject: [PATCH 150/459] Use XIWarpPointer if compiled with xinput2 Co-authored-by: Andrei E --- src/video/x11/SDL_x11mouse.c | 11 ++++++++++- src/video/x11/SDL_x11sym.h | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 4fd8fa9f7..3bf762d3f 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -315,7 +315,16 @@ WarpMouseInternal(Window xwindow, const int x, const int y) { SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; Display *display = videodata->display; - X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); +#if SDL_VIDEO_DRIVER_X11_XINPUT2 + int deviceid = 0; + X11_XIGetClientPointer(display, None, &deviceid); + if (deviceid != 0) { + X11_XIWarpPointer(display, deviceid, None, xwindow, 0.0, 0.0, 0, 0, (double)x, (double)y); + } else +#endif + { + X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); + } X11_XSync(display, False); videodata->global_mouse_changed = SDL_TRUE; } diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index 1a1b102ac..9af2320bf 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -166,7 +166,7 @@ SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), re #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return) -SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),) +SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),) #endif #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @@ -270,6 +270,8 @@ SDL_X11_SYM(int,XIGrabTouchBegin,(Display *a,int b,Window c,int d,XIEventMask *e SDL_X11_SYM(int,XIUngrabTouchBegin, (Display *a,int b,Window c, int d,XIGrabModifiers *e),(a, b, c, d, e),return) SDL_X11_SYM(Status,XIQueryVersion,(Display *a,int *b,int *c),(a,b,c),return) SDL_X11_SYM(XIEventMask*,XIGetSelectedEvents,(Display *a,Window b,int *c),(a,b,c),return) +SDL_X11_SYM(Bool,XIGetClientPointer,(Display *a,Window b,int *c),(a,b,c),return) +SDL_X11_SYM(Bool,XIWarpPointer,(Display *a,int b,Window c,Window d,double e,double f,int g,int h,double i,double j),(a,b,c,d,e,f,g,h,i,j),return) #endif /* XRandR support */ From f6ff87788a91d85209ee54f998c4086015f0c070 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 12 Oct 2022 13:55:14 +0200 Subject: [PATCH 151/459] Android default to dynamic API disabled (see #6381) --- src/dynapi/SDL_dynapi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index e3268697c..69c68de65 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/src/dynapi/SDL_dynapi.h @@ -45,6 +45,8 @@ #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */ #define SDL_DYNAMIC_API 0 +#if defined(__ANDROID__) /* probably not useful on Android. */ +#define SDL_DYNAMIC_API 0 #elif defined(__native_client__) && __native_client__ /* probably not useful on NACL. */ #define SDL_DYNAMIC_API 0 #elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */ From f69e004d01e0077f16dd220a847f00799ca347fc Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 12 Oct 2022 13:58:41 +0200 Subject: [PATCH 152/459] Android default to dynamic API disabled (see #6381) --- src/dynapi/SDL_dynapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index 69c68de65..d71946213 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/src/dynapi/SDL_dynapi.h @@ -45,7 +45,7 @@ #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */ #define SDL_DYNAMIC_API 0 -#if defined(__ANDROID__) /* probably not useful on Android. */ +#elif defined(__ANDROID__) /* probably not useful on Android. */ #define SDL_DYNAMIC_API 0 #elif defined(__native_client__) && __native_client__ /* probably not useful on NACL. */ #define SDL_DYNAMIC_API 0 From 2d7816e3586af54a27387b16f24ffde165913abc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 12 Oct 2022 09:59:31 -0400 Subject: [PATCH 153/459] dynapi: Disable support for API call logging by default. We can manually enable it if necessary, but it bloats the library to leave it on just in case. Fixes #6381. --- src/dynapi/SDL_dynapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 13b0a5551..9a7e4c994 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -190,7 +190,7 @@ SDL_DYNAPI_VARARGS(,,) #error Write me. #endif -#define ENABLE_SDL_CALL_LOGGING 1 +#define ENABLE_SDL_CALL_LOGGING 0 #if ENABLE_SDL_CALL_LOGGING static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { char buf[512]; /* !!! FIXME: dynamic allocation */ \ From 5b9608e08c67088a3d20790b93fd93625d573476 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Tue, 11 Oct 2022 23:35:33 -0400 Subject: [PATCH 154/459] Remove D3D9 workarounds for Watcom. The linked PRs have been merged since May. --- src/render/direct3d/SDL_render_d3d.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index cad5536c2..e68e4d86e 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -41,13 +41,6 @@ #include "SDL_shaders_d3d.h" -#ifdef __WATCOMC__ -/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/868 is merged */ -#define D3DBLENDOP_REVSUBTRACT 3 -/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/869 is merged */ -#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT( 2073 ) -#endif - typedef struct { SDL_Rect viewport; From 81dee3194990351148c6e2ccd9bb3b4a7bed3079 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 12 Oct 2022 12:36:41 +0100 Subject: [PATCH 155/459] testevdev: Add a static assertion for supported sizeof(long) If this assertion fails on some platform (unlikely), we will need a third implementation for SwapLongLE(). Signed-off-by: Simon McVittie --- test/testevdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/testevdev.c b/test/testevdev.c index fe9e367ee..2ac7ad5b3 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -935,6 +935,7 @@ static const GuessTest guess_tests[] = } }; +SDL_COMPILE_TIME_ASSERT(sizeof_long, sizeof(unsigned long) == 4 || sizeof(unsigned long) == 8); #define SwapLongLE(X) \ ((sizeof(unsigned long) == 4) ? SDL_SwapLE32(X) : SDL_SwapLE64(X)) From 7d230af51d5e9f735a6e5534cb9a9fbc01a7f026 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 12 Oct 2022 12:41:30 +0100 Subject: [PATCH 156/459] testevdev: Explain why the test data is encoded the way it is Signed-off-by: Simon McVittie --- test/testevdev.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/testevdev.c b/test/testevdev.c index 2ac7ad5b3..22465ff81 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -1,6 +1,6 @@ /* Copyright (C) 1997-2022 Sam Lantinga - Copyright (C) 2020 Collabora Ltd. + Copyright (C) 2020-2022 Collabora Ltd. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -935,6 +935,19 @@ static const GuessTest guess_tests[] = } }; +/* The Linux kernel provides capability info in EVIOCGBIT and in /sys + * as an array of unsigned long in native byte order, rather than an array + * of bytes, an array of native-endian 32-bit words or an array of + * native-endian 64-bit words like you might have reasonably expected. + * The order of words in the array is always lowest-valued first: for + * instance, the first unsigned long in abs[] contains the bit representing + * absolute axis 0 (ABS_X). + * + * The constant arrays above provide test data in little-endian, because + * that's the easiest representation for hard-coding into a test like this. + * On a big-endian platform we need to byteswap it, one unsigned long at a + * time, to match what the kernel would produce. This requires us to choose + * an appropriate byteswapping function for the architecture's word size. */ SDL_COMPILE_TIME_ASSERT(sizeof_long, sizeof(unsigned long) == 4 || sizeof(unsigned long) == 8); #define SwapLongLE(X) \ ((sizeof(unsigned long) == 4) ? SDL_SwapLE32(X) : SDL_SwapLE64(X)) From eea9f638e26aba97e6731600cdfb411a8ca27c87 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Wed, 12 Oct 2022 18:51:59 -0400 Subject: [PATCH 157/459] CI: Update to actions/checkout@v3. --- .github/workflows/android.yml | 2 +- .github/workflows/emscripten.yml | 2 +- .github/workflows/ios.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/msvc.yml | 2 +- .github/workflows/n3ds.yml | 2 +- .github/workflows/ps2.yaml | 2 +- .github/workflows/psp.yaml | 2 +- .github/workflows/riscos.yml | 2 +- .github/workflows/vita.yaml | 2 +- .github/workflows/vmactions.yml | 2 +- .github/workflows/watcom.yml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8864400b2..264fce2b0 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -15,7 +15,7 @@ jobs: - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: nttld/setup-ndk@v1 id: setup_ndk with: diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index fae9f9a1a..b1ab07e5a 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -6,7 +6,7 @@ jobs: emscripten: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: mymindstorm/setup-emsdk@v10 with: version: 2.0.32 diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 45bbe3c51..6034ce071 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -15,6 +15,6 @@ jobs: - { name: tvOS, target: Static Library-tvOS, sdk: appletvos } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a2042b3f..d4ce2f278 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,7 +60,7 @@ jobs: run: | brew install \ ninja - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check that versioning is consistent # We only need to run this once: arbitrarily use the Linux/CMake build if: "runner.os == 'Linux' && ! matrix.platform.autotools" diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 78468f08c..4f561b9db 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -23,7 +23,7 @@ jobs: project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Create CMake project using SDL as a subproject shell: python run: | diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml index e5569ba12..c7c1c300c 100644 --- a/.github/workflows/n3ds.yml +++ b/.github/workflows/n3ds.yml @@ -8,7 +8,7 @@ jobs: container: image: devkitpro/devkitarm:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install build requirements run: | apt update diff --git a/.github/workflows/ps2.yaml b/.github/workflows/ps2.yaml index 26b6a48e1..bfb0b1ceb 100644 --- a/.github/workflows/ps2.yaml +++ b/.github/workflows/ps2.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: ps2dev/ps2dev:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dependencies run: | apk update diff --git a/.github/workflows/psp.yaml b/.github/workflows/psp.yaml index 1d82899c5..addc7b11f 100644 --- a/.github/workflows/psp.yaml +++ b/.github/workflows/psp.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: pspdev/pspdev:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dependencies run: | apk update diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml index 1791c9504..7b1e435ea 100644 --- a/.github/workflows/riscos.yml +++ b/.github/workflows/riscos.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Setup dependencies run: apt-get update && apt-get install -y cmake ninja-build - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure (autotools) if: ${{ contains(matrix.platform.name, 'autotools') }} run: | diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index 7b3d76957..ac3b17c43 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -12,7 +12,7 @@ jobs: container: image: vitasdk/vitasdk:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install build requirements run: | apk update diff --git a/.github/workflows/vmactions.yml b/.github/workflows/vmactions.yml index 414b056f8..4485f5c59 100644 --- a/.github/workflows/vmactions.yml +++ b/.github/workflows/vmactions.yml @@ -7,7 +7,7 @@ jobs: runs-on: macos-12 name: FreeBSD steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build uses: vmactions/freebsd-vm@v0 with: diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml index f36b73e9a..bef3cf957 100644 --- a/.github/workflows/watcom.yml +++ b/.github/workflows/watcom.yml @@ -14,7 +14,7 @@ jobs: - { name: OS/2, makefile: Makefile.os2 } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: open-watcom/setup-watcom@v0 - name: Build SDL2 run: | From fc73386f458ef9deef6f49312aee0c317e02c220 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 12 Oct 2022 21:44:50 -0700 Subject: [PATCH 158/459] Fixed the mapping from raw joystick values to the expected [SDL_JOYSTICK_AXIS_MIN, SDL_JOYSTICK_AXIS_MAX] range. (thanks Tas!) The original code mapped incorrectly from [min, max] to [-32768, 32512], the upper bound being SDL_JOYSTICK_AXIS_MAX - 255 instead of SDL_JOYSTICK_AXIS_MAX. --- src/joystick/bsd/SDL_bsdjoystick.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c index f5f13ee49..598505e5f 100644 --- a/src/joystick/bsd/SDL_bsdjoystick.c +++ b/src/joystick/bsd/SDL_bsdjoystick.c @@ -677,9 +677,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) xmin--; xmax++; } - v = (Sint32) x; - v -= (xmax + xmin + 1) / 2; - v *= 32768 / ((xmax - xmin + 1) / 2); + v = (((SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) * ((Sint32)x - xmin) ) / (xmax - xmin)) + SDL_JOYSTICK_AXIS_MIN; SDL_PrivateJoystickAxis(joy, 0, v); } if (SDL_abs(y - gameport.y) > 8) { @@ -694,9 +692,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) ymin--; ymax++; } - v = (Sint32) y; - v -= (ymax + ymin + 1) / 2; - v *= 32768 / ((ymax - ymin + 1) / 2); + v = (((SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) * ((Sint32)y - ymin) ) / (ymax - ymin)) + SDL_JOYSTICK_AXIS_MIN; SDL_PrivateJoystickAxis(joy, 1, v); } SDL_PrivateJoystickButton(joy, 0, gameport.b1); @@ -731,11 +727,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) naxe = joy->hwdata->axis_map[joyaxe]; /* scaleaxe */ v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); - v -= (hitem.logical_maximum + - hitem.logical_minimum + 1) / 2; - v *= 32768 / - ((hitem.logical_maximum - - hitem.logical_minimum + 1) / 2); + v = (((SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) * (v - hitem.logical_minimum) ) / (hitem.logical_maximum - hitem.logical_minimum)) + SDL_JOYSTICK_AXIS_MIN; SDL_PrivateJoystickAxis(joy, naxe, v); } else if (usage == HUG_HAT_SWITCH) { v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); @@ -765,7 +757,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) } case HUP_BUTTON: v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); - nbutton = HID_USAGE(hitem.usage) - 1; /* SDL buttons are zero-based */ + nbutton = HID_USAGE(hitem.usage) - 1; /* SDL buttons are zero-based */ SDL_PrivateJoystickButton(joy, nbutton, v); break; default: From f5afb7d11ae06a0118c6ec4b06715c27e0aef4a9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 13 Oct 2022 18:44:15 -0500 Subject: [PATCH 159/459] directfb: Fix return type of DirectFB_RenderPresent() --- src/video/directfb/SDL_DirectFB_render.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c index 257e95005..bcb2600ea 100644 --- a/src/video/directfb/SDL_DirectFB_render.c +++ b/src/video/directfb/SDL_DirectFB_render.c @@ -1025,7 +1025,7 @@ DirectFB_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void * } -static void +static int DirectFB_RenderPresent(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -1056,6 +1056,7 @@ DirectFB_RenderPresent(SDL_Renderer * renderer) /* Send the data to the display */ SDL_DFB_CHECK(windata->window_surface->Flip(windata->window_surface, NULL, data->flipflags)); + return 0; } static void From 99f2a503941f69bc7ec15791fddf1dc42bc158a4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 13 Oct 2022 22:40:24 -0700 Subject: [PATCH 160/459] X11 scancode mapping cleanup * Consolidated scancode mapping tables into a single location for all backends * Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table * Updated the Linux scancode table with the latest kernel keycodes (still unmapped) * Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table * Disabled verbose reporting of missing keysym mappings, we have enough data for now --- include/SDL_scancode.h | 5 + src/core/linux/SDL_evdev.c | 28 +- src/events/SDL_keyboard.c | 1053 ++++++++++++---------- src/events/SDL_scancode_tables.c | 73 ++ src/events/SDL_scancode_tables_c.h | 37 + src/events/scancodes_darwin.h | 2 + src/events/scancodes_linux.h | 1033 ++++++++++++++++----- src/events/scancodes_windows.h | 2 + src/events/scancodes_xfree86.h | 491 +++++----- src/video/directfb/SDL_DirectFB_events.c | 9 +- src/video/wayland/SDL_waylandevents.c | 74 +- src/video/x11/SDL_x11events.c | 11 +- src/video/x11/SDL_x11keyboard.c | 590 +++++++++--- 13 files changed, 2251 insertions(+), 1157 deletions(-) create mode 100644 src/events/SDL_scancode_tables.c create mode 100644 src/events/SDL_scancode_tables_c.h diff --git a/include/SDL_scancode.h b/include/SDL_scancode.h index aaa782f8d..6f40884ee 100644 --- a/include/SDL_scancode.h +++ b/include/SDL_scancode.h @@ -345,6 +345,11 @@ typedef enum * \name Usage page 0x0C * * These values are mapped from usage page 0x0C (USB consumer page). + * See https://usb.org/sites/default/files/hut1_2.pdf + * + * There are way more keys in the spec than we can represent in the + * current scancode range, so pick the ones that commonly come up in + * real world usage. */ /* @{ */ diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 6355e1392..f5ab06253 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -42,7 +42,7 @@ #include "SDL_endian.h" #include "SDL_scancode.h" #include "../../events/SDL_events_c.h" -#include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ +#include "../../events/SDL_scancode_tables_c.h" #include "../../core/linux/SDL_evdev_capabilities.h" #include "../../core/linux/SDL_udev.h" @@ -509,23 +509,21 @@ SDL_EVDEV_Poll(void) static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode) { - SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; + SDL_Scancode scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, keycode); - if (keycode < SDL_arraysize(linux_scancode_table)) { - scancode = linux_scancode_table[keycode]; - - if (scancode == SDL_SCANCODE_UNKNOWN) { - /* BTN_TOUCH is handled elsewhere, but we might still end up here if - you get an unexpected BTN_TOUCH from something SDL believes is not - a touch device. In this case, we'd rather not get a misleading - SDL_Log message about an unknown key. */ - if (keycode != BTN_TOUCH) { - SDL_Log("The key you just pressed is not recognized by SDL. To help " - "get this fixed, please report this to the SDL forums/mailing list " - " EVDEV KeyCode %d", keycode); - } +#ifdef DEBUG_SCANCODES + if (scancode == SDL_SCANCODE_UNKNOWN) { + /* BTN_TOUCH is handled elsewhere, but we might still end up here if + you get an unexpected BTN_TOUCH from something SDL believes is not + a touch device. In this case, we'd rather not get a misleading + SDL_Log message about an unknown key. */ + if (keycode != BTN_TOUCH) { + SDL_Log("The key you just pressed is not recognized by SDL. To help " + "get this fixed, please report this to the SDL forums/mailing list " + " EVDEV KeyCode %d", keycode); } } +#endif /* DEBUG_SCANCODES */ return scancode; } diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index f83191251..b1e27e1ae 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -53,480 +53,591 @@ struct SDL_Keyboard static SDL_Keyboard SDL_keyboard; static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { - 0, 0, 0, 0, - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', - 'i', - 'j', - 'k', - 'l', - 'm', - 'n', - 'o', - 'p', - 'q', - 'r', - 's', - 't', - 'u', - 'v', - 'w', - 'x', - 'y', - 'z', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '0', - SDLK_RETURN, - SDLK_ESCAPE, - SDLK_BACKSPACE, - SDLK_TAB, - SDLK_SPACE, - '-', - '=', - '[', - ']', - '\\', - '#', - ';', - '\'', - '`', - ',', - '.', - '/', - SDLK_CAPSLOCK, - SDLK_F1, - SDLK_F2, - SDLK_F3, - SDLK_F4, - SDLK_F5, - SDLK_F6, - SDLK_F7, - SDLK_F8, - SDLK_F9, - SDLK_F10, - SDLK_F11, - SDLK_F12, - SDLK_PRINTSCREEN, - SDLK_SCROLLLOCK, - SDLK_PAUSE, - SDLK_INSERT, - SDLK_HOME, - SDLK_PAGEUP, - SDLK_DELETE, - SDLK_END, - SDLK_PAGEDOWN, - SDLK_RIGHT, - SDLK_LEFT, - SDLK_DOWN, - SDLK_UP, - SDLK_NUMLOCKCLEAR, - SDLK_KP_DIVIDE, - SDLK_KP_MULTIPLY, - SDLK_KP_MINUS, - SDLK_KP_PLUS, - SDLK_KP_ENTER, - SDLK_KP_1, - SDLK_KP_2, - SDLK_KP_3, - SDLK_KP_4, - SDLK_KP_5, - SDLK_KP_6, - SDLK_KP_7, - SDLK_KP_8, - SDLK_KP_9, - SDLK_KP_0, - SDLK_KP_PERIOD, - 0, - SDLK_APPLICATION, - SDLK_POWER, - SDLK_KP_EQUALS, - SDLK_F13, - SDLK_F14, - SDLK_F15, - SDLK_F16, - SDLK_F17, - SDLK_F18, - SDLK_F19, - SDLK_F20, - SDLK_F21, - SDLK_F22, - SDLK_F23, - SDLK_F24, - SDLK_EXECUTE, - SDLK_HELP, - SDLK_MENU, - SDLK_SELECT, - SDLK_STOP, - SDLK_AGAIN, - SDLK_UNDO, - SDLK_CUT, - SDLK_COPY, - SDLK_PASTE, - SDLK_FIND, - SDLK_MUTE, - SDLK_VOLUMEUP, - SDLK_VOLUMEDOWN, - 0, 0, 0, - SDLK_KP_COMMA, - SDLK_KP_EQUALSAS400, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - SDLK_ALTERASE, - SDLK_SYSREQ, - SDLK_CANCEL, - SDLK_CLEAR, - SDLK_PRIOR, - SDLK_RETURN2, - SDLK_SEPARATOR, - SDLK_OUT, - SDLK_OPER, - SDLK_CLEARAGAIN, - SDLK_CRSEL, - SDLK_EXSEL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - SDLK_KP_00, - SDLK_KP_000, - SDLK_THOUSANDSSEPARATOR, - SDLK_DECIMALSEPARATOR, - SDLK_CURRENCYUNIT, - SDLK_CURRENCYSUBUNIT, - SDLK_KP_LEFTPAREN, - SDLK_KP_RIGHTPAREN, - SDLK_KP_LEFTBRACE, - SDLK_KP_RIGHTBRACE, - SDLK_KP_TAB, - SDLK_KP_BACKSPACE, - SDLK_KP_A, - SDLK_KP_B, - SDLK_KP_C, - SDLK_KP_D, - SDLK_KP_E, - SDLK_KP_F, - SDLK_KP_XOR, - SDLK_KP_POWER, - SDLK_KP_PERCENT, - SDLK_KP_LESS, - SDLK_KP_GREATER, - SDLK_KP_AMPERSAND, - SDLK_KP_DBLAMPERSAND, - SDLK_KP_VERTICALBAR, - SDLK_KP_DBLVERTICALBAR, - SDLK_KP_COLON, - SDLK_KP_HASH, - SDLK_KP_SPACE, - SDLK_KP_AT, - SDLK_KP_EXCLAM, - SDLK_KP_MEMSTORE, - SDLK_KP_MEMRECALL, - SDLK_KP_MEMCLEAR, - SDLK_KP_MEMADD, - SDLK_KP_MEMSUBTRACT, - SDLK_KP_MEMMULTIPLY, - SDLK_KP_MEMDIVIDE, - SDLK_KP_PLUSMINUS, - SDLK_KP_CLEAR, - SDLK_KP_CLEARENTRY, - SDLK_KP_BINARY, - SDLK_KP_OCTAL, - SDLK_KP_DECIMAL, - SDLK_KP_HEXADECIMAL, - 0, 0, - SDLK_LCTRL, - SDLK_LSHIFT, - SDLK_LALT, - SDLK_LGUI, - SDLK_RCTRL, - SDLK_RSHIFT, - SDLK_RALT, - SDLK_RGUI, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - SDLK_MODE, - SDLK_AUDIONEXT, - SDLK_AUDIOPREV, - SDLK_AUDIOSTOP, - SDLK_AUDIOPLAY, - SDLK_AUDIOMUTE, - SDLK_MEDIASELECT, - SDLK_WWW, - SDLK_MAIL, - SDLK_CALCULATOR, - SDLK_COMPUTER, - SDLK_AC_SEARCH, - SDLK_AC_HOME, - SDLK_AC_BACK, - SDLK_AC_FORWARD, - SDLK_AC_STOP, - SDLK_AC_REFRESH, - SDLK_AC_BOOKMARKS, - SDLK_BRIGHTNESSDOWN, - SDLK_BRIGHTNESSUP, - SDLK_DISPLAYSWITCH, - SDLK_KBDILLUMTOGGLE, - SDLK_KBDILLUMDOWN, - SDLK_KBDILLUMUP, - SDLK_EJECT, - SDLK_SLEEP, - SDLK_APP1, - SDLK_APP2, - SDLK_AUDIOREWIND, - SDLK_AUDIOFASTFORWARD, - SDLK_SOFTLEFT, - SDLK_SOFTRIGHT, - SDLK_CALL, - SDLK_ENDCALL, + /* 0 */ 0, + /* 1 */ 0, + /* 2 */ 0, + /* 3 */ 0, + /* 4 */ 'a', + /* 5 */ 'b', + /* 6 */ 'c', + /* 7 */ 'd', + /* 8 */ 'e', + /* 9 */ 'f', + /* 10 */ 'g', + /* 11 */ 'h', + /* 12 */ 'i', + /* 13 */ 'j', + /* 14 */ 'k', + /* 15 */ 'l', + /* 16 */ 'm', + /* 17 */ 'n', + /* 18 */ 'o', + /* 19 */ 'p', + /* 20 */ 'q', + /* 21 */ 'r', + /* 22 */ 's', + /* 23 */ 't', + /* 24 */ 'u', + /* 25 */ 'v', + /* 26 */ 'w', + /* 27 */ 'x', + /* 28 */ 'y', + /* 29 */ 'z', + /* 30 */ '1', + /* 31 */ '2', + /* 32 */ '3', + /* 33 */ '4', + /* 34 */ '5', + /* 35 */ '6', + /* 36 */ '7', + /* 37 */ '8', + /* 38 */ '9', + /* 39 */ '0', + /* 40 */ SDLK_RETURN, + /* 41 */ SDLK_ESCAPE, + /* 42 */ SDLK_BACKSPACE, + /* 43 */ SDLK_TAB, + /* 44 */ SDLK_SPACE, + /* 45 */ '-', + /* 46 */ '=', + /* 47 */ '[', + /* 48 */ ']', + /* 49 */ '\\', + /* 50 */ '#', + /* 51 */ ';', + /* 52 */ '\'', + /* 53 */ '`', + /* 54 */ ',', + /* 55 */ '.', + /* 56 */ '/', + /* 57 */ SDLK_CAPSLOCK, + /* 58 */ SDLK_F1, + /* 59 */ SDLK_F2, + /* 60 */ SDLK_F3, + /* 61 */ SDLK_F4, + /* 62 */ SDLK_F5, + /* 63 */ SDLK_F6, + /* 64 */ SDLK_F7, + /* 65 */ SDLK_F8, + /* 66 */ SDLK_F9, + /* 67 */ SDLK_F10, + /* 68 */ SDLK_F11, + /* 69 */ SDLK_F12, + /* 70 */ SDLK_PRINTSCREEN, + /* 71 */ SDLK_SCROLLLOCK, + /* 72 */ SDLK_PAUSE, + /* 73 */ SDLK_INSERT, + /* 74 */ SDLK_HOME, + /* 75 */ SDLK_PAGEUP, + /* 76 */ SDLK_DELETE, + /* 77 */ SDLK_END, + /* 78 */ SDLK_PAGEDOWN, + /* 79 */ SDLK_RIGHT, + /* 80 */ SDLK_LEFT, + /* 81 */ SDLK_DOWN, + /* 82 */ SDLK_UP, + /* 83 */ SDLK_NUMLOCKCLEAR, + /* 84 */ SDLK_KP_DIVIDE, + /* 85 */ SDLK_KP_MULTIPLY, + /* 86 */ SDLK_KP_MINUS, + /* 87 */ SDLK_KP_PLUS, + /* 88 */ SDLK_KP_ENTER, + /* 89 */ SDLK_KP_1, + /* 90 */ SDLK_KP_2, + /* 91 */ SDLK_KP_3, + /* 92 */ SDLK_KP_4, + /* 93 */ SDLK_KP_5, + /* 94 */ SDLK_KP_6, + /* 95 */ SDLK_KP_7, + /* 96 */ SDLK_KP_8, + /* 97 */ SDLK_KP_9, + /* 98 */ SDLK_KP_0, + /* 99 */ SDLK_KP_PERIOD, + /* 100 */ 0, + /* 101 */ SDLK_APPLICATION, + /* 102 */ SDLK_POWER, + /* 103 */ SDLK_KP_EQUALS, + /* 104 */ SDLK_F13, + /* 105 */ SDLK_F14, + /* 106 */ SDLK_F15, + /* 107 */ SDLK_F16, + /* 108 */ SDLK_F17, + /* 109 */ SDLK_F18, + /* 110 */ SDLK_F19, + /* 111 */ SDLK_F20, + /* 112 */ SDLK_F21, + /* 113 */ SDLK_F22, + /* 114 */ SDLK_F23, + /* 115 */ SDLK_F24, + /* 116 */ SDLK_EXECUTE, + /* 117 */ SDLK_HELP, + /* 118 */ SDLK_MENU, + /* 119 */ SDLK_SELECT, + /* 120 */ SDLK_STOP, + /* 121 */ SDLK_AGAIN, + /* 122 */ SDLK_UNDO, + /* 123 */ SDLK_CUT, + /* 124 */ SDLK_COPY, + /* 125 */ SDLK_PASTE, + /* 126 */ SDLK_FIND, + /* 127 */ SDLK_MUTE, + /* 128 */ SDLK_VOLUMEUP, + /* 129 */ SDLK_VOLUMEDOWN, + /* 130 */ 0, + /* 131 */ 0, + /* 132 */ 0, + /* 133 */ SDLK_KP_COMMA, + /* 134 */ SDLK_KP_EQUALSAS400, + /* 135 */ 0, + /* 136 */ 0, + /* 137 */ 0, + /* 138 */ 0, + /* 139 */ 0, + /* 140 */ 0, + /* 141 */ 0, + /* 142 */ 0, + /* 143 */ 0, + /* 144 */ 0, + /* 145 */ 0, + /* 146 */ 0, + /* 147 */ 0, + /* 148 */ 0, + /* 149 */ 0, + /* 150 */ 0, + /* 151 */ 0, + /* 152 */ 0, + /* 153 */ SDLK_ALTERASE, + /* 154 */ SDLK_SYSREQ, + /* 155 */ SDLK_CANCEL, + /* 156 */ SDLK_CLEAR, + /* 157 */ SDLK_PRIOR, + /* 158 */ SDLK_RETURN2, + /* 159 */ SDLK_SEPARATOR, + /* 160 */ SDLK_OUT, + /* 161 */ SDLK_OPER, + /* 162 */ SDLK_CLEARAGAIN, + /* 163 */ SDLK_CRSEL, + /* 164 */ SDLK_EXSEL, + /* 165 */ 0, + /* 166 */ 0, + /* 167 */ 0, + /* 168 */ 0, + /* 169 */ 0, + /* 170 */ 0, + /* 171 */ 0, + /* 172 */ 0, + /* 173 */ 0, + /* 174 */ 0, + /* 175 */ 0, + /* 176 */ SDLK_KP_00, + /* 177 */ SDLK_KP_000, + /* 178 */ SDLK_THOUSANDSSEPARATOR, + /* 179 */ SDLK_DECIMALSEPARATOR, + /* 180 */ SDLK_CURRENCYUNIT, + /* 181 */ SDLK_CURRENCYSUBUNIT, + /* 182 */ SDLK_KP_LEFTPAREN, + /* 183 */ SDLK_KP_RIGHTPAREN, + /* 184 */ SDLK_KP_LEFTBRACE, + /* 185 */ SDLK_KP_RIGHTBRACE, + /* 186 */ SDLK_KP_TAB, + /* 187 */ SDLK_KP_BACKSPACE, + /* 188 */ SDLK_KP_A, + /* 189 */ SDLK_KP_B, + /* 190 */ SDLK_KP_C, + /* 191 */ SDLK_KP_D, + /* 192 */ SDLK_KP_E, + /* 193 */ SDLK_KP_F, + /* 194 */ SDLK_KP_XOR, + /* 195 */ SDLK_KP_POWER, + /* 196 */ SDLK_KP_PERCENT, + /* 197 */ SDLK_KP_LESS, + /* 198 */ SDLK_KP_GREATER, + /* 199 */ SDLK_KP_AMPERSAND, + /* 200 */ SDLK_KP_DBLAMPERSAND, + /* 201 */ SDLK_KP_VERTICALBAR, + /* 202 */ SDLK_KP_DBLVERTICALBAR, + /* 203 */ SDLK_KP_COLON, + /* 204 */ SDLK_KP_HASH, + /* 205 */ SDLK_KP_SPACE, + /* 206 */ SDLK_KP_AT, + /* 207 */ SDLK_KP_EXCLAM, + /* 208 */ SDLK_KP_MEMSTORE, + /* 209 */ SDLK_KP_MEMRECALL, + /* 210 */ SDLK_KP_MEMCLEAR, + /* 211 */ SDLK_KP_MEMADD, + /* 212 */ SDLK_KP_MEMSUBTRACT, + /* 213 */ SDLK_KP_MEMMULTIPLY, + /* 214 */ SDLK_KP_MEMDIVIDE, + /* 215 */ SDLK_KP_PLUSMINUS, + /* 216 */ SDLK_KP_CLEAR, + /* 217 */ SDLK_KP_CLEARENTRY, + /* 218 */ SDLK_KP_BINARY, + /* 219 */ SDLK_KP_OCTAL, + /* 220 */ SDLK_KP_DECIMAL, + /* 221 */ SDLK_KP_HEXADECIMAL, + /* 222 */ 0, + /* 223 */ 0, + /* 224 */ SDLK_LCTRL, + /* 225 */ SDLK_LSHIFT, + /* 226 */ SDLK_LALT, + /* 227 */ SDLK_LGUI, + /* 228 */ SDLK_RCTRL, + /* 229 */ SDLK_RSHIFT, + /* 230 */ SDLK_RALT, + /* 231 */ SDLK_RGUI, + /* 232 */ 0, + /* 233 */ 0, + /* 234 */ 0, + /* 235 */ 0, + /* 236 */ 0, + /* 237 */ 0, + /* 238 */ 0, + /* 239 */ 0, + /* 240 */ 0, + /* 241 */ 0, + /* 242 */ 0, + /* 243 */ 0, + /* 244 */ 0, + /* 245 */ 0, + /* 246 */ 0, + /* 247 */ 0, + /* 248 */ 0, + /* 249 */ 0, + /* 250 */ 0, + /* 251 */ 0, + /* 252 */ 0, + /* 253 */ 0, + /* 254 */ 0, + /* 255 */ 0, + /* 256 */ 0, + /* 257 */ SDLK_MODE, + /* 258 */ SDLK_AUDIONEXT, + /* 259 */ SDLK_AUDIOPREV, + /* 260 */ SDLK_AUDIOSTOP, + /* 261 */ SDLK_AUDIOPLAY, + /* 262 */ SDLK_AUDIOMUTE, + /* 263 */ SDLK_MEDIASELECT, + /* 264 */ SDLK_WWW, + /* 265 */ SDLK_MAIL, + /* 266 */ SDLK_CALCULATOR, + /* 267 */ SDLK_COMPUTER, + /* 268 */ SDLK_AC_SEARCH, + /* 269 */ SDLK_AC_HOME, + /* 270 */ SDLK_AC_BACK, + /* 271 */ SDLK_AC_FORWARD, + /* 272 */ SDLK_AC_STOP, + /* 273 */ SDLK_AC_REFRESH, + /* 274 */ SDLK_AC_BOOKMARKS, + /* 275 */ SDLK_BRIGHTNESSDOWN, + /* 276 */ SDLK_BRIGHTNESSUP, + /* 277 */ SDLK_DISPLAYSWITCH, + /* 278 */ SDLK_KBDILLUMTOGGLE, + /* 279 */ SDLK_KBDILLUMDOWN, + /* 280 */ SDLK_KBDILLUMUP, + /* 281 */ SDLK_EJECT, + /* 282 */ SDLK_SLEEP, + /* 283 */ SDLK_APP1, + /* 284 */ SDLK_APP2, + /* 285 */ SDLK_AUDIOREWIND, + /* 286 */ SDLK_AUDIOFASTFORWARD, + /* 287 */ SDLK_SOFTLEFT, + /* 288 */ SDLK_SOFTRIGHT, + /* 289 */ SDLK_CALL, + /* 290 */ SDLK_ENDCALL, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { - NULL, NULL, NULL, NULL, - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "0", - "Return", - "Escape", - "Backspace", - "Tab", - "Space", - "-", - "=", - "[", - "]", - "\\", - "#", - ";", - "'", - "`", - ",", - ".", - "/", - "CapsLock", - "F1", - "F2", - "F3", - "F4", - "F5", - "F6", - "F7", - "F8", - "F9", - "F10", - "F11", - "F12", - "PrintScreen", - "ScrollLock", - "Pause", - "Insert", - "Home", - "PageUp", - "Delete", - "End", - "PageDown", - "Right", - "Left", - "Down", - "Up", - "Numlock", - "Keypad /", - "Keypad *", - "Keypad -", - "Keypad +", - "Keypad Enter", - "Keypad 1", - "Keypad 2", - "Keypad 3", - "Keypad 4", - "Keypad 5", - "Keypad 6", - "Keypad 7", - "Keypad 8", - "Keypad 9", - "Keypad 0", - "Keypad .", - NULL, - "Application", - "Power", - "Keypad =", - "F13", - "F14", - "F15", - "F16", - "F17", - "F18", - "F19", - "F20", - "F21", - "F22", - "F23", - "F24", - "Execute", - "Help", - "Menu", - "Select", - "Stop", - "Again", - "Undo", - "Cut", - "Copy", - "Paste", - "Find", - "Mute", - "VolumeUp", - "VolumeDown", - NULL, NULL, NULL, - "Keypad ,", - "Keypad = (AS400)", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - "AltErase", - "SysReq", - "Cancel", - "Clear", - "Prior", - "Return", - "Separator", - "Out", - "Oper", - "Clear / Again", - "CrSel", - "ExSel", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "Keypad 00", - "Keypad 000", - "ThousandsSeparator", - "DecimalSeparator", - "CurrencyUnit", - "CurrencySubUnit", - "Keypad (", - "Keypad )", - "Keypad {", - "Keypad }", - "Keypad Tab", - "Keypad Backspace", - "Keypad A", - "Keypad B", - "Keypad C", - "Keypad D", - "Keypad E", - "Keypad F", - "Keypad XOR", - "Keypad ^", - "Keypad %", - "Keypad <", - "Keypad >", - "Keypad &", - "Keypad &&", - "Keypad |", - "Keypad ||", - "Keypad :", - "Keypad #", - "Keypad Space", - "Keypad @", - "Keypad !", - "Keypad MemStore", - "Keypad MemRecall", - "Keypad MemClear", - "Keypad MemAdd", - "Keypad MemSubtract", - "Keypad MemMultiply", - "Keypad MemDivide", - "Keypad +/-", - "Keypad Clear", - "Keypad ClearEntry", - "Keypad Binary", - "Keypad Octal", - "Keypad Decimal", - "Keypad Hexadecimal", - NULL, NULL, - "Left Ctrl", - "Left Shift", - "Left Alt", - "Left GUI", - "Right Ctrl", - "Right Shift", - "Right Alt", - "Right GUI", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, - "ModeSwitch", - "AudioNext", - "AudioPrev", - "AudioStop", - "AudioPlay", - "AudioMute", - "MediaSelect", - "WWW", - "Mail", - "Calculator", - "Computer", - "AC Search", - "AC Home", - "AC Back", - "AC Forward", - "AC Stop", - "AC Refresh", - "AC Bookmarks", - "BrightnessDown", - "BrightnessUp", - "DisplaySwitch", - "KBDIllumToggle", - "KBDIllumDown", - "KBDIllumUp", - "Eject", - "Sleep", - "App1", - "App2", - "AudioRewind", - "AudioFastForward", - "SoftLeft", - "SoftRight", - "Call", - "EndCall", + /* 0 */ NULL, + /* 1 */ NULL, + /* 2 */ NULL, + /* 3 */ NULL, + /* 4 */ "A", + /* 5 */ "B", + /* 6 */ "C", + /* 7 */ "D", + /* 8 */ "E", + /* 9 */ "F", + /* 10 */ "G", + /* 11 */ "H", + /* 12 */ "I", + /* 13 */ "J", + /* 14 */ "K", + /* 15 */ "L", + /* 16 */ "M", + /* 17 */ "N", + /* 18 */ "O", + /* 19 */ "P", + /* 20 */ "Q", + /* 21 */ "R", + /* 22 */ "S", + /* 23 */ "T", + /* 24 */ "U", + /* 25 */ "V", + /* 26 */ "W", + /* 27 */ "X", + /* 28 */ "Y", + /* 29 */ "Z", + /* 30 */ "1", + /* 31 */ "2", + /* 32 */ "3", + /* 33 */ "4", + /* 34 */ "5", + /* 35 */ "6", + /* 36 */ "7", + /* 37 */ "8", + /* 38 */ "9", + /* 39 */ "0", + /* 40 */ "Return", + /* 41 */ "Escape", + /* 42 */ "Backspace", + /* 43 */ "Tab", + /* 44 */ "Space", + /* 45 */ "-", + /* 46 */ "=", + /* 47 */ "[", + /* 48 */ "]", + /* 49 */ "\\", + /* 50 */ "#", + /* 51 */ ";", + /* 52 */ "'", + /* 53 */ "`", + /* 54 */ ",", + /* 55 */ ".", + /* 56 */ "/", + /* 57 */ "CapsLock", + /* 58 */ "F1", + /* 59 */ "F2", + /* 60 */ "F3", + /* 61 */ "F4", + /* 62 */ "F5", + /* 63 */ "F6", + /* 64 */ "F7", + /* 65 */ "F8", + /* 66 */ "F9", + /* 67 */ "F10", + /* 68 */ "F11", + /* 69 */ "F12", + /* 70 */ "PrintScreen", + /* 71 */ "ScrollLock", + /* 72 */ "Pause", + /* 73 */ "Insert", + /* 74 */ "Home", + /* 75 */ "PageUp", + /* 76 */ "Delete", + /* 77 */ "End", + /* 78 */ "PageDown", + /* 79 */ "Right", + /* 80 */ "Left", + /* 81 */ "Down", + /* 82 */ "Up", + /* 83 */ "Numlock", + /* 84 */ "Keypad /", + /* 85 */ "Keypad *", + /* 86 */ "Keypad -", + /* 87 */ "Keypad +", + /* 88 */ "Keypad Enter", + /* 89 */ "Keypad 1", + /* 90 */ "Keypad 2", + /* 91 */ "Keypad 3", + /* 92 */ "Keypad 4", + /* 93 */ "Keypad 5", + /* 94 */ "Keypad 6", + /* 95 */ "Keypad 7", + /* 96 */ "Keypad 8", + /* 97 */ "Keypad 9", + /* 98 */ "Keypad 0", + /* 99 */ "Keypad .", + /* 100 */ NULL, + /* 101 */ "Application", + /* 102 */ "Power", + /* 103 */ "Keypad =", + /* 104 */ "F13", + /* 105 */ "F14", + /* 106 */ "F15", + /* 107 */ "F16", + /* 108 */ "F17", + /* 109 */ "F18", + /* 110 */ "F19", + /* 111 */ "F20", + /* 112 */ "F21", + /* 113 */ "F22", + /* 114 */ "F23", + /* 115 */ "F24", + /* 116 */ "Execute", + /* 117 */ "Help", + /* 118 */ "Menu", + /* 119 */ "Select", + /* 120 */ "Stop", + /* 121 */ "Again", + /* 122 */ "Undo", + /* 123 */ "Cut", + /* 124 */ "Copy", + /* 125 */ "Paste", + /* 126 */ "Find", + /* 127 */ "Mute", + /* 128 */ "VolumeUp", + /* 129 */ "VolumeDown", + /* 130 */ NULL, + /* 131 */ NULL, + /* 132 */ NULL, + /* 133 */ "Keypad ,", + /* 134 */ "Keypad = (AS400)", + /* 135 */ NULL, + /* 136 */ NULL, + /* 137 */ NULL, + /* 138 */ NULL, + /* 139 */ NULL, + /* 140 */ NULL, + /* 141 */ NULL, + /* 142 */ NULL, + /* 143 */ NULL, + /* 144 */ NULL, + /* 145 */ NULL, + /* 146 */ NULL, + /* 147 */ NULL, + /* 148 */ NULL, + /* 149 */ NULL, + /* 150 */ NULL, + /* 151 */ NULL, + /* 152 */ NULL, + /* 153 */ "AltErase", + /* 154 */ "SysReq", + /* 155 */ "Cancel", + /* 156 */ "Clear", + /* 157 */ "Prior", + /* 158 */ "Return", + /* 159 */ "Separator", + /* 160 */ "Out", + /* 161 */ "Oper", + /* 162 */ "Clear / Again", + /* 163 */ "CrSel", + /* 164 */ "ExSel", + /* 165 */ NULL, + /* 166 */ NULL, + /* 167 */ NULL, + /* 168 */ NULL, + /* 169 */ NULL, + /* 170 */ NULL, + /* 171 */ NULL, + /* 172 */ NULL, + /* 173 */ NULL, + /* 174 */ NULL, + /* 175 */ NULL, + /* 176 */ "Keypad 00", + /* 177 */ "Keypad 000", + /* 178 */ "ThousandsSeparator", + /* 179 */ "DecimalSeparator", + /* 180 */ "CurrencyUnit", + /* 181 */ "CurrencySubUnit", + /* 182 */ "Keypad (", + /* 183 */ "Keypad )", + /* 184 */ "Keypad {", + /* 185 */ "Keypad }", + /* 186 */ "Keypad Tab", + /* 187 */ "Keypad Backspace", + /* 188 */ "Keypad A", + /* 189 */ "Keypad B", + /* 190 */ "Keypad C", + /* 191 */ "Keypad D", + /* 192 */ "Keypad E", + /* 193 */ "Keypad F", + /* 194 */ "Keypad XOR", + /* 195 */ "Keypad ^", + /* 196 */ "Keypad %", + /* 197 */ "Keypad <", + /* 198 */ "Keypad >", + /* 199 */ "Keypad &", + /* 200 */ "Keypad &&", + /* 201 */ "Keypad |", + /* 202 */ "Keypad ||", + /* 203 */ "Keypad :", + /* 204 */ "Keypad #", + /* 205 */ "Keypad Space", + /* 206 */ "Keypad @", + /* 207 */ "Keypad !", + /* 208 */ "Keypad MemStore", + /* 209 */ "Keypad MemRecall", + /* 210 */ "Keypad MemClear", + /* 211 */ "Keypad MemAdd", + /* 212 */ "Keypad MemSubtract", + /* 213 */ "Keypad MemMultiply", + /* 214 */ "Keypad MemDivide", + /* 215 */ "Keypad +/-", + /* 216 */ "Keypad Clear", + /* 217 */ "Keypad ClearEntry", + /* 218 */ "Keypad Binary", + /* 219 */ "Keypad Octal", + /* 220 */ "Keypad Decimal", + /* 221 */ "Keypad Hexadecimal", + /* 222 */ NULL, + /* 223 */ NULL, + /* 224 */ "Left Ctrl", + /* 225 */ "Left Shift", + /* 226 */ "Left Alt", + /* 227 */ "Left GUI", + /* 228 */ "Right Ctrl", + /* 229 */ "Right Shift", + /* 230 */ "Right Alt", + /* 231 */ "Right GUI", + /* 232 */ NULL, + /* 233 */ NULL, + /* 234 */ NULL, + /* 235 */ NULL, + /* 236 */ NULL, + /* 237 */ NULL, + /* 238 */ NULL, + /* 239 */ NULL, + /* 240 */ NULL, + /* 241 */ NULL, + /* 242 */ NULL, + /* 243 */ NULL, + /* 244 */ NULL, + /* 245 */ NULL, + /* 246 */ NULL, + /* 247 */ NULL, + /* 248 */ NULL, + /* 249 */ NULL, + /* 250 */ NULL, + /* 251 */ NULL, + /* 252 */ NULL, + /* 253 */ NULL, + /* 254 */ NULL, + /* 255 */ NULL, + /* 256 */ NULL, + /* 257 */ "ModeSwitch", + /* 258 */ "AudioNext", + /* 259 */ "AudioPrev", + /* 260 */ "AudioStop", + /* 261 */ "AudioPlay", + /* 262 */ "AudioMute", + /* 263 */ "MediaSelect", + /* 264 */ "WWW", + /* 265 */ "Mail", + /* 266 */ "Calculator", + /* 267 */ "Computer", + /* 268 */ "AC Search", + /* 269 */ "AC Home", + /* 270 */ "AC Back", + /* 271 */ "AC Forward", + /* 272 */ "AC Stop", + /* 273 */ "AC Refresh", + /* 274 */ "AC Bookmarks", + /* 275 */ "BrightnessDown", + /* 276 */ "BrightnessUp", + /* 277 */ "DisplaySwitch", + /* 278 */ "KBDIllumToggle", + /* 279 */ "KBDIllumDown", + /* 280 */ "KBDIllumUp", + /* 281 */ "Eject", + /* 282 */ "Sleep", + /* 283 */ "App1", + /* 284 */ "App2", + /* 285 */ "AudioRewind", + /* 286 */ "AudioFastForward", + /* 287 */ "SoftLeft", + /* 288 */ "SoftRight", + /* 289 */ "Call", + /* 290 */ "EndCall", }; /* Taken from SDL_iconv() */ diff --git a/src/events/SDL_scancode_tables.c b/src/events/SDL_scancode_tables.c new file mode 100644 index 000000000..9c9a55fe8 --- /dev/null +++ b/src/events/SDL_scancode_tables.c @@ -0,0 +1,73 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../SDL_internal.h" + +#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 + +#include "SDL_scancode_tables_c.h" + +#include "scancodes_darwin.h" +#include "scancodes_linux.h" +#include "scancodes_xfree86.h" + +static const struct +{ + SDL_ScancodeTable table; + SDL_Scancode const *scancodes; + int num_entries; +} SDL_scancode_tables[] = { + { SDL_SCANCODE_TABLE_DARWIN, darwin_scancode_table, SDL_arraysize(darwin_scancode_table) }, + { SDL_SCANCODE_TABLE_LINUX, linux_scancode_table, SDL_arraysize(linux_scancode_table) }, + { SDL_SCANCODE_TABLE_XFREE86_1, xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) }, + { SDL_SCANCODE_TABLE_XFREE86_2, xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) }, + { SDL_SCANCODE_TABLE_XVNC, xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) }, +}; + +const SDL_Scancode *SDL_GetScancodeTable(SDL_ScancodeTable table, int *num_entries) +{ + int i; + + for (i = 0; i < SDL_arraysize(SDL_scancode_tables); ++i) { + if (table == SDL_scancode_tables[i].table) { + *num_entries = SDL_scancode_tables[i].num_entries; + return SDL_scancode_tables[i].scancodes; + } + } + + *num_entries = 0; + return NULL; +} + +SDL_Scancode SDL_GetScancodeFromTable(SDL_ScancodeTable table, int keycode) +{ + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; + int num_entries; + const SDL_Scancode *scancodes = SDL_GetScancodeTable(table, &num_entries); + + if (keycode >= 0 && keycode < num_entries) { + scancode = scancodes[keycode]; + } + return scancode; +} + +#endif /* SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_scancode_tables_c.h b/src/events/SDL_scancode_tables_c.h new file mode 100644 index 000000000..c85b8ddca --- /dev/null +++ b/src/events/SDL_scancode_tables_c.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ +#include "../SDL_internal.h" + +#include "../../include/SDL_scancode.h" + +typedef enum +{ + SDL_SCANCODE_TABLE_DARWIN, + SDL_SCANCODE_TABLE_LINUX, + SDL_SCANCODE_TABLE_XFREE86_1, + SDL_SCANCODE_TABLE_XFREE86_2, + SDL_SCANCODE_TABLE_XVNC, +} SDL_ScancodeTable; + +extern const SDL_Scancode *SDL_GetScancodeTable(SDL_ScancodeTable table, int *num_entries); +extern SDL_Scancode SDL_GetScancodeFromTable(SDL_ScancodeTable table, int keycode); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/scancodes_darwin.h b/src/events/scancodes_darwin.h index 75564112a..1d0b5c165 100644 --- a/src/events/scancodes_darwin.h +++ b/src/events/scancodes_darwin.h @@ -157,3 +157,5 @@ static const SDL_Scancode darwin_scancode_table[] = { /* 127 */ SDL_SCANCODE_POWER }; /* *INDENT-ON* */ /* clang-format on */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/scancodes_linux.h b/src/events/scancodes_linux.h index f274e993a..020f76ba9 100644 --- a/src/events/scancodes_linux.h +++ b/src/events/scancodes_linux.h @@ -26,238 +26,805 @@ */ /* *INDENT-OFF* */ /* clang-format off */ static SDL_Scancode const linux_scancode_table[] = { - /* 0 */ SDL_SCANCODE_UNKNOWN, - /* 1 */ SDL_SCANCODE_ESCAPE, - /* 2 */ SDL_SCANCODE_1, - /* 3 */ SDL_SCANCODE_2, - /* 4 */ SDL_SCANCODE_3, - /* 5 */ SDL_SCANCODE_4, - /* 6 */ SDL_SCANCODE_5, - /* 7 */ SDL_SCANCODE_6, - /* 8 */ SDL_SCANCODE_7, - /* 9 */ SDL_SCANCODE_8, - /* 10 */ SDL_SCANCODE_9, - /* 11 */ SDL_SCANCODE_0, - /* 12 */ SDL_SCANCODE_MINUS, - /* 13 */ SDL_SCANCODE_EQUALS, - /* 14 */ SDL_SCANCODE_BACKSPACE, - /* 15 */ SDL_SCANCODE_TAB, - /* 16 */ SDL_SCANCODE_Q, - /* 17 */ SDL_SCANCODE_W, - /* 18 */ SDL_SCANCODE_E, - /* 19 */ SDL_SCANCODE_R, - /* 20 */ SDL_SCANCODE_T, - /* 21 */ SDL_SCANCODE_Y, - /* 22 */ SDL_SCANCODE_U, - /* 23 */ SDL_SCANCODE_I, - /* 24 */ SDL_SCANCODE_O, - /* 25 */ SDL_SCANCODE_P, - /* 26 */ SDL_SCANCODE_LEFTBRACKET, - /* 27 */ SDL_SCANCODE_RIGHTBRACKET, - /* 28 */ SDL_SCANCODE_RETURN, - /* 29 */ SDL_SCANCODE_LCTRL, - /* 30 */ SDL_SCANCODE_A, - /* 31 */ SDL_SCANCODE_S, - /* 32 */ SDL_SCANCODE_D, - /* 33 */ SDL_SCANCODE_F, - /* 34 */ SDL_SCANCODE_G, - /* 35 */ SDL_SCANCODE_H, - /* 36 */ SDL_SCANCODE_J, - /* 37 */ SDL_SCANCODE_K, - /* 38 */ SDL_SCANCODE_L, - /* 39 */ SDL_SCANCODE_SEMICOLON, - /* 40 */ SDL_SCANCODE_APOSTROPHE, - /* 41 */ SDL_SCANCODE_GRAVE, - /* 42 */ SDL_SCANCODE_LSHIFT, - /* 43 */ SDL_SCANCODE_BACKSLASH, - /* 44 */ SDL_SCANCODE_Z, - /* 45 */ SDL_SCANCODE_X, - /* 46 */ SDL_SCANCODE_C, - /* 47 */ SDL_SCANCODE_V, - /* 48 */ SDL_SCANCODE_B, - /* 49 */ SDL_SCANCODE_N, - /* 50 */ SDL_SCANCODE_M, - /* 51 */ SDL_SCANCODE_COMMA, - /* 52 */ SDL_SCANCODE_PERIOD, - /* 53 */ SDL_SCANCODE_SLASH, - /* 54 */ SDL_SCANCODE_RSHIFT, - /* 55 */ SDL_SCANCODE_KP_MULTIPLY, - /* 56 */ SDL_SCANCODE_LALT, - /* 57 */ SDL_SCANCODE_SPACE, - /* 58 */ SDL_SCANCODE_CAPSLOCK, - /* 59 */ SDL_SCANCODE_F1, - /* 60 */ SDL_SCANCODE_F2, - /* 61 */ SDL_SCANCODE_F3, - /* 62 */ SDL_SCANCODE_F4, - /* 63 */ SDL_SCANCODE_F5, - /* 64 */ SDL_SCANCODE_F6, - /* 65 */ SDL_SCANCODE_F7, - /* 66 */ SDL_SCANCODE_F8, - /* 67 */ SDL_SCANCODE_F9, - /* 68 */ SDL_SCANCODE_F10, - /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, - /* 70 */ SDL_SCANCODE_SCROLLLOCK, - /* 71 */ SDL_SCANCODE_KP_7, - /* 72 */ SDL_SCANCODE_KP_8, - /* 73 */ SDL_SCANCODE_KP_9, - /* 74 */ SDL_SCANCODE_KP_MINUS, - /* 75 */ SDL_SCANCODE_KP_4, - /* 76 */ SDL_SCANCODE_KP_5, - /* 77 */ SDL_SCANCODE_KP_6, - /* 78 */ SDL_SCANCODE_KP_PLUS, - /* 79 */ SDL_SCANCODE_KP_1, - /* 80 */ SDL_SCANCODE_KP_2, - /* 81 */ SDL_SCANCODE_KP_3, - /* 82 */ SDL_SCANCODE_KP_0, - /* 83 */ SDL_SCANCODE_KP_PERIOD, - 0, - /* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */ - /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */ - /* 87 */ SDL_SCANCODE_F11, - /* 88 */ SDL_SCANCODE_F12, - /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */ - /* 90 */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */ - /* 91 */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */ - /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */ - /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */ - /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */ - /* 95 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */ - /* 96 */ SDL_SCANCODE_KP_ENTER, - /* 97 */ SDL_SCANCODE_RCTRL, - /* 98 */ SDL_SCANCODE_KP_DIVIDE, - /* 99 */ SDL_SCANCODE_SYSREQ, - /* 100 */ SDL_SCANCODE_RALT, - /* 101 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */ - /* 102 */ SDL_SCANCODE_HOME, - /* 103 */ SDL_SCANCODE_UP, - /* 104 */ SDL_SCANCODE_PAGEUP, - /* 105 */ SDL_SCANCODE_LEFT, - /* 106 */ SDL_SCANCODE_RIGHT, - /* 107 */ SDL_SCANCODE_END, - /* 108 */ SDL_SCANCODE_DOWN, - /* 109 */ SDL_SCANCODE_PAGEDOWN, - /* 110 */ SDL_SCANCODE_INSERT, - /* 111 */ SDL_SCANCODE_DELETE, - /* 112 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */ - /* 113 */ SDL_SCANCODE_MUTE, - /* 114 */ SDL_SCANCODE_VOLUMEDOWN, - /* 115 */ SDL_SCANCODE_VOLUMEUP, - /* 116 */ SDL_SCANCODE_POWER, - /* 117 */ SDL_SCANCODE_KP_EQUALS, - /* 118 */ SDL_SCANCODE_KP_PLUSMINUS, - /* 119 */ SDL_SCANCODE_PAUSE, - 0, - /* 121 */ SDL_SCANCODE_KP_COMMA, - /* 122 */ SDL_SCANCODE_LANG1, /* KEY_HANGUEL */ - /* 123 */ SDL_SCANCODE_LANG2, /* KEY_HANJA */ - /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */ - /* 125 */ SDL_SCANCODE_LGUI, - /* 126 */ SDL_SCANCODE_RGUI, - /* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */ - /* 128 */ SDL_SCANCODE_STOP, - /* 129 */ SDL_SCANCODE_AGAIN, - /* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */ - /* 131 */ SDL_SCANCODE_UNDO, - /* 132 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */ - /* 133 */ SDL_SCANCODE_COPY, - /* 134 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */ - /* 135 */ SDL_SCANCODE_PASTE, - /* 136 */ SDL_SCANCODE_FIND, - /* 137 */ SDL_SCANCODE_CUT, - /* 138 */ SDL_SCANCODE_HELP, - /* 139 */ SDL_SCANCODE_MENU, - /* 140 */ SDL_SCANCODE_CALCULATOR, - /* 141 */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */ - /* 142 */ SDL_SCANCODE_SLEEP, - /* 143 */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */ - /* 144 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */ - /* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */ - /* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */ - /* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */ - /* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */ - /* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */ - /* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */ - /* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */ - /* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */ - /* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */ - /* 154 */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */ - /* 155 */ SDL_SCANCODE_MAIL, - /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, - /* 157 */ SDL_SCANCODE_COMPUTER, - /* 158 */ SDL_SCANCODE_AC_BACK, - /* 159 */ SDL_SCANCODE_AC_FORWARD, - /* 160 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */ - /* 161 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */ - /* 162 */ SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD */ - /* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */ - /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */ - /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ - /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ - /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ - /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ - /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ - /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ - /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ - /* 172 */ SDL_SCANCODE_AC_HOME, - /* 173 */ SDL_SCANCODE_AC_REFRESH, - /* 174 */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */ - /* 175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */ - /* 176 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */ - /* 177 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */ - /* 178 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */ - /* 179 */ SDL_SCANCODE_KP_LEFTPAREN, - /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, - /* 181 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */ - /* 182 */ SDL_SCANCODE_UNKNOWN, /* KEY_REDO */ - /* 183 */ SDL_SCANCODE_F13, - /* 184 */ SDL_SCANCODE_F14, - /* 185 */ SDL_SCANCODE_F15, - /* 186 */ SDL_SCANCODE_F16, - /* 187 */ SDL_SCANCODE_F17, - /* 188 */ SDL_SCANCODE_F18, - /* 189 */ SDL_SCANCODE_F19, - /* 190 */ SDL_SCANCODE_F20, - /* 191 */ SDL_SCANCODE_F21, - /* 192 */ SDL_SCANCODE_F22, - /* 193 */ SDL_SCANCODE_F23, - /* 194 */ SDL_SCANCODE_F24, - 0, 0, 0, 0, 0, - /* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */ - /* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */ - /* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */ - /* 203 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */ - 0, - /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ - /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ - /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ - /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ - /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ - /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ - /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ - /* 212 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */ - /* 213 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */ - /* 214 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */ - /* 215 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL */ - /* 216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */ - /* 217 */ SDL_SCANCODE_AC_SEARCH, - /* 218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */ - /* 219 */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */ - /* 220 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */ - /* 221 */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */ - /* 222 */ SDL_SCANCODE_ALTERASE, - /* 223 */ SDL_SCANCODE_CANCEL, - /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN, - /* 225 */ SDL_SCANCODE_BRIGHTNESSUP, - /* 226 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA */ - /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */ - /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE, - /* 229 */ SDL_SCANCODE_KBDILLUMDOWN, - /* 230 */ SDL_SCANCODE_KBDILLUMUP, - /* 231 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */ - /* 232 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */ - /* 233 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */ - /* 234 */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */ - /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ - /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ + /* 0, 0x000 */ SDL_SCANCODE_UNKNOWN, /* KEY_RESERVED */ + /* 1, 0x001 */ SDL_SCANCODE_ESCAPE, /* KEY_ESC */ + /* 2, 0x002 */ SDL_SCANCODE_1, /* KEY_1 */ + /* 3, 0x003 */ SDL_SCANCODE_2, /* KEY_2 */ + /* 4, 0x004 */ SDL_SCANCODE_3, /* KEY_3 */ + /* 5, 0x005 */ SDL_SCANCODE_4, /* KEY_4 */ + /* 6, 0x006 */ SDL_SCANCODE_5, /* KEY_5 */ + /* 7, 0x007 */ SDL_SCANCODE_6, /* KEY_6 */ + /* 8, 0x008 */ SDL_SCANCODE_7, /* KEY_7 */ + /* 9, 0x009 */ SDL_SCANCODE_8, /* KEY_8 */ + /* 10, 0x00a */ SDL_SCANCODE_9, /* KEY_9 */ + /* 11, 0x00b */ SDL_SCANCODE_0, /* KEY_0 */ + /* 12, 0x00c */ SDL_SCANCODE_MINUS, /* KEY_MINUS */ + /* 13, 0x00d */ SDL_SCANCODE_EQUALS, /* KEY_EQUAL */ + /* 14, 0x00e */ SDL_SCANCODE_BACKSPACE, /* KEY_BACKSPACE */ + /* 15, 0x00f */ SDL_SCANCODE_TAB, /* KEY_TAB */ + /* 16, 0x010 */ SDL_SCANCODE_Q, /* KEY_Q */ + /* 17, 0x011 */ SDL_SCANCODE_W, /* KEY_W */ + /* 18, 0x012 */ SDL_SCANCODE_E, /* KEY_E */ + /* 19, 0x013 */ SDL_SCANCODE_R, /* KEY_R */ + /* 20, 0x014 */ SDL_SCANCODE_T, /* KEY_T */ + /* 21, 0x015 */ SDL_SCANCODE_Y, /* KEY_Y */ + /* 22, 0x016 */ SDL_SCANCODE_U, /* KEY_U */ + /* 23, 0x017 */ SDL_SCANCODE_I, /* KEY_I */ + /* 24, 0x018 */ SDL_SCANCODE_O, /* KEY_O */ + /* 25, 0x019 */ SDL_SCANCODE_P, /* KEY_P */ + /* 26, 0x01a */ SDL_SCANCODE_LEFTBRACKET, /* KEY_LEFTBRACE */ + /* 27, 0x01b */ SDL_SCANCODE_RIGHTBRACKET, /* KEY_RIGHTBRACE */ + /* 28, 0x01c */ SDL_SCANCODE_RETURN, /* KEY_ENTER */ + /* 29, 0x01d */ SDL_SCANCODE_LCTRL, /* KEY_LEFTCTRL */ + /* 30, 0x01e */ SDL_SCANCODE_A, /* KEY_A */ + /* 31, 0x01f */ SDL_SCANCODE_S, /* KEY_S */ + /* 32, 0x020 */ SDL_SCANCODE_D, /* KEY_D */ + /* 33, 0x021 */ SDL_SCANCODE_F, /* KEY_F */ + /* 34, 0x022 */ SDL_SCANCODE_G, /* KEY_G */ + /* 35, 0x023 */ SDL_SCANCODE_H, /* KEY_H */ + /* 36, 0x024 */ SDL_SCANCODE_J, /* KEY_J */ + /* 37, 0x025 */ SDL_SCANCODE_K, /* KEY_K */ + /* 38, 0x026 */ SDL_SCANCODE_L, /* KEY_L */ + /* 39, 0x027 */ SDL_SCANCODE_SEMICOLON, /* KEY_SEMICOLON */ + /* 40, 0x028 */ SDL_SCANCODE_APOSTROPHE, /* KEY_APOSTROPHE */ + /* 41, 0x029 */ SDL_SCANCODE_GRAVE, /* KEY_GRAVE */ + /* 42, 0x02a */ SDL_SCANCODE_LSHIFT, /* KEY_LEFTSHIFT */ + /* 43, 0x02b */ SDL_SCANCODE_BACKSLASH, /* KEY_BACKSLASH */ + /* 44, 0x02c */ SDL_SCANCODE_Z, /* KEY_Z */ + /* 45, 0x02d */ SDL_SCANCODE_X, /* KEY_X */ + /* 46, 0x02e */ SDL_SCANCODE_C, /* KEY_C */ + /* 47, 0x02f */ SDL_SCANCODE_V, /* KEY_V */ + /* 48, 0x030 */ SDL_SCANCODE_B, /* KEY_B */ + /* 49, 0x031 */ SDL_SCANCODE_N, /* KEY_N */ + /* 50, 0x032 */ SDL_SCANCODE_M, /* KEY_M */ + /* 51, 0x033 */ SDL_SCANCODE_COMMA, /* KEY_COMMA */ + /* 52, 0x034 */ SDL_SCANCODE_PERIOD, /* KEY_DOT */ + /* 53, 0x035 */ SDL_SCANCODE_SLASH, /* KEY_SLASH */ + /* 54, 0x036 */ SDL_SCANCODE_RSHIFT, /* KEY_RIGHTSHIFT */ + /* 55, 0x037 */ SDL_SCANCODE_KP_MULTIPLY, /* KEY_KPASTERISK */ + /* 56, 0x038 */ SDL_SCANCODE_LALT, /* KEY_LEFTALT */ + /* 57, 0x039 */ SDL_SCANCODE_SPACE, /* KEY_SPACE */ + /* 58, 0x03a */ SDL_SCANCODE_CAPSLOCK, /* KEY_CAPSLOCK */ + /* 59, 0x03b */ SDL_SCANCODE_F1, /* KEY_F1 */ + /* 60, 0x03c */ SDL_SCANCODE_F2, /* KEY_F2 */ + /* 61, 0x03d */ SDL_SCANCODE_F3, /* KEY_F3 */ + /* 62, 0x03e */ SDL_SCANCODE_F4, /* KEY_F4 */ + /* 63, 0x03f */ SDL_SCANCODE_F5, /* KEY_F5 */ + /* 64, 0x040 */ SDL_SCANCODE_F6, /* KEY_F6 */ + /* 65, 0x041 */ SDL_SCANCODE_F7, /* KEY_F7 */ + /* 66, 0x042 */ SDL_SCANCODE_F8, /* KEY_F8 */ + /* 67, 0x043 */ SDL_SCANCODE_F9, /* KEY_F9 */ + /* 68, 0x044 */ SDL_SCANCODE_F10, /* KEY_F10 */ + /* 69, 0x045 */ SDL_SCANCODE_NUMLOCKCLEAR, /* KEY_NUMLOCK */ + /* 70, 0x046 */ SDL_SCANCODE_SCROLLLOCK, /* KEY_SCROLLLOCK */ + /* 71, 0x047 */ SDL_SCANCODE_KP_7, /* KEY_KP7 */ + /* 72, 0x048 */ SDL_SCANCODE_KP_8, /* KEY_KP8 */ + /* 73, 0x049 */ SDL_SCANCODE_KP_9, /* KEY_KP9 */ + /* 74, 0x04a */ SDL_SCANCODE_KP_MINUS, /* KEY_KPMINUS */ + /* 75, 0x04b */ SDL_SCANCODE_KP_4, /* KEY_KP4 */ + /* 76, 0x04c */ SDL_SCANCODE_KP_5, /* KEY_KP5 */ + /* 77, 0x04d */ SDL_SCANCODE_KP_6, /* KEY_KP6 */ + /* 78, 0x04e */ SDL_SCANCODE_KP_PLUS, /* KEY_KPPLUS */ + /* 79, 0x04f */ SDL_SCANCODE_KP_1, /* KEY_KP1 */ + /* 80, 0x050 */ SDL_SCANCODE_KP_2, /* KEY_KP2 */ + /* 81, 0x051 */ SDL_SCANCODE_KP_3, /* KEY_KP3 */ + /* 82, 0x052 */ SDL_SCANCODE_KP_0, /* KEY_KP0 */ + /* 83, 0x053 */ SDL_SCANCODE_KP_PERIOD, /* KEY_KPDOT */ + /* 84, 0x054 */ SDL_SCANCODE_UNKNOWN, + /* 85, 0x055 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */ + /* 86, 0x056 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */ + /* 87, 0x057 */ SDL_SCANCODE_F11, /* KEY_F11 */ + /* 88, 0x058 */ SDL_SCANCODE_F12, /* KEY_F12 */ + /* 89, 0x059 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */ + /* 90, 0x05a */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */ + /* 91, 0x05b */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */ + /* 92, 0x05c */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */ + /* 93, 0x05d */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */ + /* 94, 0x05e */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */ + /* 95, 0x05f */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */ + /* 96, 0x060 */ SDL_SCANCODE_KP_ENTER, /* KEY_KPENTER */ + /* 97, 0x061 */ SDL_SCANCODE_RCTRL, /* KEY_RIGHTCTRL */ + /* 98, 0x062 */ SDL_SCANCODE_KP_DIVIDE, /* KEY_KPSLASH */ + /* 99, 0x063 */ SDL_SCANCODE_SYSREQ, /* KEY_SYSRQ */ + /* 100, 0x064 */ SDL_SCANCODE_RALT, /* KEY_RIGHTALT */ + /* 101, 0x065 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */ + /* 102, 0x066 */ SDL_SCANCODE_HOME, /* KEY_HOME */ + /* 103, 0x067 */ SDL_SCANCODE_UP, /* KEY_UP */ + /* 104, 0x068 */ SDL_SCANCODE_PAGEUP, /* KEY_PAGEUP */ + /* 105, 0x069 */ SDL_SCANCODE_LEFT, /* KEY_LEFT */ + /* 106, 0x06a */ SDL_SCANCODE_RIGHT, /* KEY_RIGHT */ + /* 107, 0x06b */ SDL_SCANCODE_END, /* KEY_END */ + /* 108, 0x06c */ SDL_SCANCODE_DOWN, /* KEY_DOWN */ + /* 109, 0x06d */ SDL_SCANCODE_PAGEDOWN, /* KEY_PAGEDOWN */ + /* 110, 0x06e */ SDL_SCANCODE_INSERT, /* KEY_INSERT */ + /* 111, 0x06f */ SDL_SCANCODE_DELETE, /* KEY_DELETE */ + /* 112, 0x070 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */ + /* 113, 0x071 */ SDL_SCANCODE_MUTE, /* KEY_MUTE */ + /* 114, 0x072 */ SDL_SCANCODE_VOLUMEDOWN, /* KEY_VOLUMEDOWN */ + /* 115, 0x073 */ SDL_SCANCODE_VOLUMEUP, /* KEY_VOLUMEUP */ + /* 116, 0x074 */ SDL_SCANCODE_POWER, /* KEY_POWER */ + /* 117, 0x075 */ SDL_SCANCODE_KP_EQUALS, /* KEY_KPEQUAL */ + /* 118, 0x076 */ SDL_SCANCODE_KP_PLUSMINUS, /* KEY_KPPLUSMINUS */ + /* 119, 0x077 */ SDL_SCANCODE_PAUSE, /* KEY_PAUSE */ + /* 120, 0x078 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCALE */ + /* 121, 0x079 */ SDL_SCANCODE_KP_COMMA, /* KEY_KPCOMMA */ + /* 122, 0x07a */ SDL_SCANCODE_LANG1, /* KEY_HANGEUL */ + /* 123, 0x07b */ SDL_SCANCODE_LANG2, /* KEY_HANJA */ + /* 124, 0x07c */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */ + /* 125, 0x07d */ SDL_SCANCODE_LGUI, /* KEY_LEFTMETA */ + /* 126, 0x07e */ SDL_SCANCODE_RGUI, /* KEY_RIGHTMETA */ + /* 127, 0x07f */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */ + /* 128, 0x080 */ SDL_SCANCODE_STOP, /* KEY_STOP */ + /* 129, 0x081 */ SDL_SCANCODE_AGAIN, /* KEY_AGAIN */ + /* 130, 0x082 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */ + /* 131, 0x083 */ SDL_SCANCODE_UNDO, /* KEY_UNDO */ + /* 132, 0x084 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */ + /* 133, 0x085 */ SDL_SCANCODE_COPY, /* KEY_COPY */ + /* 134, 0x086 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */ + /* 135, 0x087 */ SDL_SCANCODE_PASTE, /* KEY_PASTE */ + /* 136, 0x088 */ SDL_SCANCODE_FIND, /* KEY_FIND */ + /* 137, 0x089 */ SDL_SCANCODE_CUT, /* KEY_CUT */ + /* 138, 0x08a */ SDL_SCANCODE_HELP, /* KEY_HELP */ + /* 139, 0x08b */ SDL_SCANCODE_MENU, /* KEY_MENU */ + /* 140, 0x08c */ SDL_SCANCODE_CALCULATOR, /* KEY_CALC */ + /* 141, 0x08d */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */ + /* 142, 0x08e */ SDL_SCANCODE_SLEEP, /* KEY_SLEEP */ + /* 143, 0x08f */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */ + /* 144, 0x090 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */ + /* 145, 0x091 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */ + /* 146, 0x092 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */ + /* 147, 0x093 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */ + /* 148, 0x094 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */ + /* 149, 0x095 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */ + /* 150, 0x096 */ SDL_SCANCODE_WWW, /* KEY_WWW */ + /* 151, 0x097 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */ + /* 152, 0x098 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */ + /* 153, 0x099 */ SDL_SCANCODE_UNKNOWN, /* KEY_ROTATE_DISPLAY */ + /* 154, 0x09a */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */ + /* 155, 0x09b */ SDL_SCANCODE_MAIL, /* KEY_MAIL */ + /* 156, 0x09c */ SDL_SCANCODE_AC_BOOKMARKS, /* KEY_BOOKMARKS */ + /* 157, 0x09d */ SDL_SCANCODE_COMPUTER, /* KEY_COMPUTER */ + /* 158, 0x09e */ SDL_SCANCODE_AC_BACK, /* KEY_BACK */ + /* 159, 0x09f */ SDL_SCANCODE_AC_FORWARD, /* KEY_FORWARD */ + /* 160, 0x0a0 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */ + /* 161, 0x0a1 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */ + /* 162, 0x0a2 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCLOSECD */ + /* 163, 0x0a3 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */ + /* 164, 0x0a4 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */ + /* 165, 0x0a5 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ + /* 166, 0x0a6 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ + /* 167, 0x0a7 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ + /* 168, 0x0a8 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ + /* 169, 0x0a9 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ + /* 170, 0x0aa */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ + /* 171, 0x0ab */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ + /* 172, 0x0ac */ SDL_SCANCODE_AC_HOME, /* KEY_HOMEPAGE */ + /* 173, 0x0ad */ SDL_SCANCODE_AC_REFRESH, /* KEY_REFRESH */ + /* 174, 0x0ae */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */ + /* 175, 0x0af */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */ + /* 176, 0x0b0 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */ + /* 177, 0x0b1 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */ + /* 178, 0x0b2 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */ + /* 179, 0x0b3 */ SDL_SCANCODE_KP_LEFTPAREN, /* KEY_KPLEFTPAREN */ + /* 180, 0x0b4 */ SDL_SCANCODE_KP_RIGHTPAREN, /* KEY_KPRIGHTPAREN */ + /* 181, 0x0b5 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */ + /* 182, 0x0b6 */ SDL_SCANCODE_AGAIN, /* KEY_REDO */ + /* 183, 0x0b7 */ SDL_SCANCODE_F13, /* KEY_F13 */ + /* 184, 0x0b8 */ SDL_SCANCODE_F14, /* KEY_F14 */ + /* 185, 0x0b9 */ SDL_SCANCODE_F15, /* KEY_F15 */ + /* 186, 0x0ba */ SDL_SCANCODE_F16, /* KEY_F16 */ + /* 187, 0x0bb */ SDL_SCANCODE_F17, /* KEY_F17 */ + /* 188, 0x0bc */ SDL_SCANCODE_F18, /* KEY_F18 */ + /* 189, 0x0bd */ SDL_SCANCODE_F19, /* KEY_F19 */ + /* 190, 0x0be */ SDL_SCANCODE_F20, /* KEY_F20 */ + /* 191, 0x0bf */ SDL_SCANCODE_F21, /* KEY_F21 */ + /* 192, 0x0c0 */ SDL_SCANCODE_F22, /* KEY_F22 */ + /* 193, 0x0c1 */ SDL_SCANCODE_F23, /* KEY_F23 */ + /* 194, 0x0c2 */ SDL_SCANCODE_F24, /* KEY_F24 */ + /* 195, 0x0c3 */ SDL_SCANCODE_UNKNOWN, + /* 196, 0x0c4 */ SDL_SCANCODE_UNKNOWN, + /* 197, 0x0c5 */ SDL_SCANCODE_UNKNOWN, + /* 198, 0x0c6 */ SDL_SCANCODE_UNKNOWN, + /* 199, 0x0c7 */ SDL_SCANCODE_UNKNOWN, + /* 200, 0x0c8 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYCD */ + /* 201, 0x0c9 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */ + /* 202, 0x0ca */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */ + /* 203, 0x0cb */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */ + /* 204, 0x0cc */ SDL_SCANCODE_UNKNOWN, /* KEY_ALL_APPLICATIONS */ + /* 205, 0x0cd */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ + /* 206, 0x0ce */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ + /* 207, 0x0cf */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAY */ + /* 208, 0x0d0 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ + /* 209, 0x0d1 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ + /* 210, 0x0d2 */ SDL_SCANCODE_PRINTSCREEN, /* KEY_PRINT */ + /* 211, 0x0d3 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ + /* 212, 0x0d4 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */ + /* 213, 0x0d5 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */ + /* 214, 0x0d6 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */ + /* 215, 0x0d7 */ SDL_SCANCODE_MAIL, /* KEY_EMAIL */ + /* 216, 0x0d8 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */ + /* 217, 0x0d9 */ SDL_SCANCODE_AC_SEARCH, /* KEY_SEARCH */ + /* 218, 0x0da */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */ + /* 219, 0x0db */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */ + /* 220, 0x0dc */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */ + /* 221, 0x0dd */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */ + /* 222, 0x0de */ SDL_SCANCODE_ALTERASE, /* KEY_ALTERASE */ + /* 223, 0x0df */ SDL_SCANCODE_CANCEL, /* KEY_CANCEL */ + /* 224, 0x0e0 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* KEY_BRIGHTNESSDOWN */ + /* 225, 0x0e1 */ SDL_SCANCODE_BRIGHTNESSUP, /* KEY_BRIGHTNESSUP */ + /* 226, 0x0e2 */ SDL_SCANCODE_MEDIASELECT, /* KEY_MEDIA */ + /* 227, 0x0e3 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */ + /* 228, 0x0e4 */ SDL_SCANCODE_KBDILLUMTOGGLE, /* KEY_KBDILLUMTOGGLE */ + /* 229, 0x0e5 */ SDL_SCANCODE_KBDILLUMDOWN, /* KEY_KBDILLUMDOWN */ + /* 230, 0x0e6 */ SDL_SCANCODE_KBDILLUMUP, /* KEY_KBDILLUMUP */ + /* 231, 0x0e7 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */ + /* 232, 0x0e8 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */ + /* 233, 0x0e9 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */ + /* 234, 0x0ea */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */ + /* 235, 0x0eb */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ + /* 236, 0x0ec */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ + /* 237, 0x0ed */ SDL_SCANCODE_UNKNOWN, /* KEY_BLUETOOTH */ + /* 238, 0x0ee */ SDL_SCANCODE_UNKNOWN, /* KEY_WLAN */ + /* 239, 0x0ef */ SDL_SCANCODE_UNKNOWN, /* KEY_UWB */ + /* 240, 0x0f0 */ SDL_SCANCODE_UNKNOWN, /* KEY_UNKNOWN */ + /* 241, 0x0f1 */ SDL_SCANCODE_UNKNOWN, /* KEY_VIDEO_NEXT */ + /* 242, 0x0f2 */ SDL_SCANCODE_UNKNOWN, /* KEY_VIDEO_PREV */ + /* 243, 0x0f3 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_CYCLE */ + /* 244, 0x0f4 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_AUTO */ + /* 245, 0x0f5 */ SDL_SCANCODE_UNKNOWN, /* KEY_DISPLAY_OFF */ + /* 246, 0x0f6 */ SDL_SCANCODE_UNKNOWN, /* KEY_WWAN */ + /* 247, 0x0f7 */ SDL_SCANCODE_UNKNOWN, /* KEY_RFKILL */ + /* 248, 0x0f8 */ SDL_SCANCODE_UNKNOWN, /* KEY_MICMUTE */ + /* 249, 0x0f9 */ SDL_SCANCODE_UNKNOWN, + /* 250, 0x0fa */ SDL_SCANCODE_UNKNOWN, + /* 251, 0x0fb */ SDL_SCANCODE_UNKNOWN, + /* 252, 0x0fc */ SDL_SCANCODE_UNKNOWN, + /* 253, 0x0fd */ SDL_SCANCODE_UNKNOWN, + /* 254, 0x0fe */ SDL_SCANCODE_UNKNOWN, + /* 255, 0x0ff */ SDL_SCANCODE_UNKNOWN, +#if 0 /* We don't have any mapped scancodes after this point (yet) */ + /* 256, 0x100 */ SDL_SCANCODE_UNKNOWN, + /* 257, 0x101 */ SDL_SCANCODE_UNKNOWN, + /* 258, 0x102 */ SDL_SCANCODE_UNKNOWN, + /* 259, 0x103 */ SDL_SCANCODE_UNKNOWN, + /* 260, 0x104 */ SDL_SCANCODE_UNKNOWN, + /* 261, 0x105 */ SDL_SCANCODE_UNKNOWN, + /* 262, 0x106 */ SDL_SCANCODE_UNKNOWN, + /* 263, 0x107 */ SDL_SCANCODE_UNKNOWN, + /* 264, 0x108 */ SDL_SCANCODE_UNKNOWN, + /* 265, 0x109 */ SDL_SCANCODE_UNKNOWN, + /* 266, 0x10a */ SDL_SCANCODE_UNKNOWN, + /* 267, 0x10b */ SDL_SCANCODE_UNKNOWN, + /* 268, 0x10c */ SDL_SCANCODE_UNKNOWN, + /* 269, 0x10d */ SDL_SCANCODE_UNKNOWN, + /* 270, 0x10e */ SDL_SCANCODE_UNKNOWN, + /* 271, 0x10f */ SDL_SCANCODE_UNKNOWN, + /* 272, 0x110 */ SDL_SCANCODE_UNKNOWN, + /* 273, 0x111 */ SDL_SCANCODE_UNKNOWN, + /* 274, 0x112 */ SDL_SCANCODE_UNKNOWN, + /* 275, 0x113 */ SDL_SCANCODE_UNKNOWN, + /* 276, 0x114 */ SDL_SCANCODE_UNKNOWN, + /* 277, 0x115 */ SDL_SCANCODE_UNKNOWN, + /* 278, 0x116 */ SDL_SCANCODE_UNKNOWN, + /* 279, 0x117 */ SDL_SCANCODE_UNKNOWN, + /* 280, 0x118 */ SDL_SCANCODE_UNKNOWN, + /* 281, 0x119 */ SDL_SCANCODE_UNKNOWN, + /* 282, 0x11a */ SDL_SCANCODE_UNKNOWN, + /* 283, 0x11b */ SDL_SCANCODE_UNKNOWN, + /* 284, 0x11c */ SDL_SCANCODE_UNKNOWN, + /* 285, 0x11d */ SDL_SCANCODE_UNKNOWN, + /* 286, 0x11e */ SDL_SCANCODE_UNKNOWN, + /* 287, 0x11f */ SDL_SCANCODE_UNKNOWN, + /* 288, 0x120 */ SDL_SCANCODE_UNKNOWN, + /* 289, 0x121 */ SDL_SCANCODE_UNKNOWN, + /* 290, 0x122 */ SDL_SCANCODE_UNKNOWN, + /* 291, 0x123 */ SDL_SCANCODE_UNKNOWN, + /* 292, 0x124 */ SDL_SCANCODE_UNKNOWN, + /* 293, 0x125 */ SDL_SCANCODE_UNKNOWN, + /* 294, 0x126 */ SDL_SCANCODE_UNKNOWN, + /* 295, 0x127 */ SDL_SCANCODE_UNKNOWN, + /* 296, 0x128 */ SDL_SCANCODE_UNKNOWN, + /* 297, 0x129 */ SDL_SCANCODE_UNKNOWN, + /* 298, 0x12a */ SDL_SCANCODE_UNKNOWN, + /* 299, 0x12b */ SDL_SCANCODE_UNKNOWN, + /* 300, 0x12c */ SDL_SCANCODE_UNKNOWN, + /* 301, 0x12d */ SDL_SCANCODE_UNKNOWN, + /* 302, 0x12e */ SDL_SCANCODE_UNKNOWN, + /* 303, 0x12f */ SDL_SCANCODE_UNKNOWN, + /* 304, 0x130 */ SDL_SCANCODE_UNKNOWN, + /* 305, 0x131 */ SDL_SCANCODE_UNKNOWN, + /* 306, 0x132 */ SDL_SCANCODE_UNKNOWN, + /* 307, 0x133 */ SDL_SCANCODE_UNKNOWN, + /* 308, 0x134 */ SDL_SCANCODE_UNKNOWN, + /* 309, 0x135 */ SDL_SCANCODE_UNKNOWN, + /* 310, 0x136 */ SDL_SCANCODE_UNKNOWN, + /* 311, 0x137 */ SDL_SCANCODE_UNKNOWN, + /* 312, 0x138 */ SDL_SCANCODE_UNKNOWN, + /* 313, 0x139 */ SDL_SCANCODE_UNKNOWN, + /* 314, 0x13a */ SDL_SCANCODE_UNKNOWN, + /* 315, 0x13b */ SDL_SCANCODE_UNKNOWN, + /* 316, 0x13c */ SDL_SCANCODE_UNKNOWN, + /* 317, 0x13d */ SDL_SCANCODE_UNKNOWN, + /* 318, 0x13e */ SDL_SCANCODE_UNKNOWN, + /* 319, 0x13f */ SDL_SCANCODE_UNKNOWN, + /* 320, 0x140 */ SDL_SCANCODE_UNKNOWN, + /* 321, 0x141 */ SDL_SCANCODE_UNKNOWN, + /* 322, 0x142 */ SDL_SCANCODE_UNKNOWN, + /* 323, 0x143 */ SDL_SCANCODE_UNKNOWN, + /* 324, 0x144 */ SDL_SCANCODE_UNKNOWN, + /* 325, 0x145 */ SDL_SCANCODE_UNKNOWN, + /* 326, 0x146 */ SDL_SCANCODE_UNKNOWN, + /* 327, 0x147 */ SDL_SCANCODE_UNKNOWN, + /* 328, 0x148 */ SDL_SCANCODE_UNKNOWN, + /* 329, 0x149 */ SDL_SCANCODE_UNKNOWN, + /* 330, 0x14a */ SDL_SCANCODE_UNKNOWN, + /* 331, 0x14b */ SDL_SCANCODE_UNKNOWN, + /* 332, 0x14c */ SDL_SCANCODE_UNKNOWN, + /* 333, 0x14d */ SDL_SCANCODE_UNKNOWN, + /* 334, 0x14e */ SDL_SCANCODE_UNKNOWN, + /* 335, 0x14f */ SDL_SCANCODE_UNKNOWN, + /* 336, 0x150 */ SDL_SCANCODE_UNKNOWN, + /* 337, 0x151 */ SDL_SCANCODE_UNKNOWN, + /* 338, 0x152 */ SDL_SCANCODE_UNKNOWN, + /* 339, 0x153 */ SDL_SCANCODE_UNKNOWN, + /* 340, 0x154 */ SDL_SCANCODE_UNKNOWN, + /* 341, 0x155 */ SDL_SCANCODE_UNKNOWN, + /* 342, 0x156 */ SDL_SCANCODE_UNKNOWN, + /* 343, 0x157 */ SDL_SCANCODE_UNKNOWN, + /* 344, 0x158 */ SDL_SCANCODE_UNKNOWN, + /* 345, 0x159 */ SDL_SCANCODE_UNKNOWN, + /* 346, 0x15a */ SDL_SCANCODE_UNKNOWN, + /* 347, 0x15b */ SDL_SCANCODE_UNKNOWN, + /* 348, 0x15c */ SDL_SCANCODE_UNKNOWN, + /* 349, 0x15d */ SDL_SCANCODE_UNKNOWN, + /* 350, 0x15e */ SDL_SCANCODE_UNKNOWN, + /* 351, 0x15f */ SDL_SCANCODE_UNKNOWN, + /* 352, 0x160 */ SDL_SCANCODE_UNKNOWN, /* KEY_OK */ + /* 353, 0x161 */ SDL_SCANCODE_UNKNOWN, /* KEY_SELECT */ + /* 354, 0x162 */ SDL_SCANCODE_UNKNOWN, /* KEY_GOTO */ + /* 355, 0x163 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLEAR */ + /* 356, 0x164 */ SDL_SCANCODE_UNKNOWN, /* KEY_POWER2 */ + /* 357, 0x165 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPTION */ + /* 358, 0x166 */ SDL_SCANCODE_UNKNOWN, /* KEY_INFO */ + /* 359, 0x167 */ SDL_SCANCODE_UNKNOWN, /* KEY_TIME */ + /* 360, 0x168 */ SDL_SCANCODE_UNKNOWN, /* KEY_VENDOR */ + /* 361, 0x169 */ SDL_SCANCODE_UNKNOWN, /* KEY_ARCHIVE */ + /* 362, 0x16a */ SDL_SCANCODE_UNKNOWN, /* KEY_PROGRAM */ + /* 363, 0x16b */ SDL_SCANCODE_UNKNOWN, /* KEY_CHANNEL */ + /* 364, 0x16c */ SDL_SCANCODE_UNKNOWN, /* KEY_FAVORITES */ + /* 365, 0x16d */ SDL_SCANCODE_UNKNOWN, /* KEY_EPG */ + /* 366, 0x16e */ SDL_SCANCODE_UNKNOWN, /* KEY_PVR */ + /* 367, 0x16f */ SDL_SCANCODE_UNKNOWN, /* KEY_MHP */ + /* 368, 0x170 */ SDL_SCANCODE_UNKNOWN, /* KEY_LANGUAGE */ + /* 369, 0x171 */ SDL_SCANCODE_UNKNOWN, /* KEY_TITLE */ + /* 370, 0x172 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUBTITLE */ + /* 371, 0x173 */ SDL_SCANCODE_UNKNOWN, /* KEY_ANGLE */ + /* 372, 0x174 */ SDL_SCANCODE_UNKNOWN, /* KEY_FULL_SCREEN */ + /* 373, 0x175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MODE */ + /* 374, 0x176 */ SDL_SCANCODE_UNKNOWN, /* KEY_KEYBOARD */ + /* 375, 0x177 */ SDL_SCANCODE_UNKNOWN, /* KEY_ASPECT_RATIO */ + /* 376, 0x178 */ SDL_SCANCODE_UNKNOWN, /* KEY_PC */ + /* 377, 0x179 */ SDL_SCANCODE_UNKNOWN, /* KEY_TV */ + /* 378, 0x17a */ SDL_SCANCODE_UNKNOWN, /* KEY_TV2 */ + /* 379, 0x17b */ SDL_SCANCODE_UNKNOWN, /* KEY_VCR */ + /* 380, 0x17c */ SDL_SCANCODE_UNKNOWN, /* KEY_VCR2 */ + /* 381, 0x17d */ SDL_SCANCODE_UNKNOWN, /* KEY_SAT */ + /* 382, 0x17e */ SDL_SCANCODE_UNKNOWN, /* KEY_SAT2 */ + /* 383, 0x17f */ SDL_SCANCODE_UNKNOWN, /* KEY_CD */ + /* 384, 0x180 */ SDL_SCANCODE_UNKNOWN, /* KEY_TAPE */ + /* 385, 0x181 */ SDL_SCANCODE_UNKNOWN, /* KEY_RADIO */ + /* 386, 0x182 */ SDL_SCANCODE_UNKNOWN, /* KEY_TUNER */ + /* 387, 0x183 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYER */ + /* 388, 0x184 */ SDL_SCANCODE_UNKNOWN, /* KEY_TEXT */ + /* 389, 0x185 */ SDL_SCANCODE_UNKNOWN, /* KEY_DVD */ + /* 390, 0x186 */ SDL_SCANCODE_UNKNOWN, /* KEY_AUX */ + /* 391, 0x187 */ SDL_SCANCODE_UNKNOWN, /* KEY_MP3 */ + /* 392, 0x188 */ SDL_SCANCODE_UNKNOWN, /* KEY_AUDIO */ + /* 393, 0x189 */ SDL_SCANCODE_UNKNOWN, /* KEY_VIDEO */ + /* 394, 0x18a */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTORY */ + /* 395, 0x18b */ SDL_SCANCODE_UNKNOWN, /* KEY_LIST */ + /* 396, 0x18c */ SDL_SCANCODE_UNKNOWN, /* KEY_MEMO */ + /* 397, 0x18d */ SDL_SCANCODE_UNKNOWN, /* KEY_CALENDAR */ + /* 398, 0x18e */ SDL_SCANCODE_UNKNOWN, /* KEY_RED */ + /* 399, 0x18f */ SDL_SCANCODE_UNKNOWN, /* KEY_GREEN */ + /* 400, 0x190 */ SDL_SCANCODE_UNKNOWN, /* KEY_YELLOW */ + /* 401, 0x191 */ SDL_SCANCODE_UNKNOWN, /* KEY_BLUE */ + /* 402, 0x192 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHANNELUP */ + /* 403, 0x193 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHANNELDOWN */ + /* 404, 0x194 */ SDL_SCANCODE_UNKNOWN, /* KEY_FIRST */ + /* 405, 0x195 */ SDL_SCANCODE_UNKNOWN, /* KEY_LAST */ + /* 406, 0x196 */ SDL_SCANCODE_UNKNOWN, /* KEY_AB */ + /* 407, 0x197 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEXT */ + /* 408, 0x198 */ SDL_SCANCODE_UNKNOWN, /* KEY_RESTART */ + /* 409, 0x199 */ SDL_SCANCODE_UNKNOWN, /* KEY_SLOW */ + /* 410, 0x19a */ SDL_SCANCODE_UNKNOWN, /* KEY_SHUFFLE */ + /* 411, 0x19b */ SDL_SCANCODE_UNKNOWN, /* KEY_BREAK */ + /* 412, 0x19c */ SDL_SCANCODE_UNKNOWN, /* KEY_PREVIOUS */ + /* 413, 0x19d */ SDL_SCANCODE_UNKNOWN, /* KEY_DIGITS */ + /* 414, 0x19e */ SDL_SCANCODE_UNKNOWN, /* KEY_TEEN */ + /* 415, 0x19f */ SDL_SCANCODE_UNKNOWN, /* KEY_TWEN */ + /* 416, 0x1a0 */ SDL_SCANCODE_UNKNOWN, /* KEY_VIDEOPHONE */ + /* 417, 0x1a1 */ SDL_SCANCODE_UNKNOWN, /* KEY_GAMES */ + /* 418, 0x1a2 */ SDL_SCANCODE_UNKNOWN, /* KEY_ZOOMIN */ + /* 419, 0x1a3 */ SDL_SCANCODE_UNKNOWN, /* KEY_ZOOMOUT */ + /* 420, 0x1a4 */ SDL_SCANCODE_UNKNOWN, /* KEY_ZOOMRESET */ + /* 421, 0x1a5 */ SDL_SCANCODE_UNKNOWN, /* KEY_WORDPROCESSOR */ + /* 422, 0x1a6 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDITOR */ + /* 423, 0x1a7 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPREADSHEET */ + /* 424, 0x1a8 */ SDL_SCANCODE_UNKNOWN, /* KEY_GRAPHICSEDITOR */ + /* 425, 0x1a9 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRESENTATION */ + /* 426, 0x1aa */ SDL_SCANCODE_UNKNOWN, /* KEY_DATABASE */ + /* 427, 0x1ab */ SDL_SCANCODE_UNKNOWN, /* KEY_NEWS */ + /* 428, 0x1ac */ SDL_SCANCODE_UNKNOWN, /* KEY_VOICEMAIL */ + /* 429, 0x1ad */ SDL_SCANCODE_UNKNOWN, /* KEY_ADDRESSBOOK */ + /* 430, 0x1ae */ SDL_SCANCODE_UNKNOWN, /* KEY_MESSENGER */ + /* 431, 0x1af */ SDL_SCANCODE_UNKNOWN, /* KEY_DISPLAYTOGGLE */ + /* 432, 0x1b0 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPELLCHECK */ + /* 433, 0x1b1 */ SDL_SCANCODE_UNKNOWN, /* KEY_LOGOFF */ + /* 434, 0x1b2 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOLLAR */ + /* 435, 0x1b3 */ SDL_SCANCODE_UNKNOWN, /* KEY_EURO */ + /* 436, 0x1b4 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRAMEBACK */ + /* 437, 0x1b5 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRAMEFORWARD */ + /* 438, 0x1b6 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONTEXT_MENU */ + /* 439, 0x1b7 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA_REPEAT */ + /* 440, 0x1b8 */ SDL_SCANCODE_UNKNOWN, /* KEY_10CHANNELSUP */ + /* 441, 0x1b9 */ SDL_SCANCODE_UNKNOWN, /* KEY_10CHANNELSDOWN */ + /* 442, 0x1ba */ SDL_SCANCODE_UNKNOWN, /* KEY_IMAGES */ + /* 443, 0x1bb */ SDL_SCANCODE_UNKNOWN, + /* 444, 0x1bc */ SDL_SCANCODE_UNKNOWN, /* KEY_NOTIFICATION_CENTER */ + /* 445, 0x1bd */ SDL_SCANCODE_UNKNOWN, /* KEY_PICKUP_PHONE */ + /* 446, 0x1be */ SDL_SCANCODE_UNKNOWN, /* KEY_HANGUP_PHONE */ + /* 447, 0x1bf */ SDL_SCANCODE_UNKNOWN, + /* 448, 0x1c0 */ SDL_SCANCODE_UNKNOWN, /* KEY_DEL_EOL */ + /* 449, 0x1c1 */ SDL_SCANCODE_UNKNOWN, /* KEY_DEL_EOS */ + /* 450, 0x1c2 */ SDL_SCANCODE_UNKNOWN, /* KEY_INS_LINE */ + /* 451, 0x1c3 */ SDL_SCANCODE_UNKNOWN, /* KEY_DEL_LINE */ + /* 452, 0x1c4 */ SDL_SCANCODE_UNKNOWN, + /* 453, 0x1c5 */ SDL_SCANCODE_UNKNOWN, + /* 454, 0x1c6 */ SDL_SCANCODE_UNKNOWN, + /* 455, 0x1c7 */ SDL_SCANCODE_UNKNOWN, + /* 456, 0x1c8 */ SDL_SCANCODE_UNKNOWN, + /* 457, 0x1c9 */ SDL_SCANCODE_UNKNOWN, + /* 458, 0x1ca */ SDL_SCANCODE_UNKNOWN, + /* 459, 0x1cb */ SDL_SCANCODE_UNKNOWN, + /* 460, 0x1cc */ SDL_SCANCODE_UNKNOWN, + /* 461, 0x1cd */ SDL_SCANCODE_UNKNOWN, + /* 462, 0x1ce */ SDL_SCANCODE_UNKNOWN, + /* 463, 0x1cf */ SDL_SCANCODE_UNKNOWN, + /* 464, 0x1d0 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN */ + /* 465, 0x1d1 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_ESC */ + /* 466, 0x1d2 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F1 */ + /* 467, 0x1d3 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F2 */ + /* 468, 0x1d4 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F3 */ + /* 469, 0x1d5 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F4 */ + /* 470, 0x1d6 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F5 */ + /* 471, 0x1d7 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F6 */ + /* 472, 0x1d8 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F7 */ + /* 473, 0x1d9 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F8 */ + /* 474, 0x1da */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F9 */ + /* 475, 0x1db */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F10 */ + /* 476, 0x1dc */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F11 */ + /* 477, 0x1dd */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F12 */ + /* 478, 0x1de */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_1 */ + /* 479, 0x1df */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_2 */ + /* 480, 0x1e0 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_D */ + /* 481, 0x1e1 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_E */ + /* 482, 0x1e2 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_F */ + /* 483, 0x1e3 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_S */ + /* 484, 0x1e4 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_B */ + /* 485, 0x1e5 */ SDL_SCANCODE_UNKNOWN, /* KEY_FN_RIGHT_SHIFT */ + /* 486, 0x1e6 */ SDL_SCANCODE_UNKNOWN, + /* 487, 0x1e7 */ SDL_SCANCODE_UNKNOWN, + /* 488, 0x1e8 */ SDL_SCANCODE_UNKNOWN, + /* 489, 0x1e9 */ SDL_SCANCODE_UNKNOWN, + /* 490, 0x1ea */ SDL_SCANCODE_UNKNOWN, + /* 491, 0x1eb */ SDL_SCANCODE_UNKNOWN, + /* 492, 0x1ec */ SDL_SCANCODE_UNKNOWN, + /* 493, 0x1ed */ SDL_SCANCODE_UNKNOWN, + /* 494, 0x1ee */ SDL_SCANCODE_UNKNOWN, + /* 495, 0x1ef */ SDL_SCANCODE_UNKNOWN, + /* 496, 0x1f0 */ SDL_SCANCODE_UNKNOWN, + /* 497, 0x1f1 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT1 */ + /* 498, 0x1f2 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT2 */ + /* 499, 0x1f3 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT3 */ + /* 500, 0x1f4 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT4 */ + /* 501, 0x1f5 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT5 */ + /* 502, 0x1f6 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT6 */ + /* 503, 0x1f7 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT7 */ + /* 504, 0x1f8 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT8 */ + /* 505, 0x1f9 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT9 */ + /* 506, 0x1fa */ SDL_SCANCODE_UNKNOWN, /* KEY_BRL_DOT10 */ + /* 507, 0x1fb */ SDL_SCANCODE_UNKNOWN, + /* 508, 0x1fc */ SDL_SCANCODE_UNKNOWN, + /* 509, 0x1fd */ SDL_SCANCODE_UNKNOWN, + /* 510, 0x1fe */ SDL_SCANCODE_UNKNOWN, + /* 511, 0x1ff */ SDL_SCANCODE_UNKNOWN, + /* 512, 0x200 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_0 */ + /* 513, 0x201 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_1 */ + /* 514, 0x202 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_2 */ + /* 515, 0x203 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_3 */ + /* 516, 0x204 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_4 */ + /* 517, 0x205 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_5 */ + /* 518, 0x206 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_6 */ + /* 519, 0x207 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_7 */ + /* 520, 0x208 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_8 */ + /* 521, 0x209 */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_9 */ + /* 522, 0x20a */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_STAR */ + /* 523, 0x20b */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_POUND */ + /* 524, 0x20c */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_A */ + /* 525, 0x20d */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_B */ + /* 526, 0x20e */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_C */ + /* 527, 0x20f */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_D */ + /* 528, 0x210 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_FOCUS */ + /* 529, 0x211 */ SDL_SCANCODE_UNKNOWN, /* KEY_WPS_BUTTON */ + /* 530, 0x212 */ SDL_SCANCODE_UNKNOWN, /* KEY_TOUCHPAD_TOGGLE */ + /* 531, 0x213 */ SDL_SCANCODE_UNKNOWN, /* KEY_TOUCHPAD_ON */ + /* 532, 0x214 */ SDL_SCANCODE_UNKNOWN, /* KEY_TOUCHPAD_OFF */ + /* 533, 0x215 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_ZOOMIN */ + /* 534, 0x216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_ZOOMOUT */ + /* 535, 0x217 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_UP */ + /* 536, 0x218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_DOWN */ + /* 537, 0x219 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_LEFT */ + /* 538, 0x21a */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA_RIGHT */ + /* 539, 0x21b */ SDL_SCANCODE_UNKNOWN, /* KEY_ATTENDANT_ON */ + /* 540, 0x21c */ SDL_SCANCODE_UNKNOWN, /* KEY_ATTENDANT_OFF */ + /* 541, 0x21d */ SDL_SCANCODE_UNKNOWN, /* KEY_ATTENDANT_TOGGLE */ + /* 542, 0x21e */ SDL_SCANCODE_UNKNOWN, /* KEY_LIGHTS_TOGGLE */ + /* 543, 0x21f */ SDL_SCANCODE_UNKNOWN, + /* 544, 0x220 */ SDL_SCANCODE_UNKNOWN, + /* 545, 0x221 */ SDL_SCANCODE_UNKNOWN, + /* 546, 0x222 */ SDL_SCANCODE_UNKNOWN, + /* 547, 0x223 */ SDL_SCANCODE_UNKNOWN, + /* 548, 0x224 */ SDL_SCANCODE_UNKNOWN, + /* 549, 0x225 */ SDL_SCANCODE_UNKNOWN, + /* 550, 0x226 */ SDL_SCANCODE_UNKNOWN, + /* 551, 0x227 */ SDL_SCANCODE_UNKNOWN, + /* 552, 0x228 */ SDL_SCANCODE_UNKNOWN, + /* 553, 0x229 */ SDL_SCANCODE_UNKNOWN, + /* 554, 0x22a */ SDL_SCANCODE_UNKNOWN, + /* 555, 0x22b */ SDL_SCANCODE_UNKNOWN, + /* 556, 0x22c */ SDL_SCANCODE_UNKNOWN, + /* 557, 0x22d */ SDL_SCANCODE_UNKNOWN, + /* 558, 0x22e */ SDL_SCANCODE_UNKNOWN, + /* 559, 0x22f */ SDL_SCANCODE_UNKNOWN, + /* 560, 0x230 */ SDL_SCANCODE_UNKNOWN, /* KEY_ALS_TOGGLE */ + /* 561, 0x231 */ SDL_SCANCODE_UNKNOWN, /* KEY_ROTATE_LOCK_TOGGLE */ + /* 562, 0x232 */ SDL_SCANCODE_UNKNOWN, + /* 563, 0x233 */ SDL_SCANCODE_UNKNOWN, + /* 564, 0x234 */ SDL_SCANCODE_UNKNOWN, + /* 565, 0x235 */ SDL_SCANCODE_UNKNOWN, + /* 566, 0x236 */ SDL_SCANCODE_UNKNOWN, + /* 567, 0x237 */ SDL_SCANCODE_UNKNOWN, + /* 568, 0x238 */ SDL_SCANCODE_UNKNOWN, + /* 569, 0x239 */ SDL_SCANCODE_UNKNOWN, + /* 570, 0x23a */ SDL_SCANCODE_UNKNOWN, + /* 571, 0x23b */ SDL_SCANCODE_UNKNOWN, + /* 572, 0x23c */ SDL_SCANCODE_UNKNOWN, + /* 573, 0x23d */ SDL_SCANCODE_UNKNOWN, + /* 574, 0x23e */ SDL_SCANCODE_UNKNOWN, + /* 575, 0x23f */ SDL_SCANCODE_UNKNOWN, + /* 576, 0x240 */ SDL_SCANCODE_UNKNOWN, /* KEY_BUTTONCONFIG */ + /* 577, 0x241 */ SDL_SCANCODE_UNKNOWN, /* KEY_TASKMANAGER */ + /* 578, 0x242 */ SDL_SCANCODE_UNKNOWN, /* KEY_JOURNAL */ + /* 579, 0x243 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONTROLPANEL */ + /* 580, 0x244 */ SDL_SCANCODE_UNKNOWN, /* KEY_APPSELECT */ + /* 581, 0x245 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCREENSAVER */ + /* 582, 0x246 */ SDL_SCANCODE_UNKNOWN, /* KEY_VOICECOMMAND */ + /* 583, 0x247 */ SDL_SCANCODE_UNKNOWN, /* KEY_ASSISTANT */ + /* 584, 0x248 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LAYOUT_NEXT */ + /* 585, 0x249 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMOJI_PICKER */ + /* 586, 0x24a */ SDL_SCANCODE_UNKNOWN, /* KEY_DICTATE */ + /* 587, 0x24b */ SDL_SCANCODE_UNKNOWN, + /* 588, 0x24c */ SDL_SCANCODE_UNKNOWN, + /* 589, 0x24d */ SDL_SCANCODE_UNKNOWN, + /* 590, 0x24e */ SDL_SCANCODE_UNKNOWN, + /* 591, 0x24f */ SDL_SCANCODE_UNKNOWN, + /* 592, 0x250 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_MIN */ + /* 593, 0x251 */ SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_MAX */ + /* 594, 0x252 */ SDL_SCANCODE_UNKNOWN, + /* 595, 0x253 */ SDL_SCANCODE_UNKNOWN, + /* 596, 0x254 */ SDL_SCANCODE_UNKNOWN, + /* 597, 0x255 */ SDL_SCANCODE_UNKNOWN, + /* 598, 0x256 */ SDL_SCANCODE_UNKNOWN, + /* 599, 0x257 */ SDL_SCANCODE_UNKNOWN, + /* 600, 0x258 */ SDL_SCANCODE_UNKNOWN, + /* 601, 0x259 */ SDL_SCANCODE_UNKNOWN, + /* 602, 0x25a */ SDL_SCANCODE_UNKNOWN, + /* 603, 0x25b */ SDL_SCANCODE_UNKNOWN, + /* 604, 0x25c */ SDL_SCANCODE_UNKNOWN, + /* 605, 0x25d */ SDL_SCANCODE_UNKNOWN, + /* 606, 0x25e */ SDL_SCANCODE_UNKNOWN, + /* 607, 0x25f */ SDL_SCANCODE_UNKNOWN, + /* 608, 0x260 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_PREV */ + /* 609, 0x261 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_NEXT */ + /* 610, 0x262 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_PREVGROUP */ + /* 611, 0x263 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_NEXTGROUP */ + /* 612, 0x264 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_ACCEPT */ + /* 613, 0x265 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBDINPUTASSIST_CANCEL */ + /* 614, 0x266 */ SDL_SCANCODE_UNKNOWN, /* KEY_RIGHT_UP */ + /* 615, 0x267 */ SDL_SCANCODE_UNKNOWN, /* KEY_RIGHT_DOWN */ + /* 616, 0x268 */ SDL_SCANCODE_UNKNOWN, /* KEY_LEFT_UP */ + /* 617, 0x269 */ SDL_SCANCODE_UNKNOWN, /* KEY_LEFT_DOWN */ + /* 618, 0x26a */ SDL_SCANCODE_UNKNOWN, /* KEY_ROOT_MENU */ + /* 619, 0x26b */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA_TOP_MENU */ + /* 620, 0x26c */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_11 */ + /* 621, 0x26d */ SDL_SCANCODE_UNKNOWN, /* KEY_NUMERIC_12 */ + /* 622, 0x26e */ SDL_SCANCODE_UNKNOWN, /* KEY_AUDIO_DESC */ + /* 623, 0x26f */ SDL_SCANCODE_UNKNOWN, /* KEY_3D_MODE */ + /* 624, 0x270 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEXT_FAVORITE */ + /* 625, 0x271 */ SDL_SCANCODE_UNKNOWN, /* KEY_STOP_RECORD */ + /* 626, 0x272 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSE_RECORD */ + /* 627, 0x273 */ SDL_SCANCODE_UNKNOWN, /* KEY_VOD */ + /* 628, 0x274 */ SDL_SCANCODE_UNKNOWN, /* KEY_UNMUTE */ + /* 629, 0x275 */ SDL_SCANCODE_UNKNOWN, /* KEY_FASTREVERSE */ + /* 630, 0x276 */ SDL_SCANCODE_UNKNOWN, /* KEY_SLOWREVERSE */ + /* 631, 0x277 */ SDL_SCANCODE_UNKNOWN, /* KEY_DATA */ + /* 632, 0x278 */ SDL_SCANCODE_UNKNOWN, /* KEY_ONSCREEN_KEYBOARD */ + /* 633, 0x279 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRIVACY_SCREEN_TOGGLE */ + /* 634, 0x27a */ SDL_SCANCODE_UNKNOWN, /* KEY_SELECTIVE_SCREENSHOT */ + /* 635, 0x27b */ SDL_SCANCODE_UNKNOWN, + /* 636, 0x27c */ SDL_SCANCODE_UNKNOWN, + /* 637, 0x27d */ SDL_SCANCODE_UNKNOWN, + /* 638, 0x27e */ SDL_SCANCODE_UNKNOWN, + /* 639, 0x27f */ SDL_SCANCODE_UNKNOWN, + /* 640, 0x280 */ SDL_SCANCODE_UNKNOWN, + /* 641, 0x281 */ SDL_SCANCODE_UNKNOWN, + /* 642, 0x282 */ SDL_SCANCODE_UNKNOWN, + /* 643, 0x283 */ SDL_SCANCODE_UNKNOWN, + /* 644, 0x284 */ SDL_SCANCODE_UNKNOWN, + /* 645, 0x285 */ SDL_SCANCODE_UNKNOWN, + /* 646, 0x286 */ SDL_SCANCODE_UNKNOWN, + /* 647, 0x287 */ SDL_SCANCODE_UNKNOWN, + /* 648, 0x288 */ SDL_SCANCODE_UNKNOWN, + /* 649, 0x289 */ SDL_SCANCODE_UNKNOWN, + /* 650, 0x28a */ SDL_SCANCODE_UNKNOWN, + /* 651, 0x28b */ SDL_SCANCODE_UNKNOWN, + /* 652, 0x28c */ SDL_SCANCODE_UNKNOWN, + /* 653, 0x28d */ SDL_SCANCODE_UNKNOWN, + /* 654, 0x28e */ SDL_SCANCODE_UNKNOWN, + /* 655, 0x28f */ SDL_SCANCODE_UNKNOWN, + /* 656, 0x290 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO1 */ + /* 657, 0x291 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO2 */ + /* 658, 0x292 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO3 */ + /* 659, 0x293 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO4 */ + /* 660, 0x294 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO5 */ + /* 661, 0x295 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO6 */ + /* 662, 0x296 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO7 */ + /* 663, 0x297 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO8 */ + /* 664, 0x298 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO9 */ + /* 665, 0x299 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO10 */ + /* 666, 0x29a */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO11 */ + /* 667, 0x29b */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO12 */ + /* 668, 0x29c */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO13 */ + /* 669, 0x29d */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO14 */ + /* 670, 0x29e */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO15 */ + /* 671, 0x29f */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO16 */ + /* 672, 0x2a0 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO17 */ + /* 673, 0x2a1 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO18 */ + /* 674, 0x2a2 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO19 */ + /* 675, 0x2a3 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO20 */ + /* 676, 0x2a4 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO21 */ + /* 677, 0x2a5 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO22 */ + /* 678, 0x2a6 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO23 */ + /* 679, 0x2a7 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO24 */ + /* 680, 0x2a8 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO25 */ + /* 681, 0x2a9 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO26 */ + /* 682, 0x2aa */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO27 */ + /* 683, 0x2ab */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO28 */ + /* 684, 0x2ac */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO29 */ + /* 685, 0x2ad */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO30 */ + /* 686, 0x2ae */ SDL_SCANCODE_UNKNOWN, + /* 687, 0x2af */ SDL_SCANCODE_UNKNOWN, + /* 688, 0x2b0 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_RECORD_START */ + /* 689, 0x2b1 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_RECORD_STOP */ + /* 690, 0x2b2 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_PRESET_CYCLE */ + /* 691, 0x2b3 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_PRESET1 */ + /* 692, 0x2b4 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_PRESET2 */ + /* 693, 0x2b5 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO_PRESET3 */ + /* 694, 0x2b6 */ SDL_SCANCODE_UNKNOWN, + /* 695, 0x2b7 */ SDL_SCANCODE_UNKNOWN, + /* 696, 0x2b8 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LCD_MENU1 */ + /* 697, 0x2b9 */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LCD_MENU2 */ + /* 698, 0x2ba */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LCD_MENU3 */ + /* 699, 0x2bb */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LCD_MENU4 */ + /* 700, 0x2bc */ SDL_SCANCODE_UNKNOWN, /* KEY_KBD_LCD_MENU5 */ + /* 701, 0x2bd */ SDL_SCANCODE_UNKNOWN, + /* 702, 0x2be */ SDL_SCANCODE_UNKNOWN, + /* 703, 0x2bf */ SDL_SCANCODE_UNKNOWN, + /* 704, 0x2c0 */ SDL_SCANCODE_UNKNOWN, + /* 705, 0x2c1 */ SDL_SCANCODE_UNKNOWN, + /* 706, 0x2c2 */ SDL_SCANCODE_UNKNOWN, + /* 707, 0x2c3 */ SDL_SCANCODE_UNKNOWN, + /* 708, 0x2c4 */ SDL_SCANCODE_UNKNOWN, + /* 709, 0x2c5 */ SDL_SCANCODE_UNKNOWN, + /* 710, 0x2c6 */ SDL_SCANCODE_UNKNOWN, + /* 711, 0x2c7 */ SDL_SCANCODE_UNKNOWN, + /* 712, 0x2c8 */ SDL_SCANCODE_UNKNOWN, + /* 713, 0x2c9 */ SDL_SCANCODE_UNKNOWN, + /* 714, 0x2ca */ SDL_SCANCODE_UNKNOWN, + /* 715, 0x2cb */ SDL_SCANCODE_UNKNOWN, + /* 716, 0x2cc */ SDL_SCANCODE_UNKNOWN, + /* 717, 0x2cd */ SDL_SCANCODE_UNKNOWN, + /* 718, 0x2ce */ SDL_SCANCODE_UNKNOWN, + /* 719, 0x2cf */ SDL_SCANCODE_UNKNOWN, + /* 720, 0x2d0 */ SDL_SCANCODE_UNKNOWN, + /* 721, 0x2d1 */ SDL_SCANCODE_UNKNOWN, + /* 722, 0x2d2 */ SDL_SCANCODE_UNKNOWN, + /* 723, 0x2d3 */ SDL_SCANCODE_UNKNOWN, + /* 724, 0x2d4 */ SDL_SCANCODE_UNKNOWN, + /* 725, 0x2d5 */ SDL_SCANCODE_UNKNOWN, + /* 726, 0x2d6 */ SDL_SCANCODE_UNKNOWN, + /* 727, 0x2d7 */ SDL_SCANCODE_UNKNOWN, + /* 728, 0x2d8 */ SDL_SCANCODE_UNKNOWN, + /* 729, 0x2d9 */ SDL_SCANCODE_UNKNOWN, + /* 730, 0x2da */ SDL_SCANCODE_UNKNOWN, + /* 731, 0x2db */ SDL_SCANCODE_UNKNOWN, + /* 732, 0x2dc */ SDL_SCANCODE_UNKNOWN, + /* 733, 0x2dd */ SDL_SCANCODE_UNKNOWN, + /* 734, 0x2de */ SDL_SCANCODE_UNKNOWN, + /* 735, 0x2df */ SDL_SCANCODE_UNKNOWN, + /* 736, 0x2e0 */ SDL_SCANCODE_UNKNOWN, + /* 737, 0x2e1 */ SDL_SCANCODE_UNKNOWN, + /* 738, 0x2e2 */ SDL_SCANCODE_UNKNOWN, + /* 739, 0x2e3 */ SDL_SCANCODE_UNKNOWN, + /* 740, 0x2e4 */ SDL_SCANCODE_UNKNOWN, + /* 741, 0x2e5 */ SDL_SCANCODE_UNKNOWN, + /* 742, 0x2e6 */ SDL_SCANCODE_UNKNOWN, + /* 743, 0x2e7 */ SDL_SCANCODE_UNKNOWN, + /* 744, 0x2e8 */ SDL_SCANCODE_UNKNOWN, + /* 745, 0x2e9 */ SDL_SCANCODE_UNKNOWN, + /* 746, 0x2ea */ SDL_SCANCODE_UNKNOWN, + /* 747, 0x2eb */ SDL_SCANCODE_UNKNOWN, + /* 748, 0x2ec */ SDL_SCANCODE_UNKNOWN, + /* 749, 0x2ed */ SDL_SCANCODE_UNKNOWN, + /* 750, 0x2ee */ SDL_SCANCODE_UNKNOWN, + /* 751, 0x2ef */ SDL_SCANCODE_UNKNOWN, + /* 752, 0x2f0 */ SDL_SCANCODE_UNKNOWN, + /* 753, 0x2f1 */ SDL_SCANCODE_UNKNOWN, + /* 754, 0x2f2 */ SDL_SCANCODE_UNKNOWN, + /* 755, 0x2f3 */ SDL_SCANCODE_UNKNOWN, + /* 756, 0x2f4 */ SDL_SCANCODE_UNKNOWN, + /* 757, 0x2f5 */ SDL_SCANCODE_UNKNOWN, + /* 758, 0x2f6 */ SDL_SCANCODE_UNKNOWN, + /* 759, 0x2f7 */ SDL_SCANCODE_UNKNOWN, + /* 760, 0x2f8 */ SDL_SCANCODE_UNKNOWN, + /* 761, 0x2f9 */ SDL_SCANCODE_UNKNOWN, + /* 762, 0x2fa */ SDL_SCANCODE_UNKNOWN, + /* 763, 0x2fb */ SDL_SCANCODE_UNKNOWN, + /* 764, 0x2fc */ SDL_SCANCODE_UNKNOWN, + /* 765, 0x2fd */ SDL_SCANCODE_UNKNOWN, + /* 766, 0x2fe */ SDL_SCANCODE_UNKNOWN, + /* 767, 0x2ff */ SDL_SCANCODE_UNKNOWN, /* KEY_MAX */ +#endif /* 0 */ }; + +#if 0 /* A shell script to update the Linux key names in this file */ +#!/bin/bash + +function get_keyname +{ + value=$(echo "$1" | awk '{print $3}') + fgrep KEY_ /usr/include/linux/input-event-codes.h | while read line; do + read -ra fields <<<"$line" + if [ "${fields[2]}" = "$value" ]; then + echo "${fields[1]}" + return + fi + done +} + +fgrep SDL_SCANCODE scancodes_linux.h | while read line; do + if [ $(echo "$line" | awk '{print NF}') -eq 5 ]; then + name=$(get_keyname "$line") + if [ "$name" != "" ]; then + echo " $line /* $name */" + continue + fi + fi + echo " $line" +done +#endif /* end script */ + /* *INDENT-ON* */ /* clang-format on */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/scancodes_windows.h b/src/events/scancodes_windows.h index 9fc7067a2..fc3e3db66 100644 --- a/src/events/scancodes_windows.h +++ b/src/events/scancodes_windows.h @@ -53,3 +53,5 @@ static const SDL_Scancode windows_scancode_table[] = SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */ }; /* *INDENT-ON* */ /* clang-format on */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/scancodes_xfree86.h b/src/events/scancodes_xfree86.h index 1ce2a8c57..605a657f1 100644 --- a/src/events/scancodes_xfree86.h +++ b/src/events/scancodes_xfree86.h @@ -179,247 +179,256 @@ static const SDL_Scancode xfree86_scancode_table[] = { /* 146 */ SDL_SCANCODE_CUT, }; -/* for wireless usb keyboard (manufacturer TRUST) without numpad. */ +/* This is largely identical to the Linux keycode mapping */ static const SDL_Scancode xfree86_scancode_table2[] = { - /* 0 */ SDL_SCANCODE_UNKNOWN, - /* 1 */ SDL_SCANCODE_ESCAPE, - /* 2 */ SDL_SCANCODE_1, - /* 3 */ SDL_SCANCODE_2, - /* 4 */ SDL_SCANCODE_3, - /* 5 */ SDL_SCANCODE_4, - /* 6 */ SDL_SCANCODE_5, - /* 7 */ SDL_SCANCODE_6, - /* 8 */ SDL_SCANCODE_7, - /* 9 */ SDL_SCANCODE_8, - /* 10 */ SDL_SCANCODE_9, - /* 11 */ SDL_SCANCODE_0, - /* 12 */ SDL_SCANCODE_MINUS, - /* 13 */ SDL_SCANCODE_EQUALS, - /* 14 */ SDL_SCANCODE_BACKSPACE, - /* 15 */ SDL_SCANCODE_TAB, - /* 16 */ SDL_SCANCODE_Q, - /* 17 */ SDL_SCANCODE_W, - /* 18 */ SDL_SCANCODE_E, - /* 19 */ SDL_SCANCODE_R, - /* 20 */ SDL_SCANCODE_T, - /* 21 */ SDL_SCANCODE_Y, - /* 22 */ SDL_SCANCODE_U, - /* 23 */ SDL_SCANCODE_I, - /* 24 */ SDL_SCANCODE_O, - /* 25 */ SDL_SCANCODE_P, - /* 26 */ SDL_SCANCODE_LEFTBRACKET, - /* 27 */ SDL_SCANCODE_RIGHTBRACKET, - /* 28 */ SDL_SCANCODE_RETURN, - /* 29 */ SDL_SCANCODE_LCTRL, - /* 30 */ SDL_SCANCODE_A, - /* 31 */ SDL_SCANCODE_S, - /* 32 */ SDL_SCANCODE_D, - /* 33 */ SDL_SCANCODE_F, - /* 34 */ SDL_SCANCODE_G, - /* 35 */ SDL_SCANCODE_H, - /* 36 */ SDL_SCANCODE_J, - /* 37 */ SDL_SCANCODE_K, - /* 38 */ SDL_SCANCODE_L, - /* 39 */ SDL_SCANCODE_SEMICOLON, - /* 40 */ SDL_SCANCODE_APOSTROPHE, - /* 41 */ SDL_SCANCODE_GRAVE, - /* 42 */ SDL_SCANCODE_LSHIFT, - /* 43 */ SDL_SCANCODE_BACKSLASH, - /* 44 */ SDL_SCANCODE_Z, - /* 45 */ SDL_SCANCODE_X, - /* 46 */ SDL_SCANCODE_C, - /* 47 */ SDL_SCANCODE_V, - /* 48 */ SDL_SCANCODE_B, - /* 49 */ SDL_SCANCODE_N, - /* 50 */ SDL_SCANCODE_M, - /* 51 */ SDL_SCANCODE_COMMA, - /* 52 */ SDL_SCANCODE_PERIOD, - /* 53 */ SDL_SCANCODE_SLASH, - /* 54 */ SDL_SCANCODE_RSHIFT, - /* 55 */ SDL_SCANCODE_KP_MULTIPLY, - /* 56 */ SDL_SCANCODE_LALT, - /* 57 */ SDL_SCANCODE_SPACE, - /* 58 */ SDL_SCANCODE_CAPSLOCK, - /* 59 */ SDL_SCANCODE_F1, - /* 60 */ SDL_SCANCODE_F2, - /* 61 */ SDL_SCANCODE_F3, - /* 62 */ SDL_SCANCODE_F4, - /* 63 */ SDL_SCANCODE_F5, - /* 64 */ SDL_SCANCODE_F6, - /* 65 */ SDL_SCANCODE_F7, - /* 66 */ SDL_SCANCODE_F8, - /* 67 */ SDL_SCANCODE_F9, - /* 68 */ SDL_SCANCODE_F10, - /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, - /* 70 */ SDL_SCANCODE_SCROLLLOCK, - /* 71 */ SDL_SCANCODE_KP_7, - /* 72 */ SDL_SCANCODE_KP_8, - /* 73 */ SDL_SCANCODE_KP_9, - /* 74 */ SDL_SCANCODE_KP_MINUS, - /* 75 */ SDL_SCANCODE_KP_4, - /* 76 */ SDL_SCANCODE_KP_5, - /* 77 */ SDL_SCANCODE_KP_6, - /* 78 */ SDL_SCANCODE_KP_PLUS, - /* 79 */ SDL_SCANCODE_KP_1, - /* 80 */ SDL_SCANCODE_KP_2, - /* 81 */ SDL_SCANCODE_KP_3, - /* 82 */ SDL_SCANCODE_KP_0, - /* 83 */ SDL_SCANCODE_KP_PERIOD, - /* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */ - /* 85 */ SDL_SCANCODE_MODE, /* ???? */ - /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, - /* 87 */ SDL_SCANCODE_F11, - /* 88 */ SDL_SCANCODE_F12, - /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */ - /* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */ - /* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */ - /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */ - /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* Hiragana_Katakana */ - /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */ - /* 95 */ SDL_SCANCODE_UNKNOWN, - /* 96 */ SDL_SCANCODE_KP_ENTER, - /* 97 */ SDL_SCANCODE_RCTRL, - /* 98 */ SDL_SCANCODE_KP_DIVIDE, - /* 99 */ SDL_SCANCODE_PRINTSCREEN, - /* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */ - /* 101 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */ - /* 102 */ SDL_SCANCODE_HOME, - /* 103 */ SDL_SCANCODE_UP, - /* 104 */ SDL_SCANCODE_PAGEUP, - /* 105 */ SDL_SCANCODE_LEFT, - /* 106 */ SDL_SCANCODE_RIGHT, - /* 107 */ SDL_SCANCODE_END, - /* 108 */ SDL_SCANCODE_DOWN, - /* 109 */ SDL_SCANCODE_PAGEDOWN, - /* 110 */ SDL_SCANCODE_INSERT, - /* 111 */ SDL_SCANCODE_DELETE, - /* 112 */ SDL_SCANCODE_UNKNOWN, - /* 113 */ SDL_SCANCODE_MUTE, - /* 114 */ SDL_SCANCODE_VOLUMEDOWN, - /* 115 */ SDL_SCANCODE_VOLUMEUP, - /* 116 */ SDL_SCANCODE_POWER, - /* 117 */ SDL_SCANCODE_KP_EQUALS, - /* 118 */ SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */ - /* 119 */ SDL_SCANCODE_PAUSE, - /* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */ - /* 121 */ SDL_SCANCODE_KP_COMMA, /* KP_Decimal */ - /* 122 */ SDL_SCANCODE_LANG1, /* Hangul */ - /* 123 */ SDL_SCANCODE_LANG2, /* Hangul_Hanja */ - /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */ - /* 125 */ SDL_SCANCODE_LGUI, - /* 126 */ SDL_SCANCODE_RGUI, - /* 127 */ SDL_SCANCODE_APPLICATION, - /* 128 */ SDL_SCANCODE_CANCEL, - /* 129 */ SDL_SCANCODE_AGAIN, - /* 130 */ SDL_SCANCODE_UNKNOWN, /* SunProps */ - /* 131 */ SDL_SCANCODE_UNDO, - /* 132 */ SDL_SCANCODE_UNKNOWN, /* SunFront */ - /* 133 */ SDL_SCANCODE_COPY, - /* 134 */ SDL_SCANCODE_UNKNOWN, /* SunOpen */ - /* 135 */ SDL_SCANCODE_PASTE, - /* 136 */ SDL_SCANCODE_FIND, - /* 137 */ SDL_SCANCODE_CUT, - /* 138 */ SDL_SCANCODE_HELP, - /* 139 */ SDL_SCANCODE_MENU, /* XF86MenuKB */ - /* 140 */ SDL_SCANCODE_CALCULATOR, - /* 141 */ SDL_SCANCODE_UNKNOWN, - /* 142 */ SDL_SCANCODE_SLEEP, - /* 143 */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */ - /* 144 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */ - /* 145 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ - /* 146 */ SDL_SCANCODE_UNKNOWN, - /* 147 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */ - /* 148 */ SDL_SCANCODE_APP1, /* XF86Launch1 */ - /* 149 */ SDL_SCANCODE_APP2, /* XF86Launch2 */ - /* 150 */ SDL_SCANCODE_WWW, - /* 151 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */ - /* 152 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */ - /* 153 */ SDL_SCANCODE_UNKNOWN, - /* 154 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */ - /* 155 */ SDL_SCANCODE_MAIL, - /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, /* XF86Favorites */ - /* 157 */ SDL_SCANCODE_COMPUTER, - /* 158 */ SDL_SCANCODE_AC_BACK, - /* 159 */ SDL_SCANCODE_AC_FORWARD, - /* 160 */ SDL_SCANCODE_UNKNOWN, - /* 161 */ SDL_SCANCODE_EJECT, - /* 162 */ SDL_SCANCODE_EJECT, - /* 163 */ SDL_SCANCODE_AUDIONEXT, - /* 164 */ SDL_SCANCODE_AUDIOPLAY, - /* 165 */ SDL_SCANCODE_AUDIOPREV, - /* 166 */ SDL_SCANCODE_AUDIOSTOP, - /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ - /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ - /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ - /* 170 */ SDL_SCANCODE_UNKNOWN, - /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */ - /* 172 */ SDL_SCANCODE_AC_HOME, - /* 173 */ SDL_SCANCODE_AC_REFRESH, - /* 174 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ - /* 175 */ SDL_SCANCODE_UNKNOWN, - /* 176 */ SDL_SCANCODE_UNKNOWN, - /* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */ - /* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */ - /* 179 */ SDL_SCANCODE_KP_LEFTPAREN, /* parenleft */ - /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, /* parenright */ - /* 181 */ SDL_SCANCODE_UNKNOWN, /* XF86New */ - /* 182 */ SDL_SCANCODE_AGAIN, - /* 183 */ SDL_SCANCODE_F13, /* XF86Tools */ - /* 184 */ SDL_SCANCODE_F14, /* XF86Launch5 */ - /* 185 */ SDL_SCANCODE_F15, /* XF86Launch6 */ - /* 186 */ SDL_SCANCODE_F16, /* XF86Launch7 */ - /* 187 */ SDL_SCANCODE_F17, /* XF86Launch8 */ - /* 188 */ SDL_SCANCODE_F18, /* XF86Launch9 */ - /* 189 */ SDL_SCANCODE_F19, /* null keysym */ - /* 190 */ SDL_SCANCODE_F20, - /* 191 */ SDL_SCANCODE_UNKNOWN, - /* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */ - /* 193 */ SDL_SCANCODE_UNKNOWN, - /* 194 */ SDL_SCANCODE_UNKNOWN, - /* 195 */ SDL_SCANCODE_MODE, - /* 196 */ SDL_SCANCODE_UNKNOWN, - /* 197 */ SDL_SCANCODE_UNKNOWN, - /* 198 */ SDL_SCANCODE_UNKNOWN, - /* 199 */ SDL_SCANCODE_UNKNOWN, - /* 200 */ SDL_SCANCODE_AUDIOPLAY, - /* 201 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */ - /* 202 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */ - /* 203 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */ - /* 204 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */ - /* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */ - /* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ - /* 207 */ SDL_SCANCODE_AUDIOPLAY, - /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, - /* 209 */ SDL_SCANCODE_UNKNOWN, - /* 210 */ SDL_SCANCODE_PRINTSCREEN, - /* 211 */ SDL_SCANCODE_UNKNOWN, - /* 212 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */ - /* 213 */ SDL_SCANCODE_UNKNOWN, - /* 214 */ SDL_SCANCODE_UNKNOWN, - /* 215 */ SDL_SCANCODE_MAIL, - /* 216 */ SDL_SCANCODE_UNKNOWN, - /* 217 */ SDL_SCANCODE_AC_SEARCH, - /* 218 */ SDL_SCANCODE_UNKNOWN, - /* 219 */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */ - /* 220 */ SDL_SCANCODE_UNKNOWN, - /* 221 */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */ - /* 222 */ SDL_SCANCODE_UNKNOWN, - /* 223 */ SDL_SCANCODE_STOP, - /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN, - /* 225 */ SDL_SCANCODE_BRIGHTNESSUP, - /* 226 */ SDL_SCANCODE_MEDIASELECT, - /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, - /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE, - /* 229 */ SDL_SCANCODE_KBDILLUMDOWN, - /* 230 */ SDL_SCANCODE_KBDILLUMUP, - /* 231 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ - /* 232 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */ - /* 233 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */ - /* 234 */ SDL_SCANCODE_UNKNOWN, /* XF86Save */ - /* 235 */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */ - /* 236 */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */ - /* 237 */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */ - /* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */ + /* 0, 0x000 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 1, 0x001 */ SDL_SCANCODE_ESCAPE, /* Escape */ + /* 2, 0x002 */ SDL_SCANCODE_1, /* 1 */ + /* 3, 0x003 */ SDL_SCANCODE_2, /* 2 */ + /* 4, 0x004 */ SDL_SCANCODE_3, /* 3 */ + /* 5, 0x005 */ SDL_SCANCODE_4, /* 4 */ + /* 6, 0x006 */ SDL_SCANCODE_5, /* 5 */ + /* 7, 0x007 */ SDL_SCANCODE_6, /* 6 */ + /* 8, 0x008 */ SDL_SCANCODE_7, /* 7 */ + /* 9, 0x009 */ SDL_SCANCODE_8, /* 8 */ + /* 10, 0x00a */ SDL_SCANCODE_9, /* 9 */ + /* 11, 0x00b */ SDL_SCANCODE_0, /* 0 */ + /* 12, 0x00c */ SDL_SCANCODE_MINUS, /* minus */ + /* 13, 0x00d */ SDL_SCANCODE_EQUALS, /* equal */ + /* 14, 0x00e */ SDL_SCANCODE_BACKSPACE, /* BackSpace */ + /* 15, 0x00f */ SDL_SCANCODE_TAB, /* Tab */ + /* 16, 0x010 */ SDL_SCANCODE_Q, /* q */ + /* 17, 0x011 */ SDL_SCANCODE_W, /* w */ + /* 18, 0x012 */ SDL_SCANCODE_E, /* e */ + /* 19, 0x013 */ SDL_SCANCODE_R, /* r */ + /* 20, 0x014 */ SDL_SCANCODE_T, /* t */ + /* 21, 0x015 */ SDL_SCANCODE_Y, /* y */ + /* 22, 0x016 */ SDL_SCANCODE_U, /* u */ + /* 23, 0x017 */ SDL_SCANCODE_I, /* i */ + /* 24, 0x018 */ SDL_SCANCODE_O, /* o */ + /* 25, 0x019 */ SDL_SCANCODE_P, /* p */ + /* 26, 0x01a */ SDL_SCANCODE_LEFTBRACKET, /* bracketleft */ + /* 27, 0x01b */ SDL_SCANCODE_RIGHTBRACKET, /* bracketright */ + /* 28, 0x01c */ SDL_SCANCODE_RETURN, /* Return */ + /* 29, 0x01d */ SDL_SCANCODE_LCTRL, /* Control_L */ + /* 30, 0x01e */ SDL_SCANCODE_A, /* a */ + /* 31, 0x01f */ SDL_SCANCODE_S, /* s */ + /* 32, 0x020 */ SDL_SCANCODE_D, /* d */ + /* 33, 0x021 */ SDL_SCANCODE_F, /* f */ + /* 34, 0x022 */ SDL_SCANCODE_G, /* g */ + /* 35, 0x023 */ SDL_SCANCODE_H, /* h */ + /* 36, 0x024 */ SDL_SCANCODE_J, /* j */ + /* 37, 0x025 */ SDL_SCANCODE_K, /* k */ + /* 38, 0x026 */ SDL_SCANCODE_L, /* l */ + /* 39, 0x027 */ SDL_SCANCODE_SEMICOLON, /* semicolon */ + /* 40, 0x028 */ SDL_SCANCODE_APOSTROPHE, /* apostrophe */ + /* 41, 0x029 */ SDL_SCANCODE_GRAVE, /* grave */ + /* 42, 0x02a */ SDL_SCANCODE_LSHIFT, /* Shift_L */ + /* 43, 0x02b */ SDL_SCANCODE_BACKSLASH, /* backslash */ + /* 44, 0x02c */ SDL_SCANCODE_Z, /* z */ + /* 45, 0x02d */ SDL_SCANCODE_X, /* x */ + /* 46, 0x02e */ SDL_SCANCODE_C, /* c */ + /* 47, 0x02f */ SDL_SCANCODE_V, /* v */ + /* 48, 0x030 */ SDL_SCANCODE_B, /* b */ + /* 49, 0x031 */ SDL_SCANCODE_N, /* n */ + /* 50, 0x032 */ SDL_SCANCODE_M, /* m */ + /* 51, 0x033 */ SDL_SCANCODE_COMMA, /* comma */ + /* 52, 0x034 */ SDL_SCANCODE_PERIOD, /* period */ + /* 53, 0x035 */ SDL_SCANCODE_SLASH, /* slash */ + /* 54, 0x036 */ SDL_SCANCODE_RSHIFT, /* Shift_R */ + /* 55, 0x037 */ SDL_SCANCODE_KP_MULTIPLY, /* KP_Multiply */ + /* 56, 0x038 */ SDL_SCANCODE_LALT, /* Alt_L */ + /* 57, 0x039 */ SDL_SCANCODE_SPACE, /* space */ + /* 58, 0x03a */ SDL_SCANCODE_CAPSLOCK, /* Caps_Lock */ + /* 59, 0x03b */ SDL_SCANCODE_F1, /* F1 */ + /* 60, 0x03c */ SDL_SCANCODE_F2, /* F2 */ + /* 61, 0x03d */ SDL_SCANCODE_F3, /* F3 */ + /* 62, 0x03e */ SDL_SCANCODE_F4, /* F4 */ + /* 63, 0x03f */ SDL_SCANCODE_F5, /* F5 */ + /* 64, 0x040 */ SDL_SCANCODE_F6, /* F6 */ + /* 65, 0x041 */ SDL_SCANCODE_F7, /* F7 */ + /* 66, 0x042 */ SDL_SCANCODE_F8, /* F8 */ + /* 67, 0x043 */ SDL_SCANCODE_F9, /* F9 */ + /* 68, 0x044 */ SDL_SCANCODE_F10, /* F10 */ + /* 69, 0x045 */ SDL_SCANCODE_NUMLOCKCLEAR, /* Num_Lock */ + /* 70, 0x046 */ SDL_SCANCODE_SCROLLLOCK, /* Scroll_Lock */ + /* 71, 0x047 */ SDL_SCANCODE_KP_7, /* KP_Home */ + /* 72, 0x048 */ SDL_SCANCODE_KP_8, /* KP_Up */ + /* 73, 0x049 */ SDL_SCANCODE_KP_9, /* KP_Prior */ + /* 74, 0x04a */ SDL_SCANCODE_KP_MINUS, /* KP_Subtract */ + /* 75, 0x04b */ SDL_SCANCODE_KP_4, /* KP_Left */ + /* 76, 0x04c */ SDL_SCANCODE_KP_5, /* KP_Begin */ + /* 77, 0x04d */ SDL_SCANCODE_KP_6, /* KP_Right */ + /* 78, 0x04e */ SDL_SCANCODE_KP_PLUS, /* KP_Add */ + /* 79, 0x04f */ SDL_SCANCODE_KP_1, /* KP_End */ + /* 80, 0x050 */ SDL_SCANCODE_KP_2, /* KP_Down */ + /* 81, 0x051 */ SDL_SCANCODE_KP_3, /* KP_Next */ + /* 82, 0x052 */ SDL_SCANCODE_KP_0, /* KP_Insert */ + /* 83, 0x053 */ SDL_SCANCODE_KP_PERIOD, /* KP_Delete */ + /* 84, 0x054 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift */ + /* 85, 0x055 */ SDL_SCANCODE_MODE, /* ???? */ + /* 86, 0x056 */ SDL_SCANCODE_NONUSBACKSLASH, /* less */ + /* 87, 0x057 */ SDL_SCANCODE_F11, /* F11 */ + /* 88, 0x058 */ SDL_SCANCODE_F12, /* F12 */ + /* 89, 0x059 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */ + /* 90, 0x05a */ SDL_SCANCODE_LANG3, /* Katakana */ + /* 91, 0x05b */ SDL_SCANCODE_LANG4, /* Hiragana */ + /* 92, 0x05c */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */ + /* 93, 0x05d */ SDL_SCANCODE_INTERNATIONAL2, /* Hiragana_Katakana */ + /* 94, 0x05e */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */ + /* 95, 0x05f */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 96, 0x060 */ SDL_SCANCODE_KP_ENTER, /* KP_Enter */ + /* 97, 0x061 */ SDL_SCANCODE_RCTRL, /* Control_R */ + /* 98, 0x062 */ SDL_SCANCODE_KP_DIVIDE, /* KP_Divide */ + /* 99, 0x063 */ SDL_SCANCODE_PRINTSCREEN, /* Print */ + /* 100, 0x064 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */ + /* 101, 0x065 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */ + /* 102, 0x066 */ SDL_SCANCODE_HOME, /* Home */ + /* 103, 0x067 */ SDL_SCANCODE_UP, /* Up */ + /* 104, 0x068 */ SDL_SCANCODE_PAGEUP, /* Prior */ + /* 105, 0x069 */ SDL_SCANCODE_LEFT, /* Left */ + /* 106, 0x06a */ SDL_SCANCODE_RIGHT, /* Right */ + /* 107, 0x06b */ SDL_SCANCODE_END, /* End */ + /* 108, 0x06c */ SDL_SCANCODE_DOWN, /* Down */ + /* 109, 0x06d */ SDL_SCANCODE_PAGEDOWN, /* Next */ + /* 110, 0x06e */ SDL_SCANCODE_INSERT, /* Insert */ + /* 111, 0x06f */ SDL_SCANCODE_DELETE, /* Delete */ + /* 112, 0x070 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 113, 0x071 */ SDL_SCANCODE_MUTE, /* XF86AudioMute */ + /* 114, 0x072 */ SDL_SCANCODE_VOLUMEDOWN, /* XF86AudioLowerVolume */ + /* 115, 0x073 */ SDL_SCANCODE_VOLUMEUP, /* XF86AudioRaiseVolume */ + /* 116, 0x074 */ SDL_SCANCODE_POWER, /* XF86PowerOff */ + /* 117, 0x075 */ SDL_SCANCODE_KP_EQUALS, /* KP_Equal */ + /* 118, 0x076 */ SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */ + /* 119, 0x077 */ SDL_SCANCODE_PAUSE, /* Pause */ + /* 120, 0x078 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */ + /* 121, 0x079 */ SDL_SCANCODE_KP_PERIOD, /* KP_Decimal */ + /* 122, 0x07a */ SDL_SCANCODE_LANG1, /* Hangul */ + /* 123, 0x07b */ SDL_SCANCODE_LANG2, /* Hangul_Hanja */ + /* 124, 0x07c */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */ + /* 125, 0x07d */ SDL_SCANCODE_LGUI, /* Super_L */ + /* 126, 0x07e */ SDL_SCANCODE_RGUI, /* Super_R */ + /* 127, 0x07f */ SDL_SCANCODE_APPLICATION, /* Menu */ + /* 128, 0x080 */ SDL_SCANCODE_CANCEL, /* Cancel */ + /* 129, 0x081 */ SDL_SCANCODE_AGAIN, /* Redo */ + /* 130, 0x082 */ SDL_SCANCODE_UNKNOWN, /* SunProps */ + /* 131, 0x083 */ SDL_SCANCODE_UNDO, /* Undo */ + /* 132, 0x084 */ SDL_SCANCODE_UNKNOWN, /* SunFront */ + /* 133, 0x085 */ SDL_SCANCODE_COPY, /* XF86Copy */ + /* 134, 0x086 */ SDL_SCANCODE_UNKNOWN, /* SunOpen, XF86Open */ + /* 135, 0x087 */ SDL_SCANCODE_PASTE, /* XF86Paste */ + /* 136, 0x088 */ SDL_SCANCODE_FIND, /* Find */ + /* 137, 0x089 */ SDL_SCANCODE_CUT, /* XF86Cut */ + /* 138, 0x08a */ SDL_SCANCODE_HELP, /* Help */ + /* 139, 0x08b */ SDL_SCANCODE_MENU, /* XF86MenuKB */ + /* 140, 0x08c */ SDL_SCANCODE_CALCULATOR, /* XF86Calculator */ + /* 141, 0x08d */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 142, 0x08e */ SDL_SCANCODE_SLEEP, /* XF86Sleep */ + /* 143, 0x08f */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */ + /* 144, 0x090 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */ + /* 145, 0x091 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ + /* 146, 0x092 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 147, 0x093 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */ + /* 148, 0x094 */ SDL_SCANCODE_APP1, /* XF86Launch1 */ + /* 149, 0x095 */ SDL_SCANCODE_APP2, /* XF86Launch2 */ + /* 150, 0x096 */ SDL_SCANCODE_WWW, /* XF86WWW */ + /* 151, 0x097 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */ + /* 152, 0x098 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */ + /* 153, 0x099 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */ + /* 154, 0x09a */ SDL_SCANCODE_UNKNOWN, /* XF86TaskPane */ + /* 155, 0x09b */ SDL_SCANCODE_MAIL, /* XF86Mail */ + /* 156, 0x09c */ SDL_SCANCODE_AC_BOOKMARKS, /* XF86Favorites */ + /* 157, 0x09d */ SDL_SCANCODE_COMPUTER, /* XF86MyComputer */ + /* 158, 0x09e */ SDL_SCANCODE_AC_BACK, /* XF86Back */ + /* 159, 0x09f */ SDL_SCANCODE_AC_FORWARD, /* XF86Forward */ + /* 160, 0x0a0 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 161, 0x0a1 */ SDL_SCANCODE_EJECT, /* XF86Eject */ + /* 162, 0x0a2 */ SDL_SCANCODE_EJECT, /* XF86Eject */ + /* 163, 0x0a3 */ SDL_SCANCODE_AUDIONEXT, /* XF86AudioNext */ + /* 164, 0x0a4 */ SDL_SCANCODE_AUDIOPLAY, /* XF86AudioPlay */ + /* 165, 0x0a5 */ SDL_SCANCODE_AUDIOPREV, /* XF86AudioPrev */ + /* 166, 0x0a6 */ SDL_SCANCODE_AUDIOSTOP, /* XF86AudioStop */ + /* 167, 0x0a7 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ + /* 168, 0x0a8 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ + /* 169, 0x0a9 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ + /* 170, 0x0aa */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 171, 0x0ab */ SDL_SCANCODE_F13, /* XF86Tools */ + /* 172, 0x0ac */ SDL_SCANCODE_AC_HOME, /* XF86HomePage */ + /* 173, 0x0ad */ SDL_SCANCODE_AC_REFRESH, /* XF86Reload */ + /* 174, 0x0ae */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ + /* 175, 0x0af */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 176, 0x0b0 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 177, 0x0b1 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */ + /* 178, 0x0b2 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */ + /* 179, 0x0b3 */ SDL_SCANCODE_KP_LEFTPAREN, /* parenleft */ + /* 180, 0x0b4 */ SDL_SCANCODE_KP_RIGHTPAREN, /* parenright */ + /* 181, 0x0b5 */ SDL_SCANCODE_UNKNOWN, /* XF86New */ + /* 182, 0x0b6 */ SDL_SCANCODE_AGAIN, /* Redo */ + /* 183, 0x0b7 */ SDL_SCANCODE_F13, /* XF86Tools */ + /* 184, 0x0b8 */ SDL_SCANCODE_F14, /* XF86Launch5 */ + /* 185, 0x0b9 */ SDL_SCANCODE_F15, /* XF86Launch6 */ + /* 186, 0x0ba */ SDL_SCANCODE_F16, /* XF86Launch7 */ + /* 187, 0x0bb */ SDL_SCANCODE_F17, /* XF86Launch8 */ + /* 188, 0x0bc */ SDL_SCANCODE_F18, /* XF86Launch9 */ + /* 189, 0x0bd */ SDL_SCANCODE_F19, /* NoSymbol */ + /* 190, 0x0be */ SDL_SCANCODE_F20, /* XF86AudioMicMute */ + /* 191, 0x0bf */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */ + /* 192, 0x0c0 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadOn */ + /* 193, 0x0c1 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadOff */ + /* 194, 0x0c2 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 195, 0x0c3 */ SDL_SCANCODE_MODE, /* Mode_switch */ + /* 196, 0x0c4 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 197, 0x0c5 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 198, 0x0c6 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 199, 0x0c7 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 200, 0x0c8 */ SDL_SCANCODE_AUDIOPLAY, /* XF86AudioPlay */ + /* 201, 0x0c9 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */ + /* 202, 0x0ca */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */ + /* 203, 0x0cb */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */ + /* 204, 0x0cc */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */ + /* 205, 0x0cd */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */ + /* 206, 0x0ce */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ + /* 207, 0x0cf */ SDL_SCANCODE_AUDIOPLAY, /* XF86AudioPlay */ + /* 208, 0x0d0 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* XF86AudioForward */ + /* 209, 0x0d1 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 210, 0x0d2 */ SDL_SCANCODE_PRINTSCREEN, /* Print */ + /* 211, 0x0d3 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 212, 0x0d4 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */ + /* 213, 0x0d5 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPreset */ + /* 214, 0x0d6 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 215, 0x0d7 */ SDL_SCANCODE_MAIL, /* XF86Mail */ + /* 216, 0x0d8 */ SDL_SCANCODE_UNKNOWN, /* XF86Messenger */ + /* 217, 0x0d9 */ SDL_SCANCODE_AC_SEARCH, /* XF86Search */ + /* 218, 0x0da */ SDL_SCANCODE_UNKNOWN, /* XF86Go */ + /* 219, 0x0db */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */ + /* 220, 0x0dc */ SDL_SCANCODE_UNKNOWN, /* XF86Game */ + /* 221, 0x0dd */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */ + /* 222, 0x0de */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 223, 0x0df */ SDL_SCANCODE_CANCEL, /* Cancel */ + /* 224, 0x0e0 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* XF86MonBrightnessDown */ + /* 225, 0x0e1 */ SDL_SCANCODE_BRIGHTNESSUP, /* XF86MonBrightnessUp */ + /* 226, 0x0e2 */ SDL_SCANCODE_MEDIASELECT, /* XF86AudioMedia */ + /* 227, 0x0e3 */ SDL_SCANCODE_DISPLAYSWITCH, /* XF86Display */ + /* 228, 0x0e4 */ SDL_SCANCODE_KBDILLUMTOGGLE, /* XF86KbdLightOnOff */ + /* 229, 0x0e5 */ SDL_SCANCODE_KBDILLUMDOWN, /* XF86KbdBrightnessDown */ + /* 230, 0x0e6 */ SDL_SCANCODE_KBDILLUMUP, /* XF86KbdBrightnessUp */ + /* 231, 0x0e7 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ + /* 232, 0x0e8 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */ + /* 233, 0x0e9 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */ + /* 234, 0x0ea */ SDL_SCANCODE_UNKNOWN, /* XF86Save */ + /* 235, 0x0eb */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */ + /* 236, 0x0ec */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */ + /* 237, 0x0ed */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */ + /* 238, 0x0ee */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */ + /* 239, 0x0ef */ SDL_SCANCODE_UNKNOWN, /* XF86UWB */ + /* 240, 0x0f0 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */ + /* 241, 0x0f1 */ SDL_SCANCODE_UNKNOWN, /* XF86Next_VMode */ + /* 242, 0x0f2 */ SDL_SCANCODE_UNKNOWN, /* XF86Prev_VMode */ + /* 243, 0x0f3 */ SDL_SCANCODE_UNKNOWN, /* XF86MonBrightnessCycle */ + /* 244, 0x0f4 */ SDL_SCANCODE_UNKNOWN, /* XF86BrightnessAuto */ + /* 245, 0x0f5 */ SDL_SCANCODE_UNKNOWN, /* XF86DisplayOff */ + /* 246, 0x0f6 */ SDL_SCANCODE_UNKNOWN, /* XF86WWAN */ + /* 247, 0x0f7 */ SDL_SCANCODE_UNKNOWN, /* XF86RFKill */ }; /* Xvnc / Xtightvnc scancodes from xmodmap -pk */ @@ -510,3 +519,5 @@ static const SDL_Scancode xvnc_scancode_table[] = { #endif /* scancodes_xfree86_h_ */ /* *INDENT-ON* */ /* clang-format on */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 9351b5b1c..897a1687d 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -34,8 +34,7 @@ #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_windowevents_c.h" #include "../../events/SDL_events_c.h" -#include "../../events/scancodes_linux.h" -#include "../../events/scancodes_xfree86.h" +#include "../../events/SDL_scancode_tables_c.h" #include "SDL_DirectFB_events.h" @@ -684,12 +683,10 @@ EnumKeyboards(DFBInputDeviceID device_id, devdata->keyboard[devdata->num_keyboard].is_generic = 0; if (!SDL_strncmp("X11", desc.name, 3)) { - devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2; - devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2); + devdata->keyboard[devdata->num_keyboard].map = SDL_GetScancodeTable(SDL_SCANCODE_TABLE_XFREE86_2, &devdata->keyboard[devdata->num_keyboard].map_size); devdata->keyboard[devdata->num_keyboard].map_adjust = 8; } else { - devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table; - devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table); + devdata->keyboard[devdata->num_keyboard].map = SDL_GetScancodeTable(SDL_SCANCODE_TABLE_EVDEV, &devdata->keyboard[devdata->num_keyboard].map_size); devdata->keyboard[devdata->num_keyboard].map_adjust = 0; } diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 54ffdaf04..57914877d 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -29,7 +29,7 @@ #include "../../core/unix/SDL_poll.h" #include "../../events/SDL_events_c.h" -#include "../../events/scancodes_xfree86.h" +#include "../../events/SDL_scancode_tables_c.h" #include "../SDL_sysvideo.h" #include "SDL_waylandvideo.h" @@ -1125,9 +1125,8 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, keyboard_input_get_text(text, input, key, SDL_RELEASED, &handled_by_ime); } - if (!handled_by_ime && key < SDL_arraysize(xfree86_scancode_table2)) { - scancode = xfree86_scancode_table2[key]; - + if (!handled_by_ime) { + scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, key); if (scancode != SDL_SCANCODE_UNKNOWN) { SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? SDL_PRESSED : SDL_RELEASED, scancode); @@ -1159,43 +1158,42 @@ Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) { const xkb_keysym_t *syms; Wayland_Keymap *sdlKeymap = (Wayland_Keymap *)data; + SDL_Scancode scancode; - if ((key - 8) < SDL_arraysize(xfree86_scancode_table2)) { - SDL_Scancode scancode = xfree86_scancode_table2[key - 8]; - if (scancode == SDL_SCANCODE_UNKNOWN) { - return; + scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, (key - 8)); + if (scancode == SDL_SCANCODE_UNKNOWN) { + return; + } + + if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) { + uint32_t keycode = SDL_KeySymToUcs4(syms[0]); + + if (!keycode) { + keycode = Wayland_KeySymToSDLKeyCode(syms[0]); } - if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) { - uint32_t keycode = SDL_KeySymToUcs4(syms[0]); - - if (!keycode) { - keycode = Wayland_KeySymToSDLKeyCode(syms[0]); - } - - if (keycode) { - sdlKeymap->keymap[scancode] = keycode; - } else { - switch (scancode) { - case SDL_SCANCODE_RETURN: - sdlKeymap->keymap[scancode] = SDLK_RETURN; - break; - case SDL_SCANCODE_ESCAPE: - sdlKeymap->keymap[scancode] = SDLK_ESCAPE; - break; - case SDL_SCANCODE_BACKSPACE: - sdlKeymap->keymap[scancode] = SDLK_BACKSPACE; - break; - case SDL_SCANCODE_TAB: - sdlKeymap->keymap[scancode] = SDLK_TAB; - break; - case SDL_SCANCODE_DELETE: - sdlKeymap->keymap[scancode] = SDLK_DELETE; - break; - default: - sdlKeymap->keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(scancode); - break; - } + if (keycode) { + sdlKeymap->keymap[scancode] = keycode; + } else { + switch (scancode) { + case SDL_SCANCODE_RETURN: + sdlKeymap->keymap[scancode] = SDLK_RETURN; + break; + case SDL_SCANCODE_ESCAPE: + sdlKeymap->keymap[scancode] = SDLK_ESCAPE; + break; + case SDL_SCANCODE_BACKSPACE: + sdlKeymap->keymap[scancode] = SDLK_BACKSPACE; + break; + case SDL_SCANCODE_TAB: + sdlKeymap->keymap[scancode] = SDLK_TAB; + break; + case SDL_SCANCODE_DELETE: + sdlKeymap->keymap[scancode] = SDLK_DELETE; + break; + default: + sdlKeymap->keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(scancode); + break; } } } diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 5c99a65d6..6e584f275 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -402,7 +402,7 @@ X11_ReconcileKeyboardState(_THIS) } keyboardState = SDL_GetKeyboardState(0); - for (keycode = 0; keycode < 256; ++keycode) { + for (keycode = 0; keycode < SDL_arraysize(viddata->key_layout); ++keycode) { SDL_Scancode scancode = viddata->key_layout[keycode]; SDL_bool x11KeyPressed = (keys[keycode / 8] & (1 << (keycode % 8))) != 0; SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; @@ -1046,18 +1046,17 @@ X11_DispatchEvent(_THIS, XEvent *xevent) #ifdef DEBUG_XEVENTS printf("window %p: %s (X11 keycode = 0x%X)\n", data, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); #endif -#if 1 +#ifdef DEBUG_SCANCODES if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) { int min_keycode, max_keycode; X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); keysym = X11_KeyCodeToSym(_this, keycode, xevent->xkey.state >> 13); - fprintf(stderr, - "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", keycode, keycode - min_keycode, keysym, X11_XKeysymToString(keysym)); } -#endif - /* */ +#endif /* DEBUG SCANCODES */ + SDL_zeroa(text); #ifdef X_HAVE_UTF8_STRING if (data->ic && xevent->type == KeyPress) { diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index c14e13d1c..1e46f5a4f 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -25,8 +25,7 @@ #include "SDL_x11video.h" #include "../../events/SDL_keyboard_c.h" -#include "../../events/scancodes_darwin.h" -#include "../../events/scancodes_xfree86.h" +#include "../../events/SDL_scancode_tables_c.h" #include #include @@ -42,43 +41,6 @@ static const struct { KeySym keysym; SDL_Scancode scancode; } KeySymToSDLScancode[] = { - { XK_Return, SDL_SCANCODE_RETURN }, - { XK_Escape, SDL_SCANCODE_ESCAPE }, - { XK_BackSpace, SDL_SCANCODE_BACKSPACE }, - { XK_Tab, SDL_SCANCODE_TAB }, - { XK_Caps_Lock, SDL_SCANCODE_CAPSLOCK }, - { XK_F1, SDL_SCANCODE_F1 }, - { XK_F2, SDL_SCANCODE_F2 }, - { XK_F3, SDL_SCANCODE_F3 }, - { XK_F4, SDL_SCANCODE_F4 }, - { XK_F5, SDL_SCANCODE_F5 }, - { XK_F6, SDL_SCANCODE_F6 }, - { XK_F7, SDL_SCANCODE_F7 }, - { XK_F8, SDL_SCANCODE_F8 }, - { XK_F9, SDL_SCANCODE_F9 }, - { XK_F10, SDL_SCANCODE_F10 }, - { XK_F11, SDL_SCANCODE_F11 }, - { XK_F12, SDL_SCANCODE_F12 }, - { XK_Print, SDL_SCANCODE_PRINTSCREEN }, - { XK_Scroll_Lock, SDL_SCANCODE_SCROLLLOCK }, - { XK_Pause, SDL_SCANCODE_PAUSE }, - { XK_Insert, SDL_SCANCODE_INSERT }, - { XK_Home, SDL_SCANCODE_HOME }, - { XK_Prior, SDL_SCANCODE_PAGEUP }, - { XK_Delete, SDL_SCANCODE_DELETE }, - { XK_End, SDL_SCANCODE_END }, - { XK_Next, SDL_SCANCODE_PAGEDOWN }, - { XK_Right, SDL_SCANCODE_RIGHT }, - { XK_Left, SDL_SCANCODE_LEFT }, - { XK_Down, SDL_SCANCODE_DOWN }, - { XK_Up, SDL_SCANCODE_UP }, - { XK_Num_Lock, SDL_SCANCODE_NUMLOCKCLEAR }, - { XK_KP_Divide, SDL_SCANCODE_KP_DIVIDE }, - { XK_KP_Multiply, SDL_SCANCODE_KP_MULTIPLY }, - { XK_KP_Subtract, SDL_SCANCODE_KP_MINUS }, - { XK_KP_Add, SDL_SCANCODE_KP_PLUS }, - { XK_KP_Enter, SDL_SCANCODE_KP_ENTER }, - { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD }, { XK_KP_End, SDL_SCANCODE_KP_1 }, { XK_KP_Down, SDL_SCANCODE_KP_2 }, { XK_KP_Next, SDL_SCANCODE_KP_3 }, @@ -89,111 +51,409 @@ static const struct { { XK_KP_Up, SDL_SCANCODE_KP_8 }, { XK_KP_Prior, SDL_SCANCODE_KP_9 }, { XK_KP_Insert, SDL_SCANCODE_KP_0 }, - { XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD }, - { XK_KP_1, SDL_SCANCODE_KP_1 }, - { XK_KP_2, SDL_SCANCODE_KP_2 }, - { XK_KP_3, SDL_SCANCODE_KP_3 }, - { XK_KP_4, SDL_SCANCODE_KP_4 }, - { XK_KP_5, SDL_SCANCODE_KP_5 }, - { XK_KP_6, SDL_SCANCODE_KP_6 }, - { XK_KP_7, SDL_SCANCODE_KP_7 }, - { XK_KP_8, SDL_SCANCODE_KP_8 }, - { XK_KP_9, SDL_SCANCODE_KP_9 }, - { XK_KP_0, SDL_SCANCODE_KP_0 }, - { XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD }, - { XK_Hyper_R, SDL_SCANCODE_APPLICATION }, - { XK_KP_Equal, SDL_SCANCODE_KP_EQUALS }, - { XK_F13, SDL_SCANCODE_F13 }, - { XK_F14, SDL_SCANCODE_F14 }, - { XK_F15, SDL_SCANCODE_F15 }, - { XK_F16, SDL_SCANCODE_F16 }, - { XK_F17, SDL_SCANCODE_F17 }, - { XK_F18, SDL_SCANCODE_F18 }, - { XK_F19, SDL_SCANCODE_F19 }, - { XK_F20, SDL_SCANCODE_F20 }, - { XK_F21, SDL_SCANCODE_F21 }, - { XK_F22, SDL_SCANCODE_F22 }, - { XK_F23, SDL_SCANCODE_F23 }, - { XK_F24, SDL_SCANCODE_F24 }, + { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD }, { XK_Execute, SDL_SCANCODE_EXECUTE }, - { XK_Help, SDL_SCANCODE_HELP }, - { XK_Menu, SDL_SCANCODE_MENU }, - { XK_Select, SDL_SCANCODE_SELECT }, - { XK_Cancel, SDL_SCANCODE_STOP }, - { XK_Redo, SDL_SCANCODE_AGAIN }, - { XK_Undo, SDL_SCANCODE_UNDO }, - { XK_Find, SDL_SCANCODE_FIND }, - { XK_KP_Separator, SDL_SCANCODE_KP_COMMA }, - { XK_Sys_Req, SDL_SCANCODE_SYSREQ }, - { XK_Control_L, SDL_SCANCODE_LCTRL }, - { XK_Shift_L, SDL_SCANCODE_LSHIFT }, - { XK_Alt_L, SDL_SCANCODE_LALT }, - { XK_Meta_L, SDL_SCANCODE_LGUI }, - { XK_Super_L, SDL_SCANCODE_LGUI }, - { XK_Control_R, SDL_SCANCODE_RCTRL }, - { XK_Shift_R, SDL_SCANCODE_RSHIFT }, - { XK_Alt_R, SDL_SCANCODE_RALT }, + { XK_Hyper_R, SDL_SCANCODE_APPLICATION }, { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, - { XK_Meta_R, SDL_SCANCODE_RGUI }, + { XK_Super_L, SDL_SCANCODE_LGUI }, { XK_Super_R, SDL_SCANCODE_RGUI }, { XK_Mode_switch, SDL_SCANCODE_MODE }, - { XK_period, SDL_SCANCODE_PERIOD }, - { XK_comma, SDL_SCANCODE_COMMA }, - { XK_slash, SDL_SCANCODE_SLASH }, - { XK_backslash, SDL_SCANCODE_BACKSLASH }, - { XK_minus, SDL_SCANCODE_MINUS }, - { XK_equal, SDL_SCANCODE_EQUALS }, - { XK_space, SDL_SCANCODE_SPACE }, - { XK_grave, SDL_SCANCODE_GRAVE }, - { XK_apostrophe, SDL_SCANCODE_APOSTROPHE }, - { XK_bracketleft, SDL_SCANCODE_LEFTBRACKET }, - { XK_bracketright, SDL_SCANCODE_RIGHTBRACKET }, + { 0x1008FF65, SDL_SCANCODE_MENU }, /* XF86MenuKB */ + { 0x1008FF81, SDL_SCANCODE_F13 }, /* XF86Tools */ + { 0x1008FF45, SDL_SCANCODE_F14 }, /* XF86Launch5 */ + { 0x1008FF46, SDL_SCANCODE_F15 }, /* XF86Launch6 */ + { 0x1008FF47, SDL_SCANCODE_F16 }, /* XF86Launch7 */ + { 0x1008FF48, SDL_SCANCODE_F17 }, /* XF86Launch8 */ + { 0x1008FF49, SDL_SCANCODE_F18 }, /* XF86Launch9 */ }; -static const struct +/* This is a mapping from X keysym to Linux keycode */ +static const KeySym LinuxKeycodeKeysyms[] = { + /* 0, 0x000 */ 0x0, /* NoSymbol */ + /* 1, 0x001 */ 0xFF1B, /* Escape */ + /* 2, 0x002 */ 0x31, /* 1 */ + /* 3, 0x003 */ 0x32, /* 2 */ + /* 4, 0x004 */ 0x33, /* 3 */ + /* 5, 0x005 */ 0x34, /* 4 */ + /* 6, 0x006 */ 0x35, /* 5 */ + /* 7, 0x007 */ 0x36, /* 6 */ + /* 8, 0x008 */ 0x37, /* 7 */ + /* 9, 0x009 */ 0x38, /* 8 */ + /* 10, 0x00a */ 0x39, /* 9 */ + /* 11, 0x00b */ 0x30, /* 0 */ + /* 12, 0x00c */ 0x2D, /* minus */ + /* 13, 0x00d */ 0x3D, /* equal */ + /* 14, 0x00e */ 0xFF08, /* BackSpace */ + /* 15, 0x00f */ 0xFF09, /* Tab */ + /* 16, 0x010 */ 0x71, /* q */ + /* 17, 0x011 */ 0x77, /* w */ + /* 18, 0x012 */ 0x65, /* e */ + /* 19, 0x013 */ 0x72, /* r */ + /* 20, 0x014 */ 0x74, /* t */ + /* 21, 0x015 */ 0x79, /* y */ + /* 22, 0x016 */ 0x75, /* u */ + /* 23, 0x017 */ 0x69, /* i */ + /* 24, 0x018 */ 0x6F, /* o */ + /* 25, 0x019 */ 0x70, /* p */ + /* 26, 0x01a */ 0x5B, /* bracketleft */ + /* 27, 0x01b */ 0x5D, /* bracketright */ + /* 28, 0x01c */ 0xFF0D, /* Return */ + /* 29, 0x01d */ 0xFFE3, /* Control_L */ + /* 30, 0x01e */ 0x61, /* a */ + /* 31, 0x01f */ 0x73, /* s */ + /* 32, 0x020 */ 0x64, /* d */ + /* 33, 0x021 */ 0x66, /* f */ + /* 34, 0x022 */ 0x67, /* g */ + /* 35, 0x023 */ 0x68, /* h */ + /* 36, 0x024 */ 0x6A, /* j */ + /* 37, 0x025 */ 0x6B, /* k */ + /* 38, 0x026 */ 0x6C, /* l */ + /* 39, 0x027 */ 0x3B, /* semicolon */ + /* 40, 0x028 */ 0x27, /* apostrophe */ + /* 41, 0x029 */ 0x60, /* grave */ + /* 42, 0x02a */ 0xFFE1, /* Shift_L */ + /* 43, 0x02b */ 0x5C, /* backslash */ + /* 44, 0x02c */ 0x7A, /* z */ + /* 45, 0x02d */ 0x78, /* x */ + /* 46, 0x02e */ 0x63, /* c */ + /* 47, 0x02f */ 0x76, /* v */ + /* 48, 0x030 */ 0x62, /* b */ + /* 49, 0x031 */ 0x6E, /* n */ + /* 50, 0x032 */ 0x6D, /* m */ + /* 51, 0x033 */ 0x2C, /* comma */ + /* 52, 0x034 */ 0x2E, /* period */ + /* 53, 0x035 */ 0x2F, /* slash */ + /* 54, 0x036 */ 0xFFE2, /* Shift_R */ + /* 55, 0x037 */ 0xFFAA, /* KP_Multiply */ + /* 56, 0x038 */ 0xFFE9, /* Alt_L */ + /* 57, 0x039 */ 0x20, /* space */ + /* 58, 0x03a */ 0xFFE5, /* Caps_Lock */ + /* 59, 0x03b */ 0xFFBE, /* F1 */ + /* 60, 0x03c */ 0xFFBF, /* F2 */ + /* 61, 0x03d */ 0xFFC0, /* F3 */ + /* 62, 0x03e */ 0xFFC1, /* F4 */ + /* 63, 0x03f */ 0xFFC2, /* F5 */ + /* 64, 0x040 */ 0xFFC3, /* F6 */ + /* 65, 0x041 */ 0xFFC4, /* F7 */ + /* 66, 0x042 */ 0xFFC5, /* F8 */ + /* 67, 0x043 */ 0xFFC6, /* F9 */ + /* 68, 0x044 */ 0xFFC7, /* F10 */ + /* 69, 0x045 */ 0xFF7F, /* Num_Lock */ + /* 70, 0x046 */ 0xFF14, /* Scroll_Lock */ + /* 71, 0x047 */ 0xFFB7, /* KP_7 */ + /* 72, 0x048 */ 0XFFB8, /* KP_8 */ + /* 73, 0x049 */ 0XFFB9, /* KP_9 */ + /* 74, 0x04a */ 0xFFAD, /* KP_Subtract */ + /* 75, 0x04b */ 0xFFB4, /* KP_4 */ + /* 76, 0x04c */ 0xFFB5, /* KP_5 */ + /* 77, 0x04d */ 0xFFB6, /* KP_6 */ + /* 78, 0x04e */ 0xFFAB, /* KP_Add */ + /* 79, 0x04f */ 0xFFB1, /* KP_1 */ + /* 80, 0x050 */ 0xFFB2, /* KP_2 */ + /* 81, 0x051 */ 0xFFB3, /* KP_3 */ + /* 82, 0x052 */ 0xFFB0, /* KP_0 */ + /* 83, 0x053 */ 0xFFAE, /* KP_Decimal */ + /* 84, 0x054 */ 0x0, /* NoSymbol */ + /* 85, 0x055 */ 0x0, /* NoSymbol */ + /* 86, 0x056 */ 0x3C, /* less */ + /* 87, 0x057 */ 0xFFC8, /* F11 */ + /* 88, 0x058 */ 0xFFC9, /* F12 */ + /* 89, 0x059 */ 0x0, /* NoSymbol */ + /* 90, 0x05a */ 0xFF26, /* Katakana */ + /* 91, 0x05b */ 0xFF25, /* Hiragana */ + /* 92, 0x05c */ 0xFF23, /* Henkan_Mode */ + /* 93, 0x05d */ 0xFF27, /* Hiragana_Katakana */ + /* 94, 0x05e */ 0xFF22, /* Muhenkan */ + /* 95, 0x05f */ 0x0, /* NoSymbol */ + /* 96, 0x060 */ 0xFF8D, /* KP_Enter */ + /* 97, 0x061 */ 0xFFE4, /* Control_R */ + /* 98, 0x062 */ 0xFFAF, /* KP_Divide */ + /* 99, 0x063 */ 0xFF15, /* Sys_Req */ + /* 100, 0x064 */ 0xFFEA, /* Alt_R */ + /* 101, 0x065 */ 0xFF0A, /* Linefeed */ + /* 102, 0x066 */ 0xFF50, /* Home */ + /* 103, 0x067 */ 0xFF52, /* Up */ + /* 104, 0x068 */ 0xFF55, /* Prior */ + /* 105, 0x069 */ 0xFF51, /* Left */ + /* 106, 0x06a */ 0xFF53, /* Right */ + /* 107, 0x06b */ 0xFF57, /* End */ + /* 108, 0x06c */ 0xFF54, /* Down */ + /* 109, 0x06d */ 0xFF56, /* Next */ + /* 110, 0x06e */ 0xFF63, /* Insert */ + /* 111, 0x06f */ 0xFFFF, /* Delete */ + /* 112, 0x070 */ 0x0, /* NoSymbol */ + /* 113, 0x071 */ 0x1008FF12, /* XF86AudioMute */ + /* 114, 0x072 */ 0x1008FF11, /* XF86AudioLowerVolume */ + /* 115, 0x073 */ 0x1008FF13, /* XF86AudioRaiseVolume */ + /* 116, 0x074 */ 0x1008FF2A, /* XF86PowerOff */ + /* 117, 0x075 */ 0xFFBD, /* KP_Equal */ + /* 118, 0x076 */ 0xB1, /* plusminus */ + /* 119, 0x077 */ 0xFF13, /* Pause */ + /* 120, 0x078 */ 0x1008FF4A, /* XF86LaunchA */ + /* 121, 0x079 */ 0xFFAC, /* KP_Separator */ + /* 122, 0x07a */ 0xFF31, /* Hangul */ + /* 123, 0x07b */ 0xFF34, /* Hangul_Hanja */ + /* 124, 0x07c */ 0x0, /* NoSymbol */ + /* 125, 0x07d */ 0xFFE7, /* Meta_L */ + /* 126, 0x07e */ 0xFFE8, /* Meta_R */ + /* 127, 0x07f */ 0xFF67, /* Menu */ + /* 128, 0x080 */ 0x00, /* NoSymbol */ + /* 129, 0x081 */ 0xFF66, /* Redo */ + /* 130, 0x082 */ 0x1005FF70, /* SunProps */ + /* 131, 0x083 */ 0xFF65, /* Undo */ + /* 132, 0x084 */ 0x1005FF71, /* SunFront */ + /* 133, 0x085 */ 0x1008FF57, /* XF86Copy */ + /* 134, 0x086 */ 0x1008FF6B, /* XF86Open */ + /* 135, 0x087 */ 0x1008FF6D, /* XF86Paste */ + /* 136, 0x088 */ 0xFF68, /* Find */ + /* 137, 0x089 */ 0x1008FF58, /* XF86Cut */ + /* 138, 0x08a */ 0xFF6A, /* Help */ + /* 139, 0x08b */ 0xFF67, /* Menu */ + /* 140, 0x08c */ 0x1008FF1D, /* XF86Calculator */ + /* 141, 0x08d */ 0x0, /* NoSymbol */ + /* 142, 0x08e */ 0x1008FF2F, /* XF86Sleep */ + /* 143, 0x08f */ 0x1008FF2B, /* XF86WakeUp */ + /* 144, 0x090 */ 0x1008FF5D, /* XF86Explorer */ + /* 145, 0x091 */ 0x1008FF7B, /* XF86Send */ + /* 146, 0x092 */ 0x0, /* NoSymbol */ + /* 147, 0x093 */ 0x1008FF8A, /* XF86Xfer */ + /* 148, 0x094 */ 0x1008FF41, /* XF86Launch1 */ + /* 149, 0x095 */ 0x1008FF42, /* XF86Launch2 */ + /* 150, 0x096 */ 0x1008FF2E, /* XF86WWW */ + /* 151, 0x097 */ 0x1008FF5A, /* XF86DOS */ + /* 152, 0x098 */ 0x1008FF2D, /* XF86ScreenSaver */ + /* 153, 0x099 */ 0x1008FF74, /* XF86RotateWindows */ + /* 154, 0x09a */ 0x1008FF7F, /* XF86TaskPane */ + /* 155, 0x09b */ 0x1008FF19, /* XF86Mail */ + /* 156, 0x09c */ 0x1008FF30, /* XF86Favorites */ + /* 157, 0x09d */ 0x1008FF33, /* XF86MyComputer */ + /* 158, 0x09e */ 0x1008FF26, /* XF86Back */ + /* 159, 0x09f */ 0x1008FF27, /* XF86Forward */ + /* 160, 0x0a0 */ 0x0, /* NoSymbol */ + /* 161, 0x0a1 */ 0x1008FF2C, /* XF86Eject */ + /* 162, 0x0a2 */ 0x1008FF2C, /* XF86Eject */ + /* 163, 0x0a3 */ 0x1008FF17, /* XF86AudioNext */ + /* 164, 0x0a4 */ 0x1008FF14, /* XF86AudioPlay */ + /* 165, 0x0a5 */ 0x1008FF16, /* XF86AudioPrev */ + /* 166, 0x0a6 */ 0x1008FF15, /* XF86AudioStop */ + /* 167, 0x0a7 */ 0x1008FF1C, /* XF86AudioRecord */ + /* 168, 0x0a8 */ 0x1008FF3E, /* XF86AudioRewind */ + /* 169, 0x0a9 */ 0x1008FF6E, /* XF86Phone */ + /* 170, 0x0aa */ 0x0, /* NoSymbol */ + /* 171, 0x0ab */ 0x1008FF81, /* XF86Tools */ + /* 172, 0x0ac */ 0x1008FF18, /* XF86HomePage */ + /* 173, 0x0ad */ 0x1008FF73, /* XF86Reload */ + /* 174, 0x0ae */ 0x1008FF56, /* XF86Close */ + /* 175, 0x0af */ 0x0, /* NoSymbol */ + /* 176, 0x0b0 */ 0x0, /* NoSymbol */ + /* 177, 0x0b1 */ 0x1008FF78, /* XF86ScrollUp */ + /* 178, 0x0b2 */ 0x1008FF79, /* XF86ScrollDown */ + /* 179, 0x0b3 */ 0x28, /* parenleft */ + /* 180, 0x0b4 */ 0x29, /* parenright */ + /* 181, 0x0b5 */ 0x1008FF68, /* XF86New */ + /* 182, 0x0b6 */ 0xFF66, /* Redo */ + /* 183, 0x0b7 */ 0xFFCA, /* F13 */ + /* 184, 0x0b8 */ 0xFFCB, /* F14 */ + /* 185, 0x0b9 */ 0xFFCC, /* F15 */ + /* 186, 0x0ba */ 0xFFCD, /* F16 */ + /* 187, 0x0bb */ 0xFFCE, /* F17 */ + /* 188, 0x0bc */ 0xFFCF, /* F18 */ + /* 189, 0x0bd */ 0xFFD0, /* F19 */ + /* 190, 0x0be */ 0xFFD1, /* F20 */ + /* 191, 0x0bf */ 0xFFD2, /* F21 */ + /* 192, 0x0c0 */ 0xFFD3, /* F22 */ + /* 193, 0x0c1 */ 0xFFD4, /* F23 */ + /* 194, 0x0c2 */ 0xFFD5, /* F24 */ + /* 195, 0x0c3 */ 0x0, /* NoSymbol */ + /* 196, 0x0c4 */ 0x0, /* NoSymbol */ + /* 197, 0x0c5 */ 0x0, /* NoSymbol */ + /* 198, 0x0c6 */ 0x0, /* NoSymbol */ + /* 199, 0x0c7 */ 0x0, /* NoSymbol */ + /* 200, 0x0c8 */ 0x1008FF14, /* XF86AudioPlay */ + /* 201, 0x0c9 */ 0x1008FF31, /* XF86AudioPause */ + /* 202, 0x0ca */ 0x1008FF43, /* XF86Launch3 */ + /* 203, 0x0cb */ 0x1008FF44, /* XF86Launch4 */ + /* 204, 0x0cc */ 0x1008FF4B, /* XF86LaunchB */ + /* 205, 0x0cd */ 0x1008FFA7, /* XF86Suspend */ + /* 206, 0x0ce */ 0x1008FF56, /* XF86Close */ + /* 207, 0x0cf */ 0x1008FF14, /* XF86AudioPlay */ + /* 208, 0x0d0 */ 0x1008FF97, /* XF86AudioForward */ + /* 209, 0x0d1 */ 0x0, /* NoSymbol */ + /* 210, 0x0d2 */ 0xFF61, /* Print */ + /* 211, 0x0d3 */ 0x0, /* NoSymbol */ + /* 212, 0x0d4 */ 0x1008FF8F, /* XF86WebCam */ + /* 213, 0x0d5 */ 0x1008FFB6, /* XF86AudioPreset */ + /* 214, 0x0d6 */ 0x0, /* NoSymbol */ + /* 215, 0x0d7 */ 0x1008FF19, /* XF86Mail */ + /* 216, 0x0d8 */ 0x1008FF8E, /* XF86Messenger */ + /* 217, 0x0d9 */ 0x1008FF1B, /* XF86Search */ + /* 218, 0x0da */ 0x1008FF5F, /* XF86Go */ + /* 219, 0x0db */ 0x1008FF3C, /* XF86Finance */ + /* 220, 0x0dc */ 0x1008FF5E, /* XF86Game */ + /* 221, 0x0dd */ 0x1008FF36, /* XF86Shop */ + /* 222, 0x0de */ 0x0, /* NoSymbol */ + /* 223, 0x0df */ 0xFF69, /* Cancel */ + /* 224, 0x0e0 */ 0x1008FF03, /* XF86MonBrightnessDown */ + /* 225, 0x0e1 */ 0x1008FF02, /* XF86MonBrightnessUp */ + /* 226, 0x0e2 */ 0x1008FF32, /* XF86AudioMedia */ + /* 227, 0x0e3 */ 0x1008FF59, /* XF86Display */ + /* 228, 0x0e4 */ 0x1008FF04, /* XF86KbdLightOnOff */ + /* 229, 0x0e5 */ 0x1008FF06, /* XF86KbdBrightnessDown */ + /* 230, 0x0e6 */ 0x1008FF05, /* XF86KbdBrightnessUp */ + /* 231, 0x0e7 */ 0x1008FF7B, /* XF86Send */ + /* 232, 0x0e8 */ 0x1008FF72, /* XF86Reply */ + /* 233, 0x0e9 */ 0x1008FF90, /* XF86MailForward */ + /* 234, 0x0ea */ 0x1008FF77, /* XF86Save */ + /* 235, 0x0eb */ 0x1008FF5B, /* XF86Documents */ + /* 236, 0x0ec */ 0x1008FF93, /* XF86Battery */ + /* 237, 0x0ed */ 0x1008FF94, /* XF86Bluetooth */ + /* 238, 0x0ee */ 0x1008FF95, /* XF86WLAN */ + /* 239, 0x0ef */ 0x1008FF96, /* XF86UWB */ + /* 240, 0x0f0 */ 0x0, /* NoSymbol */ + /* 241, 0x0f1 */ 0x1008FE22, /* XF86Next_VMode */ + /* 242, 0x0f2 */ 0x1008FE23, /* XF86Prev_VMode */ + /* 243, 0x0f3 */ 0x1008FF07, /* XF86MonBrightnessCycle */ + /* 244, 0x0f4 */ 0x100810F4, /* XF86BrightnessAuto */ + /* 245, 0x0f5 */ 0x100810F5, /* XF86DisplayOff */ + /* 246, 0x0f6 */ 0x1008FFB4, /* XF86WWAN */ + /* 247, 0x0f7 */ 0x1008FFB5, /* XF86RFKill */ +}; + +#if 0 /* Here is a script to generate the ExtendedLinuxKeycodeKeysyms table */ +#!/bin/bash + +function process_line { - SDL_Scancode const *table; - int table_size; -} scancode_set[] = { - { darwin_scancode_table, SDL_arraysize(darwin_scancode_table) }, - { xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) }, - { xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) }, - { xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) }, + sym=$(echo "$1" | awk '{print $3}') + code=$(echo "$1" | sed 's,.*_EVDEVK(\(0x[0-9A-Fa-f]*\)).*,\1,') + value=$(egrep "#define ${sym}\s" -R /usr/include/X11 | awk '{print $3}') + printf " { 0x%.8X, 0x%.3x }, /* $sym */\n" $value $code +} + +fgrep "/* Use: " /usr/include/xkbcommon/xkbcommon-keysyms.h | fgrep _EVDEVK | while read line; do + process_line "$line" +done +#endif + +static const struct { + KeySym keysym; + int linux_keycode; +} ExtendedLinuxKeycodeKeysyms[] = { + { 0x1008FF2C, 0x0a2 }, /* XF86XK_Eject */ + { 0x1008FF68, 0x0b5 }, /* XF86XK_New */ + { 0x0000FF66, 0x0b6 }, /* XK_Redo */ + { 0x1008FF4B, 0x0cc }, /* XF86XK_LaunchB */ + { 0x1008FF59, 0x0e3 }, /* XF86XK_Display */ + { 0x1008FF04, 0x0e4 }, /* XF86XK_KbdLightOnOff */ + { 0x1008FF06, 0x0e5 }, /* XF86XK_KbdBrightnessDown */ + { 0x1008FF05, 0x0e6 }, /* XF86XK_KbdBrightnessUp */ + { 0x1008FF7B, 0x0e7 }, /* XF86XK_Send */ + { 0x1008FF72, 0x0e8 }, /* XF86XK_Reply */ + { 0x1008FF90, 0x0e9 }, /* XF86XK_MailForward */ + { 0x1008FF77, 0x0ea }, /* XF86XK_Save */ + { 0x1008FF5B, 0x0eb }, /* XF86XK_Documents */ + { 0x1008FF93, 0x0ec }, /* XF86XK_Battery */ + { 0x1008FF94, 0x0ed }, /* XF86XK_Bluetooth */ + { 0x1008FF95, 0x0ee }, /* XF86XK_WLAN */ + { 0x1008FF96, 0x0ef }, /* XF86XK_UWB */ + { 0x1008FE22, 0x0f1 }, /* XF86XK_Next_VMode */ + { 0x1008FE23, 0x0f2 }, /* XF86XK_Prev_VMode */ + { 0x1008FF07, 0x0f3 }, /* XF86XK_MonBrightnessCycle */ + { 0x1008FFB4, 0x0f6 }, /* XF86XK_WWAN */ + { 0x1008FFB5, 0x0f7 }, /* XF86XK_RFKill */ + { 0x1008FFB2, 0x0f8 }, /* XF86XK_AudioMicMute */ + { 0x1008FF9C, 0x173 }, /* XF86XK_CycleAngle */ + { 0x1008FFB8, 0x174 }, /* XF86XK_FullScreen */ + { 0x1008FF87, 0x189 }, /* XF86XK_Video */ + { 0x1008FF20, 0x18d }, /* XF86XK_Calendar */ + { 0x1008FF99, 0x19a }, /* XF86XK_AudioRandomPlay */ + { 0x1008FF5E, 0x1a1 }, /* XF86XK_Game */ + { 0x1008FF8B, 0x1a2 }, /* XF86XK_ZoomIn */ + { 0x1008FF8C, 0x1a3 }, /* XF86XK_ZoomOut */ + { 0x1008FF89, 0x1a5 }, /* XF86XK_Word */ + { 0x1008FF5C, 0x1a7 }, /* XF86XK_Excel */ + { 0x1008FF69, 0x1ab }, /* XF86XK_News */ + { 0x1008FF8E, 0x1ae }, /* XF86XK_Messenger */ + { 0x1008FF61, 0x1b1 }, /* XF86XK_LogOff */ + { 0x00000024, 0x1b2 }, /* XK_dollar */ + { 0x000020AC, 0x1b3 }, /* XK_EuroSign */ + { 0x1008FF9D, 0x1b4 }, /* XF86XK_FrameBack */ + { 0x1008FF9E, 0x1b5 }, /* XF86XK_FrameForward */ + { 0x0000FFF1, 0x1f1 }, /* XK_braille_dot_1 */ + { 0x0000FFF2, 0x1f2 }, /* XK_braille_dot_2 */ + { 0x0000FFF3, 0x1f3 }, /* XK_braille_dot_3 */ + { 0x0000FFF4, 0x1f4 }, /* XK_braille_dot_4 */ + { 0x0000FFF5, 0x1f5 }, /* XK_braille_dot_5 */ + { 0x0000FFF6, 0x1f6 }, /* XK_braille_dot_6 */ + { 0x0000FFF7, 0x1f7 }, /* XK_braille_dot_7 */ + { 0x0000FFF8, 0x1f8 }, /* XK_braille_dot_8 */ + { 0x0000FFF9, 0x1f9 }, /* XK_braille_dot_9 */ + { 0x0000FFF1, 0x1fa }, /* XK_braille_dot_1 */ + { 0x1008FFA9, 0x212 }, /* XF86XK_TouchpadToggle */ + { 0x1008FFB0, 0x213 }, /* XF86XK_TouchpadOn */ + { 0x1008FFB1, 0x214 }, /* XF86XK_TouchpadOff */ + { 0x1008FFB7, 0x231 }, /* XF86XK_RotationLockToggle */ + { 0x0000FE08, 0x248 }, /* XK_ISO_Next_Group */ +}; + +static SDL_ScancodeTable scancode_set[] = { + SDL_SCANCODE_TABLE_DARWIN, + SDL_SCANCODE_TABLE_XFREE86_1, + SDL_SCANCODE_TABLE_XFREE86_2, + SDL_SCANCODE_TABLE_XVNC, }; /* *INDENT-OFF* */ /* clang-format off */ -/* This function only works for keyboards in US QWERTY layout */ +/* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */ static SDL_Scancode X11_KeyCodeToSDLScancode(_THIS, KeyCode keycode) { KeySym keysym; int i; + int linux_keycode = 0; keysym = X11_KeyCodeToSym(_this, keycode, 0); if (keysym == NoSymbol) { return SDL_SCANCODE_UNKNOWN; } - if (keysym >= XK_a && keysym <= XK_z) { - return SDL_SCANCODE_A + (keysym - XK_a); - } - if (keysym >= XK_A && keysym <= XK_Z) { - return SDL_SCANCODE_A + (keysym - XK_A); - } - - if (keysym == XK_0) { - return SDL_SCANCODE_0; - } - if (keysym >= XK_1 && keysym <= XK_9) { - return SDL_SCANCODE_1 + (keysym - XK_1); - } - + /* First check our custom list */ for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) { if (keysym == KeySymToSDLScancode[i].keysym) { return KeySymToSDLScancode[i].scancode; } } - return SDL_SCANCODE_UNKNOWN; + + /* The rest of the keysyms map to Linux keycodes, so use that mapping */ + if (keysym >= 0x10081000 && keysym <= 0x10081FFF) { + /* Per xkbcommon-keysyms.h, this is actually a linux keycode */ + linux_keycode = (keysym - 0x10081000); + } + if (!linux_keycode) { + /* See if this keysym is an exact match in our table */ + i = (keycode - 8); + if (i >= 0 && i < SDL_arraysize(LinuxKeycodeKeysyms) && keysym == LinuxKeycodeKeysyms[i]) { + linux_keycode = i; + } else { + /* Scan the table for this keysym */ + for (i = 0; i < SDL_arraysize(LinuxKeycodeKeysyms); ++i) { + if (keysym == LinuxKeycodeKeysyms[i]) { + linux_keycode = i; + break; + } + } + } + } + if (!linux_keycode) { + /* Scan the extended table for this keysym */ + for (i = 0; i < SDL_arraysize(ExtendedLinuxKeycodeKeysyms); ++i) { + if (keysym == ExtendedLinuxKeycodeKeysyms[i].keysym) { + linux_keycode = ExtendedLinuxKeycodeKeysyms[i].linux_keycode; + break; + } + } + } + return SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, linux_keycode); } static Uint32 @@ -339,21 +599,21 @@ X11_InitKeyboard(_THIS) best_index = -1; X11_XDisplayKeycodes(data->display, &min_keycode, &max_keycode); for (i = 0; i < SDL_arraysize(fingerprint); ++i) { - fingerprint[i].value = - X11_XKeysymToKeycode(data->display, fingerprint[i].keysym) - - min_keycode; + fingerprint[i].value = X11_XKeysymToKeycode(data->display, fingerprint[i].keysym) - min_keycode; } for (i = 0; i < SDL_arraysize(scancode_set); ++i) { + int table_size; + const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[i], &table_size); + /* Make sure the scancode set isn't too big */ - if ((max_keycode - min_keycode + 1) <= scancode_set[i].table_size) { + if (table_size > (max_keycode - min_keycode + 1)) { continue; } distance = 0; for (j = 0; j < SDL_arraysize(fingerprint); ++j) { - if (fingerprint[j].value < 0 - || fingerprint[j].value >= scancode_set[i].table_size) { + if (fingerprint[j].value < 0 || fingerprint[j].value >= table_size) { distance += 1; - } else if (scancode_set[i].table[fingerprint[j].value] != fingerprint[j].scancode) { + } else if (table[fingerprint[j].value] != fingerprint[j].scancode) { distance += 1; } } @@ -363,34 +623,68 @@ X11_InitKeyboard(_THIS) } } if (best_index >= 0 && best_distance <= 2) { -#ifdef DEBUG_KEYBOARD - printf("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, scancode_set[best_index].table_size); -#endif - SDL_memcpy(&data->key_layout[min_keycode], scancode_set[best_index].table, - sizeof(SDL_Scancode) * scancode_set[best_index].table_size); - } else { - SDL_Keycode keymap[SDL_NUM_SCANCODES]; + SDL_Keycode default_keymap[SDL_NUM_SCANCODES]; + int table_size; + const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[best_index], &table_size); - printf - ("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); +#ifdef DEBUG_KEYBOARD + SDL_Log("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, table_size); +#endif + /* This should never happen, but just in case... */ + if (table_size > (SDL_arraysize(data->key_layout) - min_keycode)) { + table_size = (SDL_arraysize(data->key_layout) - min_keycode); + } + SDL_memcpy(&data->key_layout[min_keycode], table, sizeof(SDL_Scancode) * table_size); + + /* Scancodes represent physical locations on the keyboard, unaffected by keyboard mapping. + However, there are a number of extended scancodes that have no standard location, so use + the X11 mapping for all non-character keys. + */ + SDL_GetDefaultKeymap(default_keymap); + + for (i = min_keycode; i <= max_keycode; ++i) { + SDL_Scancode scancode = X11_KeyCodeToSDLScancode(_this, i); +#ifdef DEBUG_KEYBOARD + { + KeySym sym; + sym = X11_KeyCodeToSym(_this, (KeyCode)i, 0); + SDL_Log("code = %d, sym = 0x%X (%s) ", i - min_keycode, + (unsigned int)sym, sym == NoSymbol ? "NoSymbol" : X11_XKeysymToString(sym)); + } +#endif + if (scancode == data->key_layout[i]) { + continue; + } + if (scancode == SDL_SCANCODE_UNKNOWN || default_keymap[scancode] >= SDLK_SCANCODE_MASK) { + /* Not a character key, safe to remap */ +#ifdef DEBUG_KEYBOARD + SDL_Log("Changing scancode, was %d (%s), now %d (%s)\n", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); +#endif + data->key_layout[i] = scancode; + } + } + } else { +#ifdef DEBUG_SCANCODES + SDL_Log("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); +#endif /* Determine key_layout - only works on US QWERTY layout */ - SDL_GetDefaultKeymap(keymap); for (i = min_keycode; i <= max_keycode; ++i) { - KeySym sym; - sym = X11_KeyCodeToSym(_this, (KeyCode) i, 0); - if (sym != NoSymbol) { - SDL_Scancode scancode; - printf("code = %d, sym = 0x%X (%s) ", i - min_keycode, - (unsigned int) sym, X11_XKeysymToString(sym)); - scancode = X11_KeyCodeToSDLScancode(_this, i); - data->key_layout[i] = scancode; - if (scancode == SDL_SCANCODE_UNKNOWN) { - printf("scancode not found\n"); - } else { - printf("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode)); - } + SDL_Scancode scancode = X11_KeyCodeToSDLScancode(_this, i); +#ifdef DEBUG_SCANCODES + { + KeySym sym; + sym = X11_KeyCodeToSym(_this, (KeyCode)i, 0); + SDL_Log("code = %d, sym = 0x%X (%s) ", i - min_keycode, + (unsigned int)sym, sym == NoSymbol ? "NoSymbol" : X11_XKeysymToString(sym)); } + if (scancode == SDL_SCANCODE_UNKNOWN) { + SDL_Log("scancode not found\n"); + } else { + SDL_Log("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode)); + } +#endif + data->key_layout[i] = scancode; } } From 2c1923859ab959f63981726cc60c30535815e4b9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 13 Oct 2022 22:50:57 -0700 Subject: [PATCH 161/459] Don't remove entries from an existing scancode keymap If we can't find the X11 keysym, it's likely that either the keysym is NoSymbol, in which case we won't hit it anyway, or it's been mapped to a character, in which case the existing mapping is correct for the scancode and the character will be reflected in the keycode mapping. --- src/video/x11/SDL_x11keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 1e46f5a4f..ffa575d55 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -655,7 +655,7 @@ X11_InitKeyboard(_THIS) if (scancode == data->key_layout[i]) { continue; } - if (scancode == SDL_SCANCODE_UNKNOWN || default_keymap[scancode] >= SDLK_SCANCODE_MASK) { + if (default_keymap[scancode] >= SDLK_SCANCODE_MASK) { /* Not a character key, safe to remap */ #ifdef DEBUG_KEYBOARD SDL_Log("Changing scancode, was %d (%s), now %d (%s)\n", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); From 139192140c8737b5b4abd1a08b9cf918a653e854 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 13 Oct 2022 23:23:55 -0700 Subject: [PATCH 162/459] Fixed reported cases of "Keyboard layout unknown" messages In all cases they were using SDL_SCANCODE_TABLE_XFREE86_2 with some keycodes remapped or fewer than expected keycodes. This adds a sanity check that catches all of them and gives them the right scancode table. --- src/video/x11/SDL_x11keyboard.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index ffa575d55..664c81661 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -605,10 +605,6 @@ X11_InitKeyboard(_THIS) int table_size; const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[i], &table_size); - /* Make sure the scancode set isn't too big */ - if (table_size > (max_keycode - min_keycode + 1)) { - continue; - } distance = 0; for (j = 0; j < SDL_arraysize(fingerprint); ++j) { if (fingerprint[j].value < 0 || fingerprint[j].value >= table_size) { @@ -622,6 +618,19 @@ X11_InitKeyboard(_THIS) best_index = i; } } + if (best_index < 0 || best_distance > 2) { + /* This is likely to be SDL_SCANCODE_TABLE_XFREE86_2 with remapped keys, double check a rarely remapped value */ + int fingerprint_value = X11_XKeysymToKeycode(data->display, 0x1008FF5B /* XF86Documents */) - min_keycode; + if (fingerprint_value == 235) { + for (i = 0; i < SDL_arraysize(scancode_set); ++i) { + if (scancode_set[i] == SDL_SCANCODE_TABLE_XFREE86_2) { + best_index = i; + best_distance = 0; + break; + } + } + } + } if (best_index >= 0 && best_distance <= 2) { SDL_Keycode default_keymap[SDL_NUM_SCANCODES]; int table_size; From 91ff88451bb01104eda608bca855f0d14cd2d7cf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 13 Oct 2022 23:56:17 -0700 Subject: [PATCH 163/459] Disable "The key you just pressed is not recognized by SDL." message by default --- src/video/cocoa/SDL_cocoakeyboard.m | 4 ++-- src/video/nacl/SDL_naclevents.c | 2 ++ src/video/riscos/SDL_riscosevents.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 02c99e8e7..e9f80a412 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -558,9 +558,9 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) } SDL_SendKeyboardKey(SDL_PRESSED, code); -#if 1 +#ifdef DEBUG_SCANCODES if (code == SDL_SCANCODE_UNKNOWN) { - fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { diff --git a/src/video/nacl/SDL_naclevents.c b/src/video/nacl/SDL_naclevents.c index f161e9c2e..dbfce081b 100644 --- a/src/video/nacl/SDL_naclevents.c +++ b/src/video/nacl/SDL_naclevents.c @@ -313,9 +313,11 @@ SDL_NACL_translate_keycode(int keycode) if (keycode < SDL_arraysize(NACL_Keycodes)) { scancode = NACL_Keycodes[keycode]; } +#ifdef DEBUG_SCANCODES if (scancode == SDL_SCANCODE_UNKNOWN) { SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list NACL KeyCode %d", keycode); } +#endif return scancode; } diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c index 56fe39882..fcca47011 100644 --- a/src/video/riscos/SDL_riscosevents.c +++ b/src/video/riscos/SDL_riscosevents.c @@ -40,9 +40,11 @@ SDL_RISCOS_translate_keycode(int keycode) if (keycode < SDL_arraysize(riscos_scancode_table)) { scancode = riscos_scancode_table[keycode]; +#ifdef DEBUG_SCANCODES if (scancode == SDL_SCANCODE_UNKNOWN) { SDL_Log("The key you just pressed is not recognized by SDL: %d", keycode); } +#endif } return scancode; From 6bb0c2a5c2513b38981a5751da56417a40f7620f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Oct 2022 06:33:38 -0700 Subject: [PATCH 164/459] Added documentation for some scancodes --- include/SDL_scancode.h | 42 ++++++++++++++++++------------------ src/events/scancodes_linux.h | 20 +++++++++++++++++ 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/include/SDL_scancode.h b/include/SDL_scancode.h index 6f40884ee..17e8fe2fd 100644 --- a/include/SDL_scancode.h +++ b/include/SDL_scancode.h @@ -225,16 +225,16 @@ typedef enum SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116, - SDL_SCANCODE_HELP = 117, - SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */ + SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */ SDL_SCANCODE_SELECT = 119, - SDL_SCANCODE_STOP = 120, - SDL_SCANCODE_AGAIN = 121, /**< redo */ - SDL_SCANCODE_UNDO = 122, - SDL_SCANCODE_CUT = 123, - SDL_SCANCODE_COPY = 124, - SDL_SCANCODE_PASTE = 125, - SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_STOP = 120, /**< AC Stop */ + SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */ + SDL_SCANCODE_UNDO = 122, /**< AC Undo */ + SDL_SCANCODE_CUT = 123, /**< AC Cut */ + SDL_SCANCODE_COPY = 124, /**< AC Copy */ + SDL_SCANCODE_PASTE = 125, /**< AC Paste */ + SDL_SCANCODE_FIND = 126, /**< AC Find */ SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128, SDL_SCANCODE_VOLUMEDOWN = 129, @@ -265,9 +265,9 @@ typedef enum SDL_SCANCODE_LANG8 = 151, /**< reserved */ SDL_SCANCODE_LANG9 = 152, /**< reserved */ - SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ SDL_SCANCODE_SYSREQ = 154, - SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */ SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158, @@ -359,17 +359,17 @@ typedef enum SDL_SCANCODE_AUDIOPLAY = 261, SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263, - SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */ SDL_SCANCODE_MAIL = 265, - SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */ SDL_SCANCODE_COMPUTER = 267, - SDL_SCANCODE_AC_SEARCH = 268, - SDL_SCANCODE_AC_HOME = 269, - SDL_SCANCODE_AC_BACK = 270, - SDL_SCANCODE_AC_FORWARD = 271, - SDL_SCANCODE_AC_STOP = 272, - SDL_SCANCODE_AC_REFRESH = 273, - SDL_SCANCODE_AC_BOOKMARKS = 274, + SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */ + SDL_SCANCODE_AC_HOME = 269, /**< AC Home */ + SDL_SCANCODE_AC_BACK = 270, /**< AC Back */ + SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */ + SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */ + SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */ + SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */ /* @} *//* Usage page 0x0C */ @@ -388,7 +388,7 @@ typedef enum SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, - SDL_SCANCODE_SLEEP = 282, + SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */ SDL_SCANCODE_APP1 = 283, SDL_SCANCODE_APP2 = 284, diff --git a/src/events/scancodes_linux.h b/src/events/scancodes_linux.h index 020f76ba9..325737746 100644 --- a/src/events/scancodes_linux.h +++ b/src/events/scancodes_linux.h @@ -825,6 +825,26 @@ fgrep SDL_SCANCODE scancodes_linux.h | while read line; do done #endif /* end script */ +#if 0 /* A shell script to get comments from the Linux header for these keys */ +#!/bin/bash + +function get_comment +{ + name=$(echo "$1" | awk '{print $7}') + if [ "$name" != "" ]; then + egrep "$name\s" /usr/include/linux/input-event-codes.h | fgrep "/*" | sed 's,[^/]*/,/,' + fi +} + +fgrep SDL_SCANCODE scancodes_linux.h | while read line; do + comment=$(get_comment "$line") + if [ "$comment" != "" ]; then + echo " $line $comment" + fi +done +#endif /* end script */ + + /* *INDENT-ON* */ /* clang-format on */ /* vi: set ts=4 sw=4 expandtab: */ From 120a957d07506f4cc2885c16b4407091915361fa Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Oct 2022 09:57:02 -0700 Subject: [PATCH 165/459] Added support for the Qanba Drone Arcade Stick --- src/joystick/SDL_joystick.c | 1 + src/joystick/controller_type.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index b22c8783a..2f6d9fb59 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1873,6 +1873,7 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c { "HORI CO.,LTD", "HORI" }, { "Mad Catz Inc.", "Mad Catz" }, { "QANBA USA, LLC", "Qanba" }, + { "QANBA USA,LLC", "Qanba" }, { "Unknown ", "" }, }; const char *custom_name; diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index 9d583b017..3f7c45586 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -79,8 +79,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // - { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone - { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone { MAKE_CONTROLLER_ID( 0x2c22, 0x2302 ), k_eControllerType_PS3Controller, NULL }, // Qanba Obsidian { MAKE_CONTROLLER_ID( 0x2c22, 0x2502 ), k_eControllerType_PS3Controller, NULL }, // Qanba Dragon { MAKE_CONTROLLER_ID( 0x8380, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // BTP 2163 @@ -128,6 +127,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition BT { MAKE_CONTROLLER_ID( 0x1532, 0x1100 ), k_eControllerType_PS4Controller, NULL }, // Razer RAION Fightpad - Trackpad, no gyro, lightbar hardcoded to green { MAKE_CONTROLLER_ID( 0x20d6, 0x792a ), k_eControllerType_PS4Controller, NULL }, // PowerA Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS4Controller, NULL }, // Qanba Drone { MAKE_CONTROLLER_ID( 0x2c22, 0x2300 ), k_eControllerType_PS4Controller, NULL }, // Qanba Obsidian { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XInputPS4Controller, NULL }, // Qanba Obsidian Arcade Joystick { MAKE_CONTROLLER_ID( 0x2c22, 0x2500 ), k_eControllerType_PS4Controller, NULL }, // Qanba Dragon From 93b7196763e3447a7f95a05d459ece7ad7738d04 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Oct 2022 10:32:03 -0700 Subject: [PATCH 166/459] Only update the battery level if we're on Bluetooth Fixes battery level dropping to empty with the Qanba Drone Arcade Stick. It looks like we might also be able to skip the check for all third party controllers, but I think this is the right thing to do for Sony controllers as well. --- src/joystick/hidapi/SDL_hidapi_ps4.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 7bccd5fa0..64c3054fc 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -919,19 +919,21 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, axis = ((int)packet->ucRightJoystickY * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); - if (packet->ucBatteryLevel & 0x10) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); - } else { - /* Battery level ranges from 0 to 10 */ - int level = (packet->ucBatteryLevel & 0xF); - if (level == 0) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); - } else if (level <= 2) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); - } else if (level <= 7) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + if (ctx->device->is_bluetooth) { + if (packet->ucBatteryLevel & 0x10) { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + /* Battery level ranges from 0 to 10 */ + int level = (packet->ucBatteryLevel & 0xF); + if (level == 0) { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); + } else if (level <= 2) { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); + } else if (level <= 7) { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + } else { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + } } } From 6af17369ca773155bd7f39b8801725c4a6d52e4f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Oct 2022 10:36:24 -0700 Subject: [PATCH 167/459] Added mapping for Qanba Drone on Linux without HIDAPI --- src/joystick/SDL_gamecontrollerdb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index b261dad5e..e89911317 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -755,6 +755,7 @@ static const char *s_ControllerMappings [] = "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", "03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00000020000011010000,Qanba Drone Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,", "03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", @@ -979,7 +980,7 @@ static const char *s_ControllerMappings [] = "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif #if SDL_JOYSTICK_N3DS - "000010324e696e74656e646f20334400,Nintendo 3DS,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", + "000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL From 5129a07707d6e0c1528cb6092859272e70b3d734 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Oct 2022 14:35:52 -0700 Subject: [PATCH 168/459] Steam Controller support defaults off, as documented in SDL_hints.h --- src/joystick/hidapi/SDL_hidapi_steam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c index d97d977d3..7b497fa95 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/src/joystick/hidapi/SDL_hidapi_steam.c @@ -1014,9 +1014,7 @@ HIDAPI_DriverSteam_UnregisterHints(SDL_HintCallback callback, void *userdata) static SDL_bool HIDAPI_DriverSteam_IsEnabled(void) { - return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAM, - SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, - SDL_HIDAPI_DEFAULT)); + return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAM, SDL_FALSE); } static SDL_bool From e89389ba0e6d498f6130eb1d7c84a350d0799669 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 14 Oct 2022 20:41:10 -0400 Subject: [PATCH 169/459] wayland: Use MAP_PRIVATE when mapping the keyboard keymap file descriptor Per the Wayland spec, this must be mapped with MAP_PRIVATE in version 7 of the protocol and higher. --- src/video/wayland/SDL_waylandevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 57914877d..99a0bc34f 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -922,7 +922,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } - map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + map_str = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); if (map_str == MAP_FAILED) { close(fd); return; From 620476865363e6dc5c0e7d126243a2427911043a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 13 Oct 2022 16:24:13 -0400 Subject: [PATCH 170/459] wayland: Don't block on libdecor_dispatch() libdecor_dispatch() needs to be called, as libdecor plugins might do some required internal processing within, however care must be taken to avoid double-blocking in the case of a timeout, which can occur if libdecor_dispatch() and the SDL event processing both work on the main Wayland queue. Additionally, assumptions that libdecor will always dispatch the main queue or not process zero-length queues (can occur if a wait is interrupted by the application queueing an event) should not be made, as this behavior is outside the control of SDL and can change. SDL handles polling for Wayland events and then calls libdecor to do its internal processing and dispatch. If libdecor operates on the main queue, it will dispatch the queued events and the additional wl_display_dispatch_pending() call will be a NOP. If a libdecor plugin uses its own, separate queue, then the wl_display_dispatch_pending() call will ensure that the main queue is always dispatched. --- src/video/wayland/SDL_waylandevents.c | 43 +++++++++++++++++++-------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 99a0bc34f..f74d0fa54 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -289,6 +289,25 @@ Wayland_SendWakeupEvent(_THIS, SDL_Window *window) WAYLAND_wl_display_flush(d->display); } +static int +dispatch_queued_events(SDL_VideoData *viddata) +{ + int ret; + + /* + * NOTE: When reconnection is implemented, check if libdecor needs to be + * involved in the reconnection process. + */ +#ifdef HAVE_LIBDECOR_H + if (viddata->shell.libdecor) { + libdecor_dispatch(viddata->shell.libdecor, 0); + } +#endif + + ret = WAYLAND_wl_display_dispatch_pending(viddata->display); + return ret >= 0 ? 1 : ret; +} + int Wayland_WaitEventTimeout(_THIS, int timeout) { @@ -321,12 +340,6 @@ Wayland_WaitEventTimeout(_THIS, int timeout) } } -#ifdef HAVE_LIBDECOR_H - if (d->shell.libdecor) { - libdecor_dispatch(d->shell.libdecor, timeout); - } -#endif - /* wl_display_prepare_read() will return -1 if the default queue is not empty. * If the default queue is empty, it will prepare us for our SDL_IOReady() call. */ if (WAYLAND_wl_display_prepare_read(d->display) == 0) { @@ -335,8 +348,7 @@ Wayland_WaitEventTimeout(_THIS, int timeout) if (err > 0) { /* There are new events available to read */ WAYLAND_wl_display_read_events(d->display); - WAYLAND_wl_display_dispatch_pending(d->display); - return 1; + return dispatch_queued_events(d); } else if (err == 0) { /* No events available within the timeout */ WAYLAND_wl_display_cancel_read(d->display); @@ -364,8 +376,7 @@ Wayland_WaitEventTimeout(_THIS, int timeout) } } else { /* We already had pending events */ - WAYLAND_wl_display_dispatch_pending(d->display); - return 1; + return dispatch_queued_events(d); } } @@ -376,14 +387,20 @@ Wayland_PumpEvents(_THIS) struct SDL_WaylandInput *input = d->input; int err; - WAYLAND_wl_display_flush(d->display); - #ifdef SDL_USE_IME if (d->text_input_manager == NULL && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_IME_PumpEvents(); } #endif +#ifdef HAVE_LIBDECOR_H + if (d->shell.libdecor) { + libdecor_dispatch(d->shell.libdecor, 0); + } +#endif + + WAYLAND_wl_display_flush(d->display); + /* wl_display_prepare_read() will return -1 if the default queue is not empty. * If the default queue is empty, it will prepare us for our SDL_IOReady() call. */ if (WAYLAND_wl_display_prepare_read(d->display) == 0) { @@ -402,7 +419,7 @@ Wayland_PumpEvents(_THIS) keyboard_repeat_handle(&input->keyboard_repeat, elapsed); } - if (err == -1 && !d->display_disconnected) { + if (err < 0 && !d->display_disconnected) { /* Something has failed with the Wayland connection -- for example, * the compositor may have shut down and closed its end of the socket, * or there is a library-specific error. No recovery is possible. */ From a6573f94abd0a74cefca600c770f525180a76534 Mon Sep 17 00:00:00 2001 From: happyharryh Date: Sun, 16 Oct 2022 00:23:25 +0800 Subject: [PATCH 171/459] Fix bugs in IMU calibration loading for Nintendo Controllers --- src/joystick/hidapi/SDL_hidapi_switch.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 1970a9d43..e4df02a41 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -821,13 +821,13 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) /* IMU scale gives us multipliers for converting raw values to real world values */ pIMUScale = reply->spiReadData.rgucReadData; - sAccelRawX = ((pIMUScale[1] << 8) & 0xF00) | pIMUScale[0]; - sAccelRawY = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; - sAccelRawZ = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; + sAccelRawX = ((pIMUScale[1] << 8) & 0xFF00) | pIMUScale[0]; + sAccelRawY = ((pIMUScale[3] << 8) & 0xFF00) | pIMUScale[2]; + sAccelRawZ = ((pIMUScale[5] << 8) & 0xFF00) | pIMUScale[4]; - sGyroRawX = ((pIMUScale[13] << 8) & 0xF00) | pIMUScale[12]; - sGyroRawY = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; - sGyroRawZ = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; + sGyroRawX = ((pIMUScale[13] << 8) & 0xFF00) | pIMUScale[12]; + sGyroRawY = ((pIMUScale[15] << 8) & 0xFF00) | pIMUScale[14]; + sGyroRawZ = ((pIMUScale[17] << 8) & 0xFF00) | pIMUScale[16]; /* Check for user calibration data. If it's present and set, it'll override the factory settings */ readParams.unAddress = k_unSPIIMUUserScaleStartOffset; @@ -835,13 +835,13 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply) && (pIMUScale[0] | pIMUScale[1] << 8) == 0xA1B2) { pIMUScale = reply->spiReadData.rgucReadData; - sAccelRawX = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; - sAccelRawY = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; - sAccelRawZ = ((pIMUScale[7] << 8) & 0xF00) | pIMUScale[6]; + sAccelRawX = ((pIMUScale[3] << 8) & 0xFF00) | pIMUScale[2]; + sAccelRawY = ((pIMUScale[5] << 8) & 0xFF00) | pIMUScale[4]; + sAccelRawZ = ((pIMUScale[7] << 8) & 0xFF00) | pIMUScale[6]; - sGyroRawX = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; - sGyroRawY = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; - sGyroRawZ = ((pIMUScale[19] << 8) & 0xF00) | pIMUScale[18]; + sGyroRawX = ((pIMUScale[15] << 8) & 0xFF00) | pIMUScale[14]; + sGyroRawY = ((pIMUScale[17] << 8) & 0xFF00) | pIMUScale[16]; + sGyroRawZ = ((pIMUScale[19] << 8) & 0xFF00) | pIMUScale[18]; } /* Accelerometer scale */ From e8fdb861ef39a35094f07ad4b81245f5933bd7a7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 15 Oct 2022 10:02:39 -0700 Subject: [PATCH 172/459] Removed redundant masking when loading the IMU calibration --- src/joystick/hidapi/SDL_hidapi_switch.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index e4df02a41..901761fac 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -821,13 +821,13 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) /* IMU scale gives us multipliers for converting raw values to real world values */ pIMUScale = reply->spiReadData.rgucReadData; - sAccelRawX = ((pIMUScale[1] << 8) & 0xFF00) | pIMUScale[0]; - sAccelRawY = ((pIMUScale[3] << 8) & 0xFF00) | pIMUScale[2]; - sAccelRawZ = ((pIMUScale[5] << 8) & 0xFF00) | pIMUScale[4]; + sAccelRawX = (pIMUScale[1] << 8) | pIMUScale[0]; + sAccelRawY = (pIMUScale[3] << 8) | pIMUScale[2]; + sAccelRawZ = (pIMUScale[5] << 8) | pIMUScale[4]; - sGyroRawX = ((pIMUScale[13] << 8) & 0xFF00) | pIMUScale[12]; - sGyroRawY = ((pIMUScale[15] << 8) & 0xFF00) | pIMUScale[14]; - sGyroRawZ = ((pIMUScale[17] << 8) & 0xFF00) | pIMUScale[16]; + sGyroRawX = (pIMUScale[13] << 8) | pIMUScale[12]; + sGyroRawY = (pIMUScale[15] << 8) | pIMUScale[14]; + sGyroRawZ = (pIMUScale[17] << 8) | pIMUScale[16]; /* Check for user calibration data. If it's present and set, it'll override the factory settings */ readParams.unAddress = k_unSPIIMUUserScaleStartOffset; @@ -835,13 +835,13 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply) && (pIMUScale[0] | pIMUScale[1] << 8) == 0xA1B2) { pIMUScale = reply->spiReadData.rgucReadData; - sAccelRawX = ((pIMUScale[3] << 8) & 0xFF00) | pIMUScale[2]; - sAccelRawY = ((pIMUScale[5] << 8) & 0xFF00) | pIMUScale[4]; - sAccelRawZ = ((pIMUScale[7] << 8) & 0xFF00) | pIMUScale[6]; + sAccelRawX = (pIMUScale[3] << 8) | pIMUScale[2]; + sAccelRawY = (pIMUScale[5] << 8) | pIMUScale[4]; + sAccelRawZ = (pIMUScale[7] << 8) | pIMUScale[6]; - sGyroRawX = ((pIMUScale[15] << 8) & 0xFF00) | pIMUScale[14]; - sGyroRawY = ((pIMUScale[17] << 8) & 0xFF00) | pIMUScale[16]; - sGyroRawZ = ((pIMUScale[19] << 8) & 0xFF00) | pIMUScale[18]; + sGyroRawX = (pIMUScale[15] << 8) | pIMUScale[14]; + sGyroRawY = (pIMUScale[17] << 8) | pIMUScale[16]; + sGyroRawZ = (pIMUScale[19] << 8) | pIMUScale[18]; } /* Accelerometer scale */ From 22461383c69f750cd1f66769f88c9893d5466368 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 15 Oct 2022 15:54:12 -0500 Subject: [PATCH 173/459] SDL_audiocvt: Respct the SDL_HINT_AUDIO_RESAMPLING_MODE hint This implements using libsamplerate for the SDL_AudioCVT API. This library was already being used for audio streams when this hint is set. --- include/SDL_hints.h | 5 +-- src/audio/SDL_audio.c | 5 ++- src/audio/SDL_audio_c.h | 1 + src/audio/SDL_audiocvt.c | 69 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 4d445b35c..600989e58 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -278,10 +278,7 @@ extern "C" { * If this hint isn't specified to a valid setting, or libsamplerate isn't * available, SDL will use the default, internal resampling algorithm. * - * Note that this is currently only applicable to resampling audio that is - * being written to a device for playback or audio being read from a device - * for capture. SDL_AudioCVT always uses the default resampler (although this - * might change for SDL 2.1). + * As of SDL 2.26, SDL_AudioCVT now respects this hint. * * This hint is currently only checked at audio subsystem initialization. * diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 11700d497..088887822 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -144,6 +144,7 @@ int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL; int (*SRC_src_reset)(SRC_STATE *state) = NULL; SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL; const char* (*SRC_src_strerror)(int error) = NULL; +int (*SRC_src_simple)(SRC_DATA *data, int converter_type, int channels) = NULL; static SDL_bool LoadLibSampleRate(void) @@ -178,8 +179,9 @@ LoadLibSampleRate(void) SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset"); SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete"); SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror"); + SRC_src_simple = (int(*)(SRC_DATA *data, int converter_type, int channels))SDL_LoadFunction(SRC_lib, "src_simple"); - if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) { + if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror || !SRC_src_simple) { SDL_UnloadObject(SRC_lib); SRC_lib = NULL; return SDL_FALSE; @@ -190,6 +192,7 @@ LoadLibSampleRate(void) SRC_src_reset = src_reset; SRC_src_delete = src_delete; SRC_src_strerror = src_strerror; + SRC_src_simple = src_simple; #endif SRC_available = SDL_TRUE; diff --git a/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h index a516c554a..a976dfd09 100644 --- a/src/audio/SDL_audio_c.h +++ b/src/audio/SDL_audio_c.h @@ -45,6 +45,7 @@ extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data); extern int (*SRC_src_reset)(SRC_STATE *state); extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state); extern const char* (*SRC_src_strerror)(int error); +extern int (*SRC_src_simple)(SRC_DATA *data, int converter_type, int channels); #endif /* Functions to get a list of "close" audio formats */ diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 85faa4b0b..e79437e91 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -418,6 +418,48 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) return retval; } +#ifdef HAVE_LIBSAMPLERATE_H + +static void +SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + const int srclen = cvt->len_cvt; + float *dst = (float *) (cvt->buf + srclen); + const int dstlen = (cvt->len * cvt->len_mult) - srclen; + const int framelen = sizeof(float) * chans; + int result = 0; + SRC_DATA data; + + SDL_zero(data); + + data.data_in = (float *)src; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */ + data.input_frames = srclen / framelen; + + data.data_out = dst; + data.output_frames = dstlen / framelen; + + data.src_ratio = cvt->rate_incr; + + result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */ + /* !!! FIXME: Handle library failures? */ + #ifdef DEBUG_CONVERT + if (result != 0) { + SDL_Log("src_simple() failed: %s", SRC_src_strerror(result)); + } + #endif + + cvt->len_cvt = data.output_frames_gen * framelen; + + SDL_memmove(cvt->buf, dst, cvt->len_cvt); + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +#endif /* HAVE_LIBSAMPLERATE_H */ + static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) { @@ -478,9 +520,36 @@ RESAMPLER_FUNCS(6) RESAMPLER_FUNCS(8) #undef RESAMPLER_FUNCS +#ifdef HAVE_LIBSAMPLERATE_H +#define RESAMPLER_FUNCS(chans) \ + static void SDLCALL \ + SDL_ResampleCVT_SRC_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \ + SDL_ResampleCVT_SRC(cvt, chans, format); \ + } +RESAMPLER_FUNCS(1) +RESAMPLER_FUNCS(2) +RESAMPLER_FUNCS(4) +RESAMPLER_FUNCS(6) +RESAMPLER_FUNCS(8) +#undef RESAMPLER_FUNCS +#endif /* HAVE_LIBSAMPLERATE_H */ + static SDL_AudioFilter ChooseCVTResampler(const int dst_channels) { + #ifdef HAVE_LIBSAMPLERATE_H + if (SRC_available) { + switch (dst_channels) { + case 1: return SDL_ResampleCVT_SRC_c1; + case 2: return SDL_ResampleCVT_SRC_c2; + case 4: return SDL_ResampleCVT_SRC_c4; + case 6: return SDL_ResampleCVT_SRC_c6; + case 8: return SDL_ResampleCVT_SRC_c8; + default: break; + } + } + #endif /* HAVE_LIBSAMPLERATE_H */ + switch (dst_channels) { case 1: return SDL_ResampleCVT_c1; case 2: return SDL_ResampleCVT_c2; From ed412c138520e515adb161fa37932bc54fca4768 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 15 Oct 2022 14:05:35 -0400 Subject: [PATCH 174/459] wayland: Cleanup event source comments, headers, and error reporting Replace instances of fprintf(stderr, ...) with SDL_SetError(), replace C++ comments with C style, use a uniform format for multi-line comments, and remove unused headers as poll and select aren't used in this file (the SDL function which calls them is used instead). --- src/video/wayland/SDL_waylandevents.c | 86 ++++++++++++++------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index f74d0fa54..fe7082417 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -57,9 +57,7 @@ #define BTN_SIDE (0x113) #define BTN_EXTRA (0x114) #endif -#include #include -#include #include #include #include @@ -844,11 +842,11 @@ static const struct wl_pointer_listener pointer_listener = { pointer_handle_motion, pointer_handle_button, pointer_handle_axis, - pointer_handle_frame, // Version 5 - pointer_handle_axis_source, // Version 5 - pointer_handle_axis_stop, // Version 5 - pointer_handle_axis_discrete, // Version 5 - pointer_handle_axis_value120 // Version 8 + pointer_handle_frame, /* Version 5 */ + pointer_handle_axis_source, /* Version 5 */ + pointer_handle_axis_stop, /* Version 5 */ + pointer_handle_axis_discrete, /* Version 5 */ + pointer_handle_axis_value120 /* Version 8 */ }; static void @@ -953,7 +951,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, close(fd); if (!input->xkb.keymap) { - fprintf(stderr, "failed to compile keymap\n"); + SDL_SetError("failed to compile keymap\n"); return; } @@ -969,7 +967,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { - fprintf(stderr, "failed to create XKB state\n"); + SDL_SetError("failed to create XKB state\n"); WAYLAND_xkb_keymap_unref(input->xkb.keymap); input->xkb.keymap = NULL; return; @@ -997,7 +995,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table, XKB_COMPOSE_STATE_NO_FLAGS); if (!input->xkb.compose_state) { - fprintf(stderr, "could not create XKB compose state\n"); + SDL_SetError("could not create XKB compose state\n"); WAYLAND_xkb_compose_table_unref(input->xkb.compose_table); input->xkb.compose_table = NULL; } @@ -1075,7 +1073,7 @@ keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint return SDL_FALSE; } - // TODO can this happen? + /* TODO: Can this happen? */ if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1) { return SDL_FALSE; } @@ -1132,10 +1130,11 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, has_text = keyboard_input_get_text(text, input, key, SDL_PRESSED, &handled_by_ime); } else { if (keyboard_repeat_key_is_set(&input->keyboard_repeat, key)) { - // Send any due key repeat events before stopping the repeat and generating the key up event - // Compute time based on the Wayland time, as it reports when the release event happened - // Using SDL_GetTicks would be wrong, as it would report when the release event is processed, - // which may be off if the application hasn't pumped events for a while + /* Send any due key repeat events before stopping the repeat and generating the key up event. + * Compute time based on the Wayland time, as it reports when the release event happened. + * Using SDL_GetTicks would be wrong, as it would report when the release event is processed, + * which may be off if the application hasn't pumped events for a while. + */ keyboard_repeat_handle(&input->keyboard_repeat, time - input->keyboard_repeat.wl_press_time); keyboard_repeat_clear(&input->keyboard_repeat); } @@ -1276,7 +1275,7 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_leave, keyboard_handle_key, keyboard_handle_modifiers, - keyboard_handle_repeat_info, // Version 4 + keyboard_handle_repeat_info, /* Version 4 */ }; static void @@ -1329,7 +1328,7 @@ seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, - seat_handle_name, // Version 2 + seat_handle_name, /* Version 2 */ }; static void @@ -1371,9 +1370,9 @@ static const struct wl_data_source_listener data_source_listener = { data_source_handle_target, data_source_handle_send, data_source_handle_cancelled, - data_source_handle_dnd_drop_performed, // Version 3 - data_source_handle_dnd_finished, // Version 3 - data_source_handle_action, // Version 3 + data_source_handle_dnd_drop_performed, /* Version 3 */ + data_source_handle_dnd_finished, /* Version 3 */ + data_source_handle_action, /* Version 3 */ }; static void @@ -1488,8 +1487,8 @@ data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer, static const struct wl_data_offer_listener data_offer_listener = { data_offer_handle_offer, - data_offer_handle_source_actions, // Version 3 - data_offer_handle_actions, // Version 3 + data_offer_handle_source_actions, /* Version 3 */ + data_offer_handle_actions, /* Version 3 */ }; static void @@ -1574,19 +1573,19 @@ data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, } /* Decodes URI escape sequences in string buf of len bytes - (excluding the terminating NULL byte) in-place. Since - URI-encoded characters take three times the space of - normal characters, this should not be an issue. - - Returns the number of decoded bytes that wound up in - the buffer, excluding the terminating NULL byte. - - The buffer is guaranteed to be NULL-terminated but - may contain embedded NULL bytes. - - On error, -1 is returned. - - FIXME: This was shamelessly copied from SDL_x11events.c + * (excluding the terminating NULL byte) in-place. Since + * URI-encoded characters take three times the space of + * normal characters, this should not be an issue. + * + * Returns the number of decoded bytes that wound up in + * the buffer, excluding the terminating NULL byte. + * + * The buffer is guaranteed to be NULL-terminated but + * may contain embedded NULL bytes. + * + * On error, -1 is returned. + * + * FIXME: This was shamelessly copied from SDL_x11events.c */ static int Wayland_URIDecode(char *buf, int len) { int ri, wi, di; @@ -1649,10 +1648,10 @@ static int Wayland_URIDecode(char *buf, int len) { } /* Convert URI to local filename - return filename if possible, else NULL - - FIXME: This was shamelessly copied from SDL_x11events.c -*/ + * return filename if possible, else NULL + * + * FIXME: This was shamelessly copied from SDL_x11events.c + */ static char* Wayland_URIToLocal(char* uri) { char *file = NULL; SDL_bool local; @@ -2582,7 +2581,8 @@ int Wayland_input_lock_pointer(struct SDL_WaylandInput *input) return -1; /* If we have a pointer confine active, we must destroy it here because - * creating a locked pointer otherwise would be a protocol error. */ + * creating a locked pointer otherwise would be a protocol error. + */ for (window = vd->windows; window; window = window->next) pointer_confine_destroy(window); @@ -2661,11 +2661,13 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi return -1; /* A confine may already be active, in which case we should destroy it and - * create a new one. */ + * create a new one. + */ pointer_confine_destroy(window); /* We cannot create a confine if the pointer is already locked. Defer until - * the pointer is unlocked. */ + * the pointer is unlocked. + */ if (d->relative_mouse_mode) return 0; From 70dfd6dd1a89f753c47bf5db06fa843a60af5169 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 16 Oct 2022 09:05:13 -0700 Subject: [PATCH 175/459] Added mapping for Xbox Series X controller Fixes https://github.com/libsdl-org/SDL/issues/6296 --- src/joystick/SDL_gamecontrollerdb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index e89911317..dd122703a 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -843,6 +843,7 @@ static const char *s_ControllerMappings [] = "030000005e040000ea02000001030000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "050000005e040000130b000007050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "050000005e040000130b000011050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,", From 485bb3565b6da24620e4eedde837fbfbc5cee6d2 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 17 Oct 2022 13:30:30 +0200 Subject: [PATCH 176/459] Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect --- src/render/SDL_render.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index aaf2e85b2..7f04f3649 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -572,10 +572,10 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou *ptr_indices++ = cur_indice + 0; *ptr_indices++ = cur_indice + 1; - *ptr_indices++ = cur_indice + 2; - *ptr_indices++ = cur_indice + 0; - *ptr_indices++ = cur_indice + 2; *ptr_indices++ = cur_indice + 3; + *ptr_indices++ = cur_indice + 1; + *ptr_indices++ = cur_indice + 3; + *ptr_indices++ = cur_indice + 2; cur_indice += 4; } @@ -3523,7 +3523,7 @@ SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 2, 0, 2, 3}; + const int indices[6] = {0, 1, 3, 1, 3, 2}; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; @@ -3671,7 +3671,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 2, 0, 2, 3}; + const int indices[6] = {0, 1, 3, 1, 3, 2}; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; From f4e3af15a1f6ebc80db3948866d28c8bb6ef6433 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Mon, 17 Oct 2022 07:23:40 -0400 Subject: [PATCH 177/459] Simplify OSS test by removing OpenBSD specific location of the soundcard.h header OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header. --- cmake/sdlchecks.cmake | 12 ++---------- configure | 34 +--------------------------------- configure.ac | 16 +--------------- include/SDL_config.h.cmake | 1 - include/SDL_config.h.in | 1 - src/audio/dsp/SDL_dspaudio.c | 6 ------ test/configure | 1 - 7 files changed, 4 insertions(+), 67 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 316453020..c1100fdc9 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -59,21 +59,13 @@ macro(CheckOSS) check_c_source_compiles(" #include int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SYS_SOUNDCARD_H) - if(NOT HAVE_OSS_SYS_SOUNDCARD_H) - check_c_source_compiles(" - #include - int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SOUNDCARD_H) - endif() - if(HAVE_OSS_SYS_SOUNDCARD_H OR HAVE_OSS_SOUNDCARD_H) + if(HAVE_OSS_SYS_SOUNDCARD_H) set(HAVE_OSS TRUE) file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c) - if(HAVE_OSS_SOUNDCARD_H) - set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) - endif() set(SDL_AUDIO_DRIVER_OSS 1) list(APPEND SOURCE_FILES ${OSS_SOURCES}) - if(NETBSD OR OPENBSD) + if(NETBSD) list(APPEND EXTRA_LIBS ossaudio) endif() set(HAVE_SDL_AUDIO TRUE) diff --git a/configure b/configure index 8e139dd08..b686dd0aa 100755 --- a/configure +++ b/configure @@ -21007,10 +21007,6 @@ fi # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes - case "$host" in - *-*-openbsd*) - enable_oss=no;; - esac fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then @@ -21036,33 +21032,6 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : have_oss=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - if test x$have_oss != xyes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main (void) -{ - - int arg = SNDCTL_DSP_SETFRAGMENT; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - - have_oss=yes - -printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h - - fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi @@ -21078,7 +21047,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h # We may need to link with ossaudio emulation library case "$host" in - *-*-openbsd*|*-*-netbsd*) + *-*-netbsd*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; esac fi @@ -32564,4 +32533,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/configure.ac b/configure.ac index 2708c1f76..612602fb7 100644 --- a/configure.ac +++ b/configure.ac @@ -933,10 +933,6 @@ CheckOSS() # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes - case "$host" in - *-*-openbsd*) - enable_oss=no;; - esac fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then @@ -949,16 +945,6 @@ CheckOSS() int arg = SNDCTL_DSP_SETFRAGMENT; ]])], [have_oss=yes],[]) fi - if test x$have_oss != xyes; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - int arg = SNDCTL_DSP_SETFRAGMENT; - ]])], [ - have_oss=yes - AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ]) - ],[]) - fi AC_MSG_RESULT($have_oss) if test x$have_oss = xyes; then SUMMARY_audio="${SUMMARY_audio} oss" @@ -968,7 +954,7 @@ CheckOSS() # We may need to link with ossaudio emulation library case "$host" in - *-*-openbsd*|*-*-netbsd*) + *-*-netbsd*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; esac fi diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 6daeadfa0..c9ee9df99 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -309,7 +309,6 @@ #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ -#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE @SDL_AUDIO_DRIVER_PIPEWIRE@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 56b53029a..f6f2171fa 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -297,7 +297,6 @@ #undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OPENSLES #undef SDL_AUDIO_DRIVER_OSS -#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_PAUDIO #undef SDL_AUDIO_DRIVER_PIPEWIRE #undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 531612a29..8734f7960 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -34,13 +34,7 @@ #include #include -#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H -/* This is installed on some systems */ -#include -#else -/* This is recommended by OSS */ #include -#endif #include "SDL_timer.h" #include "SDL_audio.h" diff --git a/test/configure b/test/configure index c71abe489..f627d92de 100755 --- a/test/configure +++ b/test/configure @@ -6103,4 +6103,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - From 5025f2403393d70ee54d83cc583287b4c4f74e84 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 17 Oct 2022 07:32:44 -0700 Subject: [PATCH 178/459] Don't use RAWINPUT joystick driver on Windows XP Fixes https://github.com/libsdl-org/SDL/issues/6400 --- src/joystick/windows/SDL_rawinputjoystick.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 26d753cff..120a361f1 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -855,6 +855,11 @@ RAWINPUT_JoystickInit(void) SDL_assert(!SDL_RAWINPUT_inited); + if (!WIN_IsWindowsVistaOrGreater()) { + /* According to bug 6400, this doesn't work on Windows XP */ + return -1; + } + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_TRUE)) { return -1; } From 47ba997f06e4eb0c291c0bbe6d9672d1436a1f88 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 17 Oct 2022 07:39:52 -0700 Subject: [PATCH 179/459] Disable the RAWINPUT joystick driver by default It's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing, and we regularly get bugs from people who aren't using an SDL window who need to turn on SDL_HINT_JOYSTICK_THREAD. --- WhatsNew.txt | 3 +++ include/SDL_hints.h | 6 ++++-- src/joystick/windows/SDL_rawinputjoystick.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/WhatsNew.txt b/WhatsNew.txt index 0318b90de..fe7a334b7 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -10,6 +10,9 @@ General: * Added support for Nintendo Wii controllers to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_WII to control whether this is used * Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers +Windows: +* The RAWINPUT joystick driver is disabled by default, since it's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing. + --------------------------------------------------------------------------- 2.24.0: diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 600989e58..37948954d 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -938,9 +938,11 @@ extern "C" { /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * + * Enabling this hint allows for more than 4 Xbox controllers on Windows, but adds significant complexity to the joystick processing. If you enable this hint and do not use an SDL window in your application, you may need to set the hint SDL_HINT_JOYSTICK_THREAD to "1" to handle joystick input messages. + * * This variable can be set to the following values: - * "0" - RAWINPUT drivers are not used - * "1" - RAWINPUT drivers are used (the default) + * "0" - RAWINPUT drivers are not used (the default) + * "1" - RAWINPUT drivers are used */ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 120a361f1..734921cce 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -860,7 +860,7 @@ RAWINPUT_JoystickInit(void) return -1; } - if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_TRUE)) { + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_FALSE)) { return -1; } From 333935ff3f8fa71193076e72da2cbcd6e56adcd9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 17 Oct 2022 11:10:53 -0700 Subject: [PATCH 180/459] Make sure we completely unlock joysticks when opening HIDAPI devices Also lock the joysticks when adding and removing Android joysticks --- src/joystick/SDL_joystick.c | 8 ++++- src/joystick/SDL_joystick_c.h | 3 ++ src/joystick/android/SDL_sysjoystick.c | 38 +++++++++++++++++------- src/joystick/hidapi/SDL_hidapijoystick.c | 14 ++++++--- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 2f6d9fb59..cc29a72d8 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -168,10 +168,16 @@ SDL_UnlockJoysticks(void) } } +SDL_bool +SDL_JoysticksLocked(void) +{ + return (SDL_joysticks_locked > 0) ? SDL_TRUE : SDL_FALSE; +} + void SDL_AssertJoysticksLocked(void) { - SDL_assert(SDL_joysticks_locked > 0); + SDL_assert(SDL_JoysticksLocked()); } /* diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index 7ed3e6318..3ded9763e 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/src/joystick/SDL_joystick_c.h @@ -45,6 +45,9 @@ extern SDL_bool SDL_JoysticksInitialized(void); /* Return whether the joystick system is shutting down */ extern SDL_bool SDL_JoysticksQuitting(void); +/* Return whether the joysticks are currently locked */ +extern SDL_bool SDL_JoysticksLocked(void); + /* Make sure we currently have the joysticks locked */ extern void SDL_AssertJoysticksLocked(void); diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 558d0d7fd..a1c8b8898 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -317,23 +317,25 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo SDL_JoystickGUID guid; int i; int axis_mask; + int result = -1; + SDL_LockJoysticks(); if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ if (naxes < 2 && nhats < 1) { - return -1; + goto done; } } - + if (JoystickByDeviceId(device_id) != NULL || name == NULL) { - return -1; + goto done; } #ifdef SDL_JOYSTICK_HIDAPI if (HIDAPI_IsDevicePresent(vendor_id, product_id, 0, name)) { /* The HIDAPI driver is taking care of this device */ - return -1; + goto done; } #endif @@ -377,7 +379,7 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item)); if (item == NULL) { - return -1; + goto done; } SDL_zerop(item); @@ -385,8 +387,8 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo item->device_id = device_id; item->name = SDL_CreateJoystickName(vendor_id, product_id, NULL, name); if (item->name == NULL) { - SDL_free(item); - return -1; + SDL_free(item); + goto done; } item->is_accelerometer = is_accelerometer; @@ -415,11 +417,16 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo SDL_PrivateJoystickAdded(item->device_instance); + result = numjoysticks; + #ifdef DEBUG_JOYSTICK SDL_Log("Added joystick %s with device_id %d", item->name, device_id); #endif - return numjoysticks; +done: + SDL_UnlockJoysticks(); + + return result; } int @@ -427,7 +434,10 @@ Android_RemoveJoystick(int device_id) { SDL_joylist_item *item = SDL_joylist; SDL_joylist_item *prev = NULL; + int result = -1; + SDL_LockJoysticks(); + /* Don't call JoystickByDeviceId here or there'll be an infinite loop! */ while (item != NULL) { if (item->device_id == device_id) { @@ -438,7 +448,7 @@ Android_RemoveJoystick(int device_id) } if (item == NULL) { - return -1; + goto done; } if (item->joystick) { @@ -460,13 +470,19 @@ Android_RemoveJoystick(int device_id) SDL_PrivateJoystickRemoved(item->device_instance); + result = numjoysticks; + #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with device_id %d", device_id); #endif - + SDL_free(item->name); SDL_free(item); - return numjoysticks; + +done: + SDL_UnlockJoysticks(); + + return result; } diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 8cf9596bb..37bed785a 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -368,15 +368,21 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) * * See https://github.com/libsdl-org/SDL/issues/6347 for details */ + int lock_count = 0; SDL_HIDAPI_Device *curr; SDL_hid_device *dev; - char *path; + char *path = SDL_strdup(device->path); SDL_AssertJoysticksLocked(); - path = SDL_strdup(device->path); - SDL_UnlockJoysticks(); + while (SDL_JoysticksLocked()) { + ++lock_count; + SDL_UnlockJoysticks(); + } dev = SDL_hid_open_path(path, 0); - SDL_LockJoysticks(); + while (lock_count > 0) { + --lock_count; + SDL_LockJoysticks(); + } SDL_free(path); /* Make sure the device didn't get removed while opening the HID path */ From 3903f4c88ac4abfa5720ed0f329e5281643612de Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Mon, 17 Oct 2022 21:59:38 +0200 Subject: [PATCH 181/459] PSP: Use vramalloc instead of conflicting valloc function The libpspvram library was offering a function with conflicted with valloc. This has been renamed now, so SDL2 had to be updated for it. --- src/render/psp/SDL_render_psp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 3e176463d..84dc47237 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -422,7 +422,7 @@ static int TexturePromoteToVram(PSP_RenderData* data, PSP_TextureData* psp_texture, SDL_bool target) { // Assumes texture in sram and a large enough continuous block in vram - void* tdata = valloc(psp_texture->size); + void* tdata = vramalloc(psp_texture->size); if(psp_texture->swizzled && target) { return TextureUnswizzle(psp_texture, tdata); } else { @@ -536,7 +536,7 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_free(psp_texture); return -1; } - psp_texture->data = valloc(psp_texture->size); + psp_texture->data = vramalloc(psp_texture->size); if(psp_texture->data) { LRUTargetPushFront(data, psp_texture); } @@ -1399,7 +1399,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags) break; } - doublebuffer = valloc(PSP_FRAME_BUFFER_SIZE*data->bpp*2); + doublebuffer = vramalloc(PSP_FRAME_BUFFER_SIZE*data->bpp*2); data->backbuffer = doublebuffer; data->frontbuffer = ((uint8_t*)doublebuffer)+PSP_FRAME_BUFFER_SIZE*data->bpp; From 7c7cd2a605a0ad84184d323d6f10d79255aac3a9 Mon Sep 17 00:00:00 2001 From: David Jacewicz Date: Mon, 17 Oct 2022 14:04:29 -0400 Subject: [PATCH 182/459] Fix issue #6037 (incorrect modifier flags on Wayland) --- src/video/wayland/SDL_waylandevents.c | 45 +++++++++++++++---------- src/video/wayland/SDL_waylandevents_c.h | 8 ----- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index fe7082417..65e829c10 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -955,16 +955,6 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } - #define GET_MOD_INDEX(mod) \ - WAYLAND_xkb_keymap_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_##mod) - input->xkb.idx_shift = 1 << GET_MOD_INDEX(SHIFT); - input->xkb.idx_ctrl = 1 << GET_MOD_INDEX(CTRL); - input->xkb.idx_alt = 1 << GET_MOD_INDEX(ALT); - input->xkb.idx_gui = 1 << GET_MOD_INDEX(LOGO); - input->xkb.idx_num = 1 << GET_MOD_INDEX(NUM); - input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); - #undef GET_MOD_INDEX - input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { SDL_SetError("failed to create XKB state\n"); @@ -1002,13 +992,30 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, } } + static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { + // Caps Lock not included because it only makes sense to consider modifiers + // that get held down, for the case where a user clicks on an unfocused + // window with a modifier key like Shift pressed, in a situation where the + // application handles Shift+click differently from a click + const SDL_Scancode mod_scancodes[] = { + SDL_SCANCODE_LSHIFT, + SDL_SCANCODE_RSHIFT, + SDL_SCANCODE_LCTRL, + SDL_SCANCODE_RCTRL, + SDL_SCANCODE_LALT, + SDL_SCANCODE_RALT, + SDL_SCANCODE_LGUI, + SDL_SCANCODE_RGUI, + }; struct SDL_WaylandInput *input = data; SDL_WindowData *window; + uint32_t *key; + SDL_Scancode scancode; if (!surface) { /* enter event for a window we've just destroyed */ @@ -1031,6 +1038,16 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, SDL_IME_SetFocus(SDL_TRUE); } #endif + + wl_array_for_each(key, keys) { + scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, *key); + for (uint32_t i = 0; i < sizeof mod_scancodes / sizeof *mod_scancodes; ++i) { + if (mod_scancodes[i] == scancode) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + break; + } + } + } } static void @@ -1223,18 +1240,10 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, { struct SDL_WaylandInput *input = data; Wayland_Keymap keymap; - uint32_t modstate = (mods_depressed | mods_latched | mods_locked); WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); - SDL_ToggleModState(KMOD_SHIFT, modstate & input->xkb.idx_shift); - SDL_ToggleModState(KMOD_CTRL, modstate & input->xkb.idx_ctrl); - SDL_ToggleModState(KMOD_ALT, modstate & input->xkb.idx_alt); - SDL_ToggleModState(KMOD_GUI, modstate & input->xkb.idx_gui); - SDL_ToggleModState(KMOD_NUM, modstate & input->xkb.idx_num); - SDL_ToggleModState(KMOD_CAPS, modstate & input->xkb.idx_caps); - /* If a key is repeating, update the text to apply the modifier. */ if(keyboard_repeat_is_set(&input->keyboard_repeat)) { char text[8]; diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index 7554a9e88..f1f472633 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -110,14 +110,6 @@ struct SDL_WaylandInput { /* Keyboard layout "group" */ uint32_t current_group; - - /* Modifier bitshift values */ - uint32_t idx_shift; - uint32_t idx_ctrl; - uint32_t idx_alt; - uint32_t idx_gui; - uint32_t idx_num; - uint32_t idx_caps; } xkb; /* information about axis events on current frame */ From cdf312c83d741922ca178b029d11d6176743e3ba Mon Sep 17 00:00:00 2001 From: Deve Date: Tue, 18 Oct 2022 00:48:55 +0200 Subject: [PATCH 183/459] Fixed mouse warp after resizing window on macOS. --- src/video/cocoa/SDL_cocoawindow.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index fa0096857..c79cdc845 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -790,6 +790,11 @@ Cocoa_UpdateClipCursor(SDL_Window * window) return; } + if (focusClickPending) { + focusClickPending = 0; + [self onMovingOrFocusClickPendingStateCleared]; + } + window = _data.window; nswindow = _data.nswindow; rect = [nswindow contentRectForFrameRect:[nswindow frame]]; From 7e1088167a7cf47ca920667743e84cacb82af481 Mon Sep 17 00:00:00 2001 From: Deve Date: Tue, 18 Oct 2022 01:07:54 +0200 Subject: [PATCH 184/459] Fixed command modifier on macOS --- src/video/cocoa/SDL_cocoakeyboard.m | 239 +++++----------------------- 1 file changed, 39 insertions(+), 200 deletions(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index e9f80a412..863e96087 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -177,209 +177,49 @@ @end - -/* This is a helper function for HandleModifierSide. This - * function reverts back to behavior before the distinction between - * sides was made. - */ -static void -HandleNonDeviceModifier(unsigned int device_independent_mask, - unsigned int oldMods, - unsigned int newMods, - SDL_Scancode scancode) -{ - unsigned int oldMask, newMask; - - /* Isolate just the bits we care about in the depedent bits so we can - * figure out what changed - */ - oldMask = oldMods & device_independent_mask; - newMask = newMods & device_independent_mask; - - if (oldMask && oldMask != newMask) { - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } else if (newMask && oldMask != newMask) { - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - } -} - -/* This is a helper function for HandleModifierSide. - * This function sets the actual SDL_PrivateKeyboard event. - */ -static void -HandleModifierOneSide(unsigned int oldMods, unsigned int newMods, - SDL_Scancode scancode, - unsigned int sided_device_dependent_mask) -{ - unsigned int old_dep_mask, new_dep_mask; - - /* Isolate just the bits we care about in the depedent bits so we can - * figure out what changed - */ - old_dep_mask = oldMods & sided_device_dependent_mask; - new_dep_mask = newMods & sided_device_dependent_mask; - - /* We now know that this side bit flipped. But we don't know if - * it went pressed to released or released to pressed, so we must - * find out which it is. - */ - if (new_dep_mask && old_dep_mask != new_dep_mask) { - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - } else { - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } -} - -/* This is a helper function for DoSidedModifiers. - * This function will figure out if the modifier key is the left or right side, - * e.g. left-shift vs right-shift. - */ -static void -HandleModifierSide(int device_independent_mask, - unsigned int oldMods, unsigned int newMods, - SDL_Scancode left_scancode, - SDL_Scancode right_scancode, - unsigned int left_device_dependent_mask, - unsigned int right_device_dependent_mask) -{ - unsigned int device_dependent_mask = (left_device_dependent_mask | - right_device_dependent_mask); - unsigned int diff_mod; - - /* On the basis that the device independent mask is set, but there are - * no device dependent flags set, we'll assume that we can't detect this - * keyboard and revert to the unsided behavior. - */ - if ((device_dependent_mask & newMods) == 0) { - /* Revert to the old behavior */ - HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode); - return; - } - - /* XOR the previous state against the new state to see if there's a change */ - diff_mod = (device_dependent_mask & oldMods) ^ - (device_dependent_mask & newMods); - if (diff_mod) { - /* A change in state was found. Isolate the left and right bits - * to handle them separately just in case the values can simulataneously - * change or if the bits don't both exist. - */ - if (left_device_dependent_mask & diff_mod) { - HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask); - } - if (right_device_dependent_mask & diff_mod) { - HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask); - } - } -} - -/* This is a helper function for DoSidedModifiers. - * This function will release a key press in the case that - * it is clear that the modifier has been released (i.e. one side - * can't still be down). - */ -static void -ReleaseModifierSide(unsigned int device_independent_mask, - unsigned int oldMods, unsigned int newMods, - SDL_Scancode left_scancode, - SDL_Scancode right_scancode, - unsigned int left_device_dependent_mask, - unsigned int right_device_dependent_mask) -{ - unsigned int device_dependent_mask = (left_device_dependent_mask | - right_device_dependent_mask); - - /* On the basis that the device independent mask is set, but there are - * no device dependent flags set, we'll assume that we can't detect this - * keyboard and revert to the unsided behavior. - */ - if ((device_dependent_mask & oldMods) == 0) { - /* In this case, we can't detect the keyboard, so use the left side - * to represent both, and release it. - */ - SDL_SendKeyboardKey(SDL_RELEASED, left_scancode); - return; - } - - /* - * This could have been done in an if-else case because at this point, - * we know that all keys have been released when calling this function. - * But I'm being paranoid so I want to handle each separately, - * so I hope this doesn't cause other problems. - */ - if ( left_device_dependent_mask & oldMods ) { - SDL_SendKeyboardKey(SDL_RELEASED, left_scancode); - } - if ( right_device_dependent_mask & oldMods ) { - SDL_SendKeyboardKey(SDL_RELEASED, right_scancode); - } -} - -/* This function will handle the modifier keys and also determine the - * correct side of the key. - */ -static void -DoSidedModifiers(unsigned short scancode, - unsigned int oldMods, unsigned int newMods) -{ - /* Set up arrays for the key syms for the left and right side. */ - const SDL_Scancode left_mapping[] = { - SDL_SCANCODE_LSHIFT, - SDL_SCANCODE_LCTRL, - SDL_SCANCODE_LALT, - SDL_SCANCODE_LGUI - }; - const SDL_Scancode right_mapping[] = { - SDL_SCANCODE_RSHIFT, - SDL_SCANCODE_RCTRL, - SDL_SCANCODE_RALT, - SDL_SCANCODE_RGUI - }; - /* Set up arrays for the device dependent masks with indices that - * correspond to the _mapping arrays - */ - const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK }; - const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK }; - - unsigned int i, bit; - - /* Iterate through the bits, testing each against the old modifiers */ - for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) { - unsigned int oldMask, newMask; - - oldMask = oldMods & bit; - newMask = newMods & bit; - - /* If the bit is set, we must always examine it because the left - * and right side keys may alternate or both may be pressed. - */ - if (newMask) { - HandleModifierSide(bit, oldMods, newMods, - left_mapping[i], right_mapping[i], - left_device_mapping[i], right_device_mapping[i]); - } - /* If the state changed from pressed to unpressed, we must examine - * the device dependent bits to release the correct keys. - */ - else if (oldMask && oldMask != newMask) { - ReleaseModifierSide(bit, oldMods, newMods, - left_mapping[i], right_mapping[i], - left_device_mapping[i], right_device_mapping[i]); - } - } -} - static void HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags) { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_Scancode code = darwin_scancode_table[scancode]; - if (modifierFlags == data.modifierFlags) { - return; + const SDL_Scancode codes[] = { + SDL_SCANCODE_LSHIFT, + SDL_SCANCODE_LCTRL, + SDL_SCANCODE_LALT, + SDL_SCANCODE_LGUI, + SDL_SCANCODE_RSHIFT, + SDL_SCANCODE_RCTRL, + SDL_SCANCODE_RALT, + SDL_SCANCODE_RGUI, + SDL_SCANCODE_LSHIFT, + SDL_SCANCODE_LCTRL, + SDL_SCANCODE_LALT, + SDL_SCANCODE_LGUI, }; + + const unsigned int modifiers[] = { + NX_DEVICELSHIFTKEYMASK, + NX_DEVICELCTLKEYMASK, + NX_DEVICELALTKEYMASK, + NX_DEVICELCMDKEYMASK, + NX_DEVICERSHIFTKEYMASK, + NX_DEVICERCTLKEYMASK, + NX_DEVICERALTKEYMASK, + NX_DEVICERCMDKEYMASK, + NX_SHIFTMASK, + NX_CONTROLMASK, + NX_ALTERNATEMASK, + NX_COMMANDMASK }; + + for (int i = 0; i < 12; i++) + { + if (code == codes[i]) + { + if (modifierFlags & modifiers[i]) + SDL_SendKeyboardKey(SDL_PRESSED, code); + else + SDL_SendKeyboardKey(SDL_RELEASED, code); + } } - - DoSidedModifiers(scancode, data.modifierFlags, modifierFlags); - data.modifierFlags = modifierFlags; } static void @@ -579,8 +419,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) SDL_SendKeyboardKey(SDL_RELEASED, code); break; case NSEventTypeFlagsChanged: - /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ - HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]); + HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]); break; default: /* just to avoid compiler warnings */ break; From 0bc852ce5354d29beb9a77957ba7e82ced37bd61 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 17 Oct 2022 17:43:06 -0700 Subject: [PATCH 185/459] Revert "Disable the RAWINPUT joystick driver by default" Disabling RAWINPUT on Windows 10 causes these issues: * All Xbox controllers are named "XInput Controller". * Trigger rumble no longer works. * "XInput Controllers" are now also listed as separate haptic devices --- WhatsNew.txt | 3 --- include/SDL_hints.h | 6 ++---- src/joystick/windows/SDL_rawinputjoystick.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/WhatsNew.txt b/WhatsNew.txt index fe7a334b7..0318b90de 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -10,9 +10,6 @@ General: * Added support for Nintendo Wii controllers to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_WII to control whether this is used * Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers -Windows: -* The RAWINPUT joystick driver is disabled by default, since it's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing. - --------------------------------------------------------------------------- 2.24.0: diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 37948954d..600989e58 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -938,11 +938,9 @@ extern "C" { /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * - * Enabling this hint allows for more than 4 Xbox controllers on Windows, but adds significant complexity to the joystick processing. If you enable this hint and do not use an SDL window in your application, you may need to set the hint SDL_HINT_JOYSTICK_THREAD to "1" to handle joystick input messages. - * * This variable can be set to the following values: - * "0" - RAWINPUT drivers are not used (the default) - * "1" - RAWINPUT drivers are used + * "0" - RAWINPUT drivers are not used + * "1" - RAWINPUT drivers are used (the default) */ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 734921cce..120a361f1 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -860,7 +860,7 @@ RAWINPUT_JoystickInit(void) return -1; } - if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_FALSE)) { + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_TRUE)) { return -1; } From 285cbf6fdd9f329a604bd289e5faa4f6884807b0 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Oct 2022 10:04:06 +0200 Subject: [PATCH 186/459] Revert commit 485bb3565b6da24620e4eedde837fbfbc5cee6d2. "Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect" because the glitch reappears on other backend --- src/render/SDL_render.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 7f04f3649..aaf2e85b2 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -572,10 +572,10 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou *ptr_indices++ = cur_indice + 0; *ptr_indices++ = cur_indice + 1; - *ptr_indices++ = cur_indice + 3; - *ptr_indices++ = cur_indice + 1; - *ptr_indices++ = cur_indice + 3; *ptr_indices++ = cur_indice + 2; + *ptr_indices++ = cur_indice + 0; + *ptr_indices++ = cur_indice + 2; + *ptr_indices++ = cur_indice + 3; cur_indice += 4; } @@ -3523,7 +3523,7 @@ SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 3, 1, 3, 2}; + const int indices[6] = {0, 1, 2, 0, 2, 3}; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; @@ -3671,7 +3671,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 3, 1, 3, 2}; + const int indices[6] = {0, 1, 2, 0, 2, 3}; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; From 428b5ae5464d567881c383edeb2d1e5712b18ffd Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Tue, 18 Oct 2022 10:34:51 +0200 Subject: [PATCH 187/459] PSP: Reorder extra imports --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index badb86182..6c07a9d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2600,16 +2600,16 @@ elseif(PSP) endif() list(APPEND EXTRA_LIBS - psppower - pspctrl - psphprm - pspge - pspgu - pspdisplay - pspvfpu - pspaudio - pspvram GL + pspvram + pspaudio + pspvfpu + pspdisplay + pspgu + pspge + psphprm + pspctrl + psppower ) if(NOT SDL2_DISABLE_SDL2MAIN) list(INSERT SDL_LIBS 0 "-lSDL2main") From 3d99d31026bb69e208ac82c30c67e62ca1333141 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Oct 2022 10:34:56 +0200 Subject: [PATCH 188/459] Fixed bug #6401 - back-end can choose the order the triangles when rendering rects, attempt to fix small glitch rendering. --- src/render/SDL_render.c | 27 +++++++++++++++++++-------- src/render/SDL_sysrender.h | 3 +++ src/render/opengl/SDL_render_gl.c | 7 +++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index aaf2e85b2..7dd19858a 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -552,6 +552,7 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou const int num_indices = 6 * count; const int size_indices = 4; int cur_indice = 0; + const int *rect_indice_list = renderer->rect_indice_list; for (i = 0; i < count; ++i) { float minx, miny, maxx, maxy; @@ -570,12 +571,12 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou *ptr_xy++ = minx; *ptr_xy++ = maxy; - *ptr_indices++ = cur_indice + 0; - *ptr_indices++ = cur_indice + 1; - *ptr_indices++ = cur_indice + 2; - *ptr_indices++ = cur_indice + 0; - *ptr_indices++ = cur_indice + 2; - *ptr_indices++ = cur_indice + 3; + *ptr_indices++ = cur_indice + rect_indice_list[0]; + *ptr_indices++ = cur_indice + rect_indice_list[1]; + *ptr_indices++ = cur_indice + rect_indice_list[2]; + *ptr_indices++ = cur_indice + rect_indice_list[3]; + *ptr_indices++ = cur_indice + rect_indice_list[4]; + *ptr_indices++ = cur_indice + rect_indice_list[5]; cur_indice += 4; } @@ -1062,6 +1063,16 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) renderer->dpi_scale.x = 1.0f; renderer->dpi_scale.y = 1.0f; + /* Default value, if not specified by the renderer back-end */ + if (renderer->rect_indice_list[0] == 0 && renderer->rect_indice_list[1] == 0) { + renderer->rect_indice_list[0] = 0; + renderer->rect_indice_list[1] = 1; + renderer->rect_indice_list[2] = 2; + renderer->rect_indice_list[3] = 0; + renderer->rect_indice_list[4] = 2; + renderer->rect_indice_list[5] = 3; + } + /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */ renderer->render_command_generation = 1; @@ -3523,7 +3534,7 @@ SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 2, 0, 2, 3}; + const int *indices = renderer->rect_indice_list; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; @@ -3671,7 +3682,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int indices[6] = {0, 1, 2, 0, 2, 3}; + const int *indices = renderer->rect_indice_list; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index 86d5eaa64..fb411f4ca 100644 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -248,6 +248,9 @@ struct SDL_Renderer /* The method of drawing lines */ SDL_RenderLineMethod line_method; + /* List of triangle indices to draw rects */ + int rect_indice_list[6]; + /* Remainder from scaled relative motion */ float xrel; float yrel; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index c55c38769..96a37660f 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1932,6 +1932,13 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; #endif + renderer->rect_indice_list[0] = 0; + renderer->rect_indice_list[1] = 1; + renderer->rect_indice_list[2] = 3; + renderer->rect_indice_list[3] = 1; + renderer->rect_indice_list[4] = 3; + renderer->rect_indice_list[5] = 2; + if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) { data->GL_EXT_framebuffer_object_supported = SDL_TRUE; data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) From 790fa3156cfee847a7c0b34986de0cd7fdd7438f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Oct 2022 10:41:10 +0200 Subject: [PATCH 189/459] Fix warning: enumeration value 'SDL_BLENDMODE_INVALID' not explicitly handled in switch --- src/render/SDL_render.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 7dd19858a..041845209 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1206,6 +1206,9 @@ IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) case SDL_BLENDMODE_MUL: return SDL_TRUE; + case SDL_BLENDMODE_INVALID: + return SDL_FALSE; + default: return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode); } From e8a4c23ce560dad786922e8d51496da2687e1723 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Oct 2022 10:45:01 +0200 Subject: [PATCH 190/459] Revert commit 790fa3156cfee847a7c0b34986de0cd7fdd7438f. SDL_BLENDMODE_INVALID case is probably used for custom blendmode --- src/render/SDL_render.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 041845209..7dd19858a 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1206,9 +1206,6 @@ IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) case SDL_BLENDMODE_MUL: return SDL_TRUE; - case SDL_BLENDMODE_INVALID: - return SDL_FALSE; - default: return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode); } From dfbb93dd0c4bcdea2a3edc0e3cb0f5dae153d16e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Oct 2022 11:31:30 +0200 Subject: [PATCH 191/459] SDL_Renderer / GLES2: add specific list of indice to render rect (see #6401) --- src/render/opengles2/SDL_render_gles2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index ac22c2b48..4112c1ad1 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -2232,6 +2232,13 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) } #endif + renderer->rect_indice_list[0] = 0; + renderer->rect_indice_list[1] = 1; + renderer->rect_indice_list[2] = 3; + renderer->rect_indice_list[3] = 1; + renderer->rect_indice_list[4] = 3; + renderer->rect_indice_list[5] = 2; + /* Set up parameters for rendering */ data->glActiveTexture(GL_TEXTURE0); data->glPixelStorei(GL_PACK_ALIGNMENT, 1); From 965ba1e09712fc57968d87c1cf60c541529fbd20 Mon Sep 17 00:00:00 2001 From: GNQG Date: Tue, 18 Oct 2022 19:03:19 +0900 Subject: [PATCH 192/459] fix SDL_SendEditingText when long composition text is enabled and strlen(text) == SDL_TEXTEDITINGEVENT_TEXT_SIZE --- src/events/SDL_keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index b1e27e1ae..99db756e9 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -1058,7 +1058,7 @@ SDL_SendEditingText(const char *text, int start, int length) SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) && - SDL_strlen(text) > SDL_arraysize(event.text.text)) { + SDL_strlen(text) >= SDL_arraysize(event.text.text)) { event.editExt.type = SDL_TEXTEDITING_EXT; event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0; event.editExt.text = text ? SDL_strdup(text) : NULL; From aefc6b5bb57cd3aadc6964e26f2caac1d1c5f624 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 18 Oct 2022 08:40:03 -0700 Subject: [PATCH 193/459] Renamed variables, index is the singular of indices --- src/render/SDL_render.c | 48 ++++++++++++------------- src/render/SDL_sysrender.h | 2 +- src/render/opengl/SDL_render_gl.c | 12 +++---- src/render/opengles2/SDL_render_gles2.c | 12 +++---- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 7dd19858a..d2d94f249 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -551,8 +551,8 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou const int num_vertices = 4 * count; const int num_indices = 6 * count; const int size_indices = 4; - int cur_indice = 0; - const int *rect_indice_list = renderer->rect_indice_list; + int cur_index = 0; + const int *rect_index_order = renderer->rect_index_order; for (i = 0; i < count; ++i) { float minx, miny, maxx, maxy; @@ -571,13 +571,13 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou *ptr_xy++ = minx; *ptr_xy++ = maxy; - *ptr_indices++ = cur_indice + rect_indice_list[0]; - *ptr_indices++ = cur_indice + rect_indice_list[1]; - *ptr_indices++ = cur_indice + rect_indice_list[2]; - *ptr_indices++ = cur_indice + rect_indice_list[3]; - *ptr_indices++ = cur_indice + rect_indice_list[4]; - *ptr_indices++ = cur_indice + rect_indice_list[5]; - cur_indice += 4; + *ptr_indices++ = cur_index + rect_index_order[0]; + *ptr_indices++ = cur_index + rect_index_order[1]; + *ptr_indices++ = cur_index + rect_index_order[2]; + *ptr_indices++ = cur_index + rect_index_order[3]; + *ptr_indices++ = cur_index + rect_index_order[4]; + *ptr_indices++ = cur_index + rect_index_order[5]; + cur_index += 4; } retval = renderer->QueueGeometry(renderer, cmd, NULL, @@ -1064,13 +1064,13 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) renderer->dpi_scale.y = 1.0f; /* Default value, if not specified by the renderer back-end */ - if (renderer->rect_indice_list[0] == 0 && renderer->rect_indice_list[1] == 0) { - renderer->rect_indice_list[0] = 0; - renderer->rect_indice_list[1] = 1; - renderer->rect_indice_list[2] = 2; - renderer->rect_indice_list[3] = 0; - renderer->rect_indice_list[4] = 2; - renderer->rect_indice_list[5] = 3; + if (renderer->rect_index_order[0] == 0 && renderer->rect_index_order[1] == 0) { + renderer->rect_index_order[0] = 0; + renderer->rect_index_order[1] = 1; + renderer->rect_index_order[2] = 2; + renderer->rect_index_order[3] = 0; + renderer->rect_index_order[4] = 2; + renderer->rect_index_order[5] = 3; } /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */ @@ -3125,7 +3125,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, int num_vertices = 4 * count; int num_indices = 0; const int size_indices = 4; - int cur_indice = -4; + int cur_index = -4; const int is_looping = (points[0].x == points[count - 1].x && points[0].y == points[count - 1].y); SDL_FPoint p; /* previous point */ p.x = p.y = 0.0f; @@ -3152,9 +3152,9 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, *ptr_xy++ = q.y + scale_y; #define ADD_TRIANGLE(i1, i2, i3) \ - *ptr_indices++ = cur_indice + i1; \ - *ptr_indices++ = cur_indice + i2; \ - *ptr_indices++ = cur_indice + i3; \ + *ptr_indices++ = cur_index + i1; \ + *ptr_indices++ = cur_index + i2; \ + *ptr_indices++ = cur_index + i3; \ num_indices += 3; \ /* closed polyline, don´t draw twice the point */ @@ -3166,7 +3166,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, /* first point only, no segment */ if (i == 0) { p = q; - cur_indice += 4; + cur_index += 4; continue; } @@ -3216,7 +3216,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, } p = q; - cur_indice += 4; + cur_index += 4; } retval = QueueCmdGeometry(renderer, NULL, @@ -3534,7 +3534,7 @@ SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int *indices = renderer->rect_indice_list; + const int *indices = renderer->rect_index_order; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; @@ -3682,7 +3682,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, float uv[8]; const int uv_stride = 2 * sizeof (float); const int num_vertices = 4; - const int *indices = renderer->rect_indice_list; + const int *indices = renderer->rect_index_order; const int num_indices = 6; const int size_indices = 4; float minu, minv, maxu, maxv; diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index fb411f4ca..dc8be4674 100644 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -249,7 +249,7 @@ struct SDL_Renderer SDL_RenderLineMethod line_method; /* List of triangle indices to draw rects */ - int rect_indice_list[6]; + int rect_index_order[6]; /* Remainder from scaled relative motion */ float xrel; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 96a37660f..4f6f1e5d5 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1932,12 +1932,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; #endif - renderer->rect_indice_list[0] = 0; - renderer->rect_indice_list[1] = 1; - renderer->rect_indice_list[2] = 3; - renderer->rect_indice_list[3] = 1; - renderer->rect_indice_list[4] = 3; - renderer->rect_indice_list[5] = 2; + renderer->rect_index_order[0] = 0; + renderer->rect_index_order[1] = 1; + renderer->rect_index_order[2] = 3; + renderer->rect_index_order[3] = 1; + renderer->rect_index_order[4] = 3; + renderer->rect_index_order[5] = 2; if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) { data->GL_EXT_framebuffer_object_supported = SDL_TRUE; diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 4112c1ad1..41bf300f4 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -2232,12 +2232,12 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) } #endif - renderer->rect_indice_list[0] = 0; - renderer->rect_indice_list[1] = 1; - renderer->rect_indice_list[2] = 3; - renderer->rect_indice_list[3] = 1; - renderer->rect_indice_list[4] = 3; - renderer->rect_indice_list[5] = 2; + renderer->rect_index_order[0] = 0; + renderer->rect_index_order[1] = 1; + renderer->rect_index_order[2] = 3; + renderer->rect_index_order[3] = 1; + renderer->rect_index_order[4] = 3; + renderer->rect_index_order[5] = 2; /* Set up parameters for rendering */ data->glActiveTexture(GL_TEXTURE0); From e7ab581d796aa83f7d028ea4249fdc66600df173 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 19 Oct 2022 09:14:16 -0400 Subject: [PATCH 194/459] coreaudio: Dispose of AudioQueue before waiting on the thread. Otherwise the thread might block for a long time (more than 10 seconds!). It's not clear to me why this happens, or why its safe to do this with a resource that's still in use, but we have, until recently, always disposed of the AudioQueue first, so changing back is probably okay. Also changed the disposal to allow in-flight buffers to reach hardware; otherwise you lose the last little bit of audio that's already been queued but not played, which you can hear clearly in the loopwave test program. Fixes #6377. --- src/audio/coreaudio/SDL_coreaudio.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 6cfc035e4..dbd85f489 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -704,6 +704,11 @@ COREAUDIO_CloseDevice(_THIS) /* if callback fires again, feed silence; don't call into the app. */ SDL_AtomicSet(&this->paused, 1); + /* dispose of the audio queue before waiting on the thread, or it might stall for a long time! */ + if (this->hidden->audioQueue) { + AudioQueueDispose(this->hidden->audioQueue, 0); + } + if (this->hidden->thread) { SDL_assert(SDL_AtomicGet(&this->shutdown) != 0); /* should have been set by SDL_audio.c */ SDL_WaitThread(this->hidden->thread, NULL); @@ -733,10 +738,6 @@ COREAUDIO_CloseDevice(_THIS) open_devices = NULL; } - if (this->hidden->audioQueue) { - AudioQueueDispose(this->hidden->audioQueue, 1); - } - if (this->hidden->ready_semaphore) { SDL_DestroySemaphore(this->hidden->ready_semaphore); } From f28cf2b0d3fa6b4b9c692b0aa04f2875a09e0dfa Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 19 Oct 2022 02:28:36 -0400 Subject: [PATCH 195/459] Also remove the OpenBSD comment about OSS --- configure | 4 ---- configure.ac | 4 ---- 2 files changed, 8 deletions(-) diff --git a/configure b/configure index b686dd0aa..76d1d3e8a 100755 --- a/configure +++ b/configure @@ -21001,10 +21001,6 @@ else $as_nop enable_oss=maybe fi - - # OpenBSD "has" OSS, but it's not really for app use. They want you to - # use sndio instead. So on there, we default to disabled. You can force - # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes fi diff --git a/configure.ac b/configure.ac index 612602fb7..5810b4f0f 100644 --- a/configure.ac +++ b/configure.ac @@ -927,10 +927,6 @@ CheckOSS() AC_ARG_ENABLE(oss, [AS_HELP_STRING([--enable-oss], [support the OSS audio API [default=maybe]])], , enable_oss=maybe) - - # OpenBSD "has" OSS, but it's not really for app use. They want you to - # use sndio instead. So on there, we default to disabled. You can force - # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes fi From d542f43b2aa23966913c08e4973793150e8073d0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 19 Oct 2022 16:03:43 +0200 Subject: [PATCH 196/459] cmake: add SDL_INSTALL_CMAKEDIR cache variable to override location of cmake config files --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c07a9d56..baa25e9d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3346,15 +3346,16 @@ if(NOT SDL2_DISABLE_INSTALL) ##### Export files ##### if (WINDOWS AND NOT MINGW) - set(PKG_PREFIX "cmake") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "cmake") else () - set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") endif () + set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL2Config.cmake") include(CMakePackageConfigHelpers) configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake" PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR - INSTALL_DESTINATION ${PKG_PREFIX} + INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake" VERSION ${SDL_VERSION} @@ -3365,7 +3366,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2Targets FILE SDL2Targets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2Targets @@ -3377,7 +3378,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2mainTargets FILE SDL2mainTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2mainTargets @@ -3389,7 +3390,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2staticTargets FILE SDL2staticTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2staticTargets @@ -3401,7 +3402,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2testTargets FILE SDL2testTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2testTargets @@ -3413,7 +3414,7 @@ if(NOT SDL2_DISABLE_INSTALL) FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" COMPONENT Devel ) From c6e89619794ed6307f9efb0b242a2cdb605e1dc3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 19 Oct 2022 08:05:47 -0700 Subject: [PATCH 197/459] Define _USE_MATH_DEFINES for Visual Studio (thanks @pionere!) Fixes https://github.com/libsdl-org/SDL/issues/3790 --- include/SDL_stdinc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index c60d6eebb..06233c013 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -80,9 +80,9 @@ # include #endif #ifdef HAVE_MATH_H -# if defined(__WINRT__) +# if defined(_MSC_VER) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on - WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx + Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. */ # define _USE_MATH_DEFINES From 94ac8ae08b19210efedd0e73b0c60010fb9308a0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 20 Oct 2022 13:29:35 +0200 Subject: [PATCH 198/459] cmake: else() does not need an argument --- mingw/pkg-support/cmake/sdl2-config-version.cmake | 2 +- mingw/pkg-support/cmake/sdl2-config.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw/pkg-support/cmake/sdl2-config-version.cmake b/mingw/pkg-support/cmake/sdl2-config-version.cmake index 131ee3aaf..9f7a8b34d 100644 --- a/mingw/pkg-support/cmake/sdl2-config-version.cmake +++ b/mingw/pkg-support/cmake/sdl2-config-version.cmake @@ -5,7 +5,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") -else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") +else() set(PACKAGE_VERSION_UNSUITABLE TRUE) return() endif() diff --git a/mingw/pkg-support/cmake/sdl2-config.cmake b/mingw/pkg-support/cmake/sdl2-config.cmake index 8becf7198..3c0799fbc 100644 --- a/mingw/pkg-support/cmake/sdl2-config.cmake +++ b/mingw/pkg-support/cmake/sdl2-config.cmake @@ -5,7 +5,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") -else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") +else() set(SDL2_FOUND FALSE) return() endif() From 11d53c84a7663d5a5861f3672990ca4b32376e3e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 20 Oct 2022 01:11:39 +0200 Subject: [PATCH 199/459] cmake: use pkg-config's library dirs as hint for finding a shared library --- cmake/sdlchecks.cmake | 81 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index c1100fdc9..090852dd7 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1,8 +1,11 @@ +include(CMakeParseArguments) macro(FindLibraryAndSONAME _LIB) + cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN}) + string(TOUPPER ${_LIB} _UPPERLNAME) string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}") - find_library(${_LNAME}_LIB ${_LIB}) + find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS}) if(${_LNAME}_LIB) # reduce the library name for shared linking @@ -121,7 +124,7 @@ macro(CheckPipewire) if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading") endif() - FindLibraryAndSONAME("pipewire-0.3") + FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PKG_PIPEWIRE_LIBRARY_DIRS}) if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"") set(HAVE_PIPEWIRE_SHARED TRUE) @@ -150,7 +153,7 @@ macro(CheckPulseAudio) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") endif() - FindLibraryAndSONAME("pulse-simple") + FindLibraryAndSONAME("pulse-simple" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS}) if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") set(HAVE_PULSEAUDIO_SHARED TRUE) @@ -179,7 +182,7 @@ macro(CheckJACK) if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") endif() - FindLibraryAndSONAME("jack") + FindLibraryAndSONAME("jack" LIBDIRS ${PKG_JACK_LIBRARY_DIRS}) if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") set(HAVE_JACK_SHARED TRUE) @@ -208,7 +211,7 @@ macro(CheckESD) if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") endif() - FindLibraryAndSONAME(esd) + FindLibraryAndSONAME(esd LIBDIRS ${PKG_ESD_LIBRARY_DIRS}) if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") set(HAVE_ESD_SHARED TRUE) @@ -301,7 +304,7 @@ macro(CheckSNDIO) if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") endif() - FindLibraryAndSONAME("sndio") + FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS}) if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") set(HAVE_SNDIO_SHARED TRUE) @@ -330,7 +333,7 @@ macro(CheckFusionSound) if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading") endif() - FindLibraryAndSONAME("fusionsound") + FindLibraryAndSONAME("fusionsound" LIBDIRS ${PKG_FUSIONSOUND_LIBRARY_DIRS}) if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") set(HAVE_FUSIONSOUND_SHARED TRUE) @@ -626,9 +629,11 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckWayland) if(SDL_WAYLAND) - pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") + set(WAYLAND_FOUND FALSE) + pkg_check_modules(PKG_WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") - if(WAYLAND_FOUND) + if(PKG_WAYLAND_FOUND) + set(WAYLAND_FOUND TRUE) find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED) execute_process( COMMAND ${WAYLAND_SCANNER} --version @@ -651,8 +656,8 @@ macro(CheckWayland) endif() if(WAYLAND_FOUND) - target_link_directories(sdl-build-options INTERFACE "${WAYLAND_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${WAYLAND_INCLUDE_DIRS}") + target_link_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_LIBRARY_DIRS}") + target_include_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}") set(HAVE_WAYLAND TRUE) set(HAVE_SDL_VIDEO TRUE) @@ -678,10 +683,10 @@ macro(CheckWayland) if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading") endif() - FindLibraryAndSONAME(wayland-client) - FindLibraryAndSONAME(wayland-egl) - FindLibraryAndSONAME(wayland-cursor) - FindLibraryAndSONAME(xkbcommon) + FindLibraryAndSONAME(wayland-client LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(wayland-egl LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(wayland-cursor LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(xkbcommon LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"") @@ -689,25 +694,25 @@ macro(CheckWayland) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"") set(HAVE_WAYLAND_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${WAYLAND_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_WAYLAND_LIBRARIES}) endif() if(SDL_WAYLAND_LIBDECOR) - pkg_check_modules(LIBDECOR libdecor-0) - if(LIBDECOR_FOUND) + pkg_check_modules(PKG_LIBDECOR libdecor-0) + if(PKG_LIBDECOR) set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_LIBDECOR_H 1) - target_link_directories(sdl-build-options INTERFACE "${LIBDECOR_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${LIBDECOR_INCLUDE_DIRS}") + target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}") + target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}") if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") endif() - FindLibraryAndSONAME(decor-0) + FindLibraryAndSONAME(decor-0 LIBDIRS ${PKG_LIBDECOR_LIBRARY_DIRS}) if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO) set(HAVE_LIBDECOR_SHARED TRUE) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") else() - list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES}) endif() endif() endif() @@ -753,7 +758,7 @@ macro(CheckDirectFB) if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") endif() - FindLibraryAndSONAME("directfb") + FindLibraryAndSONAME("directfb" LIBDIRS ${PKG_DIRECTFB_LIBRARY_DIRS}) if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO) set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"") set(HAVE_DIRECTFB_SHARED TRUE) @@ -1159,19 +1164,19 @@ macro(CheckHIDAPI) if(SDL_HIDAPI) if(SDL_HIDAPI_LIBUSB) set(HAVE_LIBUSB FALSE) - pkg_check_modules(LIBUSB libusb-1.0) - if(LIBUSB_FOUND) - check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) + pkg_check_modules(PKG_LIBUSB libusb-1.0) + if(PKG_LIBUSB_FOUND) + check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS}) if(HAVE_LIBUSB_H) set(HAVE_LIBUSB TRUE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}") if(HIDAPI_ONLY_LIBUSB) - list(APPEND EXTRA_LIBS ${LIBUSB_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES}) elseif(OS2) set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS - FindLibraryAndSONAME("usb-1.0") + FindLibraryAndSONAME("usb-1.0" LIBDIRS ${PKG_LIBUSB_LIBRARY_DIRS}) if(USB_1.0_LIB) set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") endif() @@ -1257,19 +1262,17 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckKMSDRM) if(SDL_KMSDRM) - pkg_check_modules(KMSDRM libdrm gbm egl) - if(KMSDRM_FOUND AND HAVE_OPENGL_EGL) - link_directories( - ${KMSDRM_LIBRARY_DIRS} - ) - target_include_directories(sdl-build-options INTERFACE "${KMSDRM_INCLUDE_DIRS}") + pkg_check_modules(PKG_KMSDRM libdrm gbm egl) + if(PKG_KMSDRM_FOUND AND HAVE_OPENGL_EGL) + target_link_directories(sdl-build-options INTERFACE ${PKG_KMSDRM_LIBRARY_DIRS}) + target_include_directories(sdl-build-options INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}") set(HAVE_KMSDRM TRUE) set(HAVE_SDL_VIDEO TRUE) file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) list(APPEND SOURCE_FILES ${KMSDRM_SOURCES}) - list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) + list(APPEND EXTRA_CFLAGS ${PKG_KMSDRM_CFLAGS}) set(SDL_VIDEO_DRIVER_KMSDRM 1) @@ -1277,13 +1280,13 @@ macro(CheckKMSDRM) message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") endif() if(SDL_KMSDRM_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME(drm) - FindLibraryAndSONAME(gbm) + FindLibraryAndSONAME(drm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS}) + FindLibraryAndSONAME(gbm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS}) set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") set(HAVE_KMSDRM_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${KMSDRM_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_KMSDRM_LIBRARIES}) endif() endif() endif() From 96361fc476a9f0a91ac021133bb44e6d97b16f11 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 4 Oct 2022 21:17:10 +0200 Subject: [PATCH 200/459] cmake: create and install sdl2.pc for MSVC & WATCOM --- CMakeLists.txt | 136 ++++++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baa25e9d8..00b6a239f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2976,57 +2976,67 @@ foreach(_hdr IN LISTS SDL2_INCLUDE_FILES) endforeach() list(APPEND SDL_GENERATED_HEADERS ${SDL2_COPIED_INCLUDE_FILES}) -if(NOT WINDOWS OR CYGWIN OR MINGW) - - set(prefix ${CMAKE_INSTALL_PREFIX}) - file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") - - set(exec_prefix "\${prefix}") - set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") - set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") - set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") - if(SDL_STATIC) - set(ENABLE_STATIC_TRUE "") - set(ENABLE_STATIC_FALSE "#") - else() - set(ENABLE_STATIC_TRUE "#") - set(ENABLE_STATIC_FALSE "") - endif() - if(SDL_SHARED) - set(PKGCONFIG_LIBS_PRIV " -Libs.private:") - set(ENABLE_SHARED_TRUE "") - set(ENABLE_SHARED_FALSE "#") - else() - set(PKGCONFIG_LIBS_PRIV "") - set(ENABLE_SHARED_TRUE "#") - set(ENABLE_SHARED_FALSE "") - endif() - - # Clean up the different lists - listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") - set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) - list(REMOVE_DUPLICATES SDL_STATIC_LIBS) - listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) - set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) - listtostr(SDL_LIBS _SDL_LIBS) - set(SDL_LIBS ${_SDL_LIBS}) - listtostr(SDL_CFLAGS _SDL_CFLAGS "") - set(SDL_CFLAGS ${_SDL_CFLAGS}) - - # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") - # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") - - configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in" - "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY) - configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" - "${SDL2_BINARY_DIR}/sdl2-config") - configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" - "${SDL2_BINARY_DIR}/sdl2-config" @ONLY) - configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in" - "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY) +if(MSVC OR (WATCOM AND (WIN32 OR OS2))) + # Avoid conflict between the dll import library and the static library + set(sdl_static_libname "SDL2-static") +else() + set(sdl_static_libname "SDL2") endif() +set(prefix ${CMAKE_INSTALL_PREFIX}) +file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") + +set(exec_prefix "\${prefix}") +set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") +set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +if(SDL_STATIC) + set(ENABLE_STATIC_TRUE "") + set(ENABLE_STATIC_FALSE "#") +else() + set(ENABLE_STATIC_TRUE "#") + set(ENABLE_STATIC_FALSE "") +endif() +if(SDL_SHARED) + set(PKGCONFIG_LIBS_PRIV " +Libs.private:") + set(ENABLE_SHARED_TRUE "") + set(ENABLE_SHARED_FALSE "#") +else() + set(PKGCONFIG_LIBS_PRIV "") + set(ENABLE_SHARED_TRUE "#") + set(ENABLE_SHARED_FALSE "") +endif() + +# Clean up the different lists +listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") +set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) +list(REMOVE_DUPLICATES SDL_STATIC_LIBS) +listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) +set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) +listtostr(SDL_LIBS _SDL_LIBS) +set(SDL_LIBS ${_SDL_LIBS}) +listtostr(SDL_CFLAGS _SDL_CFLAGS "") +set(SDL_CFLAGS ${_SDL_CFLAGS}) +string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "${SDL_STATIC_LIBS}") +if(NOT SDL_SHARED) + string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}") +endif() + +if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL2") + message(STATUS "\"pkg-config --static --libs sdl2\" will return invalid information") +endif() + +# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") +# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") + +configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in" + "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY) +configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" + "${SDL2_BINARY_DIR}/sdl2-config" @ONLY) +configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in" + "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY) + macro(check_add_debug_flag FLAG SUFFIX) check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX}) if (HAS_C_FLAG_${SUFFIX}) @@ -3267,13 +3277,9 @@ if(SDL_STATIC) add_dependencies(SDL2-static sdl_headers_copy) # alias target for in-tree builds add_library(SDL2::SDL2-static ALIAS SDL2-static) - if(MSVC OR (WATCOM AND (WIN32 OR OS2))) - # Avoid conflict between the dll import library and the static library - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2-static") - else() - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") - endif() - set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") + set_target_properties(SDL2-static PROPERTIES + OUTPUT_NAME "${sdl_static_libname}" + POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) # TODO: Win32 platforms keep the same suffix .lib for import and static # libraries - do we need to consider this? @@ -3347,8 +3353,10 @@ if(NOT SDL2_DISABLE_INSTALL) ##### Export files ##### if (WINDOWS AND NOT MINGW) set(SDL_INSTALL_CMAKEDIR_DEFAULT "cmake") + set(LICENSES_PREFIX "licenses/SDL2") else () set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") endif () set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL2Config.cmake") @@ -3432,6 +3440,14 @@ if(NOT SDL2_DISABLE_INSTALL) set(SOPOSTFIX "") endif() + install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}") + if(FREEBSD) + # FreeBSD uses ${PREFIX}/libdata/pkgconfig + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") + else() + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif() if(NOT (WINDOWS OR CYGWIN) OR MINGW) if(SDL_SHARED) set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. @@ -3444,17 +3460,9 @@ if(NOT SDL2_DISABLE_INSTALL) install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() endif() - if(FREEBSD) - # FreeBSD uses ${PREFIX}/libdata/pkgconfig - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") - else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") # TODO: what about the .spec file? Is it only needed for RPM creation? install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") - install(FILES "LICENSE.txt" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") endif() endif() From 4264c0b67469896fced5ba8ac4c0e75acbb13ff1 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 21 Oct 2022 11:21:40 +0300 Subject: [PATCH 201/459] os2: fix error message for SDL_LoadObject() --- src/loadso/os2/SDL_sysloadso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c index 2b96848ac..4af806854 100644 --- a/src/loadso/os2/SDL_sysloadso.c +++ b/src/loadso/os2/SDL_sysloadso.c @@ -49,7 +49,7 @@ SDL_LoadObject(const char *sofile) ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); SDL_free(pszModName); if (ulRC != NO_ERROR) { - SDL_SetError("Failed loading %s (E%u)", acError, ulRC); + SDL_SetError("Failed loading %s: %s (E%u)", sofile, acError, ulRC); return NULL; } From 0823b5973a28ebad2ca6d34058c12602bc8a69f0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 21 Oct 2022 15:31:43 +0200 Subject: [PATCH 202/459] cmake: fix finding wayland-libdecor It was broken in 11d53c84a7663d5a5861f3672990ca4b32376e3e --- cmake/sdlchecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 090852dd7..8a19e5b60 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -699,7 +699,7 @@ macro(CheckWayland) if(SDL_WAYLAND_LIBDECOR) pkg_check_modules(PKG_LIBDECOR libdecor-0) - if(PKG_LIBDECOR) + if(PKG_LIBDECOR_FOUND) set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_LIBDECOR_H 1) target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}") @@ -709,7 +709,7 @@ macro(CheckWayland) endif() FindLibraryAndSONAME(decor-0 LIBDIRS ${PKG_LIBDECOR_LIBRARY_DIRS}) if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO) - set(HAVE_LIBDECOR_SHARED TRUE) + set(HAVE_WAYLAND_LIBDECOR_SHARED TRUE) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES}) From 5ed091c12d4edefb366d78217b72cb75b563bfcd Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 21 Oct 2022 15:32:05 +0200 Subject: [PATCH 203/459] cmake: fix reporting of SDL_TESTS --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00b6a239f..27160ee62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3102,6 +3102,10 @@ if (SDL_ASAN) endif() endif() +if(SDL_TESTS) + set(HAVE_TESTS ON) +endif() + # Create target that collects all all generated include files. add_custom_target(sdl_headers_copy DEPENDS ${SDL_GENERATED_HEADERS}) @@ -3483,6 +3487,7 @@ endif() ##### Tests subproject (must appear after the install/uninstall targets) ##### if(SDL_TESTS) + set(HAVE_TESTS ON) enable_testing() add_subdirectory(test) endif() From f37db957f8c5d9de53bdd58b2a95a2da0937307d Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 21 Oct 2022 04:49:15 -0400 Subject: [PATCH 204/459] Use -lpthread on OpenBSD --- cmake/sdlchecks.cmake | 2 +- configure | 2 +- configure.ac | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 8a19e5b60..3686f01d9 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -905,7 +905,7 @@ macro(CheckPTHREAD) set(PTHREAD_LDFLAGS "-lpthread") elseif(OPENBSD) set(PTHREAD_CFLAGS "-D_REENTRANT") - set(PTHREAD_LDFLAGS "-pthread") + set(PTHREAD_LDFLAGS "-lpthread") elseif(SOLARIS) set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_LDFLAGS "-pthread -lposix4") diff --git a/configure b/configure index 76d1d3e8a..072eedb83 100755 --- a/configure +++ b/configure @@ -26778,7 +26778,7 @@ fi ;; *-*-openbsd*) pthread_cflags="-D_REENTRANT" - pthread_lib="-pthread" + pthread_lib="-lpthread" ;; *-*-solaris2.9) # From Solaris 9+, posix4's preferred name is rt. diff --git a/configure.ac b/configure.ac index 5810b4f0f..6391bae84 100644 --- a/configure.ac +++ b/configure.ac @@ -3063,7 +3063,7 @@ dnl This is used on Linux for glibc binary compatibility (Doh!) ;; *-*-openbsd*) pthread_cflags="-D_REENTRANT" - pthread_lib="-pthread" + pthread_lib="-lpthread" ;; *-*-solaris2.9) # From Solaris 9+, posix4's preferred name is rt. From 3d415bc5d61e625189ccca6348ff1b70c469e45c Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 22 Oct 2022 11:56:56 +0300 Subject: [PATCH 205/459] loadso, dlsym, SDL_LoadFunction: cleanup the underscored name path. - strlcpy was passed a wrong buffer length parameter. has worked so far by luck. - use memcpy instead of strlcpy for simplicity. - 'append' has been a typo: should be 'prepend'. --- src/loadso/dlopen/SDL_sysloadso.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/loadso/dlopen/SDL_sysloadso.c b/src/loadso/dlopen/SDL_sysloadso.c index e5abe85db..3b55a6e81 100644 --- a/src/loadso/dlopen/SDL_sysloadso.c +++ b/src/loadso/dlopen/SDL_sysloadso.c @@ -60,12 +60,12 @@ SDL_LoadFunction(void *handle, const char *name) { void *symbol = dlsym(handle, name); if (symbol == NULL) { - /* append an underscore for platforms that need that. */ + /* prepend an underscore for platforms that need that. */ SDL_bool isstack; - size_t len = 1 + SDL_strlen(name) + 1; - char *_name = SDL_small_alloc(char, len, &isstack); + size_t len = SDL_strlen(name) + 1; + char *_name = SDL_small_alloc(char, len + 1, &isstack); _name[0] = '_'; - SDL_strlcpy(&_name[1], name, len); + SDL_memcpy(&_name[1], name, len); symbol = dlsym(handle, _name); SDL_small_free(_name, isstack); if (symbol == NULL) { From 3f1b5efccaa727745b335b546a42bd650694ca08 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 22 Oct 2022 14:28:10 +0300 Subject: [PATCH 206/459] os2 loadso improvements: - SDL_LoadObject: upon failure, strip the .dll extension and retry, but only if module name has no path. - SDL_LoadFunction: upon failure, retry with an underscore prepended, e.g. for gcc-built dlls. --- src/loadso/os2/SDL_sysloadso.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c index 4af806854..292196ecb 100644 --- a/src/loadso/os2/SDL_sysloadso.c +++ b/src/loadso/os2/SDL_sysloadso.c @@ -47,11 +47,20 @@ SDL_LoadObject(const char *sofile) pszModName = OS2_UTF8ToSys(sofile); ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); - SDL_free(pszModName); + + if (ulRC != NO_ERROR && !SDL_strrchr(pszModName, '\\') && !SDL_strrchr(pszModName, '/')) { + /* strip .dll extension and retry only if name has no path. */ + size_t len = SDL_strlen(pszModName); + if (len > 4 && SDL_strcasecmp(&pszModName[len - 4], ".dll") == 0) { + pszModName[len - 4] = '\0'; + ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); + } + } if (ulRC != NO_ERROR) { SDL_SetError("Failed loading %s: %s (E%u)", sofile, acError, ulRC); - return NULL; + hModule = NULLHANDLE; } + SDL_free(pszModName); return (void *)hModule; } @@ -63,6 +72,16 @@ SDL_LoadFunction(void *handle, const char *name) PFN pFN; ulRC = DosQueryProcAddr((HMODULE)handle, 0, name, &pFN); + if (ulRC != NO_ERROR) { + /* retry with an underscore prepended, e.g. for gcc-built dlls. */ + SDL_bool isstack; + size_t len = SDL_strlen(name) + 1; + char *_name = SDL_small_alloc(char, len + 1, &isstack); + _name[0] = '_'; + SDL_memcpy(&_name[1], name, len); + ulRC = DosQueryProcAddr((HMODULE)handle, 0, _name, &pFN); + SDL_small_free(_name, isstack); + } if (ulRC != NO_ERROR) { SDL_SetError("Failed loading procedure %s (E%u)", name, ulRC); return NULL; From 65a38a4015e54add093bdb3fbd2ad1cdc1770c72 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 22 Oct 2022 14:28:10 +0300 Subject: [PATCH 207/459] hidapi, libusb: remove os/2 symbol load hack after os/2 loadso updates --- src/hidapi/SDL_hidapi.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index d62acb03f..07f8c1ea8 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -1075,13 +1075,8 @@ int SDL_hid_init(void) if (libusb_ctx.libhandle != NULL) { SDL_bool loaded = SDL_TRUE; #ifdef SDL_LIBUSB_DYNAMIC - #ifdef __OS2__ - #define LOAD_LIBUSB_SYMBOL(func) \ - if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;} - #else #define LOAD_LIBUSB_SYMBOL(func) \ if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} - #endif #else #define LOAD_LIBUSB_SYMBOL(func) \ libusb_ctx.func = libusb_##func; From a905a7869f18332579ff06ba3f7f3777708a3007 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 22 Oct 2022 08:50:18 -0700 Subject: [PATCH 208/459] Clear the previous bitmap when calculating a new window shape Fixes https://github.com/libsdl-org/SDL/issues/6428 --- src/video/SDL_shape.c | 5 +++++ src/video/directfb/SDL_DirectFB_shape.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index ef4cc6045..f393bdf1c 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -77,8 +77,12 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb; Uint8 *bitmap_scanline; SDL_Color key; + if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); + + SDL_memset(bitmap, 0, shape->h * bytes_per_scanline); + for(y = 0;yh;y++) { bitmap_scanline = bitmap + y * bytes_per_scanline; for(x=0;xw;x++) { @@ -118,6 +122,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm bitmap_scanline[x / ppb] |= mask_value << (x % ppb); } } + if(SDL_MUSTLOCK(shape)) SDL_UnlockSurface(shape); } diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c index da2290f6d..ff334c804 100644 --- a/src/video/directfb/SDL_DirectFB_shape.c +++ b/src/video/directfb/SDL_DirectFB_shape.c @@ -96,8 +96,7 @@ DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowSh SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, &data->surface)); /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */ - SDL_DFB_ALLOC_CLEAR(bitmap, shape->w * shape->h); - SDL_CalculateShapeBitmap(shaper->mode,shape,bitmap,1); + SDL_CalculateShapeBitmap(shaper->mode, shape, bitmap, 1); src = bitmap; From 0e1d19cf680fc51635b3c52a9afa33fe03881bb5 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 22 Oct 2022 18:56:40 +0300 Subject: [PATCH 209/459] fix build errors resulting from -Wmisleading-indentation --- src/video/SDL_shape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index f393bdf1c..6c95164f2 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -81,7 +81,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); - SDL_memset(bitmap, 0, shape->h * bytes_per_scanline); + SDL_memset(bitmap, 0, shape->h * bytes_per_scanline); for(y = 0;yh;y++) { bitmap_scanline = bitmap + y * bytes_per_scanline; From 5b8f830e342b296d255969bbaec5a1a3522f1083 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 22 Oct 2022 09:24:28 -0700 Subject: [PATCH 210/459] Virtual joysticks don't need initial axis jitter protection Fixes https://github.com/libsdl-org/SDL/issues/6426 --- src/joystick/SDL_joystick.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index cc29a72d8..5561afcd1 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1530,7 +1530,8 @@ SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value) if (!info->sent_initial_value) { /* Make sure we don't send motion until there's real activity on this axis */ const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */ - if (SDL_abs(value - info->value) <= MAX_ALLOWED_JITTER) { + if (SDL_abs(value - info->value) <= MAX_ALLOWED_JITTER && + !SDL_IsJoystickVirtual(joystick->guid)) { return 0; } info->sent_initial_value = SDL_TRUE; From 2dc788cb9ffa83a2840e62f5ad2d0a7055cfcb19 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 20 Oct 2022 19:54:24 +0100 Subject: [PATCH 211/459] build: Expand version info in SDL_REVISION and SDL_GetRevision() Instead of using a URL and git sha1, this uses `git describe` to describe the version relative to the nearest previous git tag, which gives a better indication of whether this is a release, a prerelease, a slightly patched prerelease, or a long way after the last release during active development. This serves two purposes: it makes those APIs more informative, and it also puts this information into the binary in a form that is easy to screen-scrape using strings(1). For instance, if the bundled version of SDL in a game has this, we can see at a glance what version it is. It's also shorter than using the web address of the origin git repository and the full git commit sha1. Also write the computed version into a file ./VERSION in `make dist` tarballs, so that when we build from a tarball on a system that doesn't have git available, we still get the version details. For the Perforce code path in showrev.sh, output the version number followed by the Perforce revision, in a format reminiscent of `git describe` (with p instead of g to indicate Perforce). For the code path with no VCS available at all, put a suffix on the version number to indicate that this is just a guess (we can't know whether this SDL version is actually a git snapshot or has been patched locally or similar). Resolves: https://github.com/libsdl-org/SDL/issues/6418 Signed-off-by: Simon McVittie --- .gitignore | 1 + CMakeLists.txt | 33 ++++++++++++++++++++------------- Makefile.in | 2 +- build-scripts/showrev.sh | 35 +++++++++++++++++++++++++++++------ build-scripts/updaterev.sh | 20 +++++++++++++++++++- configure | 1 + include/SDL_revision.h.cmake | 6 +----- test/configure | 1 + 8 files changed, 73 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 5d5849b1e..1ab87fbc9 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ build gen Build buildbot +/VERSION *.so *.so.* diff --git a/CMakeLists.txt b/CMakeLists.txt index 27160ee62..a6d865b60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2930,29 +2930,36 @@ listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS) set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) # Compat helpers for the configuration files + +if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION") + file(READ "${PROJECT_SOURCE_DIR}/VERSION" SDL_SOURCE_VERSION) +endif() + find_package(Git) if(Git_FOUND) execute_process(COMMAND - "${GIT_EXECUTABLE}" remote get-url origin - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE GIT_URL_STATUS - OUTPUT_VARIABLE GIT_URL - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process(COMMAND - "${GIT_EXECUTABLE}" rev-list --max-count=1 HEAD~.. - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + "${GIT_EXECUTABLE}" describe --always --tags --long + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" RESULT_VARIABLE GIT_REVISION_STATUS OUTPUT_VARIABLE GIT_REVISION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + set(GIT_REVISION_STATUS 1) + set(GIT_REVISION "") +endif() - if(GIT_URL_STATUS EQUAL 0 OR GIT_REVISION_STATUS EQUAL 0) - set(SDL_REVISION "${GIT_URL}@${GIT_REVISION}") +if(SDL_SOURCE_VERSION) + set(SDL_REVISION "SDL-${SDL_SOURCE_VERSION}") +elseif(GIT_REVISION_STATUS EQUAL 0) + if(GIT_REVISION MATCHES "^[0-9a-f]+$") + # Just a truncated sha1, so prefix it with the version number + set(SDL_REVISION "SDL-${SDL_VERSION}-g${GIT_REVISION}") else() - set(SDL_REVISION "") + # e.g. release-2.24.0-542-g96361fc47 + set(SDL_REVISION "SDL-${GIT_REVISION}") endif() else() - set(SDL_REVISION "") + set(SDL_REVISION "SDL-${SDL_VERSION}-no-vcs") endif() configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" diff --git a/Makefile.in b/Makefile.in index 1dc78f671..1418a6206 100644 --- a/Makefile.in +++ b/Makefile.in @@ -252,7 +252,7 @@ dist $(distfile): -name '.#*' \) \ -exec rm -f {} \; if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi - (cd $(distdir); build-scripts/updaterev.sh) + (cd $(distdir); $(srcdir)/build-scripts/updaterev.sh --dist) tar cvf - $(distdir) | gzip --best >$(distfile) rm -rf $(distdir) diff --git a/build-scripts/showrev.sh b/build-scripts/showrev.sh index 71be3fea9..02cbbb0c6 100755 --- a/build-scripts/showrev.sh +++ b/build-scripts/showrev.sh @@ -5,10 +5,31 @@ SDL_ROOT=$(dirname $0)/.. cd $SDL_ROOT +if [ -e ./VERSION ]; then + cat ./VERSION + exit 0 +fi + +major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h) +minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h) +micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h) +version="${major}.${minor}.${micro}" + if [ -x "$(command -v git)" ]; then - rev=$(echo "$(git remote get-url origin 2>/dev/null)@$(git rev-list HEAD~.. 2>/dev/null)") - if [ "$rev" != "@" ]; then - echo $rev + rev="$(git describe --tags --long 2>/dev/null)" + if [ -n "$rev" ]; then + # e.g. release-2.24.0-542-g96361fc47 + # or release-2.24.1-5-g36b987dab + # or prerelease-2.23.2-0-gcb46e1b3f + echo "$rev" + exit 0 + fi + + rev="$(git describe --always --tags --long 2>/dev/null)" + if [ -n "$rev" ]; then + # Just a truncated sha1, e.g. 96361fc47. + # Turn it into e.g. 2.25.0-g96361fc47 + echo "${version}-g${rev}" exit 0 fi fi @@ -16,10 +37,12 @@ fi if [ -x "$(command -v p4)" ]; then rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')" if [ $? = 0 ]; then - echo $rev + # e.g. 2.25.0-p7511446 + echo "${version}-p${rev}" exit 0 fi fi -echo "" -exit 1 +# best we can do +echo "${version}-no-vcs" +exit 0 diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index eb20e8069..a15784d7c 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -6,10 +6,28 @@ outdir=`pwd` cd `dirname $0` srcdir=.. header=$outdir/include/SDL_revision.h +dist= + +while [ "$#" -gt 0 ]; do + case "$1" in + (--dist) + dist=yes + shift + ;; + (*) + echo "$0: Unknown option: $1" >&2 + exit 2 + ;; + esac +done rev=`sh showrev.sh 2>/dev/null` if [ "$rev" != "" ]; then - echo "#define SDL_REVISION \"$rev\"" >"$header.new" + if [ -n "$dist" ]; then + echo "$rev" > "$outdir/VERSION" + fi + echo "/* Generated by updaterev.sh, do not edit */" >"$header.new" + echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new" echo "#define SDL_REVISION_NUMBER 0" >>"$header.new" if diff $header $header.new >/dev/null 2>&1; then rm "$header.new" diff --git a/configure b/configure index 072eedb83..88c80f735 100755 --- a/configure +++ b/configure @@ -32529,3 +32529,4 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/include/SDL_revision.h.cmake b/include/SDL_revision.h.cmake index b27ec11bf..dc120884e 100644 --- a/include/SDL_revision.h.cmake +++ b/include/SDL_revision.h.cmake @@ -1,6 +1,2 @@ -#cmakedefine SDL_REVISION "@SDL_REVISION@" +#define SDL_REVISION "@SDL_REVISION@" #define SDL_REVISION_NUMBER 0 - -#ifndef SDL_REVISION -#define SDL_REVISION "" -#endif diff --git a/test/configure b/test/configure index f627d92de..c71abe489 100755 --- a/test/configure +++ b/test/configure @@ -6103,3 +6103,4 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + From 4ca5ea5b7e8333b2cde1b7cdddf167c67cc3f23c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 20 Oct 2022 20:02:21 +0100 Subject: [PATCH 212/459] build: Add a mechanism to mark builds with vendor info Downstream distributors can use this to mark a version with their preferred version information, like a Linux distribution package version or the Steam revision it was built to be bundled into, or just to mark it with the vendor it was built by or the environment it's intended to be used in. For instance, in Debian I'd use this by configuring with: --enable-vendor-info="${DEB_VENDOR} ${DEB_VERSION}" to get a SDL_REVISION like: release-2.24.1-0-ga1d1946dc (Debian 2.24.1+dfsg-2) which gives a Debian user enough information to track down the patches and build-time configuration that were used for package revision 2. In Autotools and CMake, this is a configure-time option like any other, and will go into both SDL_REVISION (via SDL_revision.h) and SDL_GetRevision(). In other build systems (MSVC, Xcode, etc.), defining the SDL_VENDOR_INFO macro will get it into the output of SDL_GetRevision(), although not SDL_REVISION. Resolves: https://github.com/libsdl-org/SDL/issues/6418 Signed-off-by: Simon McVittie --- .github/workflows/android.yml | 1 + .github/workflows/emscripten.yml | 1 + .github/workflows/main.yml | 2 ++ .github/workflows/msvc.yml | 1 + .github/workflows/n3ds.yml | 1 + .github/workflows/riscos.yml | 1 + CMakeLists.txt | 1 + Makefile.in | 4 +++- build-scripts/updaterev.sh | 12 ++++++++++++ configure.ac | 6 ++++++ include/SDL_revision.h | 4 ++++ include/SDL_revision.h.cmake | 8 +++++++- 12 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 264fce2b0..ccc02666f 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -38,6 +38,7 @@ jobs: -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ -DANDROID_ABI=${{ matrix.platform.android_abi }} \ -DSDL_STATIC_PIC=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_INSTALL_PREFIX=prefix \ -DCMAKE_BUILD_TYPE=Release \ -GNinja diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index b1ab07e5a..5f41cb53d 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -33,6 +33,7 @@ jobs: run: | emcmake cmake -S cmake/test -B cmake_config_build \ -DCMAKE_BUILD_TYPE=Release \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DTEST_SHARED=FALSE \ -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} cmake --build cmake_config_build --verbose diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4ce2f278..f96eb738c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,6 +72,7 @@ jobs: -DSDL_TESTS=ON \ -DSDL_WERROR=ON \ -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_BUILD_TYPE=Release \ ${{ matrix.platform.cmake }} @@ -102,6 +103,7 @@ jobs: ( cd build-autotools ${{ github.workspace }}/configure \ + --enable-vendor-info="Github Workflow" \ --enable-werror \ --prefix=${{ github.workspace }}/autotools_prefix \ ) diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 4f561b9db..b4644ecc5 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -43,6 +43,7 @@ jobs: -DSDL_WERROR=${{ !matrix.platform.nowerror }} ` -DSDL_TESTS=ON ` -DSDL_INSTALL_TESTS=ON ` + -DSDL_VENDOR_INFO="Github Workflow" ` -DSDL2_DISABLE_INSTALL=OFF ` ${{ matrix.platform.flags }} ` -DCMAKE_INSTALL_PREFIX=prefix diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml index c7c1c300c..f35577e66 100644 --- a/.github/workflows/n3ds.yml +++ b/.github/workflows/n3ds.yml @@ -20,6 +20,7 @@ jobs: -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=prefix - name: Build diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml index 7b1e435ea..1fec84066 100644 --- a/.github/workflows/riscos.yml +++ b/.github/workflows/riscos.yml @@ -46,6 +46,7 @@ jobs: -DSDL_GCC_ATOMICS=OFF \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake - name: Build (CMake) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6d865b60..cf8667549 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,6 +510,7 @@ dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" O dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF) dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) +option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "") option(SDL_WERROR "Enable -Werror" OFF) diff --git a/Makefile.in b/Makefile.in index 1418a6206..d4eeee402 100644 --- a/Makefile.in +++ b/Makefile.in @@ -32,6 +32,7 @@ RANLIB = @RANLIB@ RC = @RC@ LINKER = @LINKER@ LIBTOOLLINKERTAG = @LIBTOOLLINKERTAG@ +SDL_VENDOR_INFO = @SDL_VENDOR_INFO@ TARGET = libSDL2.la OBJECTS = @OBJECTS@ @@ -152,7 +153,7 @@ $(objects)/.created: touch $@ update-revision: - $(SHELL) $(auxdir)/updaterev.sh + $(SHELL) $(auxdir)/updaterev.sh --vendor "$(SDL_VENDOR_INFO)" .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d) @@ -252,6 +253,7 @@ dist $(distfile): -name '.#*' \) \ -exec rm -f {} \; if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi + # Intentionally no vendor suffix: that's a property of the build, not the source (cd $(distdir); $(srcdir)/build-scripts/updaterev.sh --dist) tar cvf - $(distdir) | gzip --best >$(distfile) rm -rf $(distdir) diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index a15784d7c..3ab034fd5 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -7,6 +7,7 @@ cd `dirname $0` srcdir=.. header=$outdir/include/SDL_revision.h dist= +vendor= while [ "$#" -gt 0 ]; do case "$1" in @@ -14,6 +15,10 @@ while [ "$#" -gt 0 ]; do dist=yes shift ;; + (--vendor) + vendor="$2" + shift 2 + ;; (*) echo "$0: Unknown option: $1" >&2 exit 2 @@ -27,7 +32,14 @@ if [ "$rev" != "" ]; then echo "$rev" > "$outdir/VERSION" fi echo "/* Generated by updaterev.sh, do not edit */" >"$header.new" + if [ -n "$vendor" ]; then + echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new" + fi + echo "#ifdef SDL_VENDOR_INFO" >>"$header.new" + echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new" + echo "#else" >>"$header.new" echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new" + echo "#endif" >>"$header.new" echo "#define SDL_REVISION_NUMBER 0" >>"$header.new" if diff $header $header.new >/dev/null 2>&1; then rm "$header.new" diff --git a/configure.ac b/configure.ac index 6391bae84..b520d21ad 100644 --- a/configure.ac +++ b/configure.ac @@ -4684,6 +4684,12 @@ else fi AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) +AC_ARG_ENABLE([vendor-info], + [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])], + [enable_vendor_info="$enableval"], [enable_vendor_info=]) +AS_IF([test "$enable_vendor_info" = no], [enable_vendor_info=]) +AC_SUBST([SDL_VENDOR_INFO], [$enable_vendor_info]) + # Verify that we have all the platform specific files we need if test x$have_audio != xyes; then diff --git a/include/SDL_revision.h b/include/SDL_revision.h index 3e9b63af9..36691f553 100644 --- a/include/SDL_revision.h +++ b/include/SDL_revision.h @@ -1,2 +1,6 @@ +#ifdef SDL_VENDOR_INFO +#define SDL_REVISION SDL_VENDOR_INFO +#else #define SDL_REVISION "" +#endif #define SDL_REVISION_NUMBER 0 diff --git a/include/SDL_revision.h.cmake b/include/SDL_revision.h.cmake index dc120884e..84e5f414a 100644 --- a/include/SDL_revision.h.cmake +++ b/include/SDL_revision.h.cmake @@ -1,2 +1,8 @@ -#define SDL_REVISION "@SDL_REVISION@" +#cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@" #define SDL_REVISION_NUMBER 0 + +#ifdef SDL_VENDOR_INFO +#define SDL_REVISION "@SDL_REVISION@ (" SDL_VENDOR_INFO ")" +#else +#define SDL_REVISION "@SDL_REVISION@" +#endif From cfd5d8eb29c8958de3333632a96032d3481816e5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 20 Oct 2022 20:38:57 +0100 Subject: [PATCH 213/459] build: Regenerate ./configure Signed-off-by: Simon McVittie --- configure | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure b/configure index 88c80f735..0f8806ced 100755 --- a/configure +++ b/configure @@ -683,6 +683,7 @@ SDL_LIBS SDL_CFLAGS bin_prefix_relpath cmake_prefix_relpath +SDL_VENDOR_INFO INSTALL_SDL2_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS @@ -954,6 +955,7 @@ enable_foregrounding_signal enable_joystick_virtual enable_render_d3d enable_sdl2_config +enable_vendor_info ' ac_precious_vars='build_alias host_alias @@ -1781,6 +1783,8 @@ Optional Features: enable virtual joystick APIs [default=yes] --enable-render-d3d enable the Direct3D render driver [default=yes] --enable-sdl2-config Install sdl2-config [default=yes] + --enable-vendor-info=STRING + Add vendor info to SDL_REVISION Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -29471,6 +29475,21 @@ fi INSTALL_SDL2_CONFIG=$enable_sdl2_config +# Check whether --enable-vendor-info was given. +if test ${enable_vendor_info+y} +then : + enableval=$enable_vendor_info; enable_vendor_info="$enableval" +else $as_nop + enable_vendor_info= +fi + +if test "$enable_vendor_info" = no +then : + enable_vendor_info= +fi +SDL_VENDOR_INFO=$enable_vendor_info + + # Verify that we have all the platform specific files we need if test x$have_audio != xyes; then From d4d99e8c29da350379c991a8360d544d2c9eaa32 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 21 Oct 2022 12:19:59 +0100 Subject: [PATCH 214/459] workflows: Check we can screen-scrape the SDL_REVISION from Linux builds Signed-off-by: Simon McVittie --- .github/workflows/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f96eb738c..b09ae9447 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,6 +86,10 @@ jobs: set -eu export SDL_TESTS_QUICK=1 ctest -VV --test-dir build/ + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings build/libSDL2-2.0.so.0 | grep SDL- + fi - name: Install (CMake) if: "! matrix.platform.autotools" run: | @@ -141,6 +145,10 @@ jobs: parallel="$(getconf _NPROCESSORS_ONLN)" export SDL_TESTS_QUICK=1 make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL- + fi - name: Install (Autotools) if: matrix.platform.autotools run: | From c3b13346e0a2200f1521cf064b9a602c8196e6a6 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 21 Oct 2022 18:32:53 +0200 Subject: [PATCH 215/459] On x86, pass -nodefaultlib to linker when wanting to avoid the C library --- CMakeLists.txt | 8 +++++++ cmake/CheckCPUArchitecture.cmake | 40 ++++++++++++++++++++++++++++++++ src/stdlib/SDL_mslibc.c | 6 +++++ 3 files changed, 54 insertions(+) create mode 100644 cmake/CheckCPUArchitecture.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8667549..c1c9e91e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ include(GNUInstallDirs) list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) +include(${SDL2_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake) # Enable large file support on 32-bit glibc, so that we can access files # with large inode numbers @@ -3229,6 +3230,13 @@ if(SDL_SHARED) # alias target for in-tree builds add_library(SDL2::SDL2 ALIAS SDL2) set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + if(NOT SDL_LIBC) + check_cpu_architecture(x86 HAS_X86) + if(HAS_X86) + # FIXME: should be added for all architectures (missing symbols for ARM) + target_link_libraries(SDL2 PRIVATE "-nodefaultlib:MSVCRT") + endif() + endif() if(APPLE) # FIXME: Remove SOVERSION in SDL3 set_target_properties(SDL2 PROPERTIES diff --git a/cmake/CheckCPUArchitecture.cmake b/cmake/CheckCPUArchitecture.cmake new file mode 100644 index 000000000..79639f1c2 --- /dev/null +++ b/cmake/CheckCPUArchitecture.cmake @@ -0,0 +1,40 @@ +include(CheckCSourceCompiles) +include(CMakePushCheckState) + +function(_internal_check_cpu_architecture macro_check NAME VARIABLE) + cmake_push_check_state(RESET) + string(TOUPPER "${NAME}" UPPER_NAME) + set(CACHE_VARIABLE "CHECK_CPU_ARCHITECTURE_${UPPER_NAME}") + set(test_src " +int main(int argc, char *argv[]) { +#if ${macro_check} + return 0; +#else + choke +#endif +} +") + check_c_source_compiles("${test_src}" "${CACHE_VARIABLE}") + cmake_pop_check_state() + if(${CACHE_VARIABLE}) + set(${VARIABLE} "TRUE" PARENT_SCOPE) + else() + set(${VARIABLE} "FALSE" PARENT_SCOPE) + endif() +endfunction() + +function(check_cpu_architecture ARCH VARIABLE) + if(ARCH STREQUAL "x86") + _internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE}) + elseif(ARCH STREQUAL "x64") + _internal_check_cpu_architecture("defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" x64 ${VARIABLE}) + elseif(ARCH STREQUAL "arm32") + _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE}) + elseif(ARCH STREQUAL "arm64") + _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE}) + else() + message(WARNING "Unknown CPU architectures (${ARCH}).") + set(${VARIABLE} FALSE) + endif() + set("${VARIABLE}" "${${VARIABLE}}" PARENT_SCOPE) +endfunction() diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c index 02eeb0f1d..8f92463b1 100644 --- a/src/stdlib/SDL_mslibc.c +++ b/src/stdlib/SDL_mslibc.c @@ -126,6 +126,12 @@ _ftol2_sse() _ftol(); } +void +_ftol2() +{ + _ftol(); +} + /* 64-bit math operators for 32-bit systems */ void __declspec(naked) From 2ebaafa6c9334071b664b15d045656250690dd96 Mon Sep 17 00:00:00 2001 From: Deve Date: Tue, 18 Oct 2022 21:02:49 +0200 Subject: [PATCH 216/459] Use translationInView for mouse wheel event --- src/video/uikit/SDL_uikitview.m | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 77d398c20..fea10ff21 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -455,25 +455,36 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; #endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */ +static CGPoint translation_old = (CGPoint){ 0.0, 0.0 }; + -(void)mouseWheelGesture:(UIPanGestureRecognizer *)gesture { if (gesture.state == UIGestureRecognizerStateBegan || - gesture.state == UIGestureRecognizerStateChanged || - gesture.state == UIGestureRecognizerStateEnded) { - CGPoint velocity = [gesture velocityInView:self]; + gesture.state == UIGestureRecognizerStateChanged) { - if (velocity.x > 0.0f) { - velocity.x = -1.0; - } else if (velocity.x < 0.0f) { - velocity.x = 1.0f; + CGPoint translation = [gesture translationInView:self]; + CGPoint mouse_wheel = translation; + + if (gesture.state == UIGestureRecognizerStateChanged) { + mouse_wheel.x -= translation_old.x; + mouse_wheel.y -= translation_old.y; } - if (velocity.y > 0.0f) { - velocity.y = -1.0; - } else if (velocity.y < 0.0f) { - velocity.y = 1.0f; + + translation_old = translation; + + if (mouse_wheel.x > 0.0f) { + mouse_wheel.x = 1.0; + } else if (mouse_wheel.x < 0.0f) { + mouse_wheel.x = -1.0f; } - if (velocity.x != 0.0f || velocity.y != 0.0f) { - SDL_SendMouseWheel(sdlwindow, 0, velocity.x, velocity.y, SDL_MOUSEWHEEL_NORMAL); + if (mouse_wheel.y > 0.0f) { + mouse_wheel.y = 1.0; + } else if (mouse_wheel.y < 0.0f) { + mouse_wheel.y = -1.0f; + } + + if (mouse_wheel.x != 0.0f || mouse_wheel.y != 0.0f) { + SDL_SendMouseWheel(sdlwindow, 0, mouse_wheel.x, mouse_wheel.y, SDL_MOUSEWHEEL_NORMAL); } } } From 413500ab69d9ac288a73946073d4414376ca17d2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 22 Oct 2022 09:37:34 -0700 Subject: [PATCH 217/459] Replaced mouseWheelGesture with GCMouse support on iOS (thanks @russelltg!) Fixes https://github.com/libsdl-org/SDL/issues/6411 --- src/video/uikit/SDL_uikitevents.m | 5 ++++ src/video/uikit/SDL_uikitview.m | 44 ------------------------------- 2 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 61c57b253..e1bc5a29e 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -315,6 +315,11 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14 } }; + mouse.mouseInput.scroll.valueChangedHandler = ^(GCControllerDirectionPad *dpad, float xValue, float yValue) + { + SDL_SendMouseWheel(SDL_GetMouseFocus(), 0, xValue, yValue, SDL_MOUSEWHEEL_NORMAL); + }; + dispatch_queue_t queue = dispatch_queue_create( "org.libsdl.input.mouse", DISPATCH_QUEUE_SERIAL ); dispatch_set_target_queue( queue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0 ) ); mouse.handlerQueue = queue; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index fea10ff21..8c48cfa50 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -69,16 +69,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; swipeRight.direction = UISwipeGestureRecognizerDirectionRight; [self addGestureRecognizer:swipeRight]; -#elif defined(__IPHONE_13_4) - if (@available(iOS 13.4, *)) { - UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelGesture:)]; - mouseWheelRecognizer.allowedScrollTypesMask = UIScrollTypeMaskDiscrete; - mouseWheelRecognizer.allowedTouchTypes = @[ @(UITouchTypeIndirectPointer) ]; - mouseWheelRecognizer.cancelsTouchesInView = NO; - mouseWheelRecognizer.delaysTouchesBegan = NO; - mouseWheelRecognizer.delaysTouchesEnded = NO; - [self addGestureRecognizer:mouseWheelRecognizer]; - } #endif self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; @@ -455,40 +445,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; #endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */ -static CGPoint translation_old = (CGPoint){ 0.0, 0.0 }; - --(void)mouseWheelGesture:(UIPanGestureRecognizer *)gesture -{ - if (gesture.state == UIGestureRecognizerStateBegan || - gesture.state == UIGestureRecognizerStateChanged) { - - CGPoint translation = [gesture translationInView:self]; - CGPoint mouse_wheel = translation; - - if (gesture.state == UIGestureRecognizerStateChanged) { - mouse_wheel.x -= translation_old.x; - mouse_wheel.y -= translation_old.y; - } - - translation_old = translation; - - if (mouse_wheel.x > 0.0f) { - mouse_wheel.x = 1.0; - } else if (mouse_wheel.x < 0.0f) { - mouse_wheel.x = -1.0f; - } - if (mouse_wheel.y > 0.0f) { - mouse_wheel.y = 1.0; - } else if (mouse_wheel.y < 0.0f) { - mouse_wheel.y = -1.0f; - } - - if (mouse_wheel.x != 0.0f || mouse_wheel.y != 0.0f) { - SDL_SendMouseWheel(sdlwindow, 0, mouse_wheel.x, mouse_wheel.y, SDL_MOUSEWHEEL_NORMAL); - } - } -} - #if TARGET_OS_TV -(void)swipeGesture:(UISwipeGestureRecognizer *)gesture { From 8db3a33872cfbefcdfb059beea92338a7873f89e Mon Sep 17 00:00:00 2001 From: Thomas Cashman Date: Sun, 23 Oct 2022 15:45:20 +0100 Subject: [PATCH 218/459] #6433 Fix WINRT_IsScreenKeyboardShown on Xbox --- src/video/winrt/SDL_winrtevents_c.h | 1 + src/video/winrt/SDL_winrtkeyboard.cpp | 50 +++++++++++++++++++++++---- src/video/winrt/SDL_winrtvideo.cpp | 2 ++ 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/video/winrt/SDL_winrtevents_c.h b/src/video/winrt/SDL_winrtevents_c.h index 112318024..67c18b865 100644 --- a/src/video/winrt/SDL_winrtevents_c.h +++ b/src/video/winrt/SDL_winrtevents_c.h @@ -68,6 +68,7 @@ extern void WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args); extern void WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArgs ^args); #if NTDDI_VERSION >= NTDDI_WIN10 +extern void WINTRT_InitialiseInputPaneEvents(_THIS); extern SDL_bool WINRT_HasScreenKeyboardSupport(_THIS); extern void WINRT_ShowScreenKeyboard(_THIS, SDL_Window *window); extern void WINRT_HideScreenKeyboard(_THIS, SDL_Window *window); diff --git a/src/video/winrt/SDL_winrtkeyboard.cpp b/src/video/winrt/SDL_winrtkeyboard.cpp index 40681cb8a..f6ff0a409 100644 --- a/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/src/video/winrt/SDL_winrtkeyboard.cpp @@ -386,6 +386,30 @@ WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArg #if NTDDI_VERSION >= NTDDI_WIN10 +static bool WINRT_InputPaneVisible = false; + +void WINTRT_OnInputPaneShowing(Windows::UI::ViewManagement::InputPane ^ sender, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs ^ args) +{ + WINRT_InputPaneVisible = true; +} + +void WINTRT_OnInputPaneHiding(Windows::UI::ViewManagement::InputPane ^ sender, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs ^ args) +{ + WINRT_InputPaneVisible = false; +} + +void WINTRT_InitialiseInputPaneEvents(_THIS) +{ + using namespace Windows::UI::ViewManagement; + InputPane ^ inputPane = InputPane::GetForCurrentView(); + if (inputPane) { + inputPane->Showing += ref new Windows::Foundation::TypedEventHandler(&WINTRT_OnInputPaneShowing); + inputPane->Hiding += ref new Windows::Foundation::TypedEventHandler(&WINTRT_OnInputPaneHiding); + } +} + SDL_bool WINRT_HasScreenKeyboardSupport(_THIS) { return SDL_TRUE; @@ -414,12 +438,24 @@ SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window) using namespace Windows::UI::ViewManagement; InputPane ^ inputPane = InputPane::GetForCurrentView(); if (inputPane) { - // dludwig@pobox.com: checking inputPane->Visible doesn't seem to detect visibility, - // at least not on the Windows Phone 10.0.10240.0 emulator. Checking - // the size of inputPane->OccludedRect, however, does seem to work. - Windows::Foundation::Rect rect = inputPane->OccludedRect; - if (rect.Width > 0 && rect.Height > 0) { - return SDL_TRUE; + switch (SDL_WinRTGetDeviceFamily()) { + case SDL_WINRT_DEVICEFAMILY_XBOX: + //Documentation recommends using inputPane->Visible + //https://learn.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.inputpane.visible?view=winrt-22621 + //This does not seem to work on latest UWP/Xbox. + //Workaround: Listen to Showing/Hiding events + if (WINRT_InputPaneVisible) { + return SDL_TRUE; + } + break; + default: + //OccludedRect is recommend on universal apps per docs + //https://learn.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.inputpane.visible?view=winrt-22621 + Windows::Foundation::Rect rect = inputPane->OccludedRect; + if (rect.Width > 0 && rect.Height > 0) { + return SDL_TRUE; + } + break; } } return SDL_FALSE; @@ -427,4 +463,4 @@ SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window) #endif // NTDDI_VERSION >= ... -#endif // SDL_VIDEO_DRIVER_WINRT +#endif // SDL_VIDEO_DRIVER_WINRT \ No newline at end of file diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index a71ba9b07..3a7b220b9 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/src/video/winrt/SDL_winrtvideo.cpp @@ -154,6 +154,8 @@ WINRT_CreateDevice(void) device->ShowScreenKeyboard = WINRT_ShowScreenKeyboard; device->HideScreenKeyboard = WINRT_HideScreenKeyboard; device->IsScreenKeyboardShown = WINRT_IsScreenKeyboardShown; + + WINTRT_InitialiseInputPaneEvents(device); #endif #ifdef SDL_VIDEO_OPENGL_EGL From f4d1f5ed54aecbbccf20e4967b14f965196b7694 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 23 Oct 2022 16:35:36 -0700 Subject: [PATCH 219/459] SDL-HIDPS4: fix PS4 Slim controller over BT - it sends the same input report as the it does over USB, but with a larger packet size CR: saml --- src/joystick/hidapi/SDL_hidapi_ps4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 64c3054fc..b2df90e46 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -1010,8 +1010,10 @@ HIDAPI_DriverPS4_IsPacketValid(SDL_DriverPS4_Context *ctx, Uint8 *data, int size case k_EPS4ReportIdUsbState: /* In the case of a DS4 USB dongle, bit[2] of byte 31 indicates if a DS4 is actually connected (indicated by '0'). * For non-dongle, this bit is always 0 (connected). + * This is usually the ID over USB, but the DS4v2 that started shipping with the PS4 Slim will also send this + * packet over BT with a size of 128 */ - if (size == 64 && (data[31] & 0x04) == 0) { + if (size >= 64 && (data[31] & 0x04) == 0) { return SDL_TRUE; } break; From 3d35c085858faab705a75c3065ff151619d2ce28 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sun, 2 Oct 2022 17:30:03 -0700 Subject: [PATCH 220/459] fix a few 'unused but set variable' and 'unused function' warnings --- src/cpuinfo/SDL_cpuinfo.c | 4 ---- src/joystick/windows/SDL_windowsjoystick.c | 3 +-- src/render/SDL_render.c | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index c05c88cd4..540f6a54e 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -1152,8 +1152,6 @@ SDL_SIMDRealloc(void *mem, const size_t len) } if (mem) { - void **realptr = (void **) mem; - realptr--; mem = *(((void **) mem) - 1); /* Check the delta between the real pointer and user pointer */ @@ -1193,8 +1191,6 @@ void SDL_SIMDFree(void *ptr) { if (ptr) { - void **realptr = (void **) ptr; - realptr--; SDL_free(*(((void **) ptr) - 1)); } } diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index a79e34019..ccd8f37bb 100644 --- a/src/joystick/windows/SDL_windowsjoystick.c +++ b/src/joystick/windows/SDL_windowsjoystick.c @@ -522,7 +522,6 @@ WINDOWS_JoystickGetCount(void) static void WINDOWS_JoystickDetect(void) { - int device_index = 0; JoyStick_DeviceData *pCurList = NULL; /* only enum the devices if the joystick thread told us something changed */ @@ -570,7 +569,7 @@ WINDOWS_JoystickDetect(void) pCurList = pListNext; } - for (device_index = 0, pCurList = SYS_Joystick; pCurList; ++device_index, pCurList = pCurList->pNext) { + for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) { if (pCurList->send_add_event) { if (pCurList->bXInputDevice) { #if SDL_HAPTIC_XINPUT diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index d2d94f249..082545ff0 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -900,6 +900,7 @@ SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, return 0; } +#if !SDL_RENDER_DISABLED static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer) { @@ -953,6 +954,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind } renderer->simulate_vsync_interval = (1000 / refresh_rate); } +#endif SDL_Renderer * SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) From dd72f3f03d207b23d9a7a2845950f49ded5a825f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 24 Oct 2022 10:37:43 -0700 Subject: [PATCH 221/459] Added comment for #endif --- src/render/SDL_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 082545ff0..722147c3e 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -954,7 +954,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind } renderer->simulate_vsync_interval = (1000 / refresh_rate); } -#endif +#endif /* !SDL_RENDER_DISABLED */ SDL_Renderer * SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) From 019e9d4c929535531d12a1bb6b6f18dff3c211bd Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Thu, 25 Aug 2022 23:15:58 -0700 Subject: [PATCH 222/459] SDL_cocoavideo.m: add missing SDL_cocoaopengles.h include --- src/video/cocoa/SDL_cocoavideo.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index b093e2efc..6c3d44efa 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -32,6 +32,7 @@ #include "SDL_cocoashape.h" #include "SDL_cocoavulkan.h" #include "SDL_cocoametalview.h" +#include "SDL_cocoaopengles.h" @implementation SDL_VideoData From d2300516c3998277c993fd4ac336fbb4ba71641a Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Wed, 7 Sep 2022 06:49:02 -0700 Subject: [PATCH 223/459] cocoa: set sRGB colorspace on nswindow This makes the colorspace match across different graphics APIs. By default, OpenGL was getting a much more saturated colorspace (maybe Display P3?) and it was looking very different from the rendering done by Metal or MoltenVK. --- src/video/cocoa/SDL_cocoawindow.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index c79cdc845..ec223c6d3 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1743,6 +1743,8 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("%s", [[e reason] UTF8String]); } + [nswindow setColorSpace:[NSColorSpace sRGBColorSpace]]; + #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 /* Added in the 10.12.0 SDK. */ /* By default, don't allow users to make our window tabbed in 10.12 or later */ if ([nswindow respondsToSelector:@selector(setTabbingMode:)]) { From b6e7c743db663713df85bdadc83dbcd9de61c274 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Thu, 25 Aug 2022 20:21:03 -0700 Subject: [PATCH 224/459] SDL_cpuinfo: define __ARM_ARCH=8 for _M_ARM64 Microsoft's compiler doesn't define __ARM_ARCH, but we have several places that use it. --- include/SDL_cpuinfo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL_cpuinfo.h b/include/SDL_cpuinfo.h index 43a8ac501..b5ad0fcb8 100644 --- a/include/SDL_cpuinfo.h +++ b/include/SDL_cpuinfo.h @@ -90,6 +90,7 @@ _m_prefetch(void *__P) # include # include # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ +# define __ARM_ARCH 8 # endif # endif #endif From 053b5f85f164dd2f730a6500096a666001dc9d5b Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Thu, 25 Aug 2022 20:18:03 -0700 Subject: [PATCH 225/459] SDL_windowsevents: minimize white screen flash on window creation Clear the window to black on the initial window draw, to avoid a really obnoxious white flash. This doesn't always eliminate it, but it definitely minimizes it. --- src/video/windows/SDL_windowsevents.c | 8 ++++++++ src/video/windows/SDL_windowsvideo.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index e5903fdd3..7370f9e5c 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1271,7 +1271,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* We'll do our own drawing, prevent flicker */ case WM_ERASEBKGND: + if (!data->videodata->cleared) { + RECT client_rect; + HBRUSH brush; + data->videodata->cleared = SDL_TRUE; + GetClientRect(hwnd, &client_rect); + brush = CreateSolidBrush(0); + FillRect(GetDC(hwnd), &client_rect, brush); + DeleteObject(brush); } return (1); diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index e07c34443..cdebb4cfa 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/src/video/windows/SDL_windowsvideo.h @@ -394,6 +394,7 @@ typedef struct SDL_VideoData #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ SDL_bool dpi_scaling_enabled; + SDL_bool cleared; #ifndef SDL_DISABLE_WINDOWS_IME SDL_bool ime_com_initialized; From 20beed302923ad20af1d91d1bf889aed8b1a0139 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 25 Oct 2022 14:56:32 +0300 Subject: [PATCH 226/459] SDL_EGL_GetProcAddress: remove unnecessary underscore-prepended search. Closes https://github.com/libsdl-org/SDL/issues/6236. --- src/video/SDL_egl.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index c768b9914..28d02b132 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -256,23 +256,13 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) #if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ if (!retval) { - static char procname[64]; retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); - /* just in case you need an underscore prepended... */ - if (!retval && (SDL_strlen(proc) < (sizeof (procname) - 1))) { - procname[0] = '_'; - SDL_strlcpy(procname + 1, proc, sizeof (procname) - 1); - retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, procname); - } } #endif /* Try eglGetProcAddress if we're on <= 1.4 and still searching... */ if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); - if (retval) { - return retval; - } } return retval; From a6018ae57fb26140777f43c13a6599d710183c86 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 10:23:51 -0700 Subject: [PATCH 227/459] Added support for the NVIDIA SHIELD controller v1.03 to the HIDAPI driver --- src/joystick/SDL_gamecontroller.c | 5 + src/joystick/SDL_joystick.c | 4 +- src/joystick/hidapi/SDL_hidapi_shield.c | 167 +++++++++++++++++++++-- src/joystick/hidapi/SDL_hidapijoystick.c | 8 ++ src/joystick/usb_ids.h | 3 +- 5 files changed, 171 insertions(+), 16 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 89f590e23..19203f639 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -664,6 +664,11 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI case SDL_CONTROLLER_TYPE_NVIDIA_SHIELD: /* The NVIDIA SHIELD controller has a share button between back and start buttons */ SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string)); + + if (product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103) { + /* The original SHIELD controller has a touchpad as well */ + SDL_strlcat(mapping_string, "touchpad:b16,", sizeof(mapping_string)); + } break; default: if (vendor == 0 && product == 0) { diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 5561afcd1..93322e7c6 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2126,7 +2126,9 @@ SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) { type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR; - } else if (vendor == USB_VENDOR_NVIDIA && product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER) { + } else if (vendor == USB_VENDOR_NVIDIA && + (product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103 || + product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104)) { type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD; } else { diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c index 1fa75b74a..1d54676b8 100644 --- a/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/src/joystick/hidapi/SDL_hidapi_shield.c @@ -49,8 +49,19 @@ /* Reports that are too small are dropped over Bluetooth */ #define HID_REPORT_SIZE 33 +enum +{ + SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD = SDL_CONTROLLER_BUTTON_MISC1 + 1, + SDL_CONTROLLER_BUTTON_SHIELD_V103_MINUS, + SDL_CONTROLLER_BUTTON_SHIELD_V103_PLUS, + SDL_CONTROLLER_NUM_SHIELD_V103_BUTTONS, + + SDL_CONTROLLER_NUM_SHIELD_V104_BUTTONS = SDL_CONTROLLER_BUTTON_MISC1 + 1, +}; + typedef enum { k_ShieldReportIdControllerState = 0x01, + k_ShieldReportIdControllerTouch = 0x02, k_ShieldReportIdCommandResponse = 0x03, k_ShieldReportIdCommandRequest = 0x04, } EShieldReportId; @@ -180,9 +191,17 @@ HIDAPI_DriverShield_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti SDL_zeroa(ctx->last_state); /* Initialize the joystick capabilities */ - joystick->nbuttons = 16; - joystick->naxes = SDL_CONTROLLER_AXIS_MAX; - joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + if (device->product_id == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103) { + joystick->nbuttons = SDL_CONTROLLER_NUM_SHIELD_V103_BUTTONS; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + + SDL_PrivateJoystickAddTouchpad(joystick, 1); + } else { + joystick->nbuttons = SDL_CONTROLLER_NUM_SHIELD_V104_BUTTONS; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + } /* Request battery and charging info */ ctx->last_battery_query_time = SDL_GetTicks(); @@ -215,19 +234,32 @@ HIDAPI_DriverShield_SendNextRumble(SDL_HIDAPI_Device *device) static int HIDAPI_DriverShield_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { - SDL_DriverShield_Context *ctx = device->context; + if (device->product_id == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103) { + Uint8 rumble_packet[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - /* The rumble motors are quite intense, so tone down the intensity like the official driver does */ - ctx->left_motor_amplitude = low_frequency_rumble >> 11; - ctx->right_motor_amplitude = high_frequency_rumble >> 11; - ctx->rumble_update_pending = SDL_TRUE; + rumble_packet[2] = (low_frequency_rumble >> 8); + rumble_packet[4] = (high_frequency_rumble >> 8); - if (ctx->rumble_report_pending) { - /* We will service this after the hardware acknowledges the previous request */ + if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) { + return SDL_SetError("Couldn't send rumble packet"); + } return 0; - } - return HIDAPI_DriverShield_SendNextRumble(device); + } else { + SDL_DriverShield_Context *ctx = device->context; + + /* The rumble motors are quite intense, so tone down the intensity like the official driver does */ + ctx->left_motor_amplitude = low_frequency_rumble >> 11; + ctx->right_motor_amplitude = high_frequency_rumble >> 11; + ctx->rumble_update_pending = SDL_TRUE; + + if (ctx->rumble_report_pending) { + /* We will service this after the hardware acknowledges the previous request */ + return 0; + } + + return HIDAPI_DriverShield_SendNextRumble(device); + } } static int @@ -271,7 +303,104 @@ HIDAPI_DriverShield_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joy } static void -HIDAPI_DriverShield_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverShield_Context *ctx, Uint8 *data, int size) +HIDAPI_DriverShield_HandleStatePacketV103(SDL_Joystick *joystick, SDL_DriverShield_Context *ctx, Uint8 *data, int size) +{ + if (ctx->last_state[3] != data[3]) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (data[3]) { + case 0: + dpad_up = SDL_TRUE; + break; + case 1: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 2: + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 4: + dpad_down = SDL_TRUE; + break; + case 5: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + break; + case 7: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + + if (ctx->last_state[1] != data[1]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[1] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[1] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[2] != data[2]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_PLUS, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_MINUS, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, SDL_SwapLE16(*(Sint16*)&data[4]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, SDL_SwapLE16(*(Sint16*)&data[6]) - 0x8000); + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16*)&data[8]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16*)&data[10]) - 0x8000); + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_SwapLE16(*(Sint16*)&data[12]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_SwapLE16(*(Sint16*)&data[14]) - 0x8000); + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} + +#undef clamp +#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) + +static void +HIDAPI_DriverShield_HandleTouchPacketV103(SDL_Joystick *joystick, SDL_DriverShield_Context *ctx, Uint8 *data, int size) +{ + Uint8 touchpad_state; + float touchpad_x, touchpad_y; + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + + /* It's a triangular pad, but just use the center as the usable touch area */ + touchpad_state = ((data[1] & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_x = clamp((float)(data[2] - 0x70) / 0x50, 0.0f, 1.0f); + touchpad_y = clamp((float)(data[4] - 0x40) / 0x15, 0.0f, 1.0f); + SDL_PrivateJoystickTouchpad(joystick, 0, 0, touchpad_state, touchpad_x, touchpad_y, touchpad_state ? 1.0f : 0.0f); +} + +static void +HIDAPI_DriverShield_HandleStatePacketV104(SDL_Joystick *joystick, SDL_DriverShield_Context *ctx, Uint8 *data, int size) { if (size < 23) { return; @@ -380,7 +509,17 @@ HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device) if (!joystick) { break; } - HIDAPI_DriverShield_HandleStatePacket(joystick, ctx, data, size); + if (size == 16) { + HIDAPI_DriverShield_HandleStatePacketV103(joystick, ctx, data, size); + } else { + HIDAPI_DriverShield_HandleStatePacketV104(joystick, ctx, data, size); + } + break; + case k_ShieldReportIdControllerTouch: + if (!joystick) { + break; + } + HIDAPI_DriverShield_HandleTouchPacketV103(joystick, ctx, data, size); break; case k_ShieldReportIdCommandResponse: cmd_resp_report = (ShieldCommandReport_t*)data; diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 37bed785a..16909a042 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1038,6 +1038,14 @@ HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Devi } } } + + if (vendor_id == USB_VENDOR_NVIDIA) { + /* If we're looking for the NVIDIA SHIELD controller Xbox interface, match it against any NVIDIA SHIELD controller */ + if (product_id == 0xb400 && + device->type == SDL_CONTROLLER_TYPE_NVIDIA_SHIELD) { + return SDL_TRUE; + } + } return SDL_FALSE; } diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index 7c006d1e6..d06cecacc 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -82,7 +82,8 @@ #define USB_PRODUCT_NINTENDO_SWITCH_PRO 0x2009 #define USB_PRODUCT_NINTENDO_WII_REMOTE 0x0306 #define USB_PRODUCT_NINTENDO_WII_REMOTE2 0x0330 -#define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER 0x7214 +#define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103 0x7210 +#define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104 0x7214 #define USB_PRODUCT_RAZER_ATROX 0x0a00 #define USB_PRODUCT_RAZER_PANTHERA 0x0401 #define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008 From da478d1f664bb3d5959d6e354431023d7ad91c2f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 10:30:56 -0700 Subject: [PATCH 228/459] Fixed build --- src/joystick/hidapi/SDL_hidapijoystick.c | 1 + test/testautomation_joystick.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 16909a042..ecb8bf00c 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -816,6 +816,7 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H return NULL; } +#define DEBUG_HIDAPI #ifdef DEBUG_HIDAPI SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); #endif diff --git a/test/testautomation_joystick.c b/test/testautomation_joystick.c index 198128e9c..3baa4ee58 100644 --- a/test/testautomation_joystick.c +++ b/test/testautomation_joystick.c @@ -30,7 +30,7 @@ TestVirtualJoystick(void *arg) desc.naxes = SDL_CONTROLLER_AXIS_MAX; desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX; desc.vendor_id = USB_VENDOR_NVIDIA; - desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER; + desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104; desc.name = "Virtual NVIDIA SHIELD Controller"; device_index = SDL_JoystickAttachVirtualEx(&desc); SDLTest_AssertCheck(device_index >= 0, "SDL_JoystickAttachVirtualEx()"); From 5fbf8f6cf03eca6eb1305d27d85c2cf7181b1dd8 Mon Sep 17 00:00:00 2001 From: Alynne Date: Tue, 25 Oct 2022 12:37:17 -0400 Subject: [PATCH 229/459] Adds DualSense Edge --- src/joystick/controller_type.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index 3f7c45586..1279d0ffe 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -148,6 +148,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0c12, 0x0e20 ), k_eControllerType_PS4Controller, NULL }, // Brook Mars Controller - needs FW update to show up as Ps4 controller on PC. Has Gyro but touchpad is a single button. { MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony PS5 Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x0df2 ), k_eControllerType_PS5Controller, NULL }, // Sony DualSense Edge Controller { MAKE_CONTROLLER_ID( 0x0f0d, 0x0163 ), k_eControllerType_PS5Controller, NULL }, // HORI Fighting Commander OCTA { MAKE_CONTROLLER_ID( 0x0f0d, 0x0184 ), k_eControllerType_PS5Controller, NULL }, // Hori Fighting Stick α From 98dfc9296a35194da4aa8cdd187285f6b60159e8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 25 Oct 2022 14:03:32 -0400 Subject: [PATCH 230/459] build-scripts/fnsince.pl: Deal with new point-release system. This ignores 2.x.1 (etc) releases, which prevents it from thinking the next official non-point-release version is 2.26.1, when it should be 2.26.0, because it saw the "latest" release is 2.24.1. This fixes the wiki ending up with imaginary version numbers for the "this function is available since SDL 2.x.y" sections. Fixes #6343. --- build-scripts/fnsince.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build-scripts/fnsince.pl b/build-scripts/fnsince.pl index fde65c862..d49fa54e9 100755 --- a/build-scripts/fnsince.pl +++ b/build-scripts/fnsince.pl @@ -19,7 +19,15 @@ open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n"; while () { chomp; if (/\Arelease\-(.*?)\Z/) { - push @unsorted_releases, $1; + # After 2.24.x, ignore anything that isn't a x.y.0 release. + # We moved to bugfix-only point releases there, so make sure new APIs + # are assigned to the next minor version and ignore the patch versions. + my $ver = $1; + my @versplit = split /\./, $ver; + next if (scalar(@versplit) > 2) && (($versplit[0] > 2) || (($versplit[0] == 2) && ($versplit[1] >= 24))) && ($versplit[2] != 0); + + # Consider this release version. + push @unsorted_releases, $ver; } } From 393acf6362be872eafa4d4c769f1d54eeaa5322c Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 25 Oct 2022 18:07:13 +0000 Subject: [PATCH 231/459] Sync SDL wiki -> header --- include/SDL_clipboard.h | 6 +++--- include/SDL_gamecontroller.h | 2 +- include/SDL_hints.h | 2 +- include/SDL_joystick.h | 2 +- include/SDL_sensor.h | 2 +- include/SDL_video.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 9bc501b74..783c7c251 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -89,7 +89,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText @@ -108,7 +108,7 @@ extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * call SDL_free() on the returned pointer when done with it (even if * there was an error). * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText @@ -122,7 +122,7 @@ extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it * does not. * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 09320cc2d..05eeec0ce 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -910,7 +910,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController * * \param num_values The number of values to write to data * \return 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 600989e58..d7849a4d4 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -2444,7 +2444,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); * variable, or NULL if the environment isn't set. Callbacks will be called * normally with this change. * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_GetHint * \sa SDL_SetHint diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index c5091458a..72c6604df 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -665,7 +665,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha * \param crc16 A pointer filled in with a CRC used to distinguish different * products with the same VID/PID, or 0 if not available * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_JoystickGetDeviceGUID */ diff --git a/include/SDL_sensor.h b/include/SDL_sensor.h index 7c9e4cc97..684d2c6eb 100644 --- a/include/SDL_sensor.h +++ b/include/SDL_sensor.h @@ -282,7 +282,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, i * \param num_values The number of values to write to data * \returns 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. */ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values); diff --git a/include/SDL_video.h b/include/SDL_video.h index d9dce43a9..79d572fcc 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1059,7 +1059,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, * \param h a pointer to variable for storing the height in pixels, may be * NULL * - * \since This function is available since SDL 2.26.1. + * \since This function is available since SDL 2.26.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize From e3f5744db42fe66453fb780a8d2412846849f45b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 12:14:00 -0700 Subject: [PATCH 232/459] Don't use XIWarpPointer() on multi-display configurations --- src/video/x11/SDL_x11mouse.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 3bf762d3f..04c5b8c47 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -317,7 +317,12 @@ WarpMouseInternal(Window xwindow, const int x, const int y) Display *display = videodata->display; #if SDL_VIDEO_DRIVER_X11_XINPUT2 int deviceid = 0; - X11_XIGetClientPointer(display, None, &deviceid); + /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: + * https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea + */ + if (SDL_GetNumVideoDisplays() == 1) { + X11_XIGetClientPointer(display, None, &deviceid); + } if (deviceid != 0) { X11_XIWarpPointer(display, deviceid, None, xwindow, 0.0, 0.0, 0, 0, (double)x, (double)y); } else From 72f6e216dc5e633e29759b661a17af06d9aefbc6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 12:25:57 -0700 Subject: [PATCH 233/459] Disabled debug logging --- src/joystick/hidapi/SDL_hidapijoystick.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index ecb8bf00c..16909a042 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -816,7 +816,6 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H return NULL; } -#define DEBUG_HIDAPI #ifdef DEBUG_HIDAPI SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); #endif From c74ea994a55f59df8191ccf3968ea269ba2680e0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 13:11:41 -0700 Subject: [PATCH 234/459] Added support for the Razer Raiju Tournament Edition controller in Bluetooth mode --- src/joystick/hidapi/SDL_hidapi_ps4.c | 18 +++++++++++++++--- src/joystick/usb_ids.h | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index b2df90e46..52326a9e4 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -374,6 +374,11 @@ HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) /* The Razer Raiju doesn't respond to the detection protocol, but has a touchpad and vibration */ ctx->vibration_supported = SDL_TRUE; ctx->touchpad_supported = SDL_TRUE; + + if (device->product_id == USB_PRODUCT_RAZER_TOURNAMENT_EDITION_BLUETOOTH || + device->product_id == USB_PRODUCT_RAZER_ULTIMATE_EDITION_BLUETOOTH) { + device->is_bluetooth = SDL_TRUE; + } } ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported); @@ -679,7 +684,14 @@ HIDAPI_DriverPS4_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) /* Initialize the joystick capabilities */ joystick->nbuttons = ctx->touchpad_supported ? 16 : 15; joystick->naxes = SDL_CONTROLLER_AXIS_MAX; - joystick->epowerlevel = device->is_bluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED; + if (device->is_bluetooth && ctx->official_controller) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + } else if (device->is_bluetooth) { + /* We can't get the power status, assume it's full */ + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + } else { + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + } if (ctx->enhanced_mode) { /* Force initialization when opening the joystick */ @@ -765,7 +777,7 @@ HIDAPI_DriverPS4_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joy SDL_zeroa(data); - if (device->is_bluetooth) { + if (device->is_bluetooth && ctx->official_controller) { data[0] = k_EPS4ReportIdBluetoothEffects; data[1] = 0xC0 | 0x04; /* Magic value HID + CRC, also sets interval to 4ms for samples */ data[3] = 0x03; /* 0x1 is rumble, 0x2 is lightbar, 0x4 is the blink interval */ @@ -919,7 +931,7 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, axis = ((int)packet->ucRightJoystickY * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); - if (ctx->device->is_bluetooth) { + if (ctx->device->is_bluetooth && ctx->official_controller) { if (packet->ucBatteryLevel & 0x10) { SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index d06cecacc..dd390f1d2 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -88,6 +88,10 @@ #define USB_PRODUCT_RAZER_PANTHERA 0x0401 #define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008 #define USB_PRODUCT_RAZER_RAIJU 0x1000 +#define USB_PRODUCT_RAZER_TOURNAMENT_EDITION_USB 0x1007 +#define USB_PRODUCT_RAZER_TOURNAMENT_EDITION_BLUETOOTH 0x100a +#define USB_PRODUCT_RAZER_ULTIMATE_EDITION_USB 0x1004 +#define USB_PRODUCT_RAZER_ULTIMATE_EDITION_BLUETOOTH 0x1009 #define USB_PRODUCT_SHANWAN_DS3 0x0523 #define USB_PRODUCT_SONY_DS3 0x0268 #define USB_PRODUCT_SONY_DS4 0x05c4 From b6cf889af45c31b650428e4dbe476daf21be3c9e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 15:09:43 -0700 Subject: [PATCH 235/459] Use ScreenCount() instead of SDL_GetNumVideoDisplays() The limitation appears to be specific to multi-screen setups --- src/video/x11/SDL_x11mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 04c5b8c47..96a25a2b9 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -320,7 +320,7 @@ WarpMouseInternal(Window xwindow, const int x, const int y) /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: * https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea */ - if (SDL_GetNumVideoDisplays() == 1) { + if (ScreenCount(display) == 1) { X11_XIGetClientPointer(display, None, &deviceid); } if (deviceid != 0) { From e837debc2551af5f158a34a0bd584801e2deb0c2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 16:13:50 -0700 Subject: [PATCH 236/459] Bindings should have a trailing comma, so the CRC can be appended --- src/joystick/SDL_gamecontroller.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 19203f639..2c47f2372 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -1330,7 +1330,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const /* The Linux driver xpad.c maps the wireless dpad to buttons */ SDL_bool existing; mapping = SDL_PrivateAddMappingForGUID(guid, -"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3", +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } else if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) { mapping = s_pXInputMapping; @@ -1420,16 +1420,6 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefttrigger", &raw_map->lefttrigger); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "righttrigger", &raw_map->righttrigger); - /* Remove trailing comma */ - { - int pos = (int)SDL_strlen(mapping) - 1; - if (pos >= 0) { - if (mapping[pos] == ',') { - mapping[pos] = '\0'; - } - } - } - return SDL_PrivateAddMappingForGUID(guid, mapping, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } From 25d0473aadd99ac454039444e2ed2c343466ac6c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 16:14:26 -0700 Subject: [PATCH 237/459] Removed Razer Onza Tournament Edition mapping The controller can use either hat or buttons for the D-Pad, depending on what Linux driver is in use. The automatic mapping in LINUX_JoystickGetGamepadMapping() will do the right thing based on the exposed capability bits. I'm sure this is the case for other controllers as well, so we might be removing more mappings over time. --- src/joystick/SDL_gamecontrollerdb.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index dd122703a..c6c29e5d6 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -759,7 +759,6 @@ static const char *s_ControllerMappings [] = "03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000008916000000fd000024010000,Razer Onza Tournament Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000321500000104000011010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", From 30c2dac78718f68d6365aec3849c99c7eb805916 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 25 Oct 2022 20:00:38 -0400 Subject: [PATCH 238/459] wayland: Remove duplicate #include statement --- src/video/wayland/SDL_waylandvideo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 2a54d28cb..666e4efb0 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -55,7 +55,6 @@ #include "tablet-unstable-v2-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h" #include "viewporter-client-protocol.h" -#include "viewporter-client-protocol.h" #include "primary-selection-unstable-v1-client-protocol.h" #ifdef HAVE_LIBDECOR_H From c8d20f96ba966c8624c973da44214524b764c929 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 25 Oct 2022 23:13:34 -0400 Subject: [PATCH 239/459] shape: Free platform-specific shaped window data. Fixes #2128. --- src/video/cocoa/SDL_cocoawindow.m | 6 ++++++ src/video/os2/SDL_os2video.c | 11 +++++++++++ src/video/windows/SDL_windowsshape.c | 10 +++++++--- src/video/windows/SDL_windowswindow.c | 13 +++++++++++++ src/video/x11/SDL_x11window.c | 10 ++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index ec223c6d3..eea7f981a 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -2370,6 +2370,12 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window) } #endif /* SDL_VIDEO_OPENGL */ + + if (window->shaper) { + CFBridgingRelease(window->shaper->driverdata); + SDL_free(window->shaper); + window->shaper = NULL; + } } window->driverdata = NULL; }} diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c index a9599c8f3..599384edf 100644 --- a/src/video/os2/SDL_os2video.c +++ b/src/video/os2/SDL_os2video.c @@ -914,6 +914,17 @@ static void OS2_DestroyWindow(_THIS, SDL_Window * window) if (pWinData == NULL) return; + if (pWinData->hrgnShape != NULLHANDLE) { + HPS hps = WinGetPS(pWinData->hwnd); + GpiDestroyRegion(hps, pWinData->hrgnShape); + WinReleasePS(hps); + } + + if (window->shaper) { + SDL_free(window->shaper); + window->shaper = NULL; + } + if (pWinData->fnUserWndProc == NULL) { /* Window was created by SDL (OS2_CreateWindow()), * not by user (OS2_CreateWindowFrom()) */ diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index ef716a506..919076f9a 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -36,11 +36,15 @@ Win32_CreateShaper(SDL_Window * window) { result->hasshape = SDL_FALSE; result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData)); ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL; - /* Put some driver-data here. */ window->shaper = result; + /* Put some driver-data here. */ resized_properly = Win32_ResizeWindowShape(window); - if (resized_properly != 0) - return NULL; + if (resized_properly != 0) { + SDL_free(result->driverdata); + SDL_free(result); + window->shaper = NULL; + return NULL; + } return result; } diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 77417b28d..488b6fe1a 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -34,6 +34,7 @@ #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" +#include "SDL_windowsshape.h" #include "SDL_hints.h" #include "SDL_timer.h" @@ -1168,6 +1169,18 @@ WIN_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) void WIN_DestroyWindow(_THIS, SDL_Window * window) { + if (window->shaper) { + SDL_ShapeData *shapedata = (SDL_ShapeData *) window->shaper->driverdata; + if (shapedata) { + if (shapedata->mask_tree) { + SDL_FreeShapeTree(&shapedata->mask_tree); + } + SDL_free(shapedata); + } + SDL_free(window->shaper); + window->shaper = NULL; + } + CleanupWindowData(_this, window); } diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index bfba775f2..770116bb0 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1686,6 +1686,16 @@ X11_DestroyWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (window->shaper) { + SDL_ShapeData *shapedata = (SDL_ShapeData *) window->shaper->driverdata; + if (shapedata) { + SDL_free(shapedata->bitmap); + SDL_free(shapedata); + } + SDL_free(window->shaper); + window->shaper = NULL; + } + if (data) { SDL_VideoData *videodata = (SDL_VideoData *) data->videodata; Display *display = videodata->display; From 41d38c0f64a4d7da0b2d1e9d2711c30bc136a180 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 26 Oct 2022 09:43:04 -0400 Subject: [PATCH 240/459] shape: More robust handling of failure cases in CreateShaper. --- src/video/cocoa/SDL_cocoashape.m | 8 +++++++- src/video/directfb/SDL_DirectFB_shape.c | 9 +++++++++ src/video/windows/SDL_windowsshape.c | 12 ++++++++++-- src/video/x11/SDL_x11shape.c | 23 +++++++++++++++++------ 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 6dbd64bd2..ac3459c56 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/src/video/cocoa/SDL_cocoashape.m @@ -47,11 +47,17 @@ Cocoa_CreateShaper(SDL_Window* window) SDL_ShapeData* data; int resized_properly; SDL_WindowData* windata = (__bridge SDL_WindowData*)window->driverdata; + + result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); + if (!result) { + SDL_OutOfMemory(); + return NULL; + } + [windata.nswindow setOpaque:NO]; [windata.nswindow setStyleMask:NSWindowStyleMaskBorderless]; - result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c index ff334c804..b6f5d0811 100644 --- a/src/video/directfb/SDL_DirectFB_shape.c +++ b/src/video/directfb/SDL_DirectFB_shape.c @@ -35,11 +35,20 @@ DirectFB_CreateShaper(SDL_Window* window) { int resized_properly; result = SDL_malloc(sizeof(SDL_WindowShaper)); + if (!result) { + SDL_OutOfMemory(); + return NULL; + } result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; data = SDL_malloc(sizeof(SDL_ShapeData)); + if (!data) { + SDL_free(result); + SDL_OutOfMemory(); + return NULL; + } result->driverdata = data; data->surface = NULL; window->shaper = result; diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index 919076f9a..484566dd3 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -29,13 +29,21 @@ SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window) { int resized_properly; SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); + if (!result) { + SDL_OutOfMemory(); + return NULL; + } result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; result->hasshape = SDL_FALSE; - result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData)); - ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL; + result->driverdata = (SDL_ShapeData*)SDL_calloc(1, sizeof(SDL_ShapeData)); + if (!result->driverdata) { + SDL_free(result); + SDL_OutOfMemory(); + return NULL; + } window->shaper = result; /* Put some driver-data here. */ resized_properly = Win32_ResizeWindowShape(window); diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 7d78f1127..7d4e32c22 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/src/video/x11/SDL_x11shape.c @@ -31,22 +31,34 @@ SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; SDL_ShapeData* data = NULL; - int resized_properly; #if SDL_VIDEO_DRIVER_X11_XSHAPE if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */ result = SDL_malloc(sizeof(SDL_WindowShaper)); + if (!result) { + SDL_OutOfMemory(); + return NULL; + } result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; data = SDL_malloc(sizeof(SDL_ShapeData)); + if (!data) { + SDL_free(result); + SDL_OutOfMemory(); + return NULL; + } result->driverdata = data; data->bitmapsize = 0; data->bitmap = NULL; window->shaper = result; - resized_properly = X11_ResizeWindowShape(window); - SDL_assert(resized_properly == 0); + if (X11_ResizeWindowShape(window) != 0) { + SDL_free(result); + SDL_free(data); + window->shaper = NULL; + return NULL; + } } #endif @@ -64,11 +76,10 @@ X11_ResizeWindowShape(SDL_Window* window) { bitmapsize *= window->h; if(data->bitmapsize != bitmapsize || data->bitmap == NULL) { data->bitmapsize = bitmapsize; - if(data->bitmap != NULL) - SDL_free(data->bitmap); + SDL_free(data->bitmap); data->bitmap = SDL_malloc(data->bitmapsize); if(data->bitmap == NULL) { - return SDL_SetError("Could not allocate memory for shaped-window bitmap."); + return SDL_OutOfMemory(); } } SDL_memset(data->bitmap,0,data->bitmapsize); From 11a24a34e3e4dc72d573b87a6300acddb6ea4099 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 26 Oct 2022 22:30:06 +0000 Subject: [PATCH 241/459] Sync SDL wiki -> header --- include/SDL_gamecontroller.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 05eeec0ce..4703b6394 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -754,7 +754,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom * The caller should not SDL_free() the returned string. * * \param button an enum value for a given SDL_GameControllerButton - * \returns a string for the given button, or NULL if an invalid axis is + * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by * SDL_GameController mapping strings. * From 4223e6ac7a1de27b24d63b955ac9e183a79dbb34 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 26 Oct 2022 13:14:50 -0400 Subject: [PATCH 242/459] wayland: Early-out sooner when requesting fullscreen on a popup Exit the fullscreen sequence sooner if it is requested that a popup window be fullscreen. The surface commit formerly in this path is irrelevant and can be removed as previous changes made it so that SetFullscreen() is no longer called from anywhere except Wayland_SetWindowFullscreen(). --- src/video/wayland/SDL_waylandwindow.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 8d7beb3c6..3c938bd53 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -392,13 +392,6 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = wind->waylandData; - /* Pop-ups don't get to be fullscreened */ - if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { - /* ... but we still want to commit, particularly for ShowWindow */ - wl_surface_commit(wind->surface); - return; - } - /* The desktop may try to enforce min/max sizes here, so turn them off for * fullscreen and on (if applicable) for windowed */ @@ -1732,8 +1725,8 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - /* Called from within a configure event, drop it. */ - if (wind->in_fullscreen_transition) { + /* Called from within a configure event or the window is a popup, drop it. */ + if (wind->in_fullscreen_transition || wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { return; } From 9e8d2f3948139d71fd29cd69e42733e9c5a24582 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 27 Oct 2022 13:54:53 -0400 Subject: [PATCH 243/459] video: Don't use texture framebuffer on Windows Subsystem for Linux. Reference Issue #6333. --- src/video/SDL_video.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index bb2036108..321d6d026 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -56,6 +56,13 @@ #include #endif +#ifdef __LINUX__ +#include +#include +#include +#endif + + /* Available video drivers */ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_COCOA @@ -2640,6 +2647,15 @@ SDL_CreateWindowFramebuffer(SDL_Window * window) attempt_texture_framebuffer = SDL_FALSE; } +#if defined(__LINUX__) + /* On WSL, direct X11 is faster than using OpenGL for window framebuffers, so try to detect WSL and avoid texture framebuffer. */ + else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "x11") == 0)) { + struct stat sb; + if ((stat("/proc/sys/fs/binfmt_misc/WSLInterop", &sb) == 0) || (stat("/run/WSL", &sb) == 0)) { /* if either of these exist, we're on WSL. */ + attempt_texture_framebuffer = SDL_FALSE; + } + } +#endif #if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) { attempt_texture_framebuffer = SDL_FALSE; From f500c1476634d07ab9c532ad78d1dab2a93c7869 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 28 Oct 2022 08:39:02 -0700 Subject: [PATCH 244/459] Fixed DirectFB build --- src/video/directfb/SDL_DirectFB_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 897a1687d..71aac7669 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -686,7 +686,7 @@ EnumKeyboards(DFBInputDeviceID device_id, devdata->keyboard[devdata->num_keyboard].map = SDL_GetScancodeTable(SDL_SCANCODE_TABLE_XFREE86_2, &devdata->keyboard[devdata->num_keyboard].map_size); devdata->keyboard[devdata->num_keyboard].map_adjust = 8; } else { - devdata->keyboard[devdata->num_keyboard].map = SDL_GetScancodeTable(SDL_SCANCODE_TABLE_EVDEV, &devdata->keyboard[devdata->num_keyboard].map_size); + devdata->keyboard[devdata->num_keyboard].map = SDL_GetScancodeTable(SDL_SCANCODE_TABLE_LINUX, &devdata->keyboard[devdata->num_keyboard].map_size); devdata->keyboard[devdata->num_keyboard].map_adjust = 0; } From 5de01eb0aa5d8c6a03cbb643551f7eb918e465cb Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Sat, 22 Oct 2022 00:22:34 +0200 Subject: [PATCH 245/459] Make render to use new functions --- src/render/ps2/SDL_render_ps2.c | 120 ++++++-------------------------- 1 file changed, 22 insertions(+), 98 deletions(-) diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index 5d4f318b8..cd8f32634 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -225,34 +225,11 @@ PS2_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd) return 0; /* nothing to do in this backend. */ } -static int -PS2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) -{ - PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; - uint64_t color = data->drawColor; - color_vertex *vertex = (color_vertex *) SDL_AllocateRenderVertices(renderer, (count-1) * sizeof (color_vertex) * 2, 4, &cmd->data.draw.first); - - cmd->data.draw.first = (size_t)vertex; - cmd->data.draw.count = (count-1) * 2; - - for (int i = 0; i < count-1; i++) - { - vertex[i*2].x = points[i].x; - vertex[i*2].y = points[i].y; - vertex[i*2].color = color; - - vertex[i*2+1].x = points[i+1].x; - vertex[i*2+1].y = points[i+1].y; - vertex[i*2+1].color = color; - } - - return 0; -} - static int PS2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { - clear_vertex *verts = (clear_vertex *) SDL_AllocateRenderVertices(renderer, count * sizeof (clear_vertex), 4, &cmd->data.draw.first); + PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; + GSPRIMPOINT *verts = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); int i; if (!verts) { @@ -261,9 +238,15 @@ PS2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F cmd->data.draw.count = count; + const uint8_t ColorR = cmd->data.draw.r >> 1; + const uint8_t ColorG = cmd->data.draw.g >> 1; + const uint8_t ColorB = cmd->data.draw.b >> 1; + const uint8_t ColorA = cmd->data.draw.a >> 1; + const gs_rgbaq rgbaq = color_to_RGBAQ(ColorR, ColorG, ColorB, ColorA); + for (i = 0; i < count; i++, verts++, points++) { - verts->x = points->x; - verts->y = points->y; + verts->xyz2 = vertex_to_XYZ2(data->gsGlobal, points->x, points->y, 0); + verts->rgbaq = rgbaq; } return 0; } @@ -322,12 +305,8 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t } } else { - color_vertex *vertices; - - vertices = (color_vertex *)SDL_AllocateRenderVertices(renderer, - count * sizeof(color_vertex), - 4, - &cmd->data.draw.first); + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + GSPRIMPOINT *vertices = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); if (!vertices) { return -1; @@ -351,9 +330,8 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t xy_ = (float *)((char*)xy + j * xy_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride); - vertices->x = xy_[0] * scale_x; - vertices->y = xy_[1] * scale_y; - vertices->color = GS_SETREG_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0x00);; + vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); + vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1); vertices++; } @@ -514,33 +492,8 @@ PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cm gsKit_prim_triangle_goraud_texture(data->gsGlobal, ps2_tex, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, 0, c1, c2, c3); } } else { - const color_vertex *verts = (color_vertex *) (vertices + cmd->data.draw.first); - - for (i = 0; i < count/3; i++) { - x1 = verts->x; - y1 = verts->y; - - c1 = verts->color; - - verts++; - - x2 = verts->x; - y2 = verts->y; - - c2 = verts->color; - - verts++; - - x3 = verts->x; - y3 = verts->y; - - c3 = verts->color; - - verts++; - - gsKit_prim_triangle_gouraud(data->gsGlobal, x1, y1, x2, y2, x3, y3, 0, c1, c2, c3); - - } + const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); + gsKit_prim_list_triangle_gouraud_3d(data->gsGlobal, count, verts); } return 0; @@ -550,27 +503,12 @@ PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cm int PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand * cmd) { - PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - float x1, y1, x2, y2; - uint64_t c1, c2; - int i; - + const PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; const size_t count = cmd->data.draw.count; - - const color_vertex *verts = (color_vertex *) (vertices + cmd->data.draw.first); + const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); PS2_SetBlendMode(data, cmd->data.draw.blend); - - for (i = 0; i < count-1; i++, verts++) { - x1 = verts[i*2].x; - y1 = verts[i*2].y; - c1 = verts[i*2].color; - - x2 = verts[i*2+1].x; - y2 = verts[i*2+1].y; - c2 = verts[i*2+1].color; - gsKit_prim_line_goraud(data->gsGlobal, x1, y1, x2, y2, 0, c1, c2); - } + gsKit_prim_list_line_goraud_3d(data->gsGlobal, count, verts); /* We're done! */ return 0; @@ -580,25 +518,11 @@ int PS2_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand * cmd) { PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - uint64_t color; - int i; - const size_t count = cmd->data.draw.count; - - const uint8_t ColorR = cmd->data.draw.r >> 1; - const uint8_t ColorG = cmd->data.draw.g >> 1; - const uint8_t ColorB = cmd->data.draw.b >> 1; - const uint8_t ColorA = cmd->data.draw.a >> 1; - - const clear_vertex *verts = (clear_vertex *) (vertices + cmd->data.draw.first); + const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); PS2_SetBlendMode(data, cmd->data.draw.blend); - - color = GS_SETREG_RGBAQ(ColorR, ColorG, ColorB, ColorA, 0x00); - - for (i = 0; i < count; i++, verts++) { - gsKit_prim_point(data->gsGlobal, verts->x, verts->y, 0, color); - } + gsKit_prim_list_points(data->gsGlobal, count, verts); /* We're done! */ return 0; @@ -805,7 +729,7 @@ PS2_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->QueueSetViewport = PS2_QueueSetViewport; renderer->QueueSetDrawColor = PS2_QueueSetViewport; renderer->QueueDrawPoints = PS2_QueueDrawPoints; - renderer->QueueDrawLines = PS2_QueueDrawLines; + renderer->QueueDrawLines = PS2_QueueDrawPoints; renderer->QueueGeometry = PS2_QueueGeometry; renderer->RunCommandQueue = PS2_RunCommandQueue; renderer->RenderReadPixels = PS2_RenderReadPixels; From f2ebedae92eb11b71375e203189ad510b30a65df Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Thu, 27 Oct 2022 00:35:20 +0200 Subject: [PATCH 246/459] adding texture function --- src/render/ps2/SDL_render_ps2.c | 89 +++++---------------------------- 1 file changed, 12 insertions(+), 77 deletions(-) diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index cd8f32634..487717f9c 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -43,25 +43,6 @@ /* Size of Oneshot drawbuffer (Double Buffered, so it uses this size * 2) */ #define RENDER_QUEUE_OS_POOLSIZE 1024 * 1024 * 2 // 2048K of oneshot renderqueue -typedef struct clear_vertex { - float x; - float y; -} clear_vertex; - -typedef struct texture_vertex { - float x; - float y; - float u; - float v; - uint64_t color; -} texture_vertex; - -typedef struct color_vertex { - float x; - float y; - uint64_t color; -} color_vertex; - typedef struct { GSGLOBAL *gsGlobal; @@ -264,18 +245,14 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t size_indices = indices ? size_indices : 0; if (texture) { - texture_vertex *vertices; - - vertices = (texture_vertex *)SDL_AllocateRenderVertices(renderer, - count * sizeof(texture_vertex), - 4, - &cmd->data.draw.first); - + GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMUVPOINT), 4, &cmd->data.draw.first); + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->driverdata; + if (!vertices) { return -1; } - for (i = 0; i < count; i++) { int j; float *xy_; @@ -295,15 +272,13 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t col_ = *(SDL_Color *)((char*)color + j * color_stride); uv_ = (float *)((char*)uv + j * uv_stride); - vertices->x = xy_[0] * scale_x; - vertices->y = xy_[1] * scale_y; - vertices->u = uv_[0]; - vertices->v = uv_[1]; - vertices->color = GS_SETREG_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0x00); + vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); + vertices->uv = vertex_to_UV(ps2_tex, uv_[0] * ps2_tex->Width, uv_[1] * ps2_tex->Height); + vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1); vertices++; } - + } else { PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; GSPRIMPOINT *vertices = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); @@ -312,7 +287,6 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t return -1; } - for (i = 0; i < count; i++) { int j; float *xy_; @@ -339,7 +313,6 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t } return 0; - } static int @@ -441,56 +414,18 @@ PS2_SetBlendMode(PS2_RenderData *data, int blendMode) static int PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd) { - - int i; - uint64_t c1, c2, c3; - float x1, y1, x2, y2, x3, y3; - float u1, v1, u2, v2, u3, v3; - PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + const PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; const size_t count = cmd->data.draw.count; PS2_SetBlendMode(data, cmd->data.draw.blend); if (cmd->data.draw.texture) { - const texture_vertex *verts = (texture_vertex *) (vertices + cmd->data.draw.first); + const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) (vertices + cmd->data.draw.first); GSTEXTURE *ps2_tex = (GSTEXTURE *) cmd->data.draw.texture->driverdata; - - for (i = 0; i < count/3; i++) { - x1 = verts->x; - y1 = verts->y; - u1 = verts->u * ps2_tex->Width; - v1 = verts->v * ps2_tex->Height; - - c1 = verts->color; - - verts++; - - x2 = verts->x; - y2 = verts->y; - - u2 = verts->u * ps2_tex->Width; - v2 = verts->v * ps2_tex->Height; - - c2 = verts->color; - - verts++; - - x3 = verts->x; - y3 = verts->y; - - u3 = verts->u * ps2_tex->Width; - v3 = verts->v * ps2_tex->Height; - - c3 = verts->color; - - verts++; - - gsKit_TexManager_bind(data->gsGlobal, ps2_tex); - - gsKit_prim_triangle_goraud_texture(data->gsGlobal, ps2_tex, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, 0, c1, c2, c3); - } + gsKit_TexManager_bind(data->gsGlobal, ps2_tex); + gsKit_prim_list_triangle_goraud_texture_uv_3d(data->gsGlobal, ps2_tex, count, verts); } else { const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); gsKit_prim_list_triangle_gouraud_3d(data->gsGlobal, count, verts); From a8f019b1f0d225e637c12b43a390bd257e2511a9 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Fri, 28 Oct 2022 00:52:06 +0200 Subject: [PATCH 247/459] Using ST and removing warnings --- src/render/ps2/SDL_render_ps2.c | 44 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index 487717f9c..54ace06f3 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -210,24 +210,26 @@ static int PS2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; - GSPRIMPOINT *verts = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); + GSPRIMPOINT *vertices = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); + uint8_t colorR, colorG, colorB, colorA; + gs_rgbaq rgbaq; int i; - if (!verts) { + if (!vertices) { return -1; } cmd->data.draw.count = count; - const uint8_t ColorR = cmd->data.draw.r >> 1; - const uint8_t ColorG = cmd->data.draw.g >> 1; - const uint8_t ColorB = cmd->data.draw.b >> 1; - const uint8_t ColorA = cmd->data.draw.a >> 1; - const gs_rgbaq rgbaq = color_to_RGBAQ(ColorR, ColorG, ColorB, ColorA); + colorR = cmd->data.draw.r >> 1; + colorG = cmd->data.draw.g >> 1; + colorB = cmd->data.draw.b >> 1; + colorA = cmd->data.draw.a >> 1; + rgbaq = color_to_RGBAQ(colorR, colorG, colorB, colorA, 0.0f); - for (i = 0; i < count; i++, verts++, points++) { - verts->xyz2 = vertex_to_XYZ2(data->gsGlobal, points->x, points->y, 0); - verts->rgbaq = rgbaq; + for (i = 0; i < count; i++, vertices++, points++) { + vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, points->x, points->y, 0); + vertices->rgbaq = rgbaq; } return 0; } @@ -240,14 +242,13 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t { int i; int count = indices ? num_indices : num_vertices; + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; cmd->data.draw.count = count; size_indices = indices ? size_indices : 0; if (texture) { - GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMUVPOINT), 4, &cmd->data.draw.first); - PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->driverdata; + GSPRIMSTQPOINT *vertices = (GSPRIMSTQPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMSTQPOINT), 4, &cmd->data.draw.first); if (!vertices) { return -1; @@ -273,14 +274,13 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t uv_ = (float *)((char*)uv + j * uv_stride); vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); - vertices->uv = vertex_to_UV(ps2_tex, uv_[0] * ps2_tex->Width, uv_[1] * ps2_tex->Height); - vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1); + vertices->stq = vertex_to_STQ(uv_[0], uv_[1]); + vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 1.0f); vertices++; } } else { - PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; GSPRIMPOINT *vertices = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first); if (!vertices) { @@ -305,11 +305,10 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t col_ = *(SDL_Color *)((char*)color + j * color_stride); vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); - vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1); + vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0.0f); vertices++; } - } return 0; @@ -414,18 +413,17 @@ PS2_SetBlendMode(PS2_RenderData *data, int blendMode) static int PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd) { - const PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; const size_t count = cmd->data.draw.count; PS2_SetBlendMode(data, cmd->data.draw.blend); if (cmd->data.draw.texture) { - const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) (vertices + cmd->data.draw.first); + const GSPRIMSTQPOINT *verts = (GSPRIMSTQPOINT *) (vertices + cmd->data.draw.first); GSTEXTURE *ps2_tex = (GSTEXTURE *) cmd->data.draw.texture->driverdata; gsKit_TexManager_bind(data->gsGlobal, ps2_tex); - gsKit_prim_list_triangle_goraud_texture_uv_3d(data->gsGlobal, ps2_tex, count, verts); + gsKit_prim_list_triangle_goraud_texture_stq_3d(data->gsGlobal, ps2_tex, count, verts); } else { const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); gsKit_prim_list_triangle_gouraud_3d(data->gsGlobal, count, verts); @@ -438,7 +436,7 @@ PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cm int PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand * cmd) { - const PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; const size_t count = cmd->data.draw.count; const GSPRIMPOINT *verts = (GSPRIMPOINT *) (vertices + cmd->data.draw.first); From 0ddec7e4211010ece8f5dc7fd4f96db480b95bb7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 28 Oct 2022 16:07:30 -0400 Subject: [PATCH 248/459] docs: Add notes about Emscripten audio quirks. Fixes #6385. --- docs/README-emscripten.md | 41 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md index 7e9880b08..5f8c27786 100644 --- a/docs/README-emscripten.md +++ b/docs/README-emscripten.md @@ -1,5 +1,42 @@ -Emscripten -================================================================================ +# Emscripten + +(This documentation is not very robust; we will update and expand this later.) + +## A quick note about audio + +Modern web browsers will not permit web pages to produce sound before the +user has interacted with them; this is for several reasons, not the least +of which being that no one likes when a random browser tab suddenly starts +making noise and the user has to scramble to figure out which and silence +it. + +To solve this, most browsers will refuse to let a web app use the audio +subsystem at all before the user has interacted with (clicked on) the page +in a meaningful way. SDL-based apps also have to deal with this problem; if +the user hasn't interacted with the page, SDL_OpenAudioDevice will fail. + +There are two reasonable ways to deal with this: if you are writing some +sort of media player thing, where the user expects there to be a volume +control when you mouseover the canvas, just default that control to a muted +state; if the user clicks on the control to unmute it, on this first click, +open the audio device. This allows the media to play at start, the user can +reasonably opt-in to listening, and you never get access denied to the audio +device. + +Many games do not have this sort of UI, and are more rigid about starting +audio along with everything else at the start of the process. For these, your +best bet is to write a little Javascript that puts up a "Click here to play!" +UI, and upon the user clicking, remove that UI and then call the Emscripten +app's main() function. As far as the application knows, the audio device was +available to be opened as soon as the program started, and since this magic +happens in a little Javascript, you don't have to change your C/C++ code at +all to make it happen. + +Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385 +for some Javascript code to steal for this approach. + + +## Building SDL/emscripten SDL currently requires at least Emscripten 2.0.32 to build. Newer versions are likely to work, as well. From 92215481146f9225a458e9a09abb85a33b52d9ff Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 9 Oct 2022 19:33:52 -0400 Subject: [PATCH 249/459] emscripten: Make an attempt at correct keyboard scancode/keycodes. This uses a newer browser API to get physical scancodes, but still uses the (deprecated) event field that we were already using for scancodes, but for keycodes instead now, which appears to be more accurate. Since keyboard layout isn't (generally) available to web apps, this adds an internal interface to send key events with both scancode and keycode to SDL's internals, instead of sending just scancodes and expecting SDL to use its own keymap to generate keycodes. Future work in this area would be to use the keyboard layout APIs on browsers that support them, which would allow us to use SDL's usual keymap code and not rely on a deprecated browser API, but until we get there, this patch gives significantly more correct results than we would have before. Fixes #2098. --- src/events/SDL_keyboard.c | 19 +- src/events/SDL_keyboard_c.h | 4 + src/video/emscripten/SDL_emscriptenevents.c | 879 +++++++++++++------- 3 files changed, 578 insertions(+), 324 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 99db756e9..c139dbdf1 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -800,12 +800,11 @@ SDL_SetKeyboardFocus(SDL_Window * window) } static int -SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode) +SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode) { SDL_Keyboard *keyboard = &SDL_keyboard; int posted; SDL_Keymod modifier; - SDL_Keycode keycode; Uint32 type; Uint8 repeat = SDL_FALSE; @@ -851,7 +850,9 @@ SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode) /* Update internal keyboard state */ keyboard->keystate[scancode] = state; - keycode = keyboard->keymap[scancode]; + if (keycode == SDLK_UNKNOWN) { + keycode = keyboard->keymap[scancode]; + } if (source == KEYBOARD_AUTORELEASE) { keyboard->autorelease_pending = SDL_TRUE; @@ -971,13 +972,19 @@ SDL_SendKeyboardUnicodeKey(Uint32 ch) int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) { - return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode); + return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode, SDLK_UNKNOWN); +} + +int +SDL_SendKeyboardKeyComplete(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode) +{ + return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode, keycode); } int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode) { - return SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_PRESSED, scancode); + return SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_PRESSED, scancode, SDLK_UNKNOWN); } void @@ -989,7 +996,7 @@ SDL_ReleaseAutoReleaseKeys(void) if (keyboard->autorelease_pending) { for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keysource[scancode] == KEYBOARD_AUTORELEASE) { - SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_RELEASED, scancode); + SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_RELEASED, scancode, SDLK_UNKNOWN); } } keyboard->autorelease_pending = SDL_FALSE; diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index dc2e882fe..653392131 100644 --- a/src/events/SDL_keyboard_c.h +++ b/src/events/SDL_keyboard_c.h @@ -53,6 +53,10 @@ extern int SDL_SendKeyboardUnicodeKey(Uint32 ch); extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode); extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode); +/* This is for platforms that don't know the keymap but can report scancode and keycode directly. + Most platforms should prefer to optionally call SDL_SetKeymap and then use SDL_SendKeyboardKey. */ +extern int SDL_SendKeyboardKeyComplete(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode); + /* Release all the autorelease keys */ extern void SDL_ReleaseAutoReleaseKeys(void); diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 39578f854..6c2a17df9 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -25,6 +25,7 @@ #if SDL_VIDEO_DRIVER_EMSCRIPTEN #include +#include #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" @@ -38,237 +39,547 @@ #define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN ) /* -.keyCode to scancode +.keyCode to SDL keycode https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode */ -static const SDL_Scancode emscripten_scancode_table[] = { - /* 0 */ SDL_SCANCODE_UNKNOWN, - /* 1 */ SDL_SCANCODE_UNKNOWN, - /* 2 */ SDL_SCANCODE_UNKNOWN, - /* 3 */ SDL_SCANCODE_CANCEL, - /* 4 */ SDL_SCANCODE_UNKNOWN, - /* 5 */ SDL_SCANCODE_UNKNOWN, - /* 6 */ SDL_SCANCODE_HELP, - /* 7 */ SDL_SCANCODE_UNKNOWN, - /* 8 */ SDL_SCANCODE_BACKSPACE, - /* 9 */ SDL_SCANCODE_TAB, - /* 10 */ SDL_SCANCODE_UNKNOWN, - /* 11 */ SDL_SCANCODE_UNKNOWN, - /* 12 */ SDL_SCANCODE_KP_5, - /* 13 */ SDL_SCANCODE_RETURN, - /* 14 */ SDL_SCANCODE_UNKNOWN, - /* 15 */ SDL_SCANCODE_UNKNOWN, - /* 16 */ SDL_SCANCODE_LSHIFT, - /* 17 */ SDL_SCANCODE_LCTRL, - /* 18 */ SDL_SCANCODE_LALT, - /* 19 */ SDL_SCANCODE_PAUSE, - /* 20 */ SDL_SCANCODE_CAPSLOCK, - /* 21 */ SDL_SCANCODE_UNKNOWN, - /* 22 */ SDL_SCANCODE_UNKNOWN, - /* 23 */ SDL_SCANCODE_UNKNOWN, - /* 24 */ SDL_SCANCODE_UNKNOWN, - /* 25 */ SDL_SCANCODE_UNKNOWN, - /* 26 */ SDL_SCANCODE_UNKNOWN, - /* 27 */ SDL_SCANCODE_ESCAPE, - /* 28 */ SDL_SCANCODE_UNKNOWN, - /* 29 */ SDL_SCANCODE_UNKNOWN, - /* 30 */ SDL_SCANCODE_UNKNOWN, - /* 31 */ SDL_SCANCODE_UNKNOWN, - /* 32 */ SDL_SCANCODE_SPACE, - /* 33 */ SDL_SCANCODE_PAGEUP, - /* 34 */ SDL_SCANCODE_PAGEDOWN, - /* 35 */ SDL_SCANCODE_END, - /* 36 */ SDL_SCANCODE_HOME, - /* 37 */ SDL_SCANCODE_LEFT, - /* 38 */ SDL_SCANCODE_UP, - /* 39 */ SDL_SCANCODE_RIGHT, - /* 40 */ SDL_SCANCODE_DOWN, - /* 41 */ SDL_SCANCODE_UNKNOWN, - /* 42 */ SDL_SCANCODE_UNKNOWN, - /* 43 */ SDL_SCANCODE_UNKNOWN, - /* 44 */ SDL_SCANCODE_UNKNOWN, - /* 45 */ SDL_SCANCODE_INSERT, - /* 46 */ SDL_SCANCODE_DELETE, - /* 47 */ SDL_SCANCODE_UNKNOWN, - /* 48 */ SDL_SCANCODE_0, - /* 49 */ SDL_SCANCODE_1, - /* 50 */ SDL_SCANCODE_2, - /* 51 */ SDL_SCANCODE_3, - /* 52 */ SDL_SCANCODE_4, - /* 53 */ SDL_SCANCODE_5, - /* 54 */ SDL_SCANCODE_6, - /* 55 */ SDL_SCANCODE_7, - /* 56 */ SDL_SCANCODE_8, - /* 57 */ SDL_SCANCODE_9, - /* 58 */ SDL_SCANCODE_UNKNOWN, - /* 59 */ SDL_SCANCODE_SEMICOLON, - /* 60 */ SDL_SCANCODE_NONUSBACKSLASH, - /* 61 */ SDL_SCANCODE_EQUALS, - /* 62 */ SDL_SCANCODE_UNKNOWN, - /* 63 */ SDL_SCANCODE_MINUS, - /* 64 */ SDL_SCANCODE_UNKNOWN, - /* 65 */ SDL_SCANCODE_A, - /* 66 */ SDL_SCANCODE_B, - /* 67 */ SDL_SCANCODE_C, - /* 68 */ SDL_SCANCODE_D, - /* 69 */ SDL_SCANCODE_E, - /* 70 */ SDL_SCANCODE_F, - /* 71 */ SDL_SCANCODE_G, - /* 72 */ SDL_SCANCODE_H, - /* 73 */ SDL_SCANCODE_I, - /* 74 */ SDL_SCANCODE_J, - /* 75 */ SDL_SCANCODE_K, - /* 76 */ SDL_SCANCODE_L, - /* 77 */ SDL_SCANCODE_M, - /* 78 */ SDL_SCANCODE_N, - /* 79 */ SDL_SCANCODE_O, - /* 80 */ SDL_SCANCODE_P, - /* 81 */ SDL_SCANCODE_Q, - /* 82 */ SDL_SCANCODE_R, - /* 83 */ SDL_SCANCODE_S, - /* 84 */ SDL_SCANCODE_T, - /* 85 */ SDL_SCANCODE_U, - /* 86 */ SDL_SCANCODE_V, - /* 87 */ SDL_SCANCODE_W, - /* 88 */ SDL_SCANCODE_X, - /* 89 */ SDL_SCANCODE_Y, - /* 90 */ SDL_SCANCODE_Z, - /* 91 */ SDL_SCANCODE_LGUI, - /* 92 */ SDL_SCANCODE_UNKNOWN, - /* 93 */ SDL_SCANCODE_APPLICATION, - /* 94 */ SDL_SCANCODE_UNKNOWN, - /* 95 */ SDL_SCANCODE_UNKNOWN, - /* 96 */ SDL_SCANCODE_KP_0, - /* 97 */ SDL_SCANCODE_KP_1, - /* 98 */ SDL_SCANCODE_KP_2, - /* 99 */ SDL_SCANCODE_KP_3, - /* 100 */ SDL_SCANCODE_KP_4, - /* 101 */ SDL_SCANCODE_KP_5, - /* 102 */ SDL_SCANCODE_KP_6, - /* 103 */ SDL_SCANCODE_KP_7, - /* 104 */ SDL_SCANCODE_KP_8, - /* 105 */ SDL_SCANCODE_KP_9, - /* 106 */ SDL_SCANCODE_KP_MULTIPLY, - /* 107 */ SDL_SCANCODE_KP_PLUS, - /* 108 */ SDL_SCANCODE_UNKNOWN, - /* 109 */ SDL_SCANCODE_KP_MINUS, - /* 110 */ SDL_SCANCODE_KP_PERIOD, - /* 111 */ SDL_SCANCODE_KP_DIVIDE, - /* 112 */ SDL_SCANCODE_F1, - /* 113 */ SDL_SCANCODE_F2, - /* 114 */ SDL_SCANCODE_F3, - /* 115 */ SDL_SCANCODE_F4, - /* 116 */ SDL_SCANCODE_F5, - /* 117 */ SDL_SCANCODE_F6, - /* 118 */ SDL_SCANCODE_F7, - /* 119 */ SDL_SCANCODE_F8, - /* 120 */ SDL_SCANCODE_F9, - /* 121 */ SDL_SCANCODE_F10, - /* 122 */ SDL_SCANCODE_F11, - /* 123 */ SDL_SCANCODE_F12, - /* 124 */ SDL_SCANCODE_F13, - /* 125 */ SDL_SCANCODE_F14, - /* 126 */ SDL_SCANCODE_F15, - /* 127 */ SDL_SCANCODE_F16, - /* 128 */ SDL_SCANCODE_F17, - /* 129 */ SDL_SCANCODE_F18, - /* 130 */ SDL_SCANCODE_F19, - /* 131 */ SDL_SCANCODE_F20, - /* 132 */ SDL_SCANCODE_F21, - /* 133 */ SDL_SCANCODE_F22, - /* 134 */ SDL_SCANCODE_F23, - /* 135 */ SDL_SCANCODE_F24, - /* 136 */ SDL_SCANCODE_UNKNOWN, - /* 137 */ SDL_SCANCODE_UNKNOWN, - /* 138 */ SDL_SCANCODE_UNKNOWN, - /* 139 */ SDL_SCANCODE_UNKNOWN, - /* 140 */ SDL_SCANCODE_UNKNOWN, - /* 141 */ SDL_SCANCODE_UNKNOWN, - /* 142 */ SDL_SCANCODE_UNKNOWN, - /* 143 */ SDL_SCANCODE_UNKNOWN, - /* 144 */ SDL_SCANCODE_NUMLOCKCLEAR, - /* 145 */ SDL_SCANCODE_SCROLLLOCK, - /* 146 */ SDL_SCANCODE_UNKNOWN, - /* 147 */ SDL_SCANCODE_UNKNOWN, - /* 148 */ SDL_SCANCODE_UNKNOWN, - /* 149 */ SDL_SCANCODE_UNKNOWN, - /* 150 */ SDL_SCANCODE_UNKNOWN, - /* 151 */ SDL_SCANCODE_UNKNOWN, - /* 152 */ SDL_SCANCODE_UNKNOWN, - /* 153 */ SDL_SCANCODE_UNKNOWN, - /* 154 */ SDL_SCANCODE_UNKNOWN, - /* 155 */ SDL_SCANCODE_UNKNOWN, - /* 156 */ SDL_SCANCODE_UNKNOWN, - /* 157 */ SDL_SCANCODE_UNKNOWN, - /* 158 */ SDL_SCANCODE_UNKNOWN, - /* 159 */ SDL_SCANCODE_UNKNOWN, - /* 160 */ SDL_SCANCODE_GRAVE, - /* 161 */ SDL_SCANCODE_UNKNOWN, - /* 162 */ SDL_SCANCODE_UNKNOWN, - /* 163 */ SDL_SCANCODE_KP_HASH, /*KaiOS phone keypad*/ - /* 164 */ SDL_SCANCODE_UNKNOWN, - /* 165 */ SDL_SCANCODE_UNKNOWN, - /* 166 */ SDL_SCANCODE_UNKNOWN, - /* 167 */ SDL_SCANCODE_UNKNOWN, - /* 168 */ SDL_SCANCODE_UNKNOWN, - /* 169 */ SDL_SCANCODE_UNKNOWN, - /* 170 */ SDL_SCANCODE_KP_MULTIPLY, /*KaiOS phone keypad*/ - /* 171 */ SDL_SCANCODE_RIGHTBRACKET, - /* 172 */ SDL_SCANCODE_UNKNOWN, - /* 173 */ SDL_SCANCODE_MINUS, /*FX*/ - /* 174 */ SDL_SCANCODE_VOLUMEDOWN, /*IE, Chrome*/ - /* 175 */ SDL_SCANCODE_VOLUMEUP, /*IE, Chrome*/ - /* 176 */ SDL_SCANCODE_AUDIONEXT, /*IE, Chrome*/ - /* 177 */ SDL_SCANCODE_AUDIOPREV, /*IE, Chrome*/ - /* 178 */ SDL_SCANCODE_UNKNOWN, - /* 179 */ SDL_SCANCODE_AUDIOPLAY, /*IE, Chrome*/ - /* 180 */ SDL_SCANCODE_UNKNOWN, - /* 181 */ SDL_SCANCODE_AUDIOMUTE, /*FX*/ - /* 182 */ SDL_SCANCODE_VOLUMEDOWN, /*FX*/ - /* 183 */ SDL_SCANCODE_VOLUMEUP, /*FX*/ - /* 184 */ SDL_SCANCODE_UNKNOWN, - /* 185 */ SDL_SCANCODE_UNKNOWN, - /* 186 */ SDL_SCANCODE_SEMICOLON, /*IE, Chrome, D3E legacy*/ - /* 187 */ SDL_SCANCODE_EQUALS, /*IE, Chrome, D3E legacy*/ - /* 188 */ SDL_SCANCODE_COMMA, - /* 189 */ SDL_SCANCODE_MINUS, /*IE, Chrome, D3E legacy*/ - /* 190 */ SDL_SCANCODE_PERIOD, - /* 191 */ SDL_SCANCODE_SLASH, - /* 192 */ SDL_SCANCODE_GRAVE, /*FX, D3E legacy (SDL_SCANCODE_APOSTROPHE in IE/Chrome)*/ - /* 193 */ SDL_SCANCODE_UNKNOWN, - /* 194 */ SDL_SCANCODE_UNKNOWN, - /* 195 */ SDL_SCANCODE_UNKNOWN, - /* 196 */ SDL_SCANCODE_UNKNOWN, - /* 197 */ SDL_SCANCODE_UNKNOWN, - /* 198 */ SDL_SCANCODE_UNKNOWN, - /* 199 */ SDL_SCANCODE_UNKNOWN, - /* 200 */ SDL_SCANCODE_UNKNOWN, - /* 201 */ SDL_SCANCODE_UNKNOWN, - /* 202 */ SDL_SCANCODE_UNKNOWN, - /* 203 */ SDL_SCANCODE_UNKNOWN, - /* 204 */ SDL_SCANCODE_UNKNOWN, - /* 205 */ SDL_SCANCODE_UNKNOWN, - /* 206 */ SDL_SCANCODE_UNKNOWN, - /* 207 */ SDL_SCANCODE_UNKNOWN, - /* 208 */ SDL_SCANCODE_UNKNOWN, - /* 209 */ SDL_SCANCODE_UNKNOWN, - /* 210 */ SDL_SCANCODE_UNKNOWN, - /* 211 */ SDL_SCANCODE_UNKNOWN, - /* 212 */ SDL_SCANCODE_UNKNOWN, - /* 213 */ SDL_SCANCODE_UNKNOWN, - /* 214 */ SDL_SCANCODE_UNKNOWN, - /* 215 */ SDL_SCANCODE_UNKNOWN, - /* 216 */ SDL_SCANCODE_UNKNOWN, - /* 217 */ SDL_SCANCODE_UNKNOWN, - /* 218 */ SDL_SCANCODE_UNKNOWN, - /* 219 */ SDL_SCANCODE_LEFTBRACKET, - /* 220 */ SDL_SCANCODE_BACKSLASH, - /* 221 */ SDL_SCANCODE_RIGHTBRACKET, - /* 222 */ SDL_SCANCODE_APOSTROPHE, /*FX, D3E legacy*/ +static const SDL_Keycode emscripten_keycode_table[] = { + /* 0 */ SDLK_UNKNOWN, + /* 1 */ SDLK_UNKNOWN, + /* 2 */ SDLK_UNKNOWN, + /* 3 */ SDLK_CANCEL, + /* 4 */ SDLK_UNKNOWN, + /* 5 */ SDLK_UNKNOWN, + /* 6 */ SDLK_HELP, + /* 7 */ SDLK_UNKNOWN, + /* 8 */ SDLK_BACKSPACE, + /* 9 */ SDLK_TAB, + /* 10 */ SDLK_UNKNOWN, + /* 11 */ SDLK_UNKNOWN, + /* 12 */ SDLK_KP_5, + /* 13 */ SDLK_RETURN, + /* 14 */ SDLK_UNKNOWN, + /* 15 */ SDLK_UNKNOWN, + /* 16 */ SDLK_LSHIFT, + /* 17 */ SDLK_LCTRL, + /* 18 */ SDLK_LALT, + /* 19 */ SDLK_PAUSE, + /* 20 */ SDLK_CAPSLOCK, + /* 21 */ SDLK_UNKNOWN, + /* 22 */ SDLK_UNKNOWN, + /* 23 */ SDLK_UNKNOWN, + /* 24 */ SDLK_UNKNOWN, + /* 25 */ SDLK_UNKNOWN, + /* 26 */ SDLK_UNKNOWN, + /* 27 */ SDLK_ESCAPE, + /* 28 */ SDLK_UNKNOWN, + /* 29 */ SDLK_UNKNOWN, + /* 30 */ SDLK_UNKNOWN, + /* 31 */ SDLK_UNKNOWN, + /* 32 */ SDLK_SPACE, + /* 33 */ SDLK_PAGEUP, + /* 34 */ SDLK_PAGEDOWN, + /* 35 */ SDLK_END, + /* 36 */ SDLK_HOME, + /* 37 */ SDLK_LEFT, + /* 38 */ SDLK_UP, + /* 39 */ SDLK_RIGHT, + /* 40 */ SDLK_DOWN, + /* 41 */ SDLK_UNKNOWN, + /* 42 */ SDLK_UNKNOWN, + /* 43 */ SDLK_UNKNOWN, + /* 44 */ SDLK_UNKNOWN, + /* 45 */ SDLK_INSERT, + /* 46 */ SDLK_DELETE, + /* 47 */ SDLK_UNKNOWN, + /* 48 */ SDLK_0, + /* 49 */ SDLK_1, + /* 50 */ SDLK_2, + /* 51 */ SDLK_3, + /* 52 */ SDLK_4, + /* 53 */ SDLK_5, + /* 54 */ SDLK_6, + /* 55 */ SDLK_7, + /* 56 */ SDLK_8, + /* 57 */ SDLK_9, + /* 58 */ SDLK_UNKNOWN, + /* 59 */ SDLK_SEMICOLON, + /* 60 */ SDLK_BACKSLASH /*SDL_SCANCODE_NONUSBACKSLASH*/, + /* 61 */ SDLK_EQUALS, + /* 62 */ SDLK_UNKNOWN, + /* 63 */ SDLK_MINUS, + /* 64 */ SDLK_UNKNOWN, + /* 65 */ SDLK_a, + /* 66 */ SDLK_b, + /* 67 */ SDLK_c, + /* 68 */ SDLK_d, + /* 69 */ SDLK_e, + /* 70 */ SDLK_f, + /* 71 */ SDLK_g, + /* 72 */ SDLK_h, + /* 73 */ SDLK_i, + /* 74 */ SDLK_j, + /* 75 */ SDLK_k, + /* 76 */ SDLK_l, + /* 77 */ SDLK_m, + /* 78 */ SDLK_n, + /* 79 */ SDLK_o, + /* 80 */ SDLK_p, + /* 81 */ SDLK_q, + /* 82 */ SDLK_r, + /* 83 */ SDLK_s, + /* 84 */ SDLK_t, + /* 85 */ SDLK_u, + /* 86 */ SDLK_v, + /* 87 */ SDLK_w, + /* 88 */ SDLK_x, + /* 89 */ SDLK_y, + /* 90 */ SDLK_z, + /* 91 */ SDLK_LGUI, + /* 92 */ SDLK_UNKNOWN, + /* 93 */ SDLK_APPLICATION, + /* 94 */ SDLK_UNKNOWN, + /* 95 */ SDLK_UNKNOWN, + /* 96 */ SDLK_KP_0, + /* 97 */ SDLK_KP_1, + /* 98 */ SDLK_KP_2, + /* 99 */ SDLK_KP_3, + /* 100 */ SDLK_KP_4, + /* 101 */ SDLK_KP_5, + /* 102 */ SDLK_KP_6, + /* 103 */ SDLK_KP_7, + /* 104 */ SDLK_KP_8, + /* 105 */ SDLK_KP_9, + /* 106 */ SDLK_KP_MULTIPLY, + /* 107 */ SDLK_KP_PLUS, + /* 108 */ SDLK_UNKNOWN, + /* 109 */ SDLK_KP_MINUS, + /* 110 */ SDLK_KP_PERIOD, + /* 111 */ SDLK_KP_DIVIDE, + /* 112 */ SDLK_F1, + /* 113 */ SDLK_F2, + /* 114 */ SDLK_F3, + /* 115 */ SDLK_F4, + /* 116 */ SDLK_F5, + /* 117 */ SDLK_F6, + /* 118 */ SDLK_F7, + /* 119 */ SDLK_F8, + /* 120 */ SDLK_F9, + /* 121 */ SDLK_F10, + /* 122 */ SDLK_F11, + /* 123 */ SDLK_F12, + /* 124 */ SDLK_F13, + /* 125 */ SDLK_F14, + /* 126 */ SDLK_F15, + /* 127 */ SDLK_F16, + /* 128 */ SDLK_F17, + /* 129 */ SDLK_F18, + /* 130 */ SDLK_F19, + /* 131 */ SDLK_F20, + /* 132 */ SDLK_F21, + /* 133 */ SDLK_F22, + /* 134 */ SDLK_F23, + /* 135 */ SDLK_F24, + /* 136 */ SDLK_UNKNOWN, + /* 137 */ SDLK_UNKNOWN, + /* 138 */ SDLK_UNKNOWN, + /* 139 */ SDLK_UNKNOWN, + /* 140 */ SDLK_UNKNOWN, + /* 141 */ SDLK_UNKNOWN, + /* 142 */ SDLK_UNKNOWN, + /* 143 */ SDLK_UNKNOWN, + /* 144 */ SDLK_NUMLOCKCLEAR, + /* 145 */ SDLK_SCROLLLOCK, + /* 146 */ SDLK_UNKNOWN, + /* 147 */ SDLK_UNKNOWN, + /* 148 */ SDLK_UNKNOWN, + /* 149 */ SDLK_UNKNOWN, + /* 150 */ SDLK_UNKNOWN, + /* 151 */ SDLK_UNKNOWN, + /* 152 */ SDLK_UNKNOWN, + /* 153 */ SDLK_UNKNOWN, + /* 154 */ SDLK_UNKNOWN, + /* 155 */ SDLK_UNKNOWN, + /* 156 */ SDLK_UNKNOWN, + /* 157 */ SDLK_UNKNOWN, + /* 158 */ SDLK_UNKNOWN, + /* 159 */ SDLK_UNKNOWN, + /* 160 */ SDLK_BACKQUOTE, + /* 161 */ SDLK_UNKNOWN, + /* 162 */ SDLK_UNKNOWN, + /* 163 */ SDLK_KP_HASH, /*KaiOS phone keypad*/ + /* 164 */ SDLK_UNKNOWN, + /* 165 */ SDLK_UNKNOWN, + /* 166 */ SDLK_UNKNOWN, + /* 167 */ SDLK_UNKNOWN, + /* 168 */ SDLK_UNKNOWN, + /* 169 */ SDLK_UNKNOWN, + /* 170 */ SDLK_KP_MULTIPLY, /*KaiOS phone keypad*/ + /* 171 */ SDLK_RIGHTBRACKET, + /* 172 */ SDLK_UNKNOWN, + /* 173 */ SDLK_MINUS, /*FX*/ + /* 174 */ SDLK_VOLUMEDOWN, /*IE, Chrome*/ + /* 175 */ SDLK_VOLUMEUP, /*IE, Chrome*/ + /* 176 */ SDLK_AUDIONEXT, /*IE, Chrome*/ + /* 177 */ SDLK_AUDIOPREV, /*IE, Chrome*/ + /* 178 */ SDLK_UNKNOWN, + /* 179 */ SDLK_AUDIOPLAY, /*IE, Chrome*/ + /* 180 */ SDLK_UNKNOWN, + /* 181 */ SDLK_AUDIOMUTE, /*FX*/ + /* 182 */ SDLK_VOLUMEDOWN, /*FX*/ + /* 183 */ SDLK_VOLUMEUP, /*FX*/ + /* 184 */ SDLK_UNKNOWN, + /* 185 */ SDLK_UNKNOWN, + /* 186 */ SDLK_SEMICOLON, /*IE, Chrome, D3E legacy*/ + /* 187 */ SDLK_EQUALS, /*IE, Chrome, D3E legacy*/ + /* 188 */ SDLK_COMMA, + /* 189 */ SDLK_MINUS, /*IE, Chrome, D3E legacy*/ + /* 190 */ SDLK_PERIOD, + /* 191 */ SDLK_SLASH, + /* 192 */ SDLK_BACKQUOTE, /*FX, D3E legacy (SDLK_APOSTROPHE in IE/Chrome)*/ + /* 193 */ SDLK_UNKNOWN, + /* 194 */ SDLK_UNKNOWN, + /* 195 */ SDLK_UNKNOWN, + /* 196 */ SDLK_UNKNOWN, + /* 197 */ SDLK_UNKNOWN, + /* 198 */ SDLK_UNKNOWN, + /* 199 */ SDLK_UNKNOWN, + /* 200 */ SDLK_UNKNOWN, + /* 201 */ SDLK_UNKNOWN, + /* 202 */ SDLK_UNKNOWN, + /* 203 */ SDLK_UNKNOWN, + /* 204 */ SDLK_UNKNOWN, + /* 205 */ SDLK_UNKNOWN, + /* 206 */ SDLK_UNKNOWN, + /* 207 */ SDLK_UNKNOWN, + /* 208 */ SDLK_UNKNOWN, + /* 209 */ SDLK_UNKNOWN, + /* 210 */ SDLK_UNKNOWN, + /* 211 */ SDLK_UNKNOWN, + /* 212 */ SDLK_UNKNOWN, + /* 213 */ SDLK_UNKNOWN, + /* 214 */ SDLK_UNKNOWN, + /* 215 */ SDLK_UNKNOWN, + /* 216 */ SDLK_UNKNOWN, + /* 217 */ SDLK_UNKNOWN, + /* 218 */ SDLK_UNKNOWN, + /* 219 */ SDLK_LEFTBRACKET, + /* 220 */ SDLK_BACKSLASH, + /* 221 */ SDLK_RIGHTBRACKET, + /* 222 */ SDLK_QUOTE, /*FX, D3E legacy*/ }; +/* +Emscripten PK code to scancode +https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent +https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code +*/ +static const SDL_Scancode emscripten_scancode_table[] = { + /* 0x00 "Unidentified" */ SDL_SCANCODE_UNKNOWN, + /* 0x01 "Escape" */ SDL_SCANCODE_ESCAPE, + /* 0x02 "Digit0" */ SDL_SCANCODE_0, + /* 0x03 "Digit1" */ SDL_SCANCODE_1, + /* 0x04 "Digit2" */ SDL_SCANCODE_2, + /* 0x05 "Digit3" */ SDL_SCANCODE_3, + /* 0x06 "Digit4" */ SDL_SCANCODE_4, + /* 0x07 "Digit5" */ SDL_SCANCODE_5, + /* 0x08 "Digit6" */ SDL_SCANCODE_6, + /* 0x09 "Digit7" */ SDL_SCANCODE_7, + /* 0x0A "Digit8" */ SDL_SCANCODE_8, + /* 0x0B "Digit9" */ SDL_SCANCODE_9, + /* 0x0C "Minus" */ SDL_SCANCODE_MINUS, + /* 0x0D "Equal" */ SDL_SCANCODE_EQUALS, + /* 0x0E "Backspace" */ SDL_SCANCODE_BACKSPACE, + /* 0x0F "Tab" */ SDL_SCANCODE_TAB, + /* 0x10 "KeyQ" */ SDL_SCANCODE_Q, + /* 0x11 "KeyW" */ SDL_SCANCODE_W, + /* 0x12 "KeyE" */ SDL_SCANCODE_E, + /* 0x13 "KeyR" */ SDL_SCANCODE_R, + /* 0x14 "KeyT" */ SDL_SCANCODE_T, + /* 0x15 "KeyY" */ SDL_SCANCODE_Y, + /* 0x16 "KeyU" */ SDL_SCANCODE_U, + /* 0x17 "KeyI" */ SDL_SCANCODE_I, + /* 0x18 "KeyO" */ SDL_SCANCODE_O, + /* 0x19 "KeyP" */ SDL_SCANCODE_P, + /* 0x1A "BracketLeft" */ SDL_SCANCODE_LEFTBRACKET, + /* 0x1B "BracketRight" */ SDL_SCANCODE_RIGHTBRACKET, + /* 0x1C "Enter" */ SDL_SCANCODE_RETURN, + /* 0x1D "ControlLeft" */ SDL_SCANCODE_LCTRL, + /* 0x1E "KeyA" */ SDL_SCANCODE_A, + /* 0x1F "KeyS" */ SDL_SCANCODE_S, + /* 0x20 "KeyD" */ SDL_SCANCODE_D, + /* 0x21 "KeyF" */ SDL_SCANCODE_F, + /* 0x22 "KeyG" */ SDL_SCANCODE_G, + /* 0x23 "KeyH" */ SDL_SCANCODE_H, + /* 0x24 "KeyJ" */ SDL_SCANCODE_J, + /* 0x25 "KeyK" */ SDL_SCANCODE_K, + /* 0x26 "KeyL" */ SDL_SCANCODE_L, + /* 0x27 "Semicolon" */ SDL_SCANCODE_SEMICOLON, + /* 0x28 "Quote" */ SDL_SCANCODE_APOSTROPHE, + /* 0x29 "Backquote" */ SDL_SCANCODE_GRAVE, + /* 0x2A "ShiftLeft" */ SDL_SCANCODE_LSHIFT, + /* 0x2B "Backslash" */ SDL_SCANCODE_BACKSLASH, + /* 0x2C "KeyZ" */ SDL_SCANCODE_Z, + /* 0x2D "KeyX" */ SDL_SCANCODE_X, + /* 0x2E "KeyC" */ SDL_SCANCODE_C, + /* 0x2F "KeyV" */ SDL_SCANCODE_V, + /* 0x30 "KeyB" */ SDL_SCANCODE_B, + /* 0x31 "KeyN" */ SDL_SCANCODE_N, + /* 0x32 "KeyM" */ SDL_SCANCODE_M, + /* 0x33 "Comma" */ SDL_SCANCODE_COMMA, + /* 0x34 "Period" */ SDL_SCANCODE_PERIOD, + /* 0x35 "Slash" */ SDL_SCANCODE_SLASH, + /* 0x36 "ShiftRight" */ SDL_SCANCODE_RSHIFT, + /* 0x37 "NumpadMultiply" */ SDL_SCANCODE_KP_MULTIPLY, + /* 0x38 "AltLeft" */ SDL_SCANCODE_LALT, + /* 0x39 "Space" */ SDL_SCANCODE_SPACE, + /* 0x3A "CapsLock" */ SDL_SCANCODE_CAPSLOCK, + /* 0x3B "F1" */ SDL_SCANCODE_F1, + /* 0x3C "F2" */ SDL_SCANCODE_F2, + /* 0x3D "F3" */ SDL_SCANCODE_F3, + /* 0x3E "F4" */ SDL_SCANCODE_F4, + /* 0x3F "F5" */ SDL_SCANCODE_F5, + /* 0x40 "F6" */ SDL_SCANCODE_F6, + /* 0x41 "F7" */ SDL_SCANCODE_F7, + /* 0x42 "F8" */ SDL_SCANCODE_F8, + /* 0x43 "F9" */ SDL_SCANCODE_F9, + /* 0x44 "F10" */ SDL_SCANCODE_F10, + /* 0x45 "Pause" */ SDL_SCANCODE_PAUSE, + /* 0x46 "ScrollLock" */ SDL_SCANCODE_SCROLLLOCK, + /* 0x47 "Numpad7" */ SDL_SCANCODE_KP_7, + /* 0x48 "Numpad8" */ SDL_SCANCODE_KP_8, + /* 0x49 "Numpad9" */ SDL_SCANCODE_KP_9, + /* 0x4A "NumpadSubtract" */ SDL_SCANCODE_KP_MINUS, + /* 0x4B "Numpad4" */ SDL_SCANCODE_KP_4, + /* 0x4C "Numpad5" */ SDL_SCANCODE_KP_5, + /* 0x4D "Numpad6" */ SDL_SCANCODE_KP_6, + /* 0x4E "NumpadAdd" */ SDL_SCANCODE_KP_PLUS, + /* 0x4F "Numpad1" */ SDL_SCANCODE_KP_1, + /* 0x50 "Numpad2" */ SDL_SCANCODE_KP_2, + /* 0x51 "Numpad3" */ SDL_SCANCODE_KP_3, + /* 0x52 "Numpad0" */ SDL_SCANCODE_KP_0, + /* 0x53 "NumpadDecimal" */ SDL_SCANCODE_KP_PERIOD, + /* 0x54 "PrintScreen" */ SDL_SCANCODE_PRINTSCREEN, + /* 0x55 */ SDL_SCANCODE_UNKNOWN, + /* 0x56 "IntlBackslash" */ SDL_SCANCODE_NONUSBACKSLASH, + /* 0x57 "F11" */ SDL_SCANCODE_F11, + /* 0x58 "F12" */ SDL_SCANCODE_F12, + /* 0x59 "NumpadEqual" */ SDL_SCANCODE_KP_EQUALS, + /* 0x5A */ SDL_SCANCODE_UNKNOWN, + /* 0x5B */ SDL_SCANCODE_UNKNOWN, + /* 0x5C */ SDL_SCANCODE_UNKNOWN, + /* 0x5D */ SDL_SCANCODE_UNKNOWN, + /* 0x5E */ SDL_SCANCODE_UNKNOWN, + /* 0x5F */ SDL_SCANCODE_UNKNOWN, + /* 0x60 */ SDL_SCANCODE_UNKNOWN, + /* 0x61 */ SDL_SCANCODE_UNKNOWN, + /* 0x62 */ SDL_SCANCODE_UNKNOWN, + /* 0x63 */ SDL_SCANCODE_UNKNOWN, + /* 0x64 "F13" */ SDL_SCANCODE_F13, + /* 0x65 "F14" */ SDL_SCANCODE_F14, + /* 0x66 "F15" */ SDL_SCANCODE_F15, + /* 0x67 "F16" */ SDL_SCANCODE_F16, + /* 0x68 "F17" */ SDL_SCANCODE_F17, + /* 0x69 "F18" */ SDL_SCANCODE_F18, + /* 0x6A "F19" */ SDL_SCANCODE_F19, + /* 0x6B "F20" */ SDL_SCANCODE_F20, + /* 0x6C "F21" */ SDL_SCANCODE_F21, + /* 0x6D "F22" */ SDL_SCANCODE_F22, + /* 0x6E "F23" */ SDL_SCANCODE_F23, + /* 0x6F */ SDL_SCANCODE_UNKNOWN, + /* 0x70 "KanaMode" */ SDL_SCANCODE_INTERNATIONAL2, + /* 0x71 "Lang2" */ SDL_SCANCODE_LANG2, + /* 0x72 "Lang1" */ SDL_SCANCODE_LANG1, + /* 0x73 "IntlRo" */ SDL_SCANCODE_INTERNATIONAL1, + /* 0x74 */ SDL_SCANCODE_UNKNOWN, + /* 0x75 */ SDL_SCANCODE_UNKNOWN, + /* 0x76 "F24" */ SDL_SCANCODE_F24, + /* 0x77 */ SDL_SCANCODE_UNKNOWN, + /* 0x78 */ SDL_SCANCODE_UNKNOWN, + /* 0x79 "Convert" */ SDL_SCANCODE_INTERNATIONAL4, + /* 0x7A */ SDL_SCANCODE_UNKNOWN, + /* 0x7B "NonConvert" */ SDL_SCANCODE_INTERNATIONAL5, + /* 0x7C */ SDL_SCANCODE_UNKNOWN, + /* 0x7D "IntlYen" */ SDL_SCANCODE_INTERNATIONAL3, + /* 0x7E "NumpadComma" */ SDL_SCANCODE_KP_COMMA +}; + +static SDL_Scancode +Emscripten_MapScanCode(const char *code) +{ + const DOM_PK_CODE_TYPE pk_code = emscripten_compute_dom_pk_code(code); + if (pk_code < SDL_arraysize(emscripten_scancode_table)) { + return emscripten_scancode_table[pk_code]; + } + + switch (pk_code) { + case DOM_PK_PASTE: + return SDL_SCANCODE_PASTE; + case DOM_PK_MEDIA_TRACK_PREVIOUS: + return SDL_SCANCODE_AUDIOPREV; + case DOM_PK_CUT: + return SDL_SCANCODE_CUT; + case DOM_PK_COPY: + return SDL_SCANCODE_COPY; + case DOM_PK_MEDIA_TRACK_NEXT: + return SDL_SCANCODE_AUDIONEXT; + case DOM_PK_NUMPAD_ENTER: + return SDL_SCANCODE_KP_ENTER; + case DOM_PK_CONTROL_RIGHT: + return SDL_SCANCODE_RCTRL; + case DOM_PK_AUDIO_VOLUME_MUTE: + return SDL_SCANCODE_AUDIOMUTE; + case DOM_PK_LAUNCH_APP_2: + return SDL_SCANCODE_CALCULATOR; + case DOM_PK_MEDIA_PLAY_PAUSE: + return SDL_SCANCODE_AUDIOPLAY; + case DOM_PK_MEDIA_STOP: + return SDL_SCANCODE_AUDIOSTOP; + case DOM_PK_EJECT: + return SDL_SCANCODE_EJECT; + case DOM_PK_AUDIO_VOLUME_DOWN: + return SDL_SCANCODE_VOLUMEDOWN; + case DOM_PK_AUDIO_VOLUME_UP: + return SDL_SCANCODE_VOLUMEUP; + case DOM_PK_BROWSER_HOME: + return SDL_SCANCODE_AC_HOME; + case DOM_PK_NUMPAD_DIVIDE: + return SDL_SCANCODE_KP_DIVIDE; + case DOM_PK_ALT_RIGHT: + return SDL_SCANCODE_RALT; + case DOM_PK_HELP: + return SDL_SCANCODE_HELP; + case DOM_PK_NUM_LOCK: + return SDL_SCANCODE_NUMLOCKCLEAR; + case DOM_PK_HOME: + return SDL_SCANCODE_HOME; + case DOM_PK_ARROW_UP: + return SDL_SCANCODE_UP; + case DOM_PK_PAGE_UP: + return SDL_SCANCODE_PAGEUP; + case DOM_PK_ARROW_LEFT: + return SDL_SCANCODE_LEFT; + case DOM_PK_ARROW_RIGHT: + return SDL_SCANCODE_RIGHT; + case DOM_PK_END: + return SDL_SCANCODE_END; + case DOM_PK_ARROW_DOWN: + return SDL_SCANCODE_DOWN; + case DOM_PK_PAGE_DOWN: + return SDL_SCANCODE_PAGEDOWN; + case DOM_PK_INSERT: + return SDL_SCANCODE_INSERT; + case DOM_PK_DELETE: + return SDL_SCANCODE_DELETE; + case DOM_PK_META_LEFT: + return SDL_SCANCODE_LGUI; + case DOM_PK_META_RIGHT: + return SDL_SCANCODE_RGUI; + case DOM_PK_CONTEXT_MENU: + return SDL_SCANCODE_APPLICATION; + case DOM_PK_POWER: + return SDL_SCANCODE_POWER; + case DOM_PK_BROWSER_SEARCH: + return SDL_SCANCODE_AC_SEARCH; + case DOM_PK_BROWSER_FAVORITES: + return SDL_SCANCODE_AC_BOOKMARKS; + case DOM_PK_BROWSER_REFRESH: + return SDL_SCANCODE_AC_REFRESH; + case DOM_PK_BROWSER_STOP: + return SDL_SCANCODE_AC_STOP; + case DOM_PK_BROWSER_FORWARD: + return SDL_SCANCODE_AC_FORWARD; + case DOM_PK_BROWSER_BACK: + return SDL_SCANCODE_AC_BACK; + case DOM_PK_LAUNCH_APP_1: + return SDL_SCANCODE_COMPUTER; + case DOM_PK_LAUNCH_MAIL: + return SDL_SCANCODE_MAIL; + case DOM_PK_MEDIA_SELECT: + return SDL_SCANCODE_MEDIASELECT; + } + + return SDL_SCANCODE_UNKNOWN; +} + +static SDL_Keycode +Emscripten_MapKeyCode(const EmscriptenKeyboardEvent *keyEvent) +{ + SDL_Keycode keycode = SDLK_UNKNOWN; + if (keyEvent->keyCode < SDL_arraysize(emscripten_keycode_table)) { + keycode = emscripten_keycode_table[keyEvent->keyCode]; + if (keycode != SDLK_UNKNOWN) { + if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) { + switch (keycode) { + case SDLK_LSHIFT: + keycode = SDLK_RSHIFT; + break; + case SDLK_LCTRL: + keycode = SDLK_RCTRL; + break; + case SDLK_LALT: + keycode = SDLK_RALT; + break; + case SDLK_LGUI: + keycode = SDLK_RGUI; + break; + } + } else if (keyEvent->location == DOM_KEY_LOCATION_NUMPAD) { + switch (keycode) { + case SDLK_0: + case SDLK_INSERT: + keycode = SDLK_KP_0; + break; + case SDLK_1: + case SDLK_END: + keycode = SDLK_KP_1; + break; + case SDLK_2: + case SDLK_DOWN: + keycode = SDLK_KP_2; + break; + case SDLK_3: + case SDLK_PAGEDOWN: + keycode = SDLK_KP_3; + break; + case SDLK_4: + case SDLK_LEFT: + keycode = SDLK_KP_4; + break; + case SDLK_5: + keycode = SDLK_KP_5; + break; + case SDLK_6: + case SDLK_RIGHT: + keycode = SDLK_KP_6; + break; + case SDLK_7: + case SDLK_HOME: + keycode = SDLK_KP_7; + break; + case SDLK_8: + case SDLK_UP: + keycode = SDLK_KP_8; + break; + case SDLK_9: + case SDLK_PAGEUP: + keycode = SDLK_KP_9; + break; + case SDLK_RETURN: + keycode = SDLK_KP_ENTER; + break; + case SDLK_DELETE: + keycode = SDLK_KP_PERIOD; + break; + } + } + } + } + + return keycode; +} + /* "borrowed" from SDL_windowsevents.c */ static int Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) @@ -492,109 +803,41 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { - Uint32 scancode; - SDL_bool prevent_default = SDL_FALSE; - SDL_bool is_nav_key; + const SDL_Keycode keycode = Emscripten_MapKeyCode(keyEvent); + SDL_Scancode scancode = Emscripten_MapScanCode(keyEvent->code); + SDL_bool prevent_default = SDL_TRUE; + SDL_bool is_nav_key = SDL_FALSE; - /* .keyCode is deprecated, but still the most reliable way to get keys */ - if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) { - scancode = emscripten_scancode_table[keyEvent->keyCode]; - - if (keyEvent->keyCode == 0) { - /* KaiOS Left Soft Key and Right Soft Key, they act as OK/Next/Menu and Cancel/Back/Clear */ - if (SDL_strncmp(keyEvent->key, "SoftLeft", 9) == 0) { - scancode = SDL_SCANCODE_AC_FORWARD; - } - if (SDL_strncmp(keyEvent->key, "SoftRight", 10) == 0) { - scancode = SDL_SCANCODE_AC_BACK; - } + if (scancode == SDL_SCANCODE_UNKNOWN) { + /* KaiOS Left Soft Key and Right Soft Key, they act as OK/Next/Menu and Cancel/Back/Clear */ + if (SDL_strncmp(keyEvent->key, "SoftLeft", 9) == 0) { + scancode = SDL_SCANCODE_AC_FORWARD; + } else if (SDL_strncmp(keyEvent->key, "SoftRight", 10) == 0) { + scancode = SDL_SCANCODE_AC_BACK; } + } - if (scancode != SDL_SCANCODE_UNKNOWN) { - - if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) { - switch (scancode) { - case SDL_SCANCODE_LSHIFT: - scancode = SDL_SCANCODE_RSHIFT; - break; - case SDL_SCANCODE_LCTRL: - scancode = SDL_SCANCODE_RCTRL; - break; - case SDL_SCANCODE_LALT: - scancode = SDL_SCANCODE_RALT; - break; - case SDL_SCANCODE_LGUI: - scancode = SDL_SCANCODE_RGUI; - break; - } - } - else if (keyEvent->location == DOM_KEY_LOCATION_NUMPAD) { - switch (scancode) { - case SDL_SCANCODE_0: - case SDL_SCANCODE_INSERT: - scancode = SDL_SCANCODE_KP_0; - break; - case SDL_SCANCODE_1: - case SDL_SCANCODE_END: - scancode = SDL_SCANCODE_KP_1; - break; - case SDL_SCANCODE_2: - case SDL_SCANCODE_DOWN: - scancode = SDL_SCANCODE_KP_2; - break; - case SDL_SCANCODE_3: - case SDL_SCANCODE_PAGEDOWN: - scancode = SDL_SCANCODE_KP_3; - break; - case SDL_SCANCODE_4: - case SDL_SCANCODE_LEFT: - scancode = SDL_SCANCODE_KP_4; - break; - case SDL_SCANCODE_5: - scancode = SDL_SCANCODE_KP_5; - break; - case SDL_SCANCODE_6: - case SDL_SCANCODE_RIGHT: - scancode = SDL_SCANCODE_KP_6; - break; - case SDL_SCANCODE_7: - case SDL_SCANCODE_HOME: - scancode = SDL_SCANCODE_KP_7; - break; - case SDL_SCANCODE_8: - case SDL_SCANCODE_UP: - scancode = SDL_SCANCODE_KP_8; - break; - case SDL_SCANCODE_9: - case SDL_SCANCODE_PAGEUP: - scancode = SDL_SCANCODE_KP_9; - break; - case SDL_SCANCODE_RETURN: - scancode = SDL_SCANCODE_KP_ENTER; - break; - case SDL_SCANCODE_DELETE: - scancode = SDL_SCANCODE_KP_PERIOD; - break; - } - } - prevent_default = SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); - } + if (scancode != SDL_SCANCODE_UNKNOWN) { + SDL_SendKeyboardKeyComplete(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode, keycode); } /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ - is_nav_key = keyEvent->keyCode == 8 /* backspace */ || - keyEvent->keyCode == 9 /* tab */ || - keyEvent->keyCode == 37 /* left */ || - keyEvent->keyCode == 38 /* up */ || - keyEvent->keyCode == 39 /* right */ || - keyEvent->keyCode == 40 /* down */ || - (keyEvent->keyCode >= 112 && keyEvent->keyCode <= 135) /* F keys*/ || - keyEvent->ctrlKey; + if ( (scancode == SDL_SCANCODE_BACKSPACE) || + (scancode == SDL_SCANCODE_TAB) || + (scancode == SDL_SCANCODE_LEFT) || + (scancode == SDL_SCANCODE_UP) || + (scancode == SDL_SCANCODE_RIGHT) || + (scancode == SDL_SCANCODE_DOWN) || + ((scancode >= SDL_SCANCODE_F1) && (scancode <= SDL_SCANCODE_F15)) || + keyEvent->ctrlKey ) { + is_nav_key = SDL_TRUE; + } - if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && !is_nav_key) + if ((eventType == EMSCRIPTEN_EVENT_KEYDOWN) && (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) && !is_nav_key) { prevent_default = SDL_FALSE; + } return prevent_default; } From b9e1d1b4de713c031353ec300113bd776961625c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 9 Oct 2022 19:49:34 -0400 Subject: [PATCH 250/459] events: Rename SDL_SendKeyboardKeyComplete to SDL_SendKeyboardKeyAndKeycode.+ --- src/events/SDL_keyboard.c | 2 +- src/events/SDL_keyboard_c.h | 2 +- src/video/emscripten/SDL_emscriptenevents.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index c139dbdf1..87fee123b 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -976,7 +976,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) } int -SDL_SendKeyboardKeyComplete(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode) +SDL_SendKeyboardKeyAndKeycode(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode) { return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode, keycode); } diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index 653392131..db9703aaf 100644 --- a/src/events/SDL_keyboard_c.h +++ b/src/events/SDL_keyboard_c.h @@ -55,7 +55,7 @@ extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode); /* This is for platforms that don't know the keymap but can report scancode and keycode directly. Most platforms should prefer to optionally call SDL_SetKeymap and then use SDL_SendKeyboardKey. */ -extern int SDL_SendKeyboardKeyComplete(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode); +extern int SDL_SendKeyboardKeyAndKeycode(Uint8 state, SDL_Scancode scancode, SDL_Keycode keycode); /* Release all the autorelease keys */ extern void SDL_ReleaseAutoReleaseKeys(void); diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 6c2a17df9..deb12b47a 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -818,7 +818,7 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi } if (scancode != SDL_SCANCODE_UNKNOWN) { - SDL_SendKeyboardKeyComplete(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode, keycode); + SDL_SendKeyboardKeyAndKeycode(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode, keycode); } /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress From ab06a307dce89be8526e2716d0b0819e86b46f73 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Oct 2022 09:21:17 -0700 Subject: [PATCH 251/459] Don't report windows being maximized when fullscreen on X11 This is a functional state for some window managers (tested using stock Ubuntu 22.04.1), and removing that state, e.g. using SDL_RestoreWindow(), results in a window centered and floating, and not visually covering the rest of the desktop. --- src/video/x11/SDL_x11events.c | 2 +- src/video/x11/SDL_x11window.c | 32 +++++++++++++++++++++++++++----- src/video/x11/SDL_x11window.h | 2 +- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 6e584f275..38e1a7965 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1460,7 +1460,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) without ever mapping / unmapping them, so we handle that here, because they use the NETWM protocol to notify us of changes. */ - const Uint32 flags = X11_GetNetWMState(_this, xevent->xproperty.window); + const Uint32 flags = X11_GetNetWMState(_this, data->window, xevent->xproperty.window); const Uint32 changed = flags ^ data->window->flags; if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) { diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 770116bb0..a8d6a6505 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -173,7 +173,7 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) } Uint32 -X11_GetNetWMState(_THIS, Window xwindow) +X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; @@ -211,14 +211,28 @@ X11_GetNetWMState(_THIS, Window xwindow) fullscreen = 1; } } - if (maximized == 3) { - flags |= SDL_WINDOW_MAXIMIZED; - } if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } + if (maximized == 3) { + /* Fullscreen windows are maximized on some window managers, + and this is functional behavior - if maximized is removed, + the windows remain floating centered and not covering the + rest of the desktop. So we just won't change the maximize + state for fullscreen windows here, otherwise SDL would think + we're always maximized when fullscreen and not restore the + correct state when leaving fullscreen. + */ + if (fullscreen) { + flags |= (window->flags & SDL_WINDOW_MAXIMIZED); + } else { + flags |= SDL_WINDOW_MAXIMIZED; + } + } + + /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN * will not be set. Do an additional check to see if the window is unmapped * and mark it as SDL_WINDOW_HIDDEN if it is. @@ -306,7 +320,7 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) data->colormap = attrib.colormap; } - window->flags |= X11_GetNetWMState(_this, w); + window->flags |= X11_GetNetWMState(_this, window, w); { Window FocalWindow; @@ -1252,6 +1266,14 @@ SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized) window->flags |= SDL_WINDOW_MAXIMIZED; } else { window->flags &= ~SDL_WINDOW_MAXIMIZED; + + if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + /* Fullscreen windows are maximized on some window managers, + and this is functional behavior, so don't remove that state + now, we'll take care of it when we leave fullscreen mode. + */ + return; + } } if (X11_IsWindowMapped(_this, window)) { diff --git a/src/video/x11/SDL_x11window.h b/src/video/x11/SDL_x11window.h index c32955b26..5298decc4 100644 --- a/src/video/x11/SDL_x11window.h +++ b/src/video/x11/SDL_x11window.h @@ -81,7 +81,7 @@ typedef struct } SDL_WindowData; extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags); -extern Uint32 X11_GetNetWMState(_THIS, Window xwindow); +extern Uint32 X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow); extern int X11_CreateWindow(_THIS, SDL_Window * window); extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); From 4556074e183a9a6249a98c7c2b01687f227178a0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Oct 2022 09:35:07 -0700 Subject: [PATCH 252/459] Re-set the maximize state if we were maximized while fullscreen --- src/video/x11/SDL_x11window.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index a8d6a6505..9b007e79d 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1388,13 +1388,17 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis /* Fullscreen windows sometimes end up being marked maximized by window managers. Force it back to how we expect it to be. */ - if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) { + if (!fullscreen) { SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_WM_STATE; e.xclient.format = 32; e.xclient.window = data->xwindow; - e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + if ((window->flags & SDL_WINDOW_MAXIMIZED) != 0) { + e.xclient.data.l[0] = _NET_WM_STATE_ADD; + } else { + e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + } e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT; e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ; e.xclient.data.l[3] = 0l; From c360ca9928b07214b108b48a2440cd01a7ad0875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=B4=E9=80=B8?= <853974536@qq.com> Date: Sat, 29 Oct 2022 16:55:10 +0800 Subject: [PATCH 253/459] Add UWP-ARM64 Support. --- VisualC-WinRT/SDL-UWP.sln | 6 ++ VisualC-WinRT/SDL-UWP.vcxproj | 168 ++++++++++++++++------------------ 2 files changed, 84 insertions(+), 90 deletions(-) diff --git a/VisualC-WinRT/SDL-UWP.sln b/VisualC-WinRT/SDL-UWP.sln index 0a786e7d8..472c4f01b 100644 --- a/VisualC-WinRT/SDL-UWP.sln +++ b/VisualC-WinRT/SDL-UWP.sln @@ -8,21 +8,27 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.Build.0 = Debug|ARM64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.ActiveCfg = Release|ARM64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.Build.0 = Release|ARM64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64 {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32 diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj index 22b29452c..9d7c01351 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ b/VisualC-WinRT/SDL-UWP.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug ARM @@ -17,6 +21,10 @@ Release ARM + + Release + ARM64 + Release Win32 @@ -190,38 +198,18 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true @@ -236,12 +224,7 @@ - true - true - true - true - true - true + true @@ -264,23 +247,13 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true @@ -348,68 +321,28 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true @@ -438,6 +371,11 @@ true v142 + + DynamicLibrary + true + v142 + DynamicLibrary true @@ -455,6 +393,12 @@ true v142 + + DynamicLibrary + false + true + v142 + DynamicLibrary false @@ -478,6 +422,12 @@ + + + + + + @@ -506,6 +456,16 @@ false SDL2 + + false + false + SDL2 + + + false + false + SDL2 + false false @@ -572,6 +532,34 @@ /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + NotUsing + false + ..\include;%(AdditionalIncludeDirectories) + DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + NotUsing + false + ..\include;%(AdditionalIncludeDirectories) + DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + NotUsing From f6b1e028ab46bae7667db240d2238cd59f3a9d76 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Oct 2022 10:42:48 -0700 Subject: [PATCH 254/459] Allow vendor matching for hid_enumerate() on all backends --- src/hidapi/android/hid.cpp | 4 ++-- src/hidapi/mac/hid.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index de365d005..2b2af72db 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -1089,8 +1089,8 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor for ( hid_device_ref pDevice = g_Devices; pDevice; pDevice = pDevice->next ) { const hid_device_info *info = pDevice->GetDeviceInfo(); - if ( ( vendor_id == 0 && product_id == 0 ) || - ( vendor_id == info->vendor_id && product_id == info->product_id ) ) + if ( ( vendor_id == 0x0 || info->vendor_id == vendor_id ) && + ( product_id == 0x0 || info->product_id == product_id ) ) { hid_device_info *dev = CopyHIDDeviceInfo( info ); dev->next = root; diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index 35ca38037..d52b94f0a 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -568,8 +568,8 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, dev_pid = get_product_id(dev); /* Check the VID/PID against the arguments */ - if ((vendor_id == 0x0 && product_id == 0x0) || - (vendor_id == dev_vid && product_id == dev_pid)) { + if ((vendor_id == 0x0 || dev_vid == vendor_id) && + (product_id == 0x0 || dev_pid == product_id)) { struct hid_device_info *tmp; /* VID/PID match. Create the record. */ From 9c8b1fd8b69717e5978105c6733e6c6a87ed40c1 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sat, 29 Oct 2022 22:34:05 -0400 Subject: [PATCH 255/459] wayland: Cleanup work to aid reconnect support Co-authored-by: David Edmundson --- src/events/SDL_mouse.c | 24 +++++ src/events/SDL_mouse_c.h | 5 + src/video/wayland/SDL_waylanddyn.h | 1 + src/video/wayland/SDL_waylandevents.c | 17 ++- src/video/wayland/SDL_waylandsym.h | 6 ++ src/video/wayland/SDL_waylandvideo.c | 148 ++++++++++++++++++++------ src/video/wayland/SDL_waylandvideo.h | 2 + 7 files changed, 167 insertions(+), 36 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index f315674ff..994b6a6db 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -266,6 +266,30 @@ SDL_GetMouseFocus(void) return mouse->focus; } +/* TODO RECONNECT: Hello from the Wayland video driver! + * This was once removed from SDL, but it's been added back in comment form + * because we will need it when Wayland adds compositor reconnect support. + * If you need this before we do, great! Otherwise, leave this alone, we'll + * uncomment it at the right time. + * -flibit + */ +#if 0 +void +SDL_ResetMouse(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + Uint32 buttonState = GetButtonState(mouse, SDL_FALSE); + int i; + + for (i = 1; i <= sizeof(buttonState)*8; ++i) { + if (buttonState & SDL_BUTTON(i)) { + SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i); + } + } + SDL_assert(GetButtonState(mouse, SDL_FALSE) == 0); +} +#endif /* 0 */ + void SDL_SetMouseFocus(SDL_Window * window) { diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index e9dda276b..6dd023041 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -164,6 +164,11 @@ extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, /* Warp the mouse within the window, potentially overriding relative mode */ extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode); +/* TODO RECONNECT: Set mouse state to "zero" */ +#if 0 +extern void SDL_ResetMouse(void); +#endif /* 0 */ + /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h index 1346e9814..12341e16f 100644 --- a/src/video/wayland/SDL_waylanddyn.h +++ b/src/video/wayland/SDL_waylanddyn.h @@ -102,6 +102,7 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_proxy_get_tag (*WAYLAND_wl_proxy_get_tag) #define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags) #define wl_proxy_marshal_array_flags (*WAYLAND_wl_proxy_marshal_array_flags) +#define wl_display_reconnect (*WAYLAND_wl_display_reconnect) #define wl_seat_interface (*WAYLAND_wl_seat_interface) #define wl_surface_interface (*WAYLAND_wl_surface_interface) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 65e829c10..01e5ad404 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -420,11 +420,18 @@ Wayland_PumpEvents(_THIS) if (err < 0 && !d->display_disconnected) { /* Something has failed with the Wayland connection -- for example, * the compositor may have shut down and closed its end of the socket, - * or there is a library-specific error. No recovery is possible. */ - d->display_disconnected = 1; - /* Only send a single quit message, as application shutdown might call - * SDL_PumpEvents */ - SDL_SendQuit(); + * or there is a library-specific error. + * + * Try to recover once, then quit. + */ + if (!Wayland_VideoReconnect(_this)) { + d->display_disconnected = 1; + + /* Only send a single quit message, as application shutdown might call + * SDL_PumpEvents + */ + SDL_SendQuit(); + } } } diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h index 0473fa1b1..987bc499d 100644 --- a/src/video/wayland/SDL_waylandsym.h +++ b/src/video/wayland/SDL_waylandsym.h @@ -86,6 +86,12 @@ SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *prox SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args)) #endif +#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */ +#if SDL_WAYLAND_CHECK_VERSION(broken, on, purpose) +SDL_WAYLAND_SYM(int, wl_display_reconnect, (struct wl_display*)); +#endif +#endif /* 0 */ + SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 666e4efb0..318d96e08 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1028,7 +1028,7 @@ Wayland_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float } void -Wayland_VideoQuit(_THIS) +Wayland_VideoCleanup(_THIS) { SDL_VideoData *data = _this->driverdata; int i, j; @@ -1036,7 +1036,7 @@ Wayland_VideoQuit(_THIS) Wayland_QuitWin(data); Wayland_FiniMouse(data); - for (i = 0; i < _this->num_displays; ++i) { + for (i = _this->num_displays - 1; i >= 0; --i) { SDL_VideoDisplay *display = &_this->displays[i]; if (((SDL_WaylandOutputData*)display->driverdata)->xdg_output) { @@ -1051,54 +1051,158 @@ Wayland_VideoQuit(_THIS) display->display_modes[j].driverdata = NULL; } display->desktop_mode.driverdata = NULL; + SDL_DelVideoDisplay(i); } Wayland_display_destroy_input(data); Wayland_display_destroy_pointer_constraints(data); Wayland_display_destroy_relative_pointer_manager(data); - if (data->activation_manager) + if (data->activation_manager) { xdg_activation_v1_destroy(data->activation_manager); + data->activation_manager = NULL; + } - if (data->idle_inhibit_manager) + if (data->idle_inhibit_manager) { zwp_idle_inhibit_manager_v1_destroy(data->idle_inhibit_manager); + data->idle_inhibit_manager = NULL; + } - if (data->key_inhibitor_manager) + if (data->key_inhibitor_manager) { zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(data->key_inhibitor_manager); + data->key_inhibitor_manager = NULL; + } Wayland_QuitKeyboard(_this); - if (data->text_input_manager) + if (data->text_input_manager) { zwp_text_input_manager_v3_destroy(data->text_input_manager); + data->text_input_manager = NULL; + } if (data->xkb_context) { WAYLAND_xkb_context_unref(data->xkb_context); data->xkb_context = NULL; } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (data->windowmanager) + if (data->windowmanager) { qt_windowmanager_destroy(data->windowmanager); + data->windowmanager = NULL; + } - if (data->surface_extension) + if (data->surface_extension) { qt_surface_extension_destroy(data->surface_extension); + data->surface_extension = NULL; + } Wayland_touch_destroy(data); #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - if (data->tablet_manager) + if (data->tablet_manager) { zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2*)data->tablet_manager); + data->tablet_manager = NULL; + } - if (data->data_device_manager) + if (data->data_device_manager) { wl_data_device_manager_destroy(data->data_device_manager); + data->data_device_manager = NULL; + } - if (data->shm) + if (data->shm) { wl_shm_destroy(data->shm); + data->shm = NULL; + } - if (data->shell.xdg) + if (data->shell.xdg) { xdg_wm_base_destroy(data->shell.xdg); + data->shell.xdg = NULL; + } - if (data->decoration_manager) + if (data->decoration_manager) { zxdg_decoration_manager_v1_destroy(data->decoration_manager); + data->decoration_manager = NULL; + } + + if (data->xdg_output_manager) { + zxdg_output_manager_v1_destroy(data->xdg_output_manager); + data->xdg_output_manager = NULL; + } + + if (data->viewporter) { + wp_viewporter_destroy(data->viewporter); + data->viewporter = NULL; + } + + if (data->primary_selection_device_manager) { + zwp_primary_selection_device_manager_v1_destroy(data->primary_selection_device_manager); + data->primary_selection_device_manager = NULL; + } + + if (data->compositor) { + wl_compositor_destroy(data->compositor); + data->compositor = NULL; + } + + if (data->registry) { + wl_registry_destroy(data->registry); + data->registry = NULL; + } +} + +SDL_bool +Wayland_VideoReconnect(_THIS) +{ +#if 0 /* TODO RECONNECT: Uncomment all when https://invent.kde.org/plasma/kwin/-/wikis/Restarting is completed */ + SDL_VideoData *data = _this->driverdata; + + SDL_Window *window = NULL; + + SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); + SDL_Window *current_window = SDL_GL_GetCurrentWindow(); + + Wayland_FiniMouse(data); + + SDL_GL_MakeCurrent(NULL, NULL); + Wayland_VideoCleanup(_this); + + SDL_ResetKeyboard(); + SDL_ResetMouse(); + if (WAYLAND_wl_display_reconnect(data->display) < 0) { + return SDL_FALSE; + } + + Wayland_VideoInit(_this); + + window = _this->windows; + while (window) { + /* We're going to cheat _just_ for a second and strip the OpenGL flag. + * The Wayland driver actually forces it in CreateWindow, and + * RecreateWindow does a bunch of unloading/loading of libGL, so just + * strip the flag so RecreateWindow doesn't mess with the GL context, + * and CreateWindow will add it right back! + * -flibit + */ + window->flags &= ~SDL_WINDOW_OPENGL; + + SDL_RecreateWindow(window, window->flags); + window = window->next; + } + + if (current_window && current_ctx) { + SDL_GL_MakeCurrent (current_window, current_ctx); + } + return SDL_TRUE; +#else + return SDL_FALSE; +#endif /* 0 */ +} + +void +Wayland_VideoQuit(_THIS) +{ + SDL_VideoData *data = _this->driverdata; + + Wayland_VideoCleanup(_this); #ifdef HAVE_LIBDECOR_H if (data->shell.libdecor) { @@ -1107,24 +1211,6 @@ Wayland_VideoQuit(_THIS) } #endif - if (data->xdg_output_manager) { - zxdg_output_manager_v1_destroy(data->xdg_output_manager); - } - - if (data->viewporter) { - wp_viewporter_destroy(data->viewporter); - } - - if (data->primary_selection_device_manager) { - zwp_primary_selection_device_manager_v1_destroy(data->primary_selection_device_manager); - } - - if (data->compositor) - wl_compositor_destroy(data->compositor); - - if (data->registry) - wl_registry_destroy(data->registry); - SDL_free(data->classname); } diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h index e1825cbae..e7f66fe2d 100644 --- a/src/video/wayland/SDL_waylandvideo.h +++ b/src/video/wayland/SDL_waylandvideo.h @@ -126,6 +126,8 @@ extern SDL_bool SDL_WAYLAND_own_output(struct wl_output *output); extern SDL_bool Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg); +extern SDL_bool Wayland_VideoReconnect(_THIS); + #endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ From 571ff1a3a96f03a3c1e2e01479077c5d61eadfa0 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 30 Oct 2022 00:19:09 -0400 Subject: [PATCH 256/459] wayland: Prepare cursor implementation for reconnect support Co-authored-by: David Edmundson --- src/video/wayland/SDL_waylandmouse.c | 91 ++++++++++++++++++++++++---- src/video/wayland/SDL_waylandmouse.h | 3 + src/video/wayland/SDL_waylandvideo.c | 6 +- 3 files changed, 86 insertions(+), 14 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index a5a45e724..32499fdd7 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -458,25 +458,35 @@ Wayland_CreateDefaultCursor() return Wayland_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW); } +static void +Wayland_FreeCursorData(Wayland_CursorData *d) +{ + if (d->buffer) { + if (d->shm_data) { + wl_buffer_destroy(d->buffer); + } + d->buffer = NULL; + } + + if (d->surface) { + wl_surface_destroy(d->surface); + d->surface = NULL; + } +} + static void Wayland_FreeCursor(SDL_Cursor *cursor) { - Wayland_CursorData *d; - - if (!cursor) + if (!cursor) { return; - - d = cursor->driverdata; + } /* Probably not a cursor we own */ - if (!d) + if (!cursor->driverdata) { return; + } - if (d->buffer && d->shm_data) - wl_buffer_destroy(d->buffer); - - if (d->surface) - wl_surface_destroy(d->surface); + Wayland_FreeCursorData((Wayland_CursorData *) cursor->driverdata); /* Not sure what's meant to happen to shm_data */ SDL_free(cursor->driverdata); @@ -589,6 +599,65 @@ Wayland_EmulateMouseWarpChanged(void *userdata, const char *name, const char *ol input->warp_emulation_prohibited = !SDL_GetStringBoolean(hint, !input->warp_emulation_prohibited); } +#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */ +static void +Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata) +{ + Wayland_CursorData *cdata = (Wayland_CursorData *) cursor->driverdata; + + /* Probably not a cursor we own */ + if (cdata == NULL) { + return; + } + + Wayland_FreeCursorData(cdata); + + /* We're not currently freeing this, so... yolo? */ + if (cdata->shm_data != NULL) { + void *old_data_pointer = cdata->shm_data; + int stride = cdata->w * 4; + + create_buffer_from_shm(cdata, cdata->w, cdata->h, WL_SHM_FORMAT_ARGB8888); + + SDL_memcpy(cdata->shm_data, old_data_pointer, stride * cdata->h); + + cdata->surface = wl_compositor_create_surface(vdata->compositor); + wl_surface_set_user_data(cdata->surface, NULL); + } +} + +void +Wayland_RecreateCursors(void) +{ + SDL_Cursor *cursor; + SDL_Mouse *mouse = SDL_GetMouse(); + SDL_VideoData *vdata = SDL_GetVideoDevice()->driverdata; + + if (vdata && vdata->cursor_themes) { + SDL_free(vdata->cursor_themes); + vdata->cursor_themes = NULL; + vdata->num_cursor_themes = 0; + } + + if (mouse == NULL) { + return; + } + + for (cursor = mouse->cursors; cursor != NULL; cursor = cursor->next) { + Wayland_RecreateCursor(cursor, vdata); + } + if (mouse->def_cursor) { + Wayland_RecreateCursor(mouse->def_cursor, vdata); + } + if (mouse->cur_cursor) { + Wayland_RecreateCursor(mouse->cur_cursor, vdata); + if (mouse->cursor_shown) { + Wayland_ShowCursor(mouse->cur_cursor); + } + } +} +#endif /* 0 */ + void Wayland_InitMouse(void) { diff --git a/src/video/wayland/SDL_waylandmouse.h b/src/video/wayland/SDL_waylandmouse.h index 76b58b5c2..00a56af43 100644 --- a/src/video/wayland/SDL_waylandmouse.h +++ b/src/video/wayland/SDL_waylandmouse.h @@ -27,5 +27,8 @@ extern void Wayland_InitMouse(void); extern void Wayland_FiniMouse(SDL_VideoData *data); +#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */ +extern void Wayland_RecreateCursors(void); +#endif /* 0 */ #endif diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 318d96e08..eccdd0bbb 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1027,7 +1027,7 @@ Wayland_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float return driverdata->ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); } -void +static void Wayland_VideoCleanup(_THIS) { SDL_VideoData *data = _this->driverdata; @@ -1160,8 +1160,6 @@ Wayland_VideoReconnect(_THIS) SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); SDL_Window *current_window = SDL_GL_GetCurrentWindow(); - Wayland_FiniMouse(data); - SDL_GL_MakeCurrent(NULL, NULL); Wayland_VideoCleanup(_this); @@ -1188,6 +1186,8 @@ Wayland_VideoReconnect(_THIS) window = window->next; } + Wayland_RecreateCursors(); + if (current_window && current_ctx) { SDL_GL_MakeCurrent (current_window, current_ctx); } From 57973cd3797bb934748e6742c11bbf5a44c8517b Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:30:49 +0100 Subject: [PATCH 257/459] SDL_HINTS.H: Correct spelling mistake noticable -> noticeable --- include/SDL_hints.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index d7849a4d4..1af57930e 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -1257,7 +1257,7 @@ extern "C" { * When polling for events, SDL_PumpEvents is used to gather new events from devices. * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will * become stuck until the new events stop. - * This is most noticable when moving a high frequency mouse. + * This is most noticeable when moving a high frequency mouse. * * By default, poll sentinels are enabled. */ From 61f3662c9578c82e624601e8a477c5ded94d4f91 Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:34:47 +0100 Subject: [PATCH 258/459] SDL_QSA_AUDIO.C: Correct spelling mistake occured -> occurred --- src/audio/qsa/SDL_qsa_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 82f372a33..2e6f21d07 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -117,7 +117,7 @@ QSA_WaitDevice(_THIS) int result; /* Setup timeout for playing one fragment equal to 2 seconds */ - /* If timeout occured than something wrong with hardware or driver */ + /* If timeout occurred than something wrong with hardware or driver */ /* For example, Vortex 8820 audio driver stucks on second DAC because */ /* it doesn't exist ! */ result = SDL_IOReady(this->hidden->audio_fd, From 6a881302ad351f1d9d3bce2b638c7c63eaed637a Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:35:59 +0100 Subject: [PATCH 259/459] SDL_IBUS.H: Correct spelling mistake recieve -> receive --- src/core/linux/SDL_ibus.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/linux/SDL_ibus.h b/src/core/linux/SDL_ibus.h index d7071ec59..7c0bd8da7 100644 --- a/src/core/linux/SDL_ibus.h +++ b/src/core/linux/SDL_ibus.h @@ -40,7 +40,7 @@ extern void SDL_IBus_Reset(void); /* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to update its candidate list or change input methods. PumpEvents should be - called some time after this, to recieve the TextInput / TextEditing event back. */ + called some time after this, to receive the TextInput / TextEditing event back. */ extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); /* Update the position of IBus' candidate list. If rect is NULL then this will From d7a46a16e9bdfef73d20667474bfdfe6e42f4c8b Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:37:23 +0100 Subject: [PATCH 260/459] SDL_SYSLOADSO.c: Correct spelling mistake publically -> publicly --- src/loadso/windows/SDL_sysloadso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loadso/windows/SDL_sysloadso.c b/src/loadso/windows/SDL_sysloadso.c index d3c84042b..1157ed3b5 100644 --- a/src/loadso/windows/SDL_sysloadso.c +++ b/src/loadso/windows/SDL_sysloadso.c @@ -41,7 +41,7 @@ SDL_LoadObject(const char *sofile) } tstr = WIN_UTF8ToString(sofile); #ifdef __WINRT__ - /* WinRT only publically supports LoadPackagedLibrary() for loading .dll + /* WinRT only publicly supports LoadPackagedLibrary() for loading .dll files. LoadLibrary() is a private API, and not available for apps (that can be published to MS' Windows Store.) */ From 3369b0163f2a62e88b04e45d6ce78328bdf76611 Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:43:04 +0100 Subject: [PATCH 261/459] SDL_PS2_MAIN.C: Correct spelling mistake untill -> until --- src/main/ps2/SDL_ps2_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ps2/SDL_ps2_main.c b/src/main/ps2/SDL_ps2_main.c index 77ec4c5db..6d5c43a03 100644 --- a/src/main/ps2/SDL_ps2_main.c +++ b/src/main/ps2/SDL_ps2_main.c @@ -59,7 +59,7 @@ static void waitUntilDeviceIsReady(char *path) while(ret != 0 && retries > 0) { ret = stat(path, &buffer); - /* Wait untill the device is ready */ + /* Wait until the device is ready */ nopdelay(); retries--; From 8b9c82e140e81cb9cca6e7bd16dd65b8cb76fca3 Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:50:36 +0100 Subject: [PATCH 262/459] SDL_RENDER_PSP.C: Correct spelling mistakes wether -> whether --- src/render/psp/SDL_render_psp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 84dc47237..6644230ec 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -96,12 +96,12 @@ typedef struct unsigned int psm; /**< format of the display buffers */ unsigned int bpp; /**< bits per pixel of the main display */ - SDL_bool vsync; /**< wether we do vsync */ + SDL_bool vsync; /**< whether we do vsync */ PSP_BlendState blendState; /**< current blend mode */ PSP_TextureData* most_recent_target; /**< start of render target LRU double linked list */ PSP_TextureData* least_recent_target; /**< end of the LRU list */ - SDL_bool vblank_not_reached; /**< wether vblank wasn't reached */ + SDL_bool vblank_not_reached; /**< whether vblank wasn't reached */ } PSP_RenderData; From 678ef7977ffdcd5e91d4b85abd6e12ce6b5ce891 Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 30 Oct 2022 08:53:34 +0100 Subject: [PATCH 263/459] SDL_KMSDRMOPENGLES.H: Correct spelling mistakes begining -> beginning beggining -> beginning --- src/video/kmsdrm/SDL_kmsdrmopengles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c index 25d942e09..253e34ecd 100644 --- a/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -180,11 +180,11 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) { } /* Wait immediately for vsync (as if we only had two buffers). - Even if we are already doing a WaitPageflip at the begining of this + Even if we are already doing a WaitPageflip at the beginning of this function, this is NOT redundant because here we wait immediately after submitting the image to the screen, reducing lag, and if we have waited here, there won't be a pending pageflip so the - WaitPageflip at the beggining of this function will be a no-op. + WaitPageflip at the beginning of this function will be a no-op. Just leave it here and don't worry. Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " to enable this. */ From e0d904e90b15c7be45210e51b8969d3beab71437 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 31 Oct 2022 12:05:36 +0000 Subject: [PATCH 264/459] sdl2-config.in: Deprecate sdl2-config Library-specific foo-config scripts duplicate very similar logic across various different projects, and tend to break cross-compiling, multilib (gcc -m32), Debian/Ubuntu multiarch and so on by only being able to have one sdl2-config at a time as the first one in the PATH. The direct replacement is pkg-config(1) or a compatible reimplementation like pkgconf(1), which relies on each library installing declarative metadata, like SDL's sdl2.pc (available since at least 2.0.0) and centralizes the logic into the pkg-config/pkgconf tool. Most uses of `sdl2-config --foo` can be replaced by something similar to `${PKG_CONFIG:-pkg-config} --foo sdl2`. Instead of adding a custom sdl2-config to the PATH or using its --prefix or --exec-prefix options, users of a custom installation prefix can use any of pkg-config's non-SDL-specific ways to influence the result, for example setting PKG_CONFIG_PATH, PKG_CONFIG_SYSROOT_DIR or PKG_CONFIG_LIBDIR environment variables, or setting the PKG_CONFIG environment variable to point to a wrapper script. For Autotools specifically, the replacement for AM_PATH_SDL2 (which will be officially deprecated in a subsequent commit) is PKG_CHECK_MODULES. CMake has its own semi-declarative mechanism for dependency discovery, "config packages", and the SDL build already installs a config package. There's a good example of using a config package to discover SDL in `cmake/test/`. Meson natively supports pkg-config, and already uses it in preference to sdl2-config. Other build systems can run pkg-config instead of sdl2-config, preferably checking the PKG_CONFIG environment variable first. https://github.com/ioquake/ioq3 is a good example of a project doing this correctly. Helps: #6140, #3516 Signed-off-by: Simon McVittie --- sdl2-config.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdl2-config.in b/sdl2-config.in index f6eca7668..f7e5cd059 100644 --- a/sdl2-config.in +++ b/sdl2-config.in @@ -19,6 +19,11 @@ if test $# -eq 0; then exit 1 fi +echo "sdl2-config: This script is deprecated" >&2 +echo "sdl2-config: In Autotools builds, use PKG_CHECK_MODULES([SDL], [sdl2 >= 2.x.y])" >&2 +echo "sdl2-config: In CMake builds, use find_package(SDL2 CONFIG)" >&2 +echo "sdl2-config: In other build systems, look for 'sdl2' with pkg-config(1) or pkgconf(1)" >&2 + while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; From a66cb8cf216536b4e5e35c98c3f114d1787131b1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 31 Oct 2022 11:44:32 +0000 Subject: [PATCH 265/459] sdl2.m4: Deprecate AM_PATH_SDL2 in favour of PKG_CHECK_MODULES AM_PATH_SDL2 doesn't add much beyond PKG_CHECK_MODULES, and having a special m4 macro for every library that you might depend on scales poorly. The macro does add special support for macOS frameworks, but that feature was broken for around 6 years without anyone noticing (#6141), and is likely to be only rarely useful according to comments on #6141. Resolves: #6140 Signed-off-by: Simon McVittie --- sdl2.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdl2.m4 b/sdl2.m4 index 75b60f6ea..737a5e5e8 100644 --- a/sdl2.m4 +++ b/sdl2.m4 @@ -10,7 +10,7 @@ # * removed HP/UX 9 support. # * updated for newer autoconf. -# serial 2 +# serial 3 dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS @@ -19,6 +19,7 @@ AC_DEFUN([AM_PATH_SDL2], [dnl dnl Get the cflags and libraries from the sdl2-config script dnl +AC_MSG_WARN([[$0 is deprecated, please use PKG_CHECK_MODULES([SDL], [sdl2 >= MINIMUM_VERSION]) instead]]) AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], From 33a430056f15fa5e75ee11f3d7917b4fd2f81c1a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 31 Oct 2022 12:23:51 -0400 Subject: [PATCH 266/459] wayland: Don't modify the mouse capture flag in relative mode If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor. --- src/video/wayland/SDL_waylandevents.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 01e5ad404..5d8cdb1fd 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -590,6 +590,7 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, uint32_t time, uint32_t button, uint32_t state_w) { SDL_WindowData *window = input->pointer_focus; + SDL_VideoData *viddata = window->waylandData; enum wl_pointer_button_state state = state_w; uint32_t sdl_button; @@ -628,10 +629,13 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, input->buttons_pressed &= ~(SDL_BUTTON(sdl_button)); } - if (input->buttons_pressed != 0) { - window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; - } else { - window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + /* Don't modify the capture flag in relative mode. */ + if (!viddata->relative_mouse_mode) { + if (input->buttons_pressed != 0) { + window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; + } else { + window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } } Wayland_data_device_set_serial(input->data_device, serial); From 27ee8c8e14300054d03b4e53ac789df0e57d3c77 Mon Sep 17 00:00:00 2001 From: Jasper Hugunin Date: Fri, 28 Oct 2022 22:35:16 -0700 Subject: [PATCH 267/459] Fix mismatch between Init and Quit Init says that audio implies events (line 195), Quit was missing the implication. --- src/SDL.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SDL.c b/src/SDL.c index 93f7a7f6d..67db48c3b 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -407,6 +407,9 @@ SDL_QuitSubSystem(Uint32 flags) #if !SDL_AUDIO_DISABLED if ((flags & SDL_INIT_AUDIO)) { + /* audio implies events */ + flags |= SDL_INIT_EVENTS; + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { SDL_AudioQuit(); } From b75d318776c6db59935bd85e71e7bd36101806f5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 31 Oct 2022 13:33:53 -0700 Subject: [PATCH 268/459] Sometimes the HID open doesn't succeed immediately after being notified about the device Tested on Steam Link hardware with the Nintendo Switch Pro controller, which will occasionally take 2 attempts to open. --- src/joystick/hidapi/SDL_hidapijoystick.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 16909a042..aab90ed7e 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -368,6 +368,8 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) * * See https://github.com/libsdl-org/SDL/issues/6347 for details */ + const int MAX_ATTEMPTS = 3; + int attempt; int lock_count = 0; SDL_HIDAPI_Device *curr; SDL_hid_device *dev; @@ -378,7 +380,14 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) ++lock_count; SDL_UnlockJoysticks(); } - dev = SDL_hid_open_path(path, 0); + for (attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) { + dev = SDL_hid_open_path(path, 0); + if (dev != NULL) { + break; + } + /* Wait a bit and try again */ + SDL_Delay(30); + } while (lock_count > 0) { --lock_count; SDL_LockJoysticks(); From 70a41f9bc200f6358ec225545243e8a24eccbeb7 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 1 Nov 2022 09:59:16 +0100 Subject: [PATCH 269/459] wayland: Read `window` data only if `window` is valid --- src/video/wayland/SDL_waylandevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 5d8cdb1fd..00563c8f1 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -590,11 +590,11 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, uint32_t time, uint32_t button, uint32_t state_w) { SDL_WindowData *window = input->pointer_focus; - SDL_VideoData *viddata = window->waylandData; enum wl_pointer_button_state state = state_w; uint32_t sdl_button; if (window) { + SDL_VideoData *viddata = window->waylandData; switch (button) { case BTN_LEFT: sdl_button = SDL_BUTTON_LEFT; From 4c704ecfdd814f3ab4613b374f4b70ffed997662 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 16:33:21 +0100 Subject: [PATCH 270/459] cmake: use SDL2-static as static library output name when prefix/static == ""/".lib" Apparently, some clang@Windows compilers do this. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1c9e91e4..15999d2e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ endif() # Build in parallel under Visual Studio. Not enabled by default. if(MSVC) target_compile_options(sdl-build-options INTERFACE "/MP") -endif(MSVC) +endif() # CMake 3.0 expands the "if(${A})" in "set(OFF 1);set(A OFF);if(${A})" to "if(1)" # CMake 3.24+ emits a warning when not set. @@ -2985,7 +2985,7 @@ foreach(_hdr IN LISTS SDL2_INCLUDE_FILES) endforeach() list(APPEND SDL_GENERATED_HEADERS ${SDL2_COPIED_INCLUDE_FILES}) -if(MSVC OR (WATCOM AND (WIN32 OR OS2))) +if(CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "" AND CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL ".lib") # Avoid conflict between the dll import library and the static library set(sdl_static_libname "SDL2-static") else() From b50e42935455f15baae7440e3270557d53711fab Mon Sep 17 00:00:00 2001 From: Luca Lolli <920858+dashandslash@users.noreply.github.com> Date: Wed, 7 Sep 2022 12:21:56 +0200 Subject: [PATCH 271/459] Fix compilation for .m files extension --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15999d2e0..ecc74cad1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3224,6 +3224,15 @@ if(PS2) target_compile_options(sdl-build-options INTERFACE "-Wno-error=declaration-after-statement") endif() +if(APPLE) + foreach(SOURCE_FILE ${SOURCE_FILES}) + get_filename_component(FILE_EXTENSION ${SOURCE_FILE} EXT) + if(FILE_EXTENSION STREQUAL "m") + set_property(SOURCE ${SOURCE_FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " -x objective-c") + endif() + endforeach() +endif() + if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) add_dependencies(SDL2 sdl_headers_copy) From 04bcc910e914b75fcebebf11c3b09d065673af8a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 29 Oct 2022 03:14:54 +0200 Subject: [PATCH 272/459] cmake: don't do enable_language(OBJC) When SDL is included as a subproject, the following error might appear: ``` CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. Missing variable is: CMAKE_OBJC_COMPILE_OBJECT ``` This is probably because the master project does not see certain OBJC related variables --- cmake/macros.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 267a8afb1..5830fceed 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -92,7 +92,11 @@ macro(LISTTOSTRREV _LIST _OUTPUT) endforeach() endmacro() -if(${CMAKE_VERSION} VERSION_LESS "3.16.0") +if(CMAKE_VERSION VERSION_LESS 3.16.0 OR SDL2_SUBPROJECT) + # - CMake versions <3.16 do not support the OBJC language + # - When SDL is built as a subproject and when the main project does not enable OBJC, + # CMake fails due to missing internal CMake variables (CMAKE_OBJC_COMPILE_OBJECT) + # (reproduced with CMake 3.24.2) macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") From 61297f703a20c50f046a03ff9130215cce9581dd Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 29 Oct 2022 03:20:30 +0200 Subject: [PATCH 273/459] cmake: on Apple, check for presence of an OBJC compiler --- CMakeLists.txt | 1 + cmake/macros.cmake | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ecc74cad1..bbb200274 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ endif() include(CheckLibraryExists) include(CheckIncludeFiles) include(CheckIncludeFile) +include(CheckLanguage) include(CheckSymbolExists) include(CheckCSourceCompiles) include(CheckCSourceRuns) diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 5830fceed..6f6c32971 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -110,6 +110,13 @@ else() endif() endif() +if(APPLE) + check_language(OBJC) + if(NOT CMAKE_OBJC_COMPILER) + message(WARNING "Cannot find working OBJC compiler.") + endif() +endif() + if(CMAKE_VERSION VERSION_LESS 3.13.0) macro(target_link_directories _TARGET _SCOPE) link_directories(${ARGN}) From 084fa4c3fac87785dec3142c23f4a171a6bae4a1 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 1 Nov 2022 10:55:17 +0100 Subject: [PATCH 274/459] cocoa: Reset IME when sending composed text This will send an empty `TEXTEDITING` event that is used to signal the end of the composition. --- src/video/cocoa/SDL_cocoakeyboard.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 863e96087..096b71a4c 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -66,6 +66,11 @@ str = [aString UTF8String]; } + /* We're likely sending the composed text, so we reset the IME status. */ + if ([self hasMarkedText]) { + [self unmarkText]; + } + SDL_SendKeyboardText(str); } @@ -114,7 +119,7 @@ (int) selectedRange.location, (int) selectedRange.length); DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText, - selRange.location, selRange.length); + selectedRange.location, selectedRange.length); } - (void)unmarkText From c70e67590049380875d018b1f29f181837594dbf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 3 Nov 2022 12:37:54 -0700 Subject: [PATCH 275/459] Wait a bit for devices to initialize before trying to enumerate and open them. This works around udev event nodes arriving before hidraw nodes and the controller being opened twice - once using the Linux driver and once by the HIDAPI driver. This also fixes a kernel panic on Steam Link hardware due to trying to open the hidraw device node too early. A delay of 10 ms seems to be a good value, tested on Steam Link hardware. --- src/joystick/hidapi/SDL_hidapijoystick.c | 16 ++++++---------- src/joystick/linux/SDL_sysjoystick.c | 4 ++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index aab90ed7e..2ed4aee86 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -368,26 +368,22 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed) * * See https://github.com/libsdl-org/SDL/issues/6347 for details */ - const int MAX_ATTEMPTS = 3; - int attempt; int lock_count = 0; SDL_HIDAPI_Device *curr; SDL_hid_device *dev; char *path = SDL_strdup(device->path); + /* Wait a little bit for the device to initialize */ + SDL_Delay(10); + SDL_AssertJoysticksLocked(); while (SDL_JoysticksLocked()) { ++lock_count; SDL_UnlockJoysticks(); } - for (attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) { - dev = SDL_hid_open_path(path, 0); - if (dev != NULL) { - break; - } - /* Wait a bit and try again */ - SDL_Delay(30); - } + + dev = SDL_hid_open_path(path, 0); + while (lock_count > 0) { --lock_count; SDL_LockJoysticks(); diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 4e3da5dde..5d3a994f5 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -267,6 +267,10 @@ static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_clas return; } } + + /* Wait a bit for the hidraw udev node to initialize */ + SDL_Delay(10); + MaybeAddDevice(devpath); break; From 33a68f575f484723aa326f8a2d96f2b8a084da4a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 3 Nov 2022 16:02:58 -0700 Subject: [PATCH 276/459] Added Linux mappings for the Logitech G29 in PS3 and PS4 modes --- src/joystick/SDL_gamecontrollerdb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index c6c29e5d6..ffeeacceb 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -647,6 +647,8 @@ static const char *s_ControllerMappings [] = "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006d0400004fc2000011010000,Logitech G29 Racing Wheel,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b24,leftshoulder:b5,leftstick:b11,lefttrigger:b7,rightshoulder:b4,rightstick:b10,righttrigger:b6,start:b9,x:b1,y:b3,", + "030000006d04000060c2000010010000,Logitech G29 Racing Wheel,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,", "03000000c62400002b89000011010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", From 689218ebf54ba6e37102ff3cea7d239d16aa3ad7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 4 Nov 2022 12:07:20 +0000 Subject: [PATCH 277/459] Fix wayland reconnection paths Most of this code is disabled out for now. - For mouse cursors we have a wl_surface for both system and custom cursors which needs recreating. - The other patch is about nullification after deletions --- src/video/wayland/SDL_waylandmouse.c | 7 ++++--- src/video/wayland/SDL_waylandvideo.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 32499fdd7..c35457b5b 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -620,10 +620,9 @@ Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata) create_buffer_from_shm(cdata, cdata->w, cdata->h, WL_SHM_FORMAT_ARGB8888); SDL_memcpy(cdata->shm_data, old_data_pointer, stride * cdata->h); - - cdata->surface = wl_compositor_create_surface(vdata->compositor); - wl_surface_set_user_data(cdata->surface, NULL); } + cdata->surface = wl_compositor_create_surface(vdata->compositor); + wl_surface_set_user_data(cdata->surface, NULL); } void @@ -691,7 +690,9 @@ Wayland_FiniMouse(SDL_VideoData *data) for (i = 0; i < data->num_cursor_themes; i += 1) { WAYLAND_wl_cursor_theme_destroy(data->cursor_themes[i].theme); } + data->num_cursor_themes = 0; SDL_free(data->cursor_themes); + data->cursor_themes = NULL; SDL_DelHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP, Wayland_EmulateMouseWarpChanged, input); diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index eccdd0bbb..76b93cd09 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1053,6 +1053,7 @@ Wayland_VideoCleanup(_THIS) display->desktop_mode.driverdata = NULL; SDL_DelVideoDisplay(i); } + data->output_list = NULL; Wayland_display_destroy_input(data); Wayland_display_destroy_pointer_constraints(data); From 78f97108f9dad22db6708f28322561eb9828fc36 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 5 Nov 2022 10:38:33 -0400 Subject: [PATCH 278/459] audio: Avoid accumulation errors in resampler. Fixes #6391. --- src/audio/SDL_audiocvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index e79437e91..0884fa373 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -247,7 +247,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, *(dst++) = outsample; } - outtime += outtimeincr; + outtime = outtimeincr * i; } return outframes * chans * sizeof (float); From 24cdebe464342e83743eaa613efacab4ef136c58 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 10:34:08 -0700 Subject: [PATCH 279/459] Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED to control the brightness of the Xbox button LED on the Xbox One controller --- include/SDL_hints.h | 11 ++++++ src/joystick/hidapi/SDL_hidapi_xboxone.c | 50 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 1af57930e..8bc4828fa 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -935,6 +935,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE "SDL_JOYSTICK_HIDAPI_XBOX_ONE" +/** + * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. The default brightness is 0.4. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" + /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 5be605917..ea72f27ff 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -26,6 +26,7 @@ #include "SDL_timer.h" #include "SDL_joystick.h" #include "SDL_gamecontroller.h" +#include "../../SDL_hints_c.h" #include "../SDL_sysjoystick.h" #include "SDL_hidapijoystick_c.h" #include "SDL_hidapi_rumble.h" @@ -98,6 +99,7 @@ typedef enum { } SDL_XboxOneInitState; typedef struct { + SDL_HIDAPI_Device *device; Uint16 vendor_id; Uint16 product_id; SDL_bool bluetooth; @@ -143,6 +145,41 @@ ControllerHasShareButton(Uint16 vendor_id, Uint16 product_id) return SDL_IsJoystickXboxSeriesX(vendor_id, product_id); } +static int GetHomeLEDBrightness(const char *hint) +{ + const int MAX_VALUE = 50; + int value = 20; + + if (hint && *hint) { + if (SDL_strchr(hint, '.') != NULL) { + value = (int)(MAX_VALUE * SDL_atof(hint)); + } else if (!SDL_GetStringBoolean(hint, SDL_TRUE)) { + value = 0; + } + } + return value; +} + +static void SetHomeLED(SDL_DriverXboxOne_Context *ctx, int value) +{ + Uint8 led_packet[] = { 0x0A, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00 }; + + if (value > 0) { + led_packet[5] = 0x01; + led_packet[6] = (Uint8)value; + } + SDL_HIDAPI_SendRumble(ctx->device, led_packet, sizeof(led_packet)); +} + +static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)userdata; + + if (hint && *hint) { + SetHomeLED(ctx, GetHomeLEDBrightness(hint)); + } +} + static void SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state) { @@ -243,6 +280,12 @@ SendControllerInit(SDL_HIDAPI_Device *device, SDL_DriverXboxOne_Context *ctx) if (init_packet[0] != 0x01) { init_packet[2] = ctx->sequence++; } + if (init_packet[0] == 0x0A) { + /* Get the initial brightness value */ + int brightness = GetHomeLEDBrightness(SDL_GetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED)); + init_packet[5] = (brightness > 0) ? 0x01 : 0x00; + init_packet[6] = (Uint8)brightness; + } #ifdef DEBUG_XBOX_PROTOCOL HIDAPI_DumpPacket("Xbox One sending INIT packet: size = %d", init_packet, packet->size); #endif @@ -316,6 +359,7 @@ HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device) SDL_OutOfMemory(); return SDL_FALSE; } + ctx->device = device; device->context = ctx; @@ -381,6 +425,8 @@ HIDAPI_DriverXboxOne_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joyst joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; } + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED, + SDL_HomeLEDHintChanged, ctx); return SDL_TRUE; } @@ -1143,6 +1189,10 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) static void HIDAPI_DriverXboxOne_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) { + SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)device->context; + + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED, + SDL_HomeLEDHintChanged, ctx); } static void From f3bf543e2a140dba0de4fa34361a5324ad36748c Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Sat, 5 Nov 2022 15:21:29 +0000 Subject: [PATCH 280/459] recognize game controllers connected via raphnet technologies WUSBMote v2.2 This is a USB adapter for controllers shipped with Nintendo's NES-mini and SNES-mini consoles. Tested with both NES and SNES controllers, buttons map as expected on both. --- src/joystick/SDL_gamecontrollerdb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index ffeeacceb..54342bf25 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -857,6 +857,7 @@ static const char *s_ControllerMappings [] = "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,", + "030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote v2.2,a:b1,b:b4,x:b0,y:b5,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,", #endif #if defined(__OpenBSD__) "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", From a2d66b6a914163aacb2fa252b7d631cb07094859 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 13:12:10 -0700 Subject: [PATCH 281/459] SDL_GameControllerMapping() should return the string for the actual mapping that was used when opening a gamecontroller, rather than do a GUID match again Also don't match against the zero guid if that happens to be in the mapping list for some reason --- src/joystick/SDL_gamecontroller.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 2c47f2372..bd30029b9 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -125,6 +125,7 @@ struct _SDL_GameController int ref_count; const char *name; + ControllerMapping_t *mapping; int num_bindings; SDL_ExtendedGameControllerBind *bindings; SDL_ExtendedGameControllerBind **last_match_axis; @@ -740,6 +741,10 @@ static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_Joystic for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { SDL_JoystickGUID mapping_guid; + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + SDL_memcpy(&mapping_guid, &mapping->guid, sizeof(mapping_guid)); if (!match_version) { SDL_SetJoystickGUIDVersion(&mapping_guid, 0); @@ -1070,19 +1075,20 @@ SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecon /* * Make a new button mapping struct */ -static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, const char *pchName, const char *pchMapping) +static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, ControllerMapping_t *pControllerMapping) { int i; CHECK_GAMECONTROLLER_MAGIC(gamecontroller, ); - gamecontroller->name = pchName; + gamecontroller->name = pControllerMapping->name; gamecontroller->num_bindings = 0; + gamecontroller->mapping = pControllerMapping; if (gamecontroller->joystick->naxes) { SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis)); } - SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pchMapping); + SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pControllerMapping->mapping); /* Set the zero point for triggers */ for (i = 0; i < gamecontroller->num_bindings; ++i) { @@ -1191,9 +1197,9 @@ static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pContro { SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; while (gamecontrollerlist) { - if (!SDL_memcmp(&gamecontrollerlist->joystick->guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { + if (gamecontrollerlist->mapping == pControllerMapping) { /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ - SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping->name, pControllerMapping->mapping); + SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping); { SDL_Event event; @@ -1755,7 +1761,7 @@ SDL_GameControllerMapping(SDL_GameController *gamecontroller) { CHECK_GAMECONTROLLER_MAGIC(gamecontroller, NULL); - return SDL_GameControllerMappingForGUID(gamecontroller->joystick->guid); + return CreateMappingString(gamecontroller->mapping, gamecontroller->joystick->guid); } static void @@ -2126,7 +2132,7 @@ SDL_GameControllerOpen(int device_index) } } - SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController->name, pSupportedController->mapping); + SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController); /* Add the controller to list */ ++gamecontroller->ref_count; From 7e11b09b3b0761e8d0234ee0f51081ff8dab8d57 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 13:50:37 -0700 Subject: [PATCH 282/459] The PowerA Xbox One Mini Wired Controller works with the HIDAPI driver now --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index ea72f27ff..d6a864057 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -334,12 +334,6 @@ HIDAPI_DriverXboxOne_IsEnabled(void) static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) { -#ifdef __LINUX__ - if (vendor_id == USB_VENDOR_POWERA && product_id == 0x541a) { - /* The PowerA Mini controller, model 1240245-01, blocks while writing feature reports */ - return SDL_FALSE; - } -#endif #ifdef __MACOSX__ /* Wired Xbox One controllers are handled by the 360Controller driver */ if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) { From a4626dea8dc48813dd5219f2430022be6b9c7825 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 14:24:41 -0700 Subject: [PATCH 283/459] Fixed initializing the PDP Xbox One and Victrix Gambit controllers --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index d6a864057..186d57745 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -84,10 +84,10 @@ typedef struct { static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = { - /* The PDP Rock Candy controller doesn't start sending input until it gets this packet */ - { 0x0e6f, 0x0246, 0x0000, 0x0000, security_passed_packet, sizeof(security_passed_packet), { 0x00, 0x00 } }, { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init0, sizeof(xboxone_init0), { 0x00, 0x00 } }, { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init1, sizeof(xboxone_init1), { 0x00, 0x00 } }, + /* The PDP Rock Candy and Victrix Gambit controllers don't start sending input until they get this packet */ + { 0x0e6f, 0x0000, 0x0000, 0x0000, security_passed_packet, sizeof(security_passed_packet), { 0x00, 0x00 } }, { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init2, sizeof(xboxone_init2), { 0x00, 0x00 } }, }; From 297ecb706d89a78448ebd07f813ebbfa94aae556 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 15:58:30 -0700 Subject: [PATCH 284/459] Added SDL_strcasestr() for a case insensitive version of SDL_strstr() --- include/SDL_stdinc.h | 1 + src/dynapi/SDL2.exports | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/stdlib/SDL_string.c | 17 +++++++++++++++++ 5 files changed, 21 insertions(+) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 06233c013..70dba7db6 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -583,6 +583,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes); diff --git a/src/dynapi/SDL2.exports b/src/dynapi/SDL2.exports index 8cc0c617b..5085bffd9 100644 --- a/src/dynapi/SDL2.exports +++ b/src/dynapi/SDL2.exports @@ -866,3 +866,4 @@ ++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL2.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' ++'_SDL_SensorGetDataWithTimestamp'.'SDL2.dll'.'SDL_SensorGetDataWithTimestamp' ++'_SDL_ResetHints'.'SDL2.dll'.'SDL_ResetHints' +++'_SDL_strcasestr'.'SDL2.dll'.'SDL_strcasestr' diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index d5d782f34..586465276 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -892,3 +892,4 @@ #define SDL_GameControllerGetSensorDataWithTimestamp SDL_GameControllerGetSensorDataWithTimestamp_REAL #define SDL_SensorGetDataWithTimestamp SDL_SensorGetDataWithTimestamp_REAL #define SDL_ResetHints SDL_ResetHints_REAL +#define SDL_strcasestr SDL_strcasestr_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 435ccb46a..7b3e02da1 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -975,3 +975,4 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasPrimarySelectionText,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorDataWithTimestamp,(SDL_GameController *a, SDL_SensorType b, Uint64 *c, float *d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SensorGetDataWithTimestamp,(SDL_Sensor *a, Uint64 *b, float *c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),) +SDL_DYNAPI_PROC(char*,SDL_strcasestr,(const char *a, const char *b),(a,b),return) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 06ff88547..ec632b7a6 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -761,6 +761,23 @@ SDL_strstr(const char *haystack, const char *needle) #endif /* HAVE_STRSTR */ } +char * +SDL_strcasestr(const char *haystack, const char *needle) +{ +#if defined(HAVE_STRCASESTR) + return SDL_const_cast(char*,strcasestr(haystack, needle)); +#else + size_t length = SDL_strlen(needle); + while (*haystack) { + if (SDL_strncasecmp(haystack, needle, length) == 0) { + return (char *) haystack; + } + ++haystack; + } + return NULL; +#endif /* HAVE_STRCASESTR */ +} + #if !defined(HAVE__LTOA) || !defined(HAVE__I64TOA) || \ !defined(HAVE__ULTOA) || !defined(HAVE__UI64TOA) static const char ntoa_table[] = { From 15a9890919448cb463ab27f0e69be950be11ea87 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 5 Nov 2022 16:44:52 -0700 Subject: [PATCH 285/459] Added SDL_HINT_HIDAPI_IGNORE_DEVICES to specify devices that should be ignored in SDL_hid_enumerate() --- include/SDL_hints.h | 8 ++++++++ src/hidapi/android/hid.cpp | 13 +++++++++++++ src/hidapi/ios/hid.m | 13 ++++++++++++- src/hidapi/libusb/hid.c | 13 +++++++++++++ src/hidapi/linux/hid.c | 13 +++++++++++++ src/hidapi/mac/hid.c | 13 +++++++++++++ src/hidapi/windows/hid.c | 13 +++++++++++++ 7 files changed, 85 insertions(+), 1 deletion(-) diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 8bc4828fa..ce2225440 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -539,6 +539,14 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() + * + * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might + * have the string "0x2563/0x0523,0x28de/0x0000" + */ +#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES" + /** * \brief A variable controlling whether the idle timer is disabled on iOS. * diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index 2b2af72db..34fda42d3 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -1085,10 +1085,23 @@ int hid_init(void) struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) { struct hid_device_info *root = NULL; + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); + hid_mutex_guard l( &g_DevicesMutex ); for ( hid_device_ref pDevice = g_Devices; pDevice; pDevice = pDevice->next ) { const hid_device_info *info = pDevice->GetDeviceInfo(); + + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", info->vendor_id); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", info->vendor_id, info->product_id); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + continue; + } + } + if ( ( vendor_id == 0x0 || info->vendor_id == vendor_id ) && ( product_id == 0x0 || info->product_id == product_id ) ) { diff --git a/src/hidapi/ios/hid.m b/src/hidapi/ios/hid.m index 111b8f236..55845701a 100644 --- a/src/hidapi/ios/hid.m +++ b/src/hidapi/ios/hid.m @@ -836,7 +836,18 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) { @autoreleasepool { struct hid_device_info *root = NULL; - + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); + + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", VALVE_USB_VID); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", VALVE_USB_VID, D0G_BLE2_PID); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + return NULL; + } + } + if ( ( vendor_id == 0 && product_id == 0 ) || ( vendor_id == VALVE_USB_VID && product_id == D0G_BLE2_PID ) ) { diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index e86aa51cb..1f08aedfa 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -29,6 +29,7 @@ #include "../../SDL_internal.h" #include "../../thread/SDL_systhread.h" +#include "SDL_hints.h" #include "SDL_mutex.h" #include "SDL_thread.h" @@ -761,6 +762,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, struct hid_device_info *root = NULL; /* return object */ struct hid_device_info *cur_dev = NULL; + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); if(hid_init() < 0) return NULL; @@ -778,10 +780,21 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short dev_vid = desc.idVendor; unsigned short dev_pid = desc.idProduct; + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", dev_vid); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", dev_vid, dev_pid); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + continue; + } + } + res = libusb_get_active_config_descriptor(dev, &conf_desc); if (res < 0) libusb_get_config_descriptor(dev, 0, &conf_desc); if (conf_desc) { + for (j = 0; j < conf_desc->bNumInterfaces; j++) { const struct libusb_interface *intf = &conf_desc->interface[j]; for (k = 0; k < intf->num_altsetting; k++) { diff --git a/src/hidapi/linux/hid.c b/src/hidapi/linux/hid.c index 6507dde71..fbd010144 100644 --- a/src/hidapi/linux/hid.c +++ b/src/hidapi/linux/hid.c @@ -22,6 +22,8 @@ ********************************************************/ #include "../../SDL_internal.h" +#include "SDL_hints.h" + #ifndef _GNU_SOURCE #define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */ #endif @@ -481,6 +483,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, struct hid_device_info *root = NULL; /* return object */ struct hid_device_info *cur_dev = NULL; struct hid_device_info *prev_dev = NULL; /* previous device */ + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); hid_init(); @@ -552,6 +555,16 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, goto next; } + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", dev_vid); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", dev_vid, dev_pid); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + continue; + } + } + /* Check the VID/PID against the arguments */ if ((vendor_id == 0x0 || vendor_id == dev_vid) && (product_id == 0x0 || product_id == dev_pid)) { diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index d52b94f0a..d5dfbc296 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -21,6 +21,8 @@ ********************************************************/ #include "../../SDL_internal.h" +#include "SDL_hints.h" + /* See Apple Technical Note TN2187 for details on IOHidManager. */ #include @@ -517,6 +519,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, CFSetRef device_set; IOHIDDeviceRef *device_array; int i; + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); /* Set up the HID Manager if it hasn't been done */ if (hid_init() < 0) @@ -567,6 +570,16 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, dev_vid = get_vendor_id(dev); dev_pid = get_product_id(dev); + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", dev_vid); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", dev_vid, dev_pid); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + continue; + } + } + /* Check the VID/PID against the arguments */ if ((vendor_id == 0x0 || dev_vid == vendor_id) && (product_id == 0x0 || dev_pid == product_id)) { diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c index 8dfd11d05..27c09e52e 100644 --- a/src/hidapi/windows/hid.c +++ b/src/hidapi/windows/hid.c @@ -21,6 +21,8 @@ ********************************************************/ #include "../../SDL_internal.h" +#include "SDL_hints.h" + #include #ifndef _WIN32_WINNT_WIN8 @@ -371,6 +373,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL; HDEVINFO device_info_set = INVALID_HANDLE_VALUE; int device_index = 0; + const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES); if (hid_init() < 0) return NULL; @@ -488,6 +491,16 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor HidD_GetAttributes(write_handle, &attrib); //wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID); + /* See if there are any devices we should skip in enumeration */ + if (hint) { + char vendor_match[16], product_match[16]; + SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", attrib.VendorID); + SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", attrib.VendorID, attrib.ProductID); + if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) { + continue; + } + } + /* Check the VID/PID to see if we should add this device to the enumeration list. */ if ((vendor_id == 0x0 || attrib.VendorID == vendor_id) && From 0d76e2a8a1a8e6a2801123587c2205a288d49406 Mon Sep 17 00:00:00 2001 From: Edward Li Date: Sun, 6 Nov 2022 04:59:02 +0800 Subject: [PATCH 286/459] cocoa: Discard the IME Candidate Window immediately when Escape is pressed --- src/video/cocoa/SDL_cocoakeyboard.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 096b71a4c..56e109b19 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -180,6 +180,13 @@ return [NSArray array]; } +// Discard the IME Candidate Window +- (void)cancelOperation:(id)sender +{ + [[self inputContext] discardMarkedText]; + [self unmarkText]; +} + @end static void @@ -408,6 +415,11 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif + /* Discard the IME Candidate Window immediately */ + if (code == SDL_SCANCODE_ESCAPE) { + [data.fieldEdit cancelOperation:NULL]; + } + if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */ [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; From e45cb5b1e264bbc36531a232f4c7efde42b8a605 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 01:15:18 -0700 Subject: [PATCH 287/459] Fixed initializing the PowerA Xbox One Mini Wired Controller --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 186d57745..18f004dae 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -56,6 +56,11 @@ static const Uint8 xboxone_init0[] = { static const Uint8 xboxone_init1[] = { 0x0A, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 }; +/* Some PowerA controllers need to actually start the rumble motors */ +static const Uint8 xboxone_powera_rumble_init[] = { + 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, + 0x1D, 0x1D, 0xFF, 0x00, 0x00 +}; /* Setup rumble (not needed for Microsoft controllers, but it doesn't hurt) */ static const Uint8 xboxone_init2[] = { 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, @@ -88,6 +93,9 @@ static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = { { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init1, sizeof(xboxone_init1), { 0x00, 0x00 } }, /* The PDP Rock Candy and Victrix Gambit controllers don't start sending input until they get this packet */ { 0x0e6f, 0x0000, 0x0000, 0x0000, security_passed_packet, sizeof(security_passed_packet), { 0x00, 0x00 } }, + { 0x24c6, 0x541a, 0x0000, 0x0000, xboxone_powera_rumble_init, sizeof(xboxone_powera_rumble_init), { 0x00, 0x00 } }, + { 0x24c6, 0x542a, 0x0000, 0x0000, xboxone_powera_rumble_init, sizeof(xboxone_powera_rumble_init), { 0x00, 0x00 } }, + { 0x24c6, 0x543a, 0x0000, 0x0000, xboxone_powera_rumble_init, sizeof(xboxone_powera_rumble_init), { 0x00, 0x00 } }, { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init2, sizeof(xboxone_init2), { 0x00, 0x00 } }, }; From 38af459dd9ea05c014aab71418ab8747bb773dd9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 01:15:19 -0700 Subject: [PATCH 288/459] Fixed potential clobbering of packets of different types using SDL_HIDAPI_SendRumble() --- src/joystick/hidapi/SDL_hidapi_ps4.c | 4 +++- src/joystick/hidapi/SDL_hidapi_ps5.c | 4 +++- src/joystick/hidapi/SDL_hidapi_rumble.c | 13 ++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 52326a9e4..63d720df5 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -615,7 +615,9 @@ HIDAPI_DriverPS4_TickleBluetooth(SDL_HIDAPI_Device *device) data[0] = k_EPS4ReportIdBluetoothEffects; data[1] = 0xC0; /* Magic value HID + CRC */ - SDL_HIDAPI_SendRumble(device, data, sizeof(data)); + if (SDL_HIDAPI_LockRumble() == 0) { + SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data)); + } } static void diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index 4b2255d17..7458adaf4 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -746,7 +746,9 @@ HIDAPI_DriverPS5_TickleBluetooth(SDL_HIDAPI_Device *device) data[0] = k_EPS5ReportIdBluetoothEffects; data[1] = 0x02; /* Magic value */ - SDL_HIDAPI_SendRumble(device, data, sizeof(data)); + if (SDL_HIDAPI_LockRumble() == 0) { + SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data)); + } } static void diff --git a/src/joystick/hidapi/SDL_hidapi_rumble.c b/src/joystick/hidapi/SDL_hidapi_rumble.c index 9cbdb9599..9e4571f43 100644 --- a/src/joystick/hidapi/SDL_hidapi_rumble.c +++ b/src/joystick/hidapi/SDL_hidapi_rumble.c @@ -240,19 +240,18 @@ int SDL_HIDAPI_SendRumble(SDL_HIDAPI_Device *device, const Uint8 *data, int size int *pending_size; int maximum_size; + if (size <= 0) { + return SDL_SetError("Tried to send rumble with invalid size"); + } + if (SDL_HIDAPI_LockRumble() < 0) { return -1; } /* check if there is a pending request for the device and update it */ - if (SDL_HIDAPI_GetPendingRumbleLocked(device, &pending_data, &pending_size, &maximum_size)) { - if (size > maximum_size) { - SDL_HIDAPI_UnlockRumble(); - return SDL_SetError("Couldn't send rumble, size %d is greater than %d", size, maximum_size); - } - + if (SDL_HIDAPI_GetPendingRumbleLocked(device, &pending_data, &pending_size, &maximum_size) && + size == *pending_size && data[0] == pending_data[0]) { SDL_memcpy(pending_data, data, size); - *pending_size = size; SDL_HIDAPI_UnlockRumble(); return size; } From 6875e62af3c11249c4519fa7021003e19fb26c85 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 01:15:20 -0700 Subject: [PATCH 289/459] Make sure we don't send Xbox controllers rumble so quickly that it overwhelms the firmware Fixes https://github.com/libsdl-org/SDL/issues/6435 --- src/joystick/hidapi/SDL_hidapi_rumble.c | 15 ++++++ src/joystick/hidapi/SDL_hidapi_rumble.h | 2 + src/joystick/hidapi/SDL_hidapi_xboxone.c | 66 +++++++++++++++++++++--- 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_rumble.c b/src/joystick/hidapi/SDL_hidapi_rumble.c index 9e4571f43..e15ecf052 100644 --- a/src/joystick/hidapi/SDL_hidapi_rumble.c +++ b/src/joystick/hidapi/SDL_hidapi_rumble.c @@ -36,6 +36,8 @@ typedef struct SDL_HIDAPI_RumbleRequest SDL_HIDAPI_Device *device; Uint8 data[2*USB_PACKET_LENGTH]; /* need enough space for the biggest report: dualshock4 is 78 bytes */ int size; + SDL_HIDAPI_RumbleSentCallback callback; + void *userdata; struct SDL_HIDAPI_RumbleRequest *prev; } SDL_HIDAPI_RumbleRequest; @@ -83,6 +85,9 @@ static int SDLCALL SDL_HIDAPI_RumbleThread(void *data) SDL_hid_write(request->device->dev, request->data, request->size); } SDL_UnlockMutex(request->device->dev_lock); + if (request->callback) { + request->callback(request->userdata); + } (void)SDL_AtomicDecRef(&request->device->rumble_pending); SDL_free(request); @@ -116,6 +121,9 @@ SDL_HIDAPI_StopRumbleThread(SDL_HIDAPI_RumbleContext *ctx) } ctx->requests_tail = request->prev; + if (request->callback) { + request->callback(request->userdata); + } (void)SDL_AtomicDecRef(&request->device->rumble_pending); SDL_free(request); } @@ -192,6 +200,11 @@ SDL_bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **da } int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size) +{ + return SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(device, data, size, NULL, NULL); +} + +int SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size, SDL_HIDAPI_RumbleSentCallback callback, void *userdata) { SDL_HIDAPI_RumbleContext *ctx = &rumble_context; SDL_HIDAPI_RumbleRequest *request; @@ -209,6 +222,8 @@ int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, request->device = device; SDL_memcpy(request->data, data, size); request->size = size; + request->callback = callback; + request->userdata = userdata; SDL_AtomicIncRef(&device->rumble_pending); diff --git a/src/joystick/hidapi/SDL_hidapi_rumble.h b/src/joystick/hidapi/SDL_hidapi_rumble.h index b04794a9a..bf9f1adba 100644 --- a/src/joystick/hidapi/SDL_hidapi_rumble.h +++ b/src/joystick/hidapi/SDL_hidapi_rumble.h @@ -28,6 +28,8 @@ int SDL_HIDAPI_LockRumble(void); SDL_bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **data, int **size, int *maximum_size); int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size); +typedef void (*SDL_HIDAPI_RumbleSentCallback)(void *userdata); +int SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size, SDL_HIDAPI_RumbleSentCallback callback, void *userdata); void SDL_HIDAPI_UnlockRumble(void); /* Simple API, will replace any pending rumble with the new data */ diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 18f004dae..770be6d51 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -100,12 +100,18 @@ static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = { }; typedef enum { - XBOX_ONE_INIT_STATE_START_NEGOTIATING = 0, - XBOX_ONE_INIT_STATE_NEGOTIATING = 1, - XBOX_ONE_INIT_STATE_PREPARE_INPUT = 2, - XBOX_ONE_INIT_STATE_COMPLETE = 3 + XBOX_ONE_INIT_STATE_START_NEGOTIATING, + XBOX_ONE_INIT_STATE_NEGOTIATING, + XBOX_ONE_INIT_STATE_PREPARE_INPUT, + XBOX_ONE_INIT_STATE_COMPLETE, } SDL_XboxOneInitState; +typedef enum { + XBOX_ONE_RUMBLE_STATE_IDLE, + XBOX_ONE_RUMBLE_STATE_QUEUED, + XBOX_ONE_RUMBLE_STATE_BUSY +} SDL_XboxOneRumbleState; + typedef struct { SDL_HIDAPI_Device *device; Uint16 vendor_id; @@ -125,6 +131,9 @@ typedef struct { Uint8 high_frequency_rumble; Uint8 left_trigger_rumble; Uint8 right_trigger_rumble; + SDL_XboxOneRumbleState rumble_state; + Uint32 rumble_time; + SDL_bool rumble_pending; Uint8 last_state[USB_PACKET_LENGTH]; } SDL_DriverXboxOne_Context; @@ -411,6 +420,9 @@ HIDAPI_DriverXboxOne_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joyst ctx->high_frequency_rumble = 0; ctx->left_trigger_rumble = 0; ctx->right_trigger_rumble = 0; + ctx->rumble_state = XBOX_ONE_RUMBLE_STATE_IDLE; + ctx->rumble_time = 0; + ctx->rumble_pending = SDL_FALSE; SDL_zeroa(ctx->last_state); /* Initialize the joystick capabilities */ @@ -432,11 +444,47 @@ HIDAPI_DriverXboxOne_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joyst return SDL_TRUE; } +static void +HIDAPI_DriverXboxOne_RumbleSent(void *userdata) +{ + SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)userdata; + ctx->rumble_time = SDL_GetTicks(); +} + static int HIDAPI_DriverXboxOne_UpdateRumble(SDL_HIDAPI_Device *device) { SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)device->context; + if (ctx->rumble_state == XBOX_ONE_RUMBLE_STATE_QUEUED) { + if (ctx->rumble_time) { + ctx->rumble_state = XBOX_ONE_RUMBLE_STATE_BUSY; + } + } + + if (ctx->rumble_state == XBOX_ONE_RUMBLE_STATE_BUSY) { + const Uint32 RUMBLE_BUSY_TIME_MS = ctx->bluetooth ? 50 : 10; + if (SDL_TICKS_PASSED(SDL_GetTicks(), ctx->rumble_time + RUMBLE_BUSY_TIME_MS)) { + ctx->rumble_time = 0; + ctx->rumble_state = XBOX_ONE_RUMBLE_STATE_IDLE; + } + } + + if (!ctx->rumble_pending) { + return 0; + } + + if (ctx->rumble_state != XBOX_ONE_RUMBLE_STATE_IDLE) { + return 0; + } + + /* We're no longer pending, even if we fail to send the rumble below */ + ctx->rumble_pending = SDL_FALSE; + + if (SDL_HIDAPI_LockRumble() < 0) { + return -1; + } + if (ctx->bluetooth) { Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xEB }; @@ -445,7 +493,7 @@ HIDAPI_DriverXboxOne_UpdateRumble(SDL_HIDAPI_Device *device) rumble_packet[4] = ctx->low_frequency_rumble; rumble_packet[5] = ctx->high_frequency_rumble; - if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) { + if (SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(device, rumble_packet, sizeof(rumble_packet), HIDAPI_DriverXboxOne_RumbleSent, ctx) != sizeof(rumble_packet)) { return SDL_SetError("Couldn't send rumble packet"); } } else { @@ -456,10 +504,13 @@ HIDAPI_DriverXboxOne_UpdateRumble(SDL_HIDAPI_Device *device) rumble_packet[8] = ctx->low_frequency_rumble; rumble_packet[9] = ctx->high_frequency_rumble; - if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) { + if (SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(device, rumble_packet, sizeof(rumble_packet), HIDAPI_DriverXboxOne_RumbleSent, ctx) != sizeof(rumble_packet)) { return SDL_SetError("Couldn't send rumble packet"); } } + + ctx->rumble_state = XBOX_ONE_RUMBLE_STATE_QUEUED; + return 0; } @@ -471,6 +522,7 @@ HIDAPI_DriverXboxOne_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joy /* Magnitude is 1..100 so scale the 16-bit input here */ ctx->low_frequency_rumble = low_frequency_rumble / 655; ctx->high_frequency_rumble = high_frequency_rumble / 655; + ctx->rumble_pending = SDL_TRUE; return HIDAPI_DriverXboxOne_UpdateRumble(device); } @@ -487,6 +539,7 @@ HIDAPI_DriverXboxOne_RumbleJoystickTriggers(SDL_HIDAPI_Device *device, SDL_Joyst /* Magnitude is 1..100 so scale the 16-bit input here */ ctx->left_trigger_rumble = left_rumble / 655; ctx->right_trigger_rumble = right_rumble / 655; + ctx->rumble_pending = SDL_TRUE; return HIDAPI_DriverXboxOne_UpdateRumble(device); } @@ -1180,6 +1233,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) } HIDAPI_DriverXboxOne_UpdateInitState(device, ctx); + HIDAPI_DriverXboxOne_UpdateRumble(device); if (size < 0) { /* Read error, device is disconnected */ From e7a56323ab78c3bd7cbe967b07ba5f8d4457230a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 01:43:05 -0700 Subject: [PATCH 290/459] Make sure we wait after sending the rumble packet when initializing the PowerA Xbox One Mini Wired Controller --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 770be6d51..ea1a5bc5f 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -317,6 +317,11 @@ SendControllerInit(SDL_HIDAPI_Device *device, SDL_DriverXboxOne_Context *ctx) if (packet->response[0]) { return SDL_TRUE; } + + /* Wait to process the rumble packet */ + if (packet->data == xboxone_powera_rumble_init) { + SDL_Delay(10); + } } /* All done with the negotiation, prepare for input! */ From 9d1dbd2ad86805c316cf4f2ee8ab2b361be18f4d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 01:16:52 -0800 Subject: [PATCH 291/459] Added note about trigger rumble availability across third-party Xbox One controllers --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index ea1a5bc5f..1a5798e91 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -153,7 +153,16 @@ static SDL_bool ControllerHasTriggerRumble(Uint16 vendor_id, Uint16 product_id) { /* All the Microsoft Xbox One controllers have trigger rumble */ - return (vendor_id == USB_VENDOR_MICROSOFT); + if (vendor_id == USB_VENDOR_MICROSOFT) { + return SDL_TRUE; + } + + /* It turns out other controllers a mixed bag as to whether they support + trigger rumble or not, and when they do it's often a buzz rather than + the vibration of the Microsoft trigger rumble, so for now just pretend + that it is not available. + */ + return SDL_FALSE; } static SDL_bool From f2ce7c5fb25278af9b229efa55e94230a4ca0d51 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 08:23:08 -0800 Subject: [PATCH 292/459] Added the G29 as a PlayStation controller --- src/joystick/controller_type.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index 1279d0ffe..b51f27f6a 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -32,6 +32,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 + { MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3) { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK @@ -86,6 +87,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller + { MAKE_CONTROLLER_ID( 0x046d, 0xc260 ), k_eControllerType_PS4Controller, NULL }, // Logitech G29 (PS4) { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller From c2675d74c52188938073c6e0c4a3f594c6e0b424 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Nov 2022 10:52:20 -0800 Subject: [PATCH 293/459] Revert "cocoa: Discard the IME Candidate Window immediately when Escape is pressed" This reverts commit 0d76e2a8a1a8e6a2801123587c2205a288d49406, as it introduced other issues: https://github.com/libsdl-org/SDL/pull/6486#issuecomment-1304684865 --- src/video/cocoa/SDL_cocoakeyboard.m | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 56e109b19..096b71a4c 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -180,13 +180,6 @@ return [NSArray array]; } -// Discard the IME Candidate Window -- (void)cancelOperation:(id)sender -{ - [[self inputContext] discardMarkedText]; - [self unmarkText]; -} - @end static void @@ -415,11 +408,6 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif - /* Discard the IME Candidate Window immediately */ - if (code == SDL_SCANCODE_ESCAPE) { - [data.fieldEdit cancelOperation:NULL]; - } - if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */ [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; From 5dc93451d27f351b26151c0dedb1c06d404ea66d Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Sun, 6 Nov 2022 20:49:37 +0100 Subject: [PATCH 294/459] JANITORIAL : Correct some more spelling mistakes (#6489) --- cmake/test/CMakeLists.txt | 2 +- src/audio/qsa/SDL_qsa_audio.c | 2 +- src/hidapi/linux/README.txt | 2 +- src/render/SDL_sysrender.h | 2 +- src/video/cocoa/SDL_cocoamouse.h | 2 +- src/video/wayland/SDL_waylandwindow.c | 2 +- src/video/windows/SDL_windowsmessagebox.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 0695e9dfb..388e86c54 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -24,7 +24,7 @@ include(FeatureSummary) option(TEST_SHARED "Test linking to shared SDL2 library" ON) add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") -option(TEST_STATIC "Test linking to static SDL2 libary" ON) +option(TEST_STATIC "Test linking to static SDL2 library" ON) add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") if(TEST_SHARED) diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 2e6f21d07..7a843f364 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -128,7 +128,7 @@ QSA_WaitDevice(_THIS) SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno)); break; case 0: - SDL_SetError("QSA: timeout on buffer waiting occured"); + SDL_SetError("QSA: timeout on buffer waiting occurred"); this->hidden->timeout_on_wait = 1; break; default: diff --git a/src/hidapi/linux/README.txt b/src/hidapi/linux/README.txt index 800669495..c187590c1 100644 --- a/src/hidapi/linux/README.txt +++ b/src/hidapi/linux/README.txt @@ -39,7 +39,7 @@ Bugs (hidraw implementation only): ----------------------------------- On Kernel versions < 2.6.34, if your device uses numbered reports, an extra byte will be returned at the beginning of all reports returned from read() -for hidraw devices. This is worked around in the libary. No action should be +for hidraw devices. This is worked around in the library. No action should be necessary in the client library. On Kernel versions < 2.6.35, reports will only be sent using a Set_Report diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index dc8be4674..d87b2563e 100644 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -231,7 +231,7 @@ struct SDL_Renderer SDL_DRect clip_rect; SDL_DRect clip_rect_backup; - /* Wether or not the clipping rectangle is used. */ + /* Whether or not the clipping rectangle is used. */ SDL_bool clipping_enabled; SDL_bool clipping_enabled_backup; diff --git a/src/video/cocoa/SDL_cocoamouse.h b/src/video/cocoa/SDL_cocoamouse.h index 44bbe8a30..f6dcdc045 100644 --- a/src/video/cocoa/SDL_cocoamouse.h +++ b/src/video/cocoa/SDL_cocoamouse.h @@ -32,7 +32,7 @@ extern void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y); extern void Cocoa_QuitMouse(_THIS); typedef struct { - /* Wether we've seen a cursor warp since the last move event. */ + /* Whether we've seen a cursor warp since the last move event. */ SDL_bool seenWarp; /* What location our last cursor warp was to. */ CGFloat lastWarpX; diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 3c938bd53..a329ad357 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -916,7 +916,7 @@ decoration_frame_configure(struct libdecor_frame *frame, /* Update the resize capability. Since this will change the capabilities and * commit a new frame state with the last known content dimension, this has - * to be called after the new state has been commited and the new content + * to be called after the new state has been committed and the new content * dimensions were updated. */ Wayland_SetWindowResizable(SDL_GetVideoDevice(), window, diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c index f0a3ebe1a..25d40a19a 100644 --- a/src/video/windows/SDL_windowsmessagebox.c +++ b/src/video/windows/SDL_windowsmessagebox.c @@ -893,7 +893,7 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } else if (result == IDINVALPTRDLGITEM) { SDL_SetError("Couldn't find dialog control of the default enter-key button"); } else { - SDL_SetError("An unknown error occured"); + SDL_SetError("An unknown error occurred"); } retval = -1; } From 64c93f7804196e74e365570a01f25bfd2c0199b4 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 6 Nov 2022 23:51:04 +0300 Subject: [PATCH 295/459] replace AM_PATH_SDL2 usage with corresponding PKG_CHECK_MODULES. --- test/acinclude.m4 | 183 +------------------------ test/configure | 335 ++-------------------------------------------- test/configure.ac | 5 +- 3 files changed, 15 insertions(+), 508 deletions(-) diff --git a/test/acinclude.m4 b/test/acinclude.m4 index 0fdf353ea..c8d8f72ab 100644 --- a/test/acinclude.m4 +++ b/test/acinclude.m4 @@ -1,186 +1,6 @@ -# Configure paths for SDL -# Sam Lantinga 9/21/99 -# stolen from Manish Singh -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -# serial 2 - -dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS -dnl -AC_DEFUN([AM_PATH_SDL2], -[dnl -dnl Get the cflags and libraries from the sdl2-config script -dnl -AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], - sdl_prefix="$withval", sdl_prefix="") -AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], - sdl_exec_prefix="$withval", sdl_exec_prefix="") -AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], - , enable_sdltest=yes) - - min_sdl_version=ifelse([$1], ,2.0.0,$1) - - if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], - [sdl_pc=yes], - [sdl_pc=no]) - else - sdl_pc=no - if test x$sdl_exec_prefix != x ; then - sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config - fi - fi - fi - - if test "x$sdl_pc" = xyes ; then - no_sdl="" - SDL2_CONFIG="pkg-config sdl2" - else - as_save_PATH="$PATH" - if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - fi - AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) - PATH="$as_save_PATH" - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - no_sdl="" - - if test "$SDL2_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` - - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" -dnl -dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl2-config to some extent -dnl - rm -f conf.sdltest - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include "SDL.h" - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - FILE *fp = fopen("conf.sdltest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -]])], [], [no_sdl=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - fi - if test "x$no_sdl" = x ; then - ifelse([$2], , :, [$2]) - else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main -]], [[ return 0; ]])], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - rm -f conf.sdltest -]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) -# +# # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify @@ -270,7 +90,6 @@ else fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED - # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # diff --git a/test/configure b/test/configure index c71abe489..41c5f7460 100755 --- a/test/configure +++ b/test/configure @@ -627,7 +627,6 @@ OPENGLES2_TARGETS OPENGLES1_TARGETS CPP XMKMF -SDL2_CONFIG SDL_LIBS SDL_CFLAGS PKG_CONFIG_LIBDIR @@ -697,9 +696,6 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_sdl_prefix -with_sdl_exec_prefix -enable_sdltest with_x enable_werror ' @@ -1344,14 +1340,11 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-sdltest Do not try to compile and run a test SDL program --enable-werror treat warnings as errors [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-sdl-prefix=PFX Prefix where SDL is installed (optional) - --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) --with-x use the X Window System Some influential environment variables: @@ -1543,49 +1536,6 @@ fi } # ac_fn_c_try_link -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -3850,50 +3800,20 @@ printf "%s\n" "no" >&6; } fi fi -# Check whether --with-sdl-prefix was given. -if test ${with_sdl_prefix+y} -then : - withval=$with_sdl_prefix; sdl_prefix="$withval" -else $as_nop - sdl_prefix="" -fi - - -# Check whether --with-sdl-exec-prefix was given. -if test ${with_sdl_exec_prefix+y} -then : - withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" -else $as_nop - sdl_exec_prefix="" -fi - -# Check whether --enable-sdltest was given. -if test ${enable_sdltest+y} -then : - enableval=$enable_sdltest; -else $as_nop - enable_sdltest=yes -fi - - - min_sdl_version=$SDL_VERSION - - if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 -printf %s "checking for sdl2 >= $min_sdl_version... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $SDL_VERSION" >&5 +printf %s "checking for sdl2 >= $SDL_VERSION... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$SDL_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2 >= $SDL_VERSION") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $SDL_VERSION" 2>/dev/null` else pkg_failed=yes fi @@ -3904,12 +3824,12 @@ if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$SDL_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2 >= $SDL_VERSION") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $SDL_VERSION" 2>/dev/null` else pkg_failed=yes fi @@ -3929,254 +3849,25 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $SDL_VERSION" 2>&1` else - SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $SDL_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SDL_PKG_ERRORS" >&5 - sdl_pc=no + as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - sdl_pc=no + as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 else SDL_CFLAGS=$pkg_cv_SDL_CFLAGS SDL_LIBS=$pkg_cv_SDL_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - sdl_pc=yes + fi - else - sdl_pc=no - if test x$sdl_exec_prefix != x ; then - sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config - fi - fi - fi - - if test "x$sdl_pc" = xyes ; then - no_sdl="" - SDL2_CONFIG="pkg-config sdl2" - else - as_save_PATH="$PATH" - if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - fi - # Extract the first word of "sdl2-config", so it can be a program name with args. -set dummy sdl2-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_SDL2_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $SDL2_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no" - ;; -esac -fi -SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG -if test -n "$SDL2_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 -printf "%s\n" "$SDL2_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - PATH="$as_save_PATH" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 -printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } - no_sdl="" - - if test "$SDL2_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` - - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - rm -f conf.sdltest - if test "$cross_compiling" = yes -then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include "SDL.h" - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - FILE *fp = fopen("conf.sdltest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - - -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - -else $as_nop - no_sdl=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi - fi - if test "x$no_sdl" = x ; then - : - else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main - -int -main (void) -{ - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else $as_nop - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 - - fi - - - rm -f conf.sdltest - CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS -lSDL2_test $SDL_LIBS" diff --git a/test/configure.ac b/test/configure.ac index e9890163e..a613e9f9d 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -101,10 +101,7 @@ AC_SUBST(ISOS2) dnl Check for SDL SDL_VERSION=2.0.18 -AM_PATH_SDL2($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) -) +PKG_CHECK_MODULES([SDL], [sdl2 >= $SDL_VERSION],, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])) CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS -lSDL2_test $SDL_LIBS" From eb670742f5b096114c1c281a462ecbd216777c3e Mon Sep 17 00:00:00 2001 From: pionere Date: Mon, 7 Nov 2022 09:05:32 +0100 Subject: [PATCH 296/459] better SDL_AtomicGet(Ptr) implementation --- src/atomic/SDL_atomic.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 21ba381d7..74e930c8c 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -264,6 +264,17 @@ SDL_AtomicGet(SDL_atomic_t *a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#elif defined(HAVE_MSC_ATOMICS) + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(long) == sizeof(int)); + return _InterlockedOr((long *)&a->value, 0); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xadd_watcom(&a->value, 0); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_or_and_fetch(&a->value, 0); +#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return sizeof(int) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value); +#elif defined(__SOLARIS__) + return atomic_or_uint((volatile uint_t *)&a->value, 0); #else int value; do { @@ -278,6 +289,12 @@ SDL_AtomicGetPtr(void **a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(a, __ATOMIC_SEQ_CST); +#elif defined(HAVE_MSC_ATOMICS) + return _InterlockedCompareExchangePointer(a, NULL, NULL); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_val_compare_and_swap(a, (void *)0, (void *)0); +#elif defined(__SOLARIS__) + return atomic_cas_ptr(a, (void *)0, (void *)0); #else void *value; do { From e873d6098186f7733e5dd157d9c529f8b0b6f6d4 Mon Sep 17 00:00:00 2001 From: pionere Date: Mon, 7 Nov 2022 10:02:06 +0100 Subject: [PATCH 297/459] fix handling of SDL_EventQ.active - SDL_EventQ.active is a bool variable -> do not use SDL_AtomicGet/Set, it does not help in any way - protect SDL_EventQ.active with SDL_EventQ.lock - set SDL_EventQ.active to FALSE by default --- src/events/SDL_events.c | 49 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 00a4053c7..52b72cd22 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -86,7 +86,7 @@ typedef struct _SDL_SysWMEntry static struct { SDL_mutex *lock; - SDL_atomic_t active; + SDL_bool active; SDL_atomic_t count; int max_events_seen; SDL_EventEntry *head; @@ -94,7 +94,7 @@ static struct SDL_EventEntry *free; SDL_SysWMEntry *wmmsg_used; SDL_SysWMEntry *wmmsg_free; -} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; +} SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; #if !SDL_JOYSTICK_DISABLED @@ -474,7 +474,7 @@ SDL_StopEventLoop(void) SDL_LockMutex(SDL_EventQ.lock); } - SDL_AtomicSet(&SDL_EventQ.active, 0); + SDL_EventQ.active = SDL_FALSE; if (report && SDL_atoi(report)) { SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", @@ -554,10 +554,12 @@ SDL_StartEventLoop(void) return -1; } } + SDL_LockMutex(SDL_EventQ.lock); if (!SDL_event_watchers_lock) { SDL_event_watchers_lock = SDL_CreateMutex(); if (SDL_event_watchers_lock == NULL) { + SDL_UnlockMutex(SDL_EventQ.lock); return -1; } } @@ -572,8 +574,10 @@ SDL_StartEventLoop(void) SDL_EventState(SDL_DROPTEXT, SDL_DISABLE); #endif - SDL_AtomicSet(&SDL_EventQ.active, 1); - + SDL_EventQ.active = SDL_TRUE; + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } return 0; } @@ -692,17 +696,20 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action { int i, used, sentinels_expected = 0; - /* Don't look after we've quit */ - if (!SDL_AtomicGet(&SDL_EventQ.active)) { - /* We get a few spurious events at shutdown, so don't warn then */ - if (action == SDL_GETEVENT) { - SDL_SetError("The event system has been shut down"); - } - return (-1); - } /* Lock the event queue */ used = 0; if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { + /* Don't look after we've quit */ + if (!SDL_EventQ.active) { + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } + /* We get a few spurious events at shutdown, so don't warn then */ + if (action == SDL_GETEVENT) { + SDL_SetError("The event system has been shut down"); + } + return (-1); + } if (action == SDL_ADDEVENT) { for (i = 0; i < numevents; ++i) { used += SDL_AddEvent(&events[i]); @@ -810,15 +817,12 @@ SDL_FlushEvent(Uint32 type) void SDL_FlushEvents(Uint32 minType, Uint32 maxType) { + SDL_EventEntry *entry, *next; + Uint32 type; /* !!! FIXME: we need to manually SDL_free() the strings in TEXTINPUT and drag'n'drop events if we're flushing them without passing them to the app, but I don't know if this is the right place to do that. */ - /* Don't look after we've quit */ - if (!SDL_AtomicGet(&SDL_EventQ.active)) { - return; - } - /* Make sure the events are current */ #if 0 /* Actually, we can't do this since we might be flushing while processing @@ -829,8 +833,13 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) /* Lock the event queue */ if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { - SDL_EventEntry *entry, *next; - Uint32 type; + /* Don't look after we've quit */ + if (!SDL_EventQ.active) { + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } + return; + } for (entry = SDL_EventQ.head; entry; entry = next) { next = entry->next; type = entry->event.type; From db01016dd6c07c861a8ba286ae0664af34f7f35f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Mon, 7 Nov 2022 21:15:30 +0300 Subject: [PATCH 298/459] revert replace AM_PATH_SDL2 usage with corresponding PKG_CHECK_MODULES. Reference issue: https://github.com/libsdl-org/SDL/issues/6494 . --- test/acinclude.m4 | 183 ++++++++++++++++++++++++- test/configure | 335 ++++++++++++++++++++++++++++++++++++++++++++-- test/configure.ac | 5 +- 3 files changed, 508 insertions(+), 15 deletions(-) diff --git a/test/acinclude.m4 b/test/acinclude.m4 index c8d8f72ab..0fdf353ea 100644 --- a/test/acinclude.m4 +++ b/test/acinclude.m4 @@ -1,6 +1,186 @@ +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +# serial 2 + +dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN([AM_PATH_SDL2], +[dnl +dnl Get the cflags and libraries from the sdl2-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + min_sdl_version=ifelse([$1], ,2.0.0,$1) + + if test "x$sdl_prefix$sdl_exec_prefix" = x ; then + PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + [sdl_pc=yes], + [sdl_pc=no]) + else + sdl_pc=no + if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + fi + fi + fi + + if test "x$sdl_pc" = xyes ; then + no_sdl="" + SDL2_CONFIG="pkg-config sdl2" + else + as_save_PATH="$PATH" + if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi + AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + PATH="$as_save_PATH" + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + + if test "$SDL2_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + + sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl2-config to some extent +dnl + rm -f conf.sdltest + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include "SDL.h" + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + FILE *fp = fopen("conf.sdltest", "w"); + + if (fp) fclose(fp); + + if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); + printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +]])], [], [no_sdl=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi + if test "x$no_sdl" = x ; then + ifelse([$2], , :, [$2]) + else + if test "$SDL2_CONFIG" = "no" ; then + echo "*** The sdl2-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL2_CONFIG environment variable to the" + echo "*** full path to sdl2-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +]], [[ return 0; ]])], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) -# +# # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify @@ -90,6 +270,7 @@ else fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED + # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # diff --git a/test/configure b/test/configure index 41c5f7460..c71abe489 100755 --- a/test/configure +++ b/test/configure @@ -627,6 +627,7 @@ OPENGLES2_TARGETS OPENGLES1_TARGETS CPP XMKMF +SDL2_CONFIG SDL_LIBS SDL_CFLAGS PKG_CONFIG_LIBDIR @@ -696,6 +697,9 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +with_sdl_prefix +with_sdl_exec_prefix +enable_sdltest with_x enable_werror ' @@ -1340,11 +1344,14 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-sdltest Do not try to compile and run a test SDL program --enable-werror treat warnings as errors [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-sdl-prefix=PFX Prefix where SDL is installed (optional) + --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) --with-x use the X Window System Some influential environment variables: @@ -1536,6 +1543,49 @@ fi } # ac_fn_c_try_link +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -3800,20 +3850,50 @@ printf "%s\n" "no" >&6; } fi fi +# Check whether --with-sdl-prefix was given. +if test ${with_sdl_prefix+y} +then : + withval=$with_sdl_prefix; sdl_prefix="$withval" +else $as_nop + sdl_prefix="" +fi + + +# Check whether --with-sdl-exec-prefix was given. +if test ${with_sdl_exec_prefix+y} +then : + withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" +else $as_nop + sdl_exec_prefix="" +fi + +# Check whether --enable-sdltest was given. +if test ${enable_sdltest+y} +then : + enableval=$enable_sdltest; +else $as_nop + enable_sdltest=yes +fi + + + min_sdl_version=$SDL_VERSION + + if test "x$sdl_prefix$sdl_exec_prefix" = x ; then + pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $SDL_VERSION" >&5 -printf %s "checking for sdl2 >= $SDL_VERSION... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 +printf %s "checking for sdl2 >= $min_sdl_version... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$SDL_VERSION\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $SDL_VERSION") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $SDL_VERSION" 2>/dev/null` + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -3824,12 +3904,12 @@ if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$SDL_VERSION\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $SDL_VERSION") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $SDL_VERSION" 2>/dev/null` + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -3849,25 +3929,254 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $SDL_VERSION" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $min_sdl_version" 2>&1` else - SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $SDL_VERSION" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $min_sdl_version" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SDL_PKG_ERRORS" >&5 - as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 + sdl_pc=no elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 + sdl_pc=no else SDL_CFLAGS=$pkg_cv_SDL_CFLAGS SDL_LIBS=$pkg_cv_SDL_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - + sdl_pc=yes fi + else + sdl_pc=no + if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + fi + fi + fi + + if test "x$sdl_pc" = xyes ; then + no_sdl="" + SDL2_CONFIG="pkg-config sdl2" + else + as_save_PATH="$PATH" + if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi + # Extract the first word of "sdl2-config", so it can be a program name with args. +set dummy sdl2-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_SDL2_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $SDL2_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no" + ;; +esac +fi +SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG +if test -n "$SDL2_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 +printf "%s\n" "$SDL2_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + PATH="$as_save_PATH" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 +printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } + no_sdl="" + + if test "$SDL2_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + + sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + rm -f conf.sdltest + if test "$cross_compiling" = yes +then : + echo $ac_n "cross compiling; assumed OK... $ac_c" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include "SDL.h" + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + FILE *fp = fopen("conf.sdltest", "w"); + + if (fp) fclose(fp); + + if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); + printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + +else $as_nop + no_sdl=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + fi + if test "x$no_sdl" = x ; then + : + else + if test "$SDL2_CONFIG" = "no" ; then + echo "*** The sdl2-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL2_CONFIG environment variable to the" + echo "*** full path to sdl2-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main + +int +main (void) +{ + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else $as_nop + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 + + fi + + + rm -f conf.sdltest + CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS -lSDL2_test $SDL_LIBS" diff --git a/test/configure.ac b/test/configure.ac index a613e9f9d..e9890163e 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -101,7 +101,10 @@ AC_SUBST(ISOS2) dnl Check for SDL SDL_VERSION=2.0.18 -PKG_CHECK_MODULES([SDL], [sdl2 >= $SDL_VERSION],, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])) +AM_PATH_SDL2($SDL_VERSION, + :, + AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) +) CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS -lSDL2_test $SDL_LIBS" From b0dc6709b9735d22b2713a7b76e5bc0892a0e5df Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 7 Nov 2022 14:26:48 -0500 Subject: [PATCH 299/459] coreaudio: Don't use deprecated kAudioObjectPropertyElementMaster symbol. Fixes #6449. --- src/audio/coreaudio/SDL_coreaudio.h | 8 ++++++++ src/audio/coreaudio/SDL_coreaudio.m | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h index b426ea404..9353046a4 100644 --- a/src/audio/coreaudio/SDL_coreaudio.h +++ b/src/audio/coreaudio/SDL_coreaudio.h @@ -39,6 +39,14 @@ #include #include +/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ +#if MACOSX_COREAUDIO +#include +#ifndef MAC_OS_VERSION_12_0 +#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster +#endif +#endif + /* Hidden "this" pointer for the audio functions */ #define _THIS SDL_AudioDevice *this diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index dbd85f489..d22335912 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -53,7 +53,7 @@ static const AudioObjectPropertyAddress devlist_address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; typedef void (*addDevFn)(const char *name, SDL_AudioSpec *spec, const int iscapture, AudioDeviceID devId, void *data); @@ -131,17 +131,17 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) const AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreamConfiguration, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; const AudioObjectPropertyAddress nameaddr = { kAudioObjectPropertyName, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; const AudioObjectPropertyAddress freqaddr = { kAudioDevicePropertyNominalSampleRate, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); @@ -642,7 +642,7 @@ static const AudioObjectPropertyAddress alive_address = { kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; static OSStatus @@ -764,7 +764,7 @@ prepare_device(_THIS) AudioObjectPropertyAddress addr = { 0, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; if (handle == NULL) { @@ -811,7 +811,7 @@ assign_device_to_audioqueue(_THIS) const AudioObjectPropertyAddress prop = { kAudioDevicePropertyDeviceUID, this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; OSStatus result; @@ -960,7 +960,7 @@ audioqueue_thread(void *arg) const AudioObjectPropertyAddress default_device_address = { this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; if (this->handle == NULL) { /* opened the default device? Register to know if the user picks a new default. */ @@ -1185,24 +1185,24 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) : kAudioHardwarePropertyDefaultOutputDevice, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress nameaddr = { kAudioObjectPropertyName, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress freqaddr = { kAudioDevicePropertyNominalSampleRate, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress bufaddr = { kAudioDevicePropertyStreamConfiguration, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; /* Get the Device ID */ From 02bc359b6454acac743693962eaf506ccf863a82 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 7 Nov 2022 19:31:18 -0800 Subject: [PATCH 300/459] Shorten "Bensussen Deutsch & Associates,Inc.(BDA)" to "BDA" for controller names --- src/joystick/SDL_joystick.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 93322e7c6..60a82c967 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1874,6 +1874,7 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c const char *replacement; } replacements[] = { { "ASTRO Gaming", "ASTRO" }, + { "Bensussen Deutsch & Associates,Inc.(BDA)", "BDA" }, { "NVIDIA Corporation ", "" }, { "Performance Designed Products", "PDP" }, { "HORI CO.,LTD.", "HORI" }, From 2e3b4f3fd77cb167038a4d113dca60a5c96bfe75 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 8 Nov 2022 07:50:51 -0800 Subject: [PATCH 301/459] Don't send rumble to the Amazon Luna controller on macOS Sending rumble to the Amazon Luna controller on macOS gets there, but IOHIDDeviceSetReport() blocks for a long time and eventually fails. This appears to be a bug in the macOS Bluetooth stack, ref rdar://99265496 --- src/joystick/hidapi/SDL_hidapi_luna.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_luna.c b/src/joystick/hidapi/SDL_hidapi_luna.c index 3bcf3d050..c9cd2810e 100644 --- a/src/joystick/hidapi/SDL_hidapi_luna.c +++ b/src/joystick/hidapi/SDL_hidapi_luna.c @@ -35,6 +35,11 @@ /* Define this if you want to log all packets from the controller */ /*#define DEBUG_LUNA_PROTOCOL*/ +/* Sending rumble on macOS blocks for a long time and eventually fails */ +#if !defined(__MACOSX__) +#define ENABLE_LUNA_BLUETOOTH_RUMBLE +#endif + enum { SDL_CONTROLLER_BUTTON_LUNA_MIC = 15, @@ -119,6 +124,7 @@ HIDAPI_DriverLuna_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick static int HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { +#ifdef ENABLE_LUNA_BLUETOOTH_RUMBLE if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) { /* Same packet as on Xbox One controllers connected via Bluetooth */ Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xEB }; @@ -132,10 +138,11 @@ HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti } return 0; - } else { - /* FIXME: Is there a rumble packet over USB? */ - return SDL_Unsupported(); } +#endif /* ENABLE_LUNA_BLUETOOTH_RUMBLE */ + + /* There is currently no rumble packet over USB */ + return SDL_Unsupported(); } static int @@ -149,9 +156,11 @@ HIDAPI_DriverLuna_GetJoystickCapabilities(SDL_HIDAPI_Device *device, SDL_Joystic { Uint32 result = 0; +#ifdef ENABLE_LUNA_BLUETOOTH_RUMBLE if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) { result |= SDL_JOYCAP_RUMBLE; } +#endif return result; } From 6432f45a1cfcac5fa782a8c200cecf295c7b9665 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 8 Nov 2022 10:27:21 -0800 Subject: [PATCH 302/459] Don't treat the Nintendo IMU as a separate game controller on Linux --- src/joystick/SDL_gamecontroller.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index bd30029b9..2bb97657b 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -1999,6 +1999,10 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) /* Don't treat the PS3 and PS4 motion controls as a separate game controller */ return SDL_TRUE; } + if (SDL_strncmp(name, "Nintendo ", 9) == 0 && SDL_strstr(name, " IMU") != NULL) { + /* Don't treat the Nintendo IMU as a separate game controller */ + return SDL_TRUE; + } if (SDL_endswith(name, " Accelerometer") || SDL_endswith(name, " IR") || SDL_endswith(name, " Motion Plus") || From 3dc88da0222c9ee3156b87c5213a4a9e400e6883 Mon Sep 17 00:00:00 2001 From: meyraud705 Date: Tue, 8 Nov 2022 13:27:56 +0100 Subject: [PATCH 303/459] Fix Dualshock 4 rumble stopping too early Dualshock 4 controller only rumbles for 5 seconds maximum. Resend rumble command every 2 seconds to make long rumble work. --- src/joystick/SDL_joystick.c | 21 +++++++++++++++++++-- src/joystick/SDL_sysjoystick.h | 5 +++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 60a82c967..c1e47beb0 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1005,6 +1005,10 @@ SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h result = 0; } else { result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); + joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; + if (!joystick->rumble_resend) { + joystick->rumble_resend = 1; + } } if (result == 0) { @@ -1018,6 +1022,7 @@ SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h } } else { joystick->rumble_expiration = 0; + joystick->rumble_resend = 0; } } SDL_UnlockJoysticks(); @@ -1713,6 +1718,7 @@ void SDL_JoystickUpdate(void) { int i; + Uint32 now; SDL_Joystick *joystick; if (!SDL_WasInit(SDL_INIT_JOYSTICK)) { @@ -1735,13 +1741,24 @@ SDL_JoystickUpdate(void) } } + now = SDL_GetTicks(); if (joystick->rumble_expiration && - SDL_TICKS_PASSED(SDL_GetTicks(), joystick->rumble_expiration)) { + SDL_TICKS_PASSED(now, joystick->rumble_expiration)) { SDL_JoystickRumble(joystick, 0, 0, 0); + joystick->rumble_resend = 0; + } + + if (joystick->rumble_resend && + SDL_TICKS_PASSED(now, joystick->rumble_resend)) { + joystick->driver->Rumble(joystick, joystick->low_frequency_rumble, joystick->high_frequency_rumble); + joystick->rumble_resend = now + SDL_RUMBLE_RESEND_MS; + if (joystick->rumble_resend == 0) { + joystick->rumble_resend = 1; + } } if (joystick->trigger_rumble_expiration && - SDL_TICKS_PASSED(SDL_GetTicks(), joystick->trigger_rumble_expiration)) { + SDL_TICKS_PASSED(now, joystick->trigger_rumble_expiration)) { SDL_JoystickRumbleTriggers(joystick, 0, 0, 0); } } diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 707ab4ae3..015007c59 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -103,6 +103,7 @@ struct _SDL_Joystick Uint16 low_frequency_rumble; Uint16 high_frequency_rumble; Uint32 rumble_expiration; + Uint32 rumble_resend; Uint16 left_trigger_rumble; Uint16 right_trigger_rumble; @@ -217,6 +218,10 @@ typedef struct _SDL_JoystickDriver /* Windows and Mac OSX has a limit of MAX_DWORD / 1000, Linux kernel has a limit of 0xFFFF */ #define SDL_MAX_RUMBLE_DURATION_MS 0xFFFF +/* Dualshock4 only rumbles for about 5 seconds max, resend rumble command every 2 seconds + * to make long rumble work. */ +#define SDL_RUMBLE_RESEND_MS 2000 + #define SDL_LED_MIN_REPEAT_MS 5000 /* The available joystick drivers */ From b095df7f5cc0f32f8b90cca10e509204ec742ae0 Mon Sep 17 00:00:00 2001 From: pionere Date: Tue, 8 Nov 2022 08:39:43 +0100 Subject: [PATCH 304/459] simplify MSC_ATOMICS - use _Interlocked(Compare)ExchangePointer in case of _M_IX86 as well - improve assertions: 1. add assertions to SDL_AtomicAdd/SDL_AtomicSet and SDL_AtomicCAS 2. use sizeof(a->value) instead of sizeof(int) --- src/atomic/SDL_atomic.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 74e930c8c..fa9065bd9 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -128,6 +128,7 @@ SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value)); return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); #elif defined(HAVE_WATCOM_ATOMICS) return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval); @@ -158,9 +159,7 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval) { -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) +#if defined(HAVE_MSC_ATOMICS) return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); #elif defined(HAVE_WATCOM_ATOMICS) return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); @@ -192,6 +191,7 @@ int SDL_AtomicSet(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value)); return _InterlockedExchange((long*)&a->value, v); #elif defined(HAVE_WATCOM_ATOMICS) return _SDL_xchg_watcom(&a->value, v); @@ -213,9 +213,7 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) void* SDL_AtomicSetPtr(void **a, void *v) { -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (void *) _InterlockedExchange((long *)a, (long) v); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) +#if defined(HAVE_MSC_ATOMICS) return _InterlockedExchangePointer(a, v); #elif defined(HAVE_WATCOM_ATOMICS) return (void *) _SDL_xchg_watcom((int *)a, (long)v); @@ -236,6 +234,7 @@ int SDL_AtomicAdd(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(long) == sizeof(a->value)); return _InterlockedExchangeAdd((long*)&a->value, v); #elif defined(HAVE_WATCOM_ATOMICS) return _SDL_xadd_watcom(&a->value, v); @@ -265,14 +264,14 @@ SDL_AtomicGet(SDL_atomic_t *a) #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); #elif defined(HAVE_MSC_ATOMICS) - SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(long) == sizeof(int)); + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(long) == sizeof(a->value)); return _InterlockedOr((long *)&a->value, 0); #elif defined(HAVE_WATCOM_ATOMICS) return _SDL_xadd_watcom(&a->value, 0); #elif defined(HAVE_GCC_ATOMICS) return __sync_or_and_fetch(&a->value, 0); #elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ - return sizeof(int) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value); + return sizeof(a->value) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value); #elif defined(__SOLARIS__) return atomic_or_uint((volatile uint_t *)&a->value, 0); #else From e5c599f8c692e94c96072131b559d8d3b8a6b04b Mon Sep 17 00:00:00 2001 From: pionere Date: Wed, 9 Nov 2022 09:02:23 +0100 Subject: [PATCH 305/459] fix SOLARIS_ATOMICS - use 'sizeless' int types (int uses 32-bit even if _LP64 is set) --- src/atomic/SDL_atomic.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index fa9065bd9..a89134e1a 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -136,10 +136,8 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); #elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); -#elif defined(__SOLARIS__) && defined(_LP64) - return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval); -#elif defined(__SOLARIS__) && !defined(_LP64) - return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)&a->value, (uint32_t)oldval, (uint32_t)newval) == oldval); +#elif defined(__SOLARIS__) + return (SDL_bool) ((int) atomic_cas_uint((volatile uint_t*)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); #elif EMULATE_CAS SDL_bool retval = SDL_FALSE; @@ -197,10 +195,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) return _SDL_xchg_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); -#elif defined(__SOLARIS__) && defined(_LP64) - return (int) atomic_swap_64((volatile uint64_t*)&a->value, (uint64_t)v); -#elif defined(__SOLARIS__) && !defined(_LP64) - return (int) atomic_swap_32((volatile uint32_t*)&a->value, (uint32_t)v); +#elif defined(__SOLARIS__) + return (int) atomic_swap_uint((volatile uint_t*)&a->value, v); #else int value; do { @@ -241,13 +237,9 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(__SOLARIS__) - int pv = a->value; - membar_consumer(); -#if defined(_LP64) - atomic_add_64((volatile uint64_t*)&a->value, v); -#elif !defined(_LP64) - atomic_add_32((volatile uint32_t*)&a->value, v); -#endif + int pv = a->value; + membar_consumer(); + atomic_add_int((volatile uint_t*)&a->value, v); return pv; #else int value; From ac3349faafd80b2df91dcfb591b03506a9610e6e Mon Sep 17 00:00:00 2001 From: pionere Date: Wed, 9 Nov 2022 09:11:04 +0100 Subject: [PATCH 306/459] solve FIXMEs in SDL_video.c --- src/video/SDL_video.c | 65 +++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 321d6d026..56b387de7 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -694,29 +694,32 @@ SDL_GetDisplayName(int displayIndex) int SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) { + SDL_VideoDisplay *display; + CHECK_DISPLAY_INDEX(displayIndex, -1); - if (rect) { - SDL_VideoDisplay *display = &_this->displays[displayIndex]; + if (!rect) + return SDL_InvalidParamError("rect"); - if (_this->GetDisplayBounds) { - if (_this->GetDisplayBounds(_this, display, rect) == 0) { - return 0; - } - } + display = &_this->displays[displayIndex]; - /* Assume that the displays are left to right */ - if (displayIndex == 0) { - rect->x = 0; - rect->y = 0; - } else { - SDL_GetDisplayBounds(displayIndex-1, rect); - rect->x += rect->w; + if (_this->GetDisplayBounds) { + if (_this->GetDisplayBounds(_this, display, rect) == 0) { + return 0; } - rect->w = display->current_mode.w; - rect->h = display->current_mode.h; } - return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ + + /* Assume that the displays are left to right */ + if (displayIndex == 0) { + rect->x = 0; + rect->y = 0; + } else { + SDL_GetDisplayBounds(displayIndex-1, rect); + rect->x += rect->w; + } + rect->w = display->current_mode.w; + rect->h = display->current_mode.h; + return 0; } static int @@ -729,25 +732,27 @@ ParseDisplayUsableBoundsHint(SDL_Rect *rect) int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) { + SDL_VideoDisplay *display; + CHECK_DISPLAY_INDEX(displayIndex, -1); - if (rect) { - SDL_VideoDisplay *display = &_this->displays[displayIndex]; + if (!rect) + return SDL_InvalidParamError("rect"); - if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) { + display = &_this->displays[displayIndex]; + + if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) { + return 0; + } + + if (_this->GetDisplayUsableBounds) { + if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) { return 0; } - - if (_this->GetDisplayUsableBounds) { - if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) { - return 0; - } - } - - /* Oh well, just give the entire display bounds. */ - return SDL_GetDisplayBounds(displayIndex, rect); } - return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ + + /* Oh well, just give the entire display bounds. */ + return SDL_GetDisplayBounds(displayIndex, rect); } int From 1008cc8e5f129f3bc78b982ce8f37f404d69e743 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 9 Nov 2022 12:55:27 -0500 Subject: [PATCH 307/459] video: Add some braces to match SDL coding style. --- src/video/SDL_video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 56b387de7..dde4912ad 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -698,8 +698,9 @@ SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) CHECK_DISPLAY_INDEX(displayIndex, -1); - if (!rect) + if (!rect) { return SDL_InvalidParamError("rect"); + } display = &_this->displays[displayIndex]; @@ -736,8 +737,9 @@ SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) CHECK_DISPLAY_INDEX(displayIndex, -1); - if (!rect) + if (!rect) { return SDL_InvalidParamError("rect"); + } display = &_this->displays[displayIndex]; From 29cafa9c94e4db6dadfae43aece9fb2edcac121b Mon Sep 17 00:00:00 2001 From: pionere Date: Thu, 10 Nov 2022 08:23:16 +0100 Subject: [PATCH 308/459] add SDL_ContextNotSupported and validate flags in SDL_RecreateWindow similar to SDL_CreateWindow --- src/video/SDL_video.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index dde4912ad..7994c1943 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1579,6 +1579,14 @@ SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) } } +static int +SDL_ContextNotSupported(const char *name) +{ + return SDL_SetError("%s support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", name, _this->name); +} + SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { @@ -1627,9 +1635,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) if (flags & SDL_WINDOW_OPENGL) { if (!_this->GL_CreateContext) { - SDL_SetError("OpenGL support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + SDL_ContextNotSupported("OpenGL"); return NULL; } if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -1639,9 +1645,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) if (flags & SDL_WINDOW_VULKAN) { if (!_this->Vulkan_CreateSurface) { - SDL_SetError("Vulkan support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + SDL_ContextNotSupported("Vulkan"); return NULL; } if (graphics_flags & SDL_WINDOW_OPENGL) { @@ -1655,9 +1659,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) if (flags & SDL_WINDOW_METAL) { if (!_this->Metal_CreateView) { - SDL_SetError("Metal support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + SDL_ContextNotSupported("Metal"); return NULL; } /* 'flags' may have default flags appended, don't check against that. */ @@ -1809,9 +1811,7 @@ SDL_CreateWindowFrom(const void *data) if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, SDL_FALSE)) { if (!_this->GL_CreateContext) { - SDL_SetError("OpenGL support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + SDL_ContextNotSupported("OpenGL"); return NULL; } if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -1822,9 +1822,7 @@ SDL_CreateWindowFrom(const void *data) if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN, SDL_FALSE)) { if (!_this->Vulkan_CreateSurface) { - SDL_SetError("Vulkan support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + SDL_ContextNotSupported("Vulkan"); return NULL; } if (flags & SDL_WINDOW_OPENGL) { @@ -1877,9 +1875,13 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) SDL_bool need_vulkan_load = SDL_FALSE; if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) { - return SDL_SetError("OpenGL support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + return SDL_ContextNotSupported("OpenGL"); + } + if ((flags & SDL_WINDOW_VULKAN) && !_this->Vulkan_CreateSurface) { + return SDL_ContextNotSupported("Vulkan"); + } + if ((flags & SDL_WINDOW_METAL) && !_this->Metal_CreateView) { + return SDL_ContextNotSupported("Metal"); } if (window->flags & SDL_WINDOW_FOREIGN) { @@ -4753,9 +4755,7 @@ int SDL_Vulkan_LoadLibrary(const char *path) retval = 0; } else { if (!_this->Vulkan_LoadLibrary) { - return SDL_SetError("Vulkan support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); + return SDL_ContextNotSupported("Vulkan"); } retval = _this->Vulkan_LoadLibrary(_this, path); } From 404cb27677b4d6f953a55d181508b5f690df0993 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 10 Nov 2022 13:28:03 -0800 Subject: [PATCH 309/459] Added macOS mappings for the Nintendo Switch Pro Controller over Bluetooth --- src/joystick/SDL_gamecontrollerdb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 54342bf25..0c9f84057 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -449,6 +449,8 @@ static const char *s_ControllerMappings [] = "03000000550900001472000025050000,NVIDIA Controller v01.04,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", "030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "050000007e05000009200000ff070000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000ff070000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "030000006f0e00000901000002010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", From 7c05ea0a0ef075527fd745215d5d8a77f667bc21 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 10 Nov 2022 13:35:40 -0800 Subject: [PATCH 310/459] Added mappings for the GameSir T3 and T4 Pro controllers --- src/joystick/SDL_gamecontrollerdb.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 0c9f84057..32c59c837 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -141,8 +141,10 @@ static const char *s_ControllerMappings [] = "03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,", + "03000000491900000204000000000000,GameSir T4 Pro,crc:1aa4,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000ac0500001a06000000000000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000c01100000140000000000000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", @@ -412,6 +414,7 @@ static const char *s_ControllerMappings [] = "03000000151900004000000001000000,Flydigi Vader 2,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000b40400001124000000000000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b4,paddle2:b5,paddle3:b17,rightshoulder:b7,rightstick:b13,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b2,y:b3,", "03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000ac0500001a06000002020000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000c01100000140000000010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", @@ -602,6 +605,8 @@ static const char *s_ControllerMappings [] = "0500000047532067616d657061640000,GS Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", "03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "0500000049190000020400001b010000,GameSir T4 Pro,crc:8283,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b23,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "03000000ac0500001a06000011010000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000c01100000140000011010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", @@ -858,8 +863,8 @@ static const char *s_ControllerMappings [] = "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote v2.2,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,", "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,", - "030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote v2.2,a:b1,b:b4,x:b0,y:b5,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,", #endif #if defined(__OpenBSD__) "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", From f430ef5ddcd84ac0bb6c20308480df410931ac73 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 10 Nov 2022 17:27:48 -0800 Subject: [PATCH 311/459] Don't change the window position when creating it on iOS, it is already placed on the correct display --- src/video/uikit/SDL_uikitwindow.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 433c80ee1..7b8dfff56 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -136,8 +136,10 @@ SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) } #endif /* !TARGET_OS_TV */ +#if 0 /* Don't set the x/y position, it's already placed on a display */ window->x = 0; window->y = 0; +#endif window->w = width; window->h = height; From 0dfc829a6b75b5a3c4c1d49fb943b622c12d67bc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 10 Nov 2022 19:16:53 -0800 Subject: [PATCH 312/459] Added simple BLE Steam Controller support on all platforms This is still disabled by default via the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM --- Makefile.os2 | 2 +- Makefile.w32 | 2 +- VisualC-GDK/SDL/SDL.vcxproj | 1 + VisualC-GDK/SDL/SDL.vcxproj.filters | 3 ++ VisualC/SDL/SDL.vcxproj | 1 + VisualC/SDL/SDL.vcxproj.filters | 3 ++ Xcode/SDL/SDL.xcodeproj/project.pbxproj | 6 +++ include/SDL_hints.h | 2 +- src/joystick/hidapi/SDL_hidapi_steam.c | 48 +++++++++++++++------- src/joystick/hidapi/SDL_hidapijoystick_c.h | 6 +-- test/testgamecontroller.c | 1 + 11 files changed, 53 insertions(+), 22 deletions(-) diff --git a/Makefile.os2 b/Makefile.os2 index 76b2b398d..6ec172b37 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -94,7 +94,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_steam.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c diff --git a/Makefile.w32 b/Makefile.w32 index 68c3a3731..407bfd2a0 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -73,7 +73,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_steam.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index e3966e693..c8208b41f 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -600,6 +600,7 @@ + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 0c02e0796..02dc97ef3 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -1078,6 +1078,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index e3b66d1cb..2c85790e2 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -491,6 +491,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 167e40d29..082e257b4 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -1069,6 +1069,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 9c086f1ff..a0741e06c 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3393,6 +3393,9 @@ F323060528939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; F323060628939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; F323060728939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; + F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; + F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; + F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; }; @@ -8909,6 +8912,7 @@ A7D8BBD923E2574800DCD162 /* SDL_uikitmessagebox.m in Sources */, A7D8AD2923E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95123E2514000DCD162 /* SDL_spinlock.c in Sources */, + F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8BAAF23E2514400DCD162 /* s_atan.c in Sources */, A7D8B75223E2514300DCD162 /* SDL_sysloadso.c in Sources */, A7D8BBE123E2574800DCD162 /* SDL_uikitopenglview.m in Sources */, @@ -9103,6 +9107,7 @@ A7D8B41F23E2514300DCD162 /* SDL_systls.c in Sources */, A7D8AD2C23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95423E2514000DCD162 /* SDL_spinlock.c in Sources */, + F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8BAB223E2514400DCD162 /* s_atan.c in Sources */, F3A490A12554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, A7D8B75523E2514300DCD162 /* SDL_sysloadso.c in Sources */, @@ -9297,6 +9302,7 @@ A7D8AD2E23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95623E2514000DCD162 /* SDL_spinlock.c in Sources */, A7D8BAB423E2514400DCD162 /* s_atan.c in Sources */, + F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8B75723E2514300DCD162 /* SDL_sysloadso.c in Sources */, F3A490A42554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, A7D8B98B23E2514400DCD162 /* SDL_render_metal.m in Sources */, diff --git a/include/SDL_hints.h b/include/SDL_hints.h index ce2225440..d51525936 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -817,7 +817,7 @@ extern "C" { #define SDL_HINT_JOYSTICK_HIDAPI_STADIA "SDL_JOYSTICK_HIDAPI_STADIA" /** - * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * \brief A variable controlling whether the HIDAPI driver for Bluetooth Steam Controllers should be used. * * This variable can be set to the following values: * "0" - HIDAPI driver is not used diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c index 7b497fa95..9221d12e8 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/src/joystick/hidapi/SDL_hidapi_steam.c @@ -356,30 +356,41 @@ static int GetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65] ) if ( bBle ) { int nRetries = 0; - uint8_t uSegmentBuffer[ MAX_REPORT_SEGMENT_SIZE ]; + uint8_t uSegmentBuffer[ MAX_REPORT_SEGMENT_SIZE + 1 ]; + uint8_t ucBytesToRead = MAX_REPORT_SEGMENT_SIZE; + uint8_t ucDataStartOffset = 0; SteamControllerPacketAssembler assembler; InitializeSteamControllerPacketAssembler( &assembler ); + // On Windows and macOS, BLE devices get 2 copies of the feature report ID, one that is removed by ReadFeatureReport, + // and one that's included in the buffer we receive. We pad the bytes to read and skip over the report ID + // if necessary. +#if defined(__WIN32__) || defined(__MACOSX__) + ++ucBytesToRead; + ++ucDataStartOffset; +#endif + while( nRetries < BLE_MAX_READ_RETRIES ) { SDL_memset( uSegmentBuffer, 0, sizeof( uSegmentBuffer ) ); uSegmentBuffer[ 0 ] = BLE_REPORT_NUMBER; - nRet = SDL_hid_get_feature_report( dev, uSegmentBuffer, sizeof( uSegmentBuffer ) ); + nRet = SDL_hid_get_feature_report( dev, uSegmentBuffer, ucBytesToRead ); + DPRINTF( "GetFeatureReport ble ret=%d\n", nRet ); HEXDUMP( uSegmentBuffer, nRet ); // Zero retry counter if we got data - if ( nRet > 2 && ( uSegmentBuffer[ 1 ] & REPORT_SEGMENT_DATA_FLAG ) ) + if ( nRet > 2 && ( uSegmentBuffer[ ucDataStartOffset + 1 ] & REPORT_SEGMENT_DATA_FLAG ) ) nRetries = 0; else nRetries++; - + if ( nRet > 0 ) { int nPacketLength = WriteSegmentToSteamControllerPacketAssembler( &assembler, - uSegmentBuffer, - nRet ); + uSegmentBuffer + ucDataStartOffset, + nRet - ucDataStartOffset ); if ( nPacketLength > 0 && nPacketLength < 65 ) { @@ -424,7 +435,8 @@ static bool ResetSteamController( SDL_hid_device *dev, bool bSuppressErrorSpew, { // Firmware quirk: Set Feature and Get Feature requests always require a 65-byte buffer. unsigned char buf[65]; - int res = -1, i; + unsigned int i; + int res = -1; int nSettings = 0; int nAttributesLength; FeatureReportMsg *msg; @@ -803,8 +815,8 @@ static void FormatStatePacketUntilGyro( SteamControllerStateInternal_t *pState, pState->sRightPadX = clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16); pState->sRightPadY = clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16); - pState->sTriggerL = (unsigned short)RemapValClamped( (pStatePacket->ButtonTriggerData.Triggers.nLeft << 7) | pStatePacket->ButtonTriggerData.Triggers.nLeft, 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); - pState->sTriggerR = (unsigned short)RemapValClamped( (pStatePacket->ButtonTriggerData.Triggers.nRight << 7) | pStatePacket->ButtonTriggerData.Triggers.nRight, 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); + pState->sTriggerL = (unsigned short)RemapValClamped( (float)((pStatePacket->ButtonTriggerData.Triggers.nLeft << 7) | pStatePacket->ButtonTriggerData.Triggers.nLeft), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); + pState->sTriggerR = (unsigned short)RemapValClamped( (float)((pStatePacket->ButtonTriggerData.Triggers.nRight << 7) | pStatePacket->ButtonTriggerData.Triggers.nRight), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); } @@ -827,8 +839,8 @@ static bool UpdateBLESteamControllerState( const uint8_t *pData, int nDataSize, if ( ucOptionDataMask & k_EBLEButtonChunk2 ) { // The middle 2 bytes of the button bits over the wire are triggers when over the wire and non-SC buttons in the internal controller state packet - pState->sTriggerL = (unsigned short)RemapValClamped( ( pData[ 0 ] << 7 ) | pData[ 0 ], 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); - pState->sTriggerR = (unsigned short)RemapValClamped( ( pData[ 1 ] << 7 ) | pData[ 1 ], 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); + pState->sTriggerL = (unsigned short)RemapValClamped( (float)(( pData[ 0 ] << 7 ) | pData[ 0 ]), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); + pState->sTriggerR = (unsigned short)RemapValClamped( (float)(( pData[ 1 ] << 7 ) | pData[ 1 ]), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 ); pData += 2; } if ( ucOptionDataMask & k_EBLEButtonChunk3 ) @@ -1035,6 +1047,14 @@ HIDAPI_DriverSteam_InitDevice(SDL_HIDAPI_Device *device) } device->context = ctx; +#if defined(__WIN32__) + if (device->serial) { + /* We get a garbage serial number on Windows */ + SDL_free(device->serial); + device->serial = NULL; + } +#endif /* __WIN32__ */ + HIDAPI_SetDeviceName(device, "Steam Controller"); return HIDAPI_JoystickConnected(device, NULL); @@ -1240,9 +1260,9 @@ HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device) ctx->timestamp_us += ctx->update_rate_in_us; - values[0] = (ctx->m_state.sGyroX / 32768.0f) * (2000.0f * (M_PI / 180.0f)); - values[1] = (ctx->m_state.sGyroZ / 32768.0f) * (2000.0f * (M_PI / 180.0f)); - values[2] = (ctx->m_state.sGyroY / 32768.0f) * (2000.0f * (M_PI / 180.0f)); + values[0] = (ctx->m_state.sGyroX / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); + values[1] = (ctx->m_state.sGyroZ / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); + values[2] = (ctx->m_state.sGyroY / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, ctx->timestamp_us, values, 3); values[0] = (ctx->m_state.sAccelX / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; diff --git a/src/joystick/hidapi/SDL_hidapijoystick_c.h b/src/joystick/hidapi/SDL_hidapijoystick_c.h index a03221c1e..4ebadede9 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick_c.h +++ b/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -38,17 +38,13 @@ #define SDL_JOYSTICK_HIDAPI_PS4 #define SDL_JOYSTICK_HIDAPI_PS5 #define SDL_JOYSTICK_HIDAPI_STADIA +#define SDL_JOYSTICK_HIDAPI_STEAM /* Simple support for BLE Steam Controller, hint is disabled by default */ #define SDL_JOYSTICK_HIDAPI_SWITCH #define SDL_JOYSTICK_HIDAPI_WII #define SDL_JOYSTICK_HIDAPI_XBOX360 #define SDL_JOYSTICK_HIDAPI_XBOXONE #define SDL_JOYSTICK_HIDAPI_SHIELD -#if defined(__IPHONEOS__) || defined(__TVOS__) || defined(__ANDROID__) -/* Very basic Steam Controller support on mobile devices */ -#define SDL_JOYSTICK_HIDAPI_STEAM -#endif - /* Whether HIDAPI is enabled by default */ #define SDL_HIDAPI_DEFAULT SDL_TRUE diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 5d87b7a2c..053bea023 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -793,6 +793,7 @@ main(int argc, char *argv[]) SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_ROG_CHAKRAM, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_LINUX_JOYSTICK_DEADZONES, "1"); From dd44cacbd66b27ecff2842b092331f06eca9b04f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 11 Nov 2022 12:51:30 +0300 Subject: [PATCH 313/459] remove duplicated SDL_hidapi_steam.c additions to watcom makefiles. --- Makefile.os2 | 2 +- Makefile.w32 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.os2 b/Makefile.os2 index 6ec172b37..76b2b398d 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -94,7 +94,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_steam.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c diff --git a/Makefile.w32 b/Makefile.w32 index 407bfd2a0..68c3a3731 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -73,7 +73,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_steam.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c From 36c6ed4b6f2622222d0515204700dfbc78c7df0f Mon Sep 17 00:00:00 2001 From: pionere Date: Fri, 11 Nov 2022 08:33:55 +0100 Subject: [PATCH 314/459] video: add SDL_DllNotSupported - add SDL_DllNotSupported and use it to sync the behavior of SDL_GL_LoadLibrary with SDL_Vulkan_LoadLibrary --- src/video/SDL_video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 7994c1943..ff4602f95 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1587,6 +1587,12 @@ SDL_ContextNotSupported(const char *name) "(%s) or platform", name, _this->name); } +static int +SDL_DllNotSupported(const char *name) +{ + return SDL_SetError("No dynamic %s support in current SDL video driver (%s)", name, _this->name); +} + SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { @@ -3444,7 +3450,7 @@ SDL_GL_LoadLibrary(const char *path) retval = 0; } else { if (!_this->GL_LoadLibrary) { - return SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name); + return SDL_DllNotSupported("OpenGL"); } retval = _this->GL_LoadLibrary(_this, path); } @@ -4755,7 +4761,7 @@ int SDL_Vulkan_LoadLibrary(const char *path) retval = 0; } else { if (!_this->Vulkan_LoadLibrary) { - return SDL_ContextNotSupported("Vulkan"); + return SDL_DllNotSupported("Vulkan"); } retval = _this->Vulkan_LoadLibrary(_this, path); } From b71d9274291d38df68254b236448e3933a8c4eb3 Mon Sep 17 00:00:00 2001 From: pionere Date: Fri, 11 Nov 2022 12:09:15 +0100 Subject: [PATCH 315/459] video: add NOT_AN_OPENGL_WINDOW define (similar to NOT_A_VULKAN_WINDOW) --- src/video/SDL_video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ff4602f95..24a42a4ce 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4067,6 +4067,8 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) #endif /* SDL_VIDEO_OPENGL */ } +#define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window" + SDL_GLContext SDL_GL_CreateContext(SDL_Window * window) { @@ -4074,7 +4076,7 @@ SDL_GL_CreateContext(SDL_Window * window) CHECK_WINDOW_MAGIC(window, NULL); if (!(window->flags & SDL_WINDOW_OPENGL)) { - SDL_SetError("The specified window isn't an OpenGL window"); + SDL_SetError(NOT_AN_OPENGL_WINDOW); return NULL; } @@ -4111,7 +4113,7 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx) CHECK_WINDOW_MAGIC(window, -1); if (!(window->flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("The specified window isn't an OpenGL window"); + return SDL_SetError(NOT_AN_OPENGL_WINDOW); } } else if (!_this->gl_allow_no_surface) { return SDL_SetError("Use of OpenGL without a window is not supported on this platform"); @@ -4192,7 +4194,7 @@ SDL_GL_SwapWindowWithResult(SDL_Window * window) CHECK_WINDOW_MAGIC(window, -1); if (!(window->flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("The specified window isn't an OpenGL window"); + return SDL_SetError(NOT_AN_OPENGL_WINDOW); } if (SDL_GL_GetCurrentWindow() != window) { From d09edcbcac13e10676eedced42bd5b71948820a3 Mon Sep 17 00:00:00 2001 From: pionere Date: Fri, 11 Nov 2022 12:10:27 +0100 Subject: [PATCH 316/459] video: sync Metal_CreateView with GL_CreateContext and Vulkan_CreateSurface no need to check if _this->Metal_CreateView, since it is already checked in Re(create)Window --- src/video/SDL_video.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 24a42a4ce..0495e8ca9 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4867,12 +4867,7 @@ SDL_Metal_CreateView(SDL_Window * window) return NULL; } - if (_this->Metal_CreateView) { - return _this->Metal_CreateView(_this, window); - } else { - SDL_SetError("Metal is not supported."); - return NULL; - } + return _this->Metal_CreateView(_this, window); } void From afbafc2aef9f06847d234997a4e7f81000d39d3d Mon Sep 17 00:00:00 2001 From: Michael Fitzmayer Date: Fri, 21 Oct 2022 08:11:48 +0200 Subject: [PATCH 317/459] Remove redundant dependency to bitdraw.h, minor cleanup --- src/video/ngage/SDL_ngagevideo.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/video/ngage/SDL_ngagevideo.h b/src/video/ngage/SDL_ngagevideo.h index 86fc1a586..af8e8d857 100644 --- a/src/video/ngage/SDL_ngagevideo.h +++ b/src/video/ngage/SDL_ngagevideo.h @@ -30,7 +30,16 @@ #include #include #include -#include // CFbsDrawDevice + +class CFbsDrawDevice : public CBase +{ +public: +public: + IMPORT_C static CFbsDrawDevice* NewScreenDeviceL(TScreenInfoV01 aInfo,TDisplayMode aDispMode); +public: + virtual void Update() {} + virtual void UpdateRegion(const TRect&) {} +}; #define _THIS SDL_VideoDevice *_this @@ -46,10 +55,7 @@ typedef struct SDL_VideoData TRequestStatus NGAGE_WsEventStatus; TRequestStatus NGAGE_RedrawEventStatus; TWsEvent NGAGE_WsEvent; - //TWsRedrawEvent NGAGE_RedrawEvent; - CFbsDrawDevice* NGAGE_DrawDevice; - TBool NGAGE_IsWindowFocused; /* Not used yet */ /* Screen hardware frame buffer info */ @@ -64,10 +70,6 @@ typedef struct SDL_VideoData CFbsBitGc::TGraphicsOrientation NGAGE_ScreenOrientation; - /* Simulate double screen height */ - //TInt NGAGE_ScreenXScaleValue; - //TInt NGAGE_ScreenYScaleValue; - } SDL_VideoData; #endif /* _SDL_ngagevideo_h */ From 875e9b35d70d88b2de3fdb7b57e4fecd8f35d39a Mon Sep 17 00:00:00 2001 From: Michael Fitzmayer Date: Wed, 26 Oct 2022 15:19:28 +0200 Subject: [PATCH 318/459] N-Gage: additional cleanup --- src/video/ngage/SDL_ngageframebuffer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/video/ngage/SDL_ngageframebuffer.cpp b/src/video/ngage/SDL_ngageframebuffer.cpp index a67fa5a8a..98ff9ff71 100644 --- a/src/video/ngage/SDL_ngageframebuffer.cpp +++ b/src/video/ngage/SDL_ngageframebuffer.cpp @@ -220,10 +220,9 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer) TInt i; - //const TInt sourceNumBytesPerPixel = ((screen->format->BitsPerPixel-1) >> 3) + 1; TDisplayMode displayMode = phdata->NGAGE_DisplayMode; const TInt sourceNumBytesPerPixel = ((GetBpp(displayMode)-1) / 8) + 1; - // + const TPoint fixedOffset = phdata->NGAGE_ScreenOffset; const TInt screenW = screen->w; const TInt screenH = screen->h; @@ -383,7 +382,6 @@ void DirectUpdate(_THIS, int numrects, SDL_Rect *rects) DirectDraw(_this, numrects, rects, screenBuffer); } - //TRect rect2 = TRect(phdata->NGAGE_WsWindow.Size()); for (int i = 0; i < numrects; ++i) { TInt aAx = rects[i].x; From b7e65a81f1b0638c084d3c4195a7b88fb7175b6c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Nov 2022 08:57:07 -0800 Subject: [PATCH 319/459] Fixed incorrect WGI controller state when the application loses focus Recenter the controller elements when WGI stops reporting valid state Fixes https://github.com/libsdl-org/SDL/issues/5261 --- src/joystick/SDL_joystick.c | 2 +- src/joystick/SDL_joystick_c.h | 1 + .../windows/SDL_windows_gaming_input.c | 26 ++++++++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index c1e47beb0..c6d2bf393 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1432,7 +1432,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type) SDL_small_free(events, isstack); } -static void +void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick) { int i, j; diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index 3ded9763e..0f2093caf 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/src/joystick/SDL_joystick_c.h @@ -152,6 +152,7 @@ extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers) extern void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type, float rate); extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance); extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance); +extern void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick); extern int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value); extern int SDL_PrivateJoystickBall(SDL_Joystick *joystick, diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c index deec84bf5..3a89d1154 100644 --- a/src/joystick/windows/SDL_windows_gaming_input.c +++ b/src/joystick/windows/SDL_windows_gaming_input.c @@ -852,15 +852,27 @@ WGI_JoystickUpdate(SDL_Joystick *joystick) hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_GetCurrentReading(hwdata->controller, nbuttons, buttons, nhats, hats, naxes, axes, ×tamp); if (SUCCEEDED(hr) && timestamp != hwdata->timestamp) { UINT32 i; + SDL_bool all_zero = SDL_TRUE; - for (i = 0; i < nbuttons; ++i) { - SDL_PrivateJoystickButton(joystick, (Uint8)i, buttons[i]); - } - for (i = 0; i < nhats; ++i) { - SDL_PrivateJoystickHat(joystick, (Uint8)i, ConvertHatValue(hats[i])); - } + /* The axes are all zero when the application loses focus */ for (i = 0; i < naxes; ++i) { - SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)((int) (axes[i] * 65535) - 32768)); + if (axes[i] != 0.0f) { + all_zero = SDL_FALSE; + break; + } + } + if (all_zero) { + SDL_PrivateJoystickForceRecentering(joystick); + } else { + for (i = 0; i < nbuttons; ++i) { + SDL_PrivateJoystickButton(joystick, (Uint8) i, buttons[i]); + } + for (i = 0; i < nhats; ++i) { + SDL_PrivateJoystickHat(joystick, (Uint8) i, ConvertHatValue(hats[i])); + } + for (i = 0; i < naxes; ++i) { + SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)((int) (axes[i] * 65535) - 32768)); + } } hwdata->timestamp = timestamp; } From 9f8b68a2785563031473011379878bb63ed5d3a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Nov 2022 10:24:17 -0800 Subject: [PATCH 320/459] Fixed building without linux/input.h https://github.com/libsdl-org/SDL/issues/6169 --- CMakeLists.txt | 3 ++- configure | 16 ++++++++++++---- configure.ac | 14 ++++++++------ include/SDL_config.h.cmake | 1 + include/SDL_config.h.in | 1 + src/core/linux/SDL_evdev_capabilities.c | 8 ++++++-- src/core/linux/SDL_evdev_capabilities.h | 5 ++++- src/core/linux/SDL_ime.c | 1 + src/core/linux/SDL_sandbox.c | 3 +-- src/core/linux/SDL_udev.c | 1 + src/core/linux/SDL_udev.h | 4 ++-- src/hidapi/SDL_hidapi.c | 1 - 12 files changed, 39 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbb200274..d27141d1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1010,6 +1010,7 @@ if(SDL_LIBC) string(REPLACE "." "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) endforeach() + check_include_file(linux/input.h HAVE_LINUX_INPUT_H) set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h") check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS) @@ -1579,7 +1580,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(FREEBSD OR NETBSD OR OPENBSD OR BSDI) CheckUSBHID() endif() - if(LINUX AND NOT ANDROID) + if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) diff --git a/configure b/configure index 0f8806ced..4f4253cf1 100755 --- a/configure +++ b/configure @@ -18816,6 +18816,12 @@ if test "x$ac_cv_header_signal_h" = xyes then : printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_input_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h + fi @@ -28492,15 +28498,17 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h if test x$enable_joystick = xyes; then case $ARCH in linux) + if test "x$ac_cv_header_linux_input_h" = xyes; then printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" - have_joystick=yes + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + fi ;; freebsd) - if test x$use_input_events = xyes; then + if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index b520d21ad..60ab5b6f1 100644 --- a/configure.ac +++ b/configure.ac @@ -329,7 +329,7 @@ if test x$enable_libc = xyes; then dnl Check for C library headers dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated. m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC]) - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h linux/input.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -3900,13 +3900,15 @@ case "$host" in if test x$enable_joystick = xyes; then case $ARCH in linux) - AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" - have_joystick=yes + if test "x$ac_cv_header_linux_input_h" = xyes; then + AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + fi ;; freebsd) - if test x$use_input_events = xyes; then + if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index c9ee9df99..b85c5672b 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -72,6 +72,7 @@ #cmakedefine HAVE_STRING_H 1 #cmakedefine HAVE_SYS_TYPES_H 1 #cmakedefine HAVE_WCHAR_H 1 +#cmakedefine HAVE_LINUX_INPUT_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 #cmakedefine HAVE_LIBUNWIND_H 1 diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index f6f2171fa..67e50745b 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -75,6 +75,7 @@ #undef HAVE_STRING_H #undef HAVE_SYS_TYPES_H #undef HAVE_WCHAR_H +#undef HAVE_LINUX_INPUT_H #undef HAVE_PTHREAD_NP_H #undef HAVE_LIBUNWIND_H diff --git a/src/core/linux/SDL_evdev_capabilities.c b/src/core/linux/SDL_evdev_capabilities.c index 976f629fc..e23d49973 100644 --- a/src/core/linux/SDL_evdev_capabilities.c +++ b/src/core/linux/SDL_evdev_capabilities.c @@ -19,10 +19,12 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "../../SDL_internal.h" #include "SDL_evdev_capabilities.h" -#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) + +#if HAVE_LINUX_INPUT_H /* missing defines in older Linux kernel headers */ #ifndef BTN_TRIGGER_HAPPY @@ -142,4 +144,6 @@ SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)], return devclass; } -#endif +#endif /* HAVE_LINUX_INPUT_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/linux/SDL_evdev_capabilities.h b/src/core/linux/SDL_evdev_capabilities.h index 990ebe01b..67b7075cc 100644 --- a/src/core/linux/SDL_evdev_capabilities.h +++ b/src/core/linux/SDL_evdev_capabilities.h @@ -19,12 +19,13 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "../../SDL_internal.h" #ifndef SDL_evdev_capabilities_h_ #define SDL_evdev_capabilities_h_ +#if HAVE_LINUX_INPUT_H + #include /* A device can be any combination of these classes */ @@ -51,6 +52,8 @@ extern int SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)], unsigned long bitmask_key[NBITS(KEY_MAX)], unsigned long bitmask_rel[NBITS(REL_MAX)]); +#endif /* HAVE_LINUX_INPUT_H */ + #endif /* SDL_evdev_capabilities_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/linux/SDL_ime.c b/src/core/linux/SDL_ime.c index 50b5ebf7d..3ad4dbf43 100644 --- a/src/core/linux/SDL_ime.c +++ b/src/core/linux/SDL_ime.c @@ -18,6 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "../../SDL_internal.h" #include "SDL_ime.h" #include "SDL_ibus.h" diff --git a/src/core/linux/SDL_sandbox.c b/src/core/linux/SDL_sandbox.c index e266e5e5c..3987890ad 100644 --- a/src/core/linux/SDL_sandbox.c +++ b/src/core/linux/SDL_sandbox.c @@ -19,9 +19,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - - #include "../../SDL_internal.h" + #include "SDL_sandbox.h" #include diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c index fa775bc22..311cdd1eb 100644 --- a/src/core/linux/SDL_udev.c +++ b/src/core/linux/SDL_udev.c @@ -18,6 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "../../SDL_internal.h" /* * To list the properties of a device, try something like: diff --git a/src/core/linux/SDL_udev.h b/src/core/linux/SDL_udev.h index 9af4c3f5d..8ac6cbe89 100644 --- a/src/core/linux/SDL_udev.h +++ b/src/core/linux/SDL_udev.h @@ -24,7 +24,7 @@ #ifndef SDL_udev_h_ #define SDL_udev_h_ -#if HAVE_LIBUDEV_H +#if HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H #ifndef SDL_USE_LIBUDEV #define SDL_USE_LIBUDEV 1 @@ -108,7 +108,7 @@ extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void); extern void SDL_UDEV_ReleaseUdevSyms(void); -#endif /* HAVE_LIBUDEV_H */ +#endif /* HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H */ #endif /* SDL_udev_h_ */ diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 07f8c1ea8..52ee67027 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -551,7 +551,6 @@ HIDAPI_ShutdownDiscovery() #undef HIDAPI_H__ #if __LINUX__ -#include "../core/linux/SDL_udev.h" #if SDL_USE_LIBUDEV static const SDL_UDEV_Symbols *udev_ctx = NULL; From 85aa9b8b6f3457e3fcc687cff1afc62ab102aa4e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 11 Nov 2022 13:47:36 -0500 Subject: [PATCH 321/459] wasapi: Favor the system resampler again, for now. Reference Issue #5538. --- src/audio/wasapi/SDL_wasapi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index 80a36bdfb..3a1acfeb0 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -458,7 +458,10 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); } -#if 1 /* we're getting reports that WASAPI's resampler introduces distortions, so it's disabled for now. --ryan. */ + /* we've gotten reports that WASAPI's resampler introduces distortions, but in the short term + it fixes some other WASAPI-specific quirks we haven't quite tracked down. + Refer to bug #6326 for the immediate concern. */ +#if 0 this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in, if necessary. */ #else /* favor WASAPI's resampler over our own */ From 22354b414276872f50218a9596d10fd2f4d0ad82 Mon Sep 17 00:00:00 2001 From: pionere Date: Sat, 12 Nov 2022 08:29:15 +0100 Subject: [PATCH 322/459] video: simplify window-type check in SDL_CreateWindow --- src/video/SDL_video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0495e8ca9..fdfd912cd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1597,7 +1597,7 @@ SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { SDL_Window *window; - Uint32 graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); + Uint32 type_flags, graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); if (!_this) { /* Initialize the video system if needed */ @@ -1606,7 +1606,9 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } - if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) { + /* ensure no more than one of these flags is set */ + type_flags = flags & (SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU); + if ((type_flags & (type_flags - 1)) != 0) { SDL_SetError("Conflicting window flags specified"); return NULL; } From 5f2a1231ddd1e08a9d03e28a3471f20b8e161547 Mon Sep 17 00:00:00 2001 From: pionere Date: Sun, 13 Nov 2022 08:00:03 +0100 Subject: [PATCH 323/459] video: check graphics flags the same way as the type flags --- src/video/SDL_video.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index fdfd912cd..19458608b 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1597,7 +1597,7 @@ SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { SDL_Window *window; - Uint32 type_flags, graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); + Uint32 type_flags, graphics_flags; if (!_this) { /* Initialize the video system if needed */ @@ -1627,6 +1627,13 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) return NULL; } + /* ensure no more than one of these flags is set */ + graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); + if ((graphics_flags & (graphics_flags - 1)) != 0) { + SDL_SetError("Conflicting window flags specified"); + return NULL; + } + /* Some platforms have certain graphics backends enabled by default */ if (!graphics_flags && !SDL_IsVideoContextExternal()) { #if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ @@ -1656,10 +1663,6 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) SDL_ContextNotSupported("Vulkan"); return NULL; } - if (graphics_flags & SDL_WINDOW_OPENGL) { - SDL_SetError("Vulkan and OpenGL not supported on same window"); - return NULL; - } if (SDL_Vulkan_LoadLibrary(NULL) < 0) { return NULL; } @@ -1670,16 +1673,6 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) SDL_ContextNotSupported("Metal"); return NULL; } - /* 'flags' may have default flags appended, don't check against that. */ - if (graphics_flags & SDL_WINDOW_OPENGL) { - SDL_SetError("Metal and OpenGL not supported on same window"); - return NULL; - } - if (graphics_flags & SDL_WINDOW_VULKAN) { - SDL_SetError("Metal and Vulkan not supported on same window. " - "To use MoltenVK, set SDL_WINDOW_VULKAN only."); - return NULL; - } } /* Unless the user has specified the high-DPI disabling hint, respect the From c4b9f621649d4e2ddb05e7f396e43e2d9e0402cc Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 13 Nov 2022 12:45:13 -0500 Subject: [PATCH 324/459] x11: Add support for the Steam Deck on-screen keyboard --- src/video/x11/SDL_x11keyboard.c | 44 +++++++++++++++++++++++++++++++++ src/video/x11/SDL_x11keyboard.h | 4 +++ src/video/x11/SDL_x11video.c | 9 +++++++ src/video/x11/SDL_x11video.h | 4 +++ 4 files changed, 61 insertions(+) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 664c81661..f5be37ec5 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -22,6 +22,8 @@ #if SDL_VIDEO_DRIVER_X11 +#include "SDL_hints.h" +#include "SDL_misc.h" #include "SDL_x11video.h" #include "../../events/SDL_keyboard_c.h" @@ -841,6 +843,48 @@ X11_SetTextInputRect(_THIS, const SDL_Rect *rect) #endif } +SDL_bool +X11_HasScreenKeyboardSupport(_THIS) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + return videodata->is_steam_deck; +} + +void +X11_ShowScreenKeyboard(_THIS, SDL_Window *window) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + + if (videodata->is_steam_deck) { + /* For more documentation of the URL parameters, see: + * https://partner.steamgames.com/doc/api/ISteamUtils#ShowFloatingGamepadTextInput + */ + char deeplink[128]; + SDL_snprintf(deeplink, sizeof(deeplink), + "steam://open/keyboard?XPosition=0&YPosition=0&Width=0&Height=0&Mode=%d", + SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE) ? 0 : 1); + SDL_OpenURL(deeplink); + videodata->steam_keyboard_open = SDL_TRUE; + } +} + +void X11_HideScreenKeyboard(_THIS, SDL_Window *window) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + + if (videodata->is_steam_deck) { + SDL_OpenURL("steam://close/keyboard"); + videodata->steam_keyboard_open = SDL_FALSE; + } +} + +SDL_bool X11_IsScreenKeyboardShown(_THIS, SDL_Window *window) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + + return videodata->steam_keyboard_open; +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11keyboard.h b/src/video/x11/SDL_x11keyboard.h index 4ce41069b..645e7ba41 100644 --- a/src/video/x11/SDL_x11keyboard.h +++ b/src/video/x11/SDL_x11keyboard.h @@ -29,6 +29,10 @@ extern void X11_QuitKeyboard(_THIS); extern void X11_StartTextInput(_THIS); extern void X11_StopTextInput(_THIS); extern void X11_SetTextInputRect(_THIS, const SDL_Rect *rect); +extern SDL_bool X11_HasScreenKeyboardSupport(_THIS); +extern void X11_ShowScreenKeyboard(_THIS, SDL_Window *window); +extern void X11_HideScreenKeyboard(_THIS, SDL_Window *window); +extern SDL_bool X11_IsScreenKeyboardShown(_THIS, SDL_Window *window); extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group); #endif /* SDL_x11keyboard_h_ */ diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 2e5e190bd..49f5c5b9b 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -212,6 +212,11 @@ X11_CreateDevice(void) safety_net_triggered = SDL_FALSE; orig_x11_errhandler = X11_XSetErrorHandler(X11_SafetyNetErrHandler); + /* Steam Deck will have an on-screen keyboard, so check their environment + * variable so we can make use of SDL_StartTextInput. + */ + data->is_steam_deck = SDL_GetHintBoolean("SteamDeck", SDL_FALSE); + /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; @@ -307,6 +312,10 @@ X11_CreateDevice(void) device->StartTextInput = X11_StartTextInput; device->StopTextInput = X11_StopTextInput; device->SetTextInputRect = X11_SetTextInputRect; + device->HasScreenKeyboardSupport = X11_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = X11_ShowScreenKeyboard; + device->HideScreenKeyboard = X11_HideScreenKeyboard; + device->IsScreenKeyboardShown = X11_IsScreenKeyboardShown; device->free = X11_DeleteDevice; diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index e2edf248a..511ed365c 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -152,6 +152,10 @@ typedef struct SDL_VideoData PFN_XGetXCBConnection vulkan_XGetXCBConnection; #endif + /* Used to interact with the on-screen keyboard */ + SDL_bool is_steam_deck; + SDL_bool steam_keyboard_open; + } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); From 1b0277da61551c7fef1a09ad359024dfaaebd81a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 13 Nov 2022 11:08:37 -0800 Subject: [PATCH 325/459] Move SDL_mslibc.c into the source file list --- VisualC-WinRT/SDL-UWP.vcxproj.filters | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters index d788502e1..6599cdabb 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -842,5 +842,8 @@ Source Files + + Source Files + - + \ No newline at end of file From 674989261d1f3c7efd36a1cfdfc0efbc1cca6949 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 13 Nov 2022 11:09:20 -0800 Subject: [PATCH 326/459] Fixed warning Fixes https://github.com/libsdl-org/SDL/issues/5842 --- src/video/winrt/SDL_winrtvideo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index 3a7b220b9..7511aa531 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/src/video/winrt/SDL_winrtvideo.cpp @@ -526,7 +526,7 @@ WINRT_DetectWindowFlags(SDL_Window * window) #if SDL_WINRT_USE_APPLICATIONVIEW if (data->appView) { - is_fullscreen = data->appView->IsFullScreen; + is_fullscreen = data->appView->IsFullScreenMode; } #elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8) is_fullscreen = true; From eef4d3c86a653f91b7221c80809ba8ab56f94cf1 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 13 Nov 2022 16:56:04 -0500 Subject: [PATCH 327/459] wayland: Clamp wl_seat version on older versions of libwayland Clamp the wl_seat max version to 5 if being built against a version of libwayland below 1.21.0, or containers that bundle newer versions of SDL with older versions of libwayland can break if the compositor advertises support for a protocol version above 5. --- src/video/wayland/SDL_waylandevents.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 00563c8f1..2d37a0e23 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -64,6 +64,13 @@ #include #include "../../events/imKStoUCS.h" +/* Clamp the wl_seat version on older versions of libwayland. */ +#if SDL_WAYLAND_CHECK_VERSION(1, 21, 0) +#define SDL_WL_SEAT_VERSION 8 +#else +#define SDL_WL_SEAT_VERSION 5 +#endif + /* Weston uses a ratio of 10 units per scroll tick */ #define WAYLAND_WHEEL_AXIS_UNIT 10 @@ -2384,7 +2391,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) return; input->display = d; - input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(8, version)); + input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(SDL_WL_SEAT_VERSION, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); input->xkb.current_group = ~0; From dad8df3ed1e6397e6ad97215921322f5ed6a70b4 Mon Sep 17 00:00:00 2001 From: pionere Date: Mon, 14 Nov 2022 08:20:31 +0100 Subject: [PATCH 328/459] video: check graphics flags the same way in SDL_RecreateWindow as in SDL_CreateWindow - single check to validate the graphics flags - check it before tearing down the window --- src/video/SDL_video.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 19458608b..51e282f06 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1874,6 +1874,13 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) SDL_bool loaded_vulkan = SDL_FALSE; SDL_bool need_vulkan_unload = SDL_FALSE; SDL_bool need_vulkan_load = SDL_FALSE; + Uint32 graphics_flags; + + /* ensure no more than one of these flags is set */ + graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); + if ((graphics_flags & (graphics_flags - 1)) != 0) { + return SDL_SetError("Conflicting window flags specified"); + } if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) { return SDL_ContextNotSupported("OpenGL"); @@ -1937,18 +1944,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) need_vulkan_load = SDL_TRUE; } - if ((flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("Vulkan and OpenGL not supported on same window"); - } - - if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("Metal and OpenGL not supported on same window"); - } - - if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) { - return SDL_SetError("Metal and Vulkan not supported on same window"); - } - if (need_gl_unload) { SDL_GL_UnloadLibrary(); } From b886f4c6c97f3d37d65f65afdb6bd68148fd4de6 Mon Sep 17 00:00:00 2001 From: pionere Date: Mon, 14 Nov 2022 17:35:28 +0100 Subject: [PATCH 329/459] events: eliminate redundant code in SDL_SendEditingText --- src/events/SDL_keyboard.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 87fee123b..7dc0fb9b2 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -1058,11 +1058,6 @@ SDL_SendEditingText(const char *text, int start, int length) posted = 0; if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) { SDL_Event event; - event.edit.type = SDL_TEXTEDITING; - event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; - event.edit.start = start; - event.edit.length = length; - SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) && SDL_strlen(text) >= SDL_arraysize(event.text.text)) { From 9f784b1887fea886efb03ea65416eb956ba79bf1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 14 Nov 2022 10:58:59 -0800 Subject: [PATCH 330/459] The iOS and tvOS demos link SDL statically, not as a framework --- Xcode-iOS/Demos/config.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xcode-iOS/Demos/config.xcconfig b/Xcode-iOS/Demos/config.xcconfig index a73eec4d7..563917290 100644 --- a/Xcode-iOS/Demos/config.xcconfig +++ b/Xcode-iOS/Demos/config.xcconfig @@ -10,5 +10,5 @@ #include? "build.xcconfig" CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL2 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal -CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit -CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit From a40b7cde10e434f861ae5683a4619efbad6210b7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 14 Nov 2022 13:03:52 -0800 Subject: [PATCH 331/459] Workaround for views being in portrait instead of landscape mode on iOS 16 Fixes https://github.com/libsdl-org/SDL/issues/6289 --- src/video/uikit/SDL_uikitmetalview.m | 12 ++++++++++++ src/video/uikit/SDL_uikitview.h | 2 ++ src/video/uikit/SDL_uikitview.m | 25 ++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index 8bc338095..af6eb0cd3 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -69,6 +69,18 @@ CGSize size = self.bounds.size; size.width *= self.layer.contentsScale; size.height *= self.layer.contentsScale; + + /* Make sure the width/height are oriented correctly + * + * This works around an issue in iOS 16 where the bounds come back in portrait mode + * instead of landscape until the event loop runs. + */ + if ([self shouldSwapDimensions:(size.width >= size.height)]) { + CGFloat temp = size.width; + size.width = size.height; + size.height = temp; + } + ((CAMetalLayer *)self.layer).drawableSize = size; } diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index dcd63c7a5..5369bb212 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -35,6 +35,8 @@ - (void)setSDLWindow:(SDL_Window *)window; +- (BOOL)shouldSwapDimensions:(BOOL)portrait; + #if !TARGET_OS_TV && defined(__IPHONE_13_4) - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4)); - (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4)); diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 8c48cfa50..50d7393e7 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -120,6 +120,8 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; [data.uiwindow layoutIfNeeded]; } + sdlwindow = window; + /* Add ourself to the new window. */ if (window) { data = (__bridge SDL_WindowData *) window->driverdata; @@ -144,8 +146,29 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; * layout now to immediately update the bounds. */ [data.uiwindow layoutIfNeeded]; } +} - sdlwindow = window; +- (BOOL)shouldSwapDimensions:(BOOL)landscape +{ +#if !TARGET_OS_TV + if (sdlwindow) { + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(sdlwindow); + SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata; + + if (displaydata.uiscreen == [UIScreen mainScreen]) { + NSUInteger orients = UIKit_GetSupportedOrientations(sdlwindow); + BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; + BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; + + /* Make sure the width/height are oriented correctly */ + if ((landscape && !supportsLandscape) || (!landscape && !supportsPortrait)) { + return YES; + } + } + } +#endif /* !TARGET_OS_TV */ + + return NO; } #if !TARGET_OS_TV && defined(__IPHONE_13_4) From d080e3bf3a581035d4d078f52803fc60b2504817 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 17:56:48 -0500 Subject: [PATCH 332/459] Silence `-Wmaybe-uninitialized` warnings in tests. --- test/controllermap.c | 6 ++++-- test/testautomation_pixels.c | 2 ++ test/testautomation_rwops.c | 1 + test/testautomation_video.c | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/controllermap.c b/test/controllermap.c index 5905b8a58..22ab19e37 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -611,7 +611,7 @@ WatchJoystick(SDL_Joystick * joystick) SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex; SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping)); } else { - const char *pszAxisName; + const char *pszAxisName = NULL; switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) { case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE: if (!BMergeAxisBindings(iIndex)) { @@ -660,7 +660,9 @@ WatchJoystick(SDL_Joystick * joystick) pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT); break; } - SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); + if (pszAxisName) { + SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); + } } SDL_strlcat(mapping, ":", SDL_arraysize(mapping)); diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c index 63b177f18..8117c11e4 100644 --- a/test/testautomation_pixels.c +++ b/test/testautomation_pixels.c @@ -330,6 +330,7 @@ pixels_allocFreePalette(void *arg) for (variation = 1; variation <= 3; variation++) { switch (variation) { /* Just one color */ + default: case 1: ncolors = 1; break; @@ -426,6 +427,7 @@ pixels_calcGammaRamp(void *arg) for (variation = 0; variation < 4; variation++) { switch (variation) { /* gamma = 0 all black */ + default: case 0: gamma = 0.0f; break; diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c index 16d540752..687ff75de 100644 --- a/test/testautomation_rwops.c +++ b/test/testautomation_rwops.c @@ -616,6 +616,7 @@ rwops_testFileWriteReadEndian(void) /* Create test data */ switch (mode) { + default: case 0: SDLTest_Log("All 0 values"); BE16value = 0; diff --git a/test/testautomation_video.c b/test/testautomation_video.c index bf0283b80..8d248bf8f 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -123,6 +123,7 @@ video_createWindowVariousPositions(void *arg) for (xVariation = 0; xVariation < 6; xVariation++) { for (yVariation = 0; yVariation < 6; yVariation++) { switch(xVariation) { + default: case 0: /* Zero X Position */ x = 0; @@ -150,6 +151,7 @@ video_createWindowVariousPositions(void *arg) } switch(yVariation) { + default: case 0: /* Zero X Position */ y = 0; @@ -267,6 +269,7 @@ video_createWindowVariousFlags(void *arg) for (fVariation = 0; fVariation < 14; fVariation++) { switch(fVariation) { + default: case 0: flags = SDL_WINDOW_FULLSCREEN; /* Skip - blanks screen; comment out next line to run test */ @@ -1074,6 +1077,7 @@ video_getSetWindowPosition(void *arg) for (xVariation = 0; xVariation < 4; xVariation++) { for (yVariation = 0; yVariation < 4; yVariation++) { switch(xVariation) { + default: case 0: /* Zero X Position */ desiredX = 0; @@ -1093,6 +1097,7 @@ video_getSetWindowPosition(void *arg) } switch(yVariation) { + default: case 0: /* Zero X Position */ desiredY = 0; @@ -1236,6 +1241,7 @@ video_getSetWindowSize(void *arg) for (wVariation = 0; wVariation < maxwVariation; wVariation++) { for (hVariation = 0; hVariation < maxhVariation; hVariation++) { switch(wVariation) { + default: case 0: /* 1 Pixel Wide */ desiredW = 1; @@ -1259,6 +1265,7 @@ video_getSetWindowSize(void *arg) } switch(hVariation) { + default: case 0: /* 1 Pixel High */ desiredH = 1; From bf4f9aaa636863555a6edd7a611a3fb4191cd1c7 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 16:11:58 -0500 Subject: [PATCH 333/459] N3DS: Use designated initialiser for drivers. Just a sanity check that the functions are actually mapped correctly. --- src/joystick/n3ds/SDL_sysjoystick.c | 40 ++++++++++++++--------------- src/sensor/n3ds/SDL_n3dssensor.c | 22 ++++++++-------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c index ea00a6d69..933f64ee0 100644 --- a/src/joystick/n3ds/SDL_sysjoystick.c +++ b/src/joystick/n3ds/SDL_sysjoystick.c @@ -279,26 +279,26 @@ N3DS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) } SDL_JoystickDriver SDL_N3DS_JoystickDriver = { - N3DS_JoystickInit, - N3DS_JoystickGetCount, - N3DS_JoystickDetect, - N3DS_JoystickGetDeviceName, - N3DS_JoystickGetDevicePath, - N3DS_JoystickGetDevicePlayerIndex, - N3DS_JoystickSetDevicePlayerIndex, - N3DS_JoystickGetDeviceGUID, - N3DS_JoystickGetDeviceInstanceID, - N3DS_JoystickOpen, - N3DS_JoystickRumble, - N3DS_JoystickRumbleTriggers, - N3DS_JoystickGetCapabilities, - N3DS_JoystickSetLED, - N3DS_JoystickSendEffect, - N3DS_JoystickSetSensorsEnabled, - N3DS_JoystickUpdate, - N3DS_JoystickClose, - N3DS_JoystickQuit, - N3DS_JoystickGetGamepadMapping + .Init = N3DS_JoystickInit, + .GetCount = N3DS_JoystickGetCount, + .Detect = N3DS_JoystickDetect, + .GetDeviceName = N3DS_JoystickGetDeviceName, + .GetDevicePath = N3DS_JoystickGetDevicePath, + .GetDevicePlayerIndex = N3DS_JoystickGetDevicePlayerIndex, + .SetDevicePlayerIndex = N3DS_JoystickSetDevicePlayerIndex, + .GetDeviceGUID = N3DS_JoystickGetDeviceGUID, + .GetDeviceInstanceID = N3DS_JoystickGetDeviceInstanceID, + .Open = N3DS_JoystickOpen, + .Rumble = N3DS_JoystickRumble, + .RumbleTriggers = N3DS_JoystickRumbleTriggers, + .GetCapabilities = N3DS_JoystickGetCapabilities, + .SetLED = N3DS_JoystickSetLED, + .SendEffect = N3DS_JoystickSendEffect, + .SetSensorsEnabled = N3DS_JoystickSetSensorsEnabled, + .Update = N3DS_JoystickUpdate, + .Close = N3DS_JoystickClose, + .Quit = N3DS_JoystickQuit, + .GetGamepadMapping = N3DS_JoystickGetGamepadMapping }; #endif /* SDL_JOYSTICK_N3DS */ diff --git a/src/sensor/n3ds/SDL_n3dssensor.c b/src/sensor/n3ds/SDL_n3dssensor.c index a435ae236..ea22ef247 100644 --- a/src/sensor/n3ds/SDL_n3dssensor.c +++ b/src/sensor/n3ds/SDL_n3dssensor.c @@ -200,17 +200,17 @@ N3DS_SensorQuit(void) } SDL_SensorDriver SDL_N3DS_SensorDriver = { - N3DS_SensorInit, - N3DS_SensorGetCount, - N3DS_SensorDetect, - N3DS_SensorGetDeviceName, - N3DS_SensorGetDeviceType, - N3DS_SensorGetDeviceNonPortableType, - N3DS_SensorGetDeviceInstanceID, - N3DS_SensorOpen, - N3DS_SensorUpdate, - N3DS_SensorClose, - N3DS_SensorQuit, + .Init = N3DS_SensorInit, + .GetCount = N3DS_SensorGetCount, + .Detect = N3DS_SensorDetect, + .GetDeviceName = N3DS_SensorGetDeviceName, + .GetDeviceType = N3DS_SensorGetDeviceType, + .GetDeviceNonPortableType = N3DS_SensorGetDeviceNonPortableType, + .GetDeviceInstanceID = N3DS_SensorGetDeviceInstanceID, + .Open = N3DS_SensorOpen, + .Update = N3DS_SensorUpdate, + .Close = N3DS_SensorClose, + .Quit = N3DS_SensorQuit, }; #endif /* SDL_SENSOR_N3DS */ From 7d536d52406c87c0102afed2d620d6b07cc1ca00 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 16:16:21 -0500 Subject: [PATCH 334/459] N3DS: Put `SDL_Log.txt` in the proper directory. The homebrew "user" directory should be `/3ds/`. To avoid ambiguity, `sdmc:` is specified. --- src/SDL_log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SDL_log.c b/src/SDL_log.c index 66191d2b4..c01e31d8a 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -487,10 +487,10 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, } #elif defined(__3DS__) { - FILE* pFile; - pFile = fopen ("/SDL_Log.txt", "a"); + FILE *pFile; + pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); - fclose (pFile); + fclose(pFile); } #endif #if HAVE_STDIO_H && \ From de5fa89b509a155d962b01de5b36955b5ba0df09 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 16:56:51 -0500 Subject: [PATCH 335/459] N3DS: Prepend PrefPath with `sdmc:`. --- src/filesystem/n3ds/SDL_sysfilesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filesystem/n3ds/SDL_sysfilesystem.c b/src/filesystem/n3ds/SDL_sysfilesystem.c index 06b4cd65b..9d0621bd4 100644 --- a/src/filesystem/n3ds/SDL_sysfilesystem.c +++ b/src/filesystem/n3ds/SDL_sysfilesystem.c @@ -68,7 +68,7 @@ SDL_FORCE_INLINE char * MakePrefPath(const char *app) { char *pref_path; - if (SDL_asprintf(&pref_path, "/3ds/%s/", app) < 0) { + if (SDL_asprintf(&pref_path, "sdmc:/3ds/%s/", app) < 0) { SDL_OutOfMemory(); return NULL; } From dcfa127fd4c553db20f3e53cad9dfa7916a19b84 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 17:34:22 -0500 Subject: [PATCH 336/459] N3DS: Document the SDL_GetBasePath behaviour. --- docs/README-n3ds.md | 1 + include/SDL_filesystem.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/README-n3ds.md b/docs/README-n3ds.md index 991eaa07f..66e194d0b 100644 --- a/docs/README-n3ds.md +++ b/docs/README-n3ds.md @@ -24,3 +24,4 @@ cmake --install build - Currently only software rendering is supported. - SDL2main should be used to ensure ROMFS is enabled. - By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function. +- `SDL_GetBasePath` returns the romfs root instead of the executable's directory. diff --git a/include/SDL_filesystem.h b/include/SDL_filesystem.h index a7606bde2..60f8202be 100644 --- a/include/SDL_filesystem.h +++ b/include/SDL_filesystem.h @@ -60,6 +60,10 @@ extern "C" { * - `parent`: the containing directory of the bundle. For example: * `/Applications/SDLApp/` * + * **Nintendo 3DS Specific Functionality**: This function returns "romfs" + * directory of the application as it is uncommon to store resources + * outside the executable. As such it is not a writable directory. + * * The returned path is guaranteed to end with a path separator ('\' on * Windows, '/' on most other platforms). * From 491d0bcc3ca152158653f656957a5e78471436a7 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 17:38:42 -0500 Subject: [PATCH 337/459] N3DS: Refactor N3DS_FileOpen. --- src/file/n3ds/SDL_rwopsromfs.c | 60 +++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/src/file/n3ds/SDL_rwopsromfs.c b/src/file/n3ds/SDL_rwopsromfs.c index c75323f61..9d3ec87e9 100644 --- a/src/file/n3ds/SDL_rwopsromfs.c +++ b/src/file/n3ds/SDL_rwopsromfs.c @@ -22,6 +22,15 @@ #include "SDL_rwopsromfs.h" #include "SDL_error.h" +/* Checks if the mode is a kind of reading */ +SDL_FORCE_INLINE SDL_bool IsReadMode(const char *mode); + +/* Checks if the file starts with the given prefix */ +SDL_FORCE_INLINE SDL_bool HasPrefix(const char *file, const char *prefix); + +SDL_FORCE_INLINE FILE *TryOpenFile(const char *file, const char *mode); +SDL_FORCE_INLINE FILE *TryOpenInRomfs(const char *file, const char *mode); + /* Nintendo 3DS applications may embed resources in the executable. The resources are stored in a special read-only partition prefixed with 'romfs:/'. As such, when opening a file, we should first try the romfs @@ -30,31 +39,58 @@ FILE * N3DS_FileOpen(const char *file, const char *mode) { - FILE *fp = NULL; - char *romfs_path; - /* romfs are read-only */ - if (SDL_strchr(mode, 'r') == NULL) { + if (!IsReadMode(mode)) { return fopen(file, mode); } /* If the path has an explicit prefix, we skip the guess work */ - if (SDL_strncmp("romfs:/", file, 7) == 0 || - SDL_strncmp("sdmc:/", file, 6) == 0) { + if (HasPrefix(file, "romfs:/") || HasPrefix(file, "sdmc:/")) { return fopen(file, mode); } - if (SDL_asprintf(&romfs_path, "romfs:/%s", file) < 0) { - SDL_OutOfMemory(); - return NULL; - } + return TryOpenFile(file, mode); +} - fp = fopen(romfs_path, mode); +SDL_FORCE_INLINE SDL_bool +IsReadMode(const char *mode) +{ + return SDL_strchr(mode, 'r') != NULL; +} + +SDL_FORCE_INLINE SDL_bool +HasPrefix(const char *file, const char *prefix) +{ + return SDL_strncmp(prefix, file, SDL_strlen(prefix)) == 0; +} + +SDL_FORCE_INLINE FILE * +TryOpenFile(const char *file, const char *mode) +{ + FILE *fp = NULL; + + fp = TryOpenInRomfs(file, mode); if (fp == NULL) { fp = fopen(file, mode); } - SDL_free(romfs_path); + return fp; +} + +SDL_FORCE_INLINE FILE * +TryOpenInRomfs(const char *file, const char *mode) +{ + FILE *fp = NULL; + char *prefixed_filepath = NULL; + + if (SDL_asprintf(&prefixed_filepath, "romfs:/%s", file) < 0) { + SDL_OutOfMemory(); + return NULL; + } + + fp = fopen(prefixed_filepath, mode); + + SDL_free(prefixed_filepath); return fp; } From 80ff20f6fe15fdba95fb1c49cfdc855a12e6eea1 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Mon, 14 Nov 2022 23:56:20 -0500 Subject: [PATCH 338/459] N3DS: Set keyboard focus to newly created windows. This fixes polling issues with Joystick subsystem where `SDL_PrivateJoystickShouldIgnoreEvent` would always return true, thus ignoring all inputs. --- src/video/n3ds/SDL_n3dsvideo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c index 73486e653..d4a46ad06 100644 --- a/src/video/n3ds/SDL_n3dsvideo.c +++ b/src/video/n3ds/SDL_n3dsvideo.c @@ -178,6 +178,7 @@ N3DS_CreateWindow(_THIS, SDL_Window *window) display_data = (DisplayDriverData *) SDL_GetDisplayDriverData(window->display_index); window_data->screen = display_data->screen; window->driverdata = window_data; + SDL_SetKeyboardFocus(window); return 0; } From 5e61f245ab5e5dd178a35001b37bab1f6292ffd7 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 15 Nov 2022 05:25:16 +0000 Subject: [PATCH 339/459] Sync SDL wiki -> header --- include/SDL_filesystem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL_filesystem.h b/include/SDL_filesystem.h index 60f8202be..1914f81d9 100644 --- a/include/SDL_filesystem.h +++ b/include/SDL_filesystem.h @@ -61,8 +61,8 @@ extern "C" { * `/Applications/SDLApp/` * * **Nintendo 3DS Specific Functionality**: This function returns "romfs" - * directory of the application as it is uncommon to store resources - * outside the executable. As such it is not a writable directory. + * directory of the application as it is uncommon to store resources outside + * the executable. As such it is not a writable directory. * * The returned path is guaranteed to end with a path separator ('\' on * Windows, '/' on most other platforms). From a71ad40ac3646b33c47bfd6b2f62478b82e0f25d Mon Sep 17 00:00:00 2001 From: Pierre Wendling <50808272+FtZPetruska@users.noreply.github.com> Date: Tue, 15 Nov 2022 13:04:22 -0500 Subject: [PATCH 340/459] CMake: Add option to use Ccache. --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d27141d1f..3103b01f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -513,6 +513,7 @@ dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" O dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "") +set_option(SDL_CCACHE "Use Ccache to speed up build" ON) option(SDL_WERROR "Enable -Werror" OFF) @@ -3113,6 +3114,19 @@ if (SDL_ASAN) endif() endif() +if(SDL_CCACHE) + cmake_minimum_required(VERSION 3.4) + find_program(CCACHE_BINARY ccache) + if(CCACHE_BINARY) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(CMAKE_OBJC_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(HAVE_CCACHE ON) + else() + set(HAVE_CCACHE OFF) + endif() +endif() + if(SDL_TESTS) set(HAVE_TESTS ON) endif() From 70656b133c89c614422130b6c7e0a52cdccc6d4f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 15 Nov 2022 10:18:41 -0800 Subject: [PATCH 341/459] Don't recreate the window when creating a Metal renderer on an OpenGL window. It turns out that we can safely create a Metal view on an existing window, and that avoids issues with the window being recreated with the wrong orientation in iOS 16. Fixes https://github.com/libsdl-org/SDL/issues/6289 --- src/render/metal/SDL_render_metal.m | 25 ------------------------- src/video/SDL_video.c | 12 ++++++++++-- src/video/uikit/SDL_uikitmetalview.m | 12 ------------ src/video/uikit/SDL_uikitview.h | 2 -- src/video/uikit/SDL_uikitview.m | 25 +------------------------ 5 files changed, 11 insertions(+), 65 deletions(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 3dc346d57..80fd96f07 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -55,9 +55,6 @@ /* Apple Metal renderer implementation */ -/* Used to re-create the window with Metal capability */ -extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); - /* macOS requires constants in a buffer to have a 256 byte alignment. */ /* Use native type alignments from https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf */ #if defined(__MACOSX__) || TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST @@ -1635,13 +1632,11 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) SDL_MetalView view = NULL; CAMetalLayer *layer = nil; SDL_SysWMinfo syswm; - SDL_bool changed_window = SDL_FALSE; NSError *err = nil; dispatch_data_t mtllibdata; char *constantdata; int maxtexsize, quadcount = UINT16_MAX / 4; UInt16 *indexdata; - Uint32 window_flags; size_t indicessize = sizeof(UInt16) * quadcount * 6; MTLSamplerDescriptor *samplerdesc; id mtlcmdqueue; @@ -1697,20 +1692,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) return NULL; } - window_flags = SDL_GetWindowFlags(window); - if (!(window_flags & SDL_WINDOW_METAL)) { - changed_window = SDL_TRUE; - if (SDL_RecreateWindow(window, (window_flags & ~(SDL_WINDOW_VULKAN | SDL_WINDOW_OPENGL)) | SDL_WINDOW_METAL) < 0) { - return NULL; - } - } - renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); if (!renderer) { SDL_OutOfMemory(); - if (changed_window) { - SDL_RecreateWindow(window, window_flags); - } return NULL; } @@ -1720,9 +1704,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) if (mtldevice == nil) { SDL_free(renderer); SDL_SetError("Failed to obtain Metal device"); - if (changed_window) { - SDL_RecreateWindow(window, window_flags); - } return NULL; } @@ -1733,9 +1714,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) if (view == NULL) { SDL_free(renderer); - if (changed_window) { - SDL_RecreateWindow(window, window_flags); - } return NULL; } @@ -1749,9 +1727,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) /* SDL_Metal_DestroyView(view); */ CFBridgingRelease(view); SDL_free(renderer); - if (changed_window) { - SDL_RecreateWindow(window, window_flags); - } return NULL; } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 51e282f06..c75b026d9 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4853,8 +4853,16 @@ SDL_Metal_CreateView(SDL_Window * window) CHECK_WINDOW_MAGIC(window, NULL); if (!(window->flags & SDL_WINDOW_METAL)) { - SDL_SetError("The specified window isn't a Metal window"); - return NULL; + /* No problem, we can convert to Metal */ + if (window->flags & SDL_WINDOW_OPENGL) { + window->flags &= ~SDL_WINDOW_OPENGL; + SDL_GL_UnloadLibrary(); + } + if (window->flags & SDL_WINDOW_VULKAN) { + window->flags &= ~SDL_WINDOW_VULKAN; + SDL_Vulkan_UnloadLibrary(); + } + window->flags |= SDL_WINDOW_METAL; } return _this->Metal_CreateView(_this, window); diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index af6eb0cd3..8bc338095 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -69,18 +69,6 @@ CGSize size = self.bounds.size; size.width *= self.layer.contentsScale; size.height *= self.layer.contentsScale; - - /* Make sure the width/height are oriented correctly - * - * This works around an issue in iOS 16 where the bounds come back in portrait mode - * instead of landscape until the event loop runs. - */ - if ([self shouldSwapDimensions:(size.width >= size.height)]) { - CGFloat temp = size.width; - size.width = size.height; - size.height = temp; - } - ((CAMetalLayer *)self.layer).drawableSize = size; } diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index 5369bb212..dcd63c7a5 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -35,8 +35,6 @@ - (void)setSDLWindow:(SDL_Window *)window; -- (BOOL)shouldSwapDimensions:(BOOL)portrait; - #if !TARGET_OS_TV && defined(__IPHONE_13_4) - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4)); - (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4)); diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 50d7393e7..8c48cfa50 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -120,8 +120,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; [data.uiwindow layoutIfNeeded]; } - sdlwindow = window; - /* Add ourself to the new window. */ if (window) { data = (__bridge SDL_WindowData *) window->driverdata; @@ -146,29 +144,8 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; * layout now to immediately update the bounds. */ [data.uiwindow layoutIfNeeded]; } -} -- (BOOL)shouldSwapDimensions:(BOOL)landscape -{ -#if !TARGET_OS_TV - if (sdlwindow) { - SDL_VideoDisplay *display = SDL_GetDisplayForWindow(sdlwindow); - SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata; - - if (displaydata.uiscreen == [UIScreen mainScreen]) { - NSUInteger orients = UIKit_GetSupportedOrientations(sdlwindow); - BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; - BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; - - /* Make sure the width/height are oriented correctly */ - if ((landscape && !supportsLandscape) || (!landscape && !supportsPortrait)) { - return YES; - } - } - } -#endif /* !TARGET_OS_TV */ - - return NO; + sdlwindow = window; } #if !TARGET_OS_TV && defined(__IPHONE_13_4) From e6c4db816085d2cb84e7d44562a3cd10cabe62a5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 15 Nov 2022 19:22:42 +0100 Subject: [PATCH 342/459] The SDL2::SDL2 target in SDL2.framework needs to see the SDL2 include folder SDL.h includes other files through SDL2/SDL_xxx.h --- Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake index e4294d90f..28c34bc70 100644 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake @@ -39,7 +39,7 @@ string(REGEX REPLACE "SDL2\\.framework.*" "" SDL2_FRAMEWORK_PARENT_PATH "${CMAKE set_and_check(SDL2_PREFIX "${SDL2_FRAMEWORK_PATH}") set_and_check(SDL2_EXEC_PREFIX "${SDL2_FRAMEWORK_PATH}") set_and_check(SDL2_INCLUDE_DIR "${SDL2_FRAMEWORK_PATH}/Headers") -set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}") +set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR};${SDL2_FRAMEWORK_PATH}") set_and_check(SDL2_BINDIR "${SDL2_FRAMEWORK_PATH}") set_and_check(SDL2_LIBDIR "${SDL2_FRAMEWORK_PATH}") @@ -53,7 +53,7 @@ if(NOT TARGET SDL2::SDL2) set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\"" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2" COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" INTERFACE_SDL2_SHARED "ON" From f3cc99fb9342337c75ecf16250f80f54f4a4c8b5 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Tue, 15 Nov 2022 13:56:44 -0500 Subject: [PATCH 343/459] x11: Minor style fixes for recent OSK changes --- src/video/x11/SDL_x11keyboard.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index f5be37ec5..0583f7a81 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -868,7 +868,8 @@ X11_ShowScreenKeyboard(_THIS, SDL_Window *window) } } -void X11_HideScreenKeyboard(_THIS, SDL_Window *window) +void +X11_HideScreenKeyboard(_THIS, SDL_Window *window) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; @@ -878,7 +879,8 @@ void X11_HideScreenKeyboard(_THIS, SDL_Window *window) } } -SDL_bool X11_IsScreenKeyboardShown(_THIS, SDL_Window *window) +SDL_bool +X11_IsScreenKeyboardShown(_THIS, SDL_Window *window) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; From 44d7b8b91d6c22247188cc926716f54106cb91b9 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 15 Nov 2022 13:57:01 -0500 Subject: [PATCH 344/459] egl: Check for a NULL pointer in SDL_EGL_GetProcAddress. This happens on kmsdrm if you try to GetProcAddress before creating a window. Fixes #5399. --- src/video/SDL_egl.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 28d02b132..2438faf00 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -244,27 +244,28 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext void * SDL_EGL_GetProcAddress(_THIS, const char *proc) { - const Uint32 eglver = (((Uint32) _this->egl_data->egl_version_major) << 16) | ((Uint32) _this->egl_data->egl_version_minor); - const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32) 1) << 16) | 5); void *retval = NULL; + if (_this->egl_data != NULL) { + const Uint32 eglver = (((Uint32) _this->egl_data->egl_version_major) << 16) | ((Uint32) _this->egl_data->egl_version_minor); + const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32) 1) << 16) | 5); - /* EGL 1.5 can use eglGetProcAddress() for any symbol. 1.4 and earlier can't use it for core entry points. */ - if (!retval && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { - retval = _this->egl_data->eglGetProcAddress(proc); + /* EGL 1.5 can use eglGetProcAddress() for any symbol. 1.4 and earlier can't use it for core entry points. */ + if (!retval && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { + retval = _this->egl_data->eglGetProcAddress(proc); + } + + #if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ + /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ + if (!retval) { + retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); + } + #endif + + /* Try eglGetProcAddress if we're on <= 1.4 and still searching... */ + if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { + retval = _this->egl_data->eglGetProcAddress(proc); + } } - - #if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ - /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ - if (!retval) { - retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); - } - #endif - - /* Try eglGetProcAddress if we're on <= 1.4 and still searching... */ - if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { - retval = _this->egl_data->eglGetProcAddress(proc); - } - return retval; } From 0e446c54bd487f29ed624619fc45728c3767ff10 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 4 Nov 2022 12:27:36 -0400 Subject: [PATCH 345/459] events: Factor out the xkb keysym to scancode conversion from the X11 driver --- src/events/SDL_keysym_to_scancode.c | 444 ++++++++++++++++++++++++++ src/events/SDL_keysym_to_scancode_c.h | 31 ++ src/video/x11/SDL_x11keyboard.c | 406 +---------------------- 3 files changed, 479 insertions(+), 402 deletions(-) create mode 100644 src/events/SDL_keysym_to_scancode.c create mode 100644 src/events/SDL_keysym_to_scancode_c.h diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c new file mode 100644 index 000000000..267cc0b3a --- /dev/null +++ b/src/events/SDL_keysym_to_scancode.c @@ -0,0 +1,444 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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. +*/ + +#include "../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 + +#include "SDL_keyboard_c.h" +#include "SDL_scancode_tables_c.h" + +#include +#include + +/* *INDENT-OFF* */ /* clang-format off */ +static const struct { + xkb_keysym_t keysym; + SDL_Scancode scancode; +} KeySymToSDLScancode[] = { + { XKB_KEY_KP_End, SDL_SCANCODE_KP_1 }, + { XKB_KEY_KP_Down, SDL_SCANCODE_KP_2 }, + { XKB_KEY_KP_Next, SDL_SCANCODE_KP_3 }, + { XKB_KEY_KP_Left, SDL_SCANCODE_KP_4 }, + { XKB_KEY_KP_Begin, SDL_SCANCODE_KP_5 }, + { XKB_KEY_KP_Right, SDL_SCANCODE_KP_6 }, + { XKB_KEY_KP_Home, SDL_SCANCODE_KP_7 }, + { XKB_KEY_KP_Up, SDL_SCANCODE_KP_8 }, + { XKB_KEY_KP_Prior, SDL_SCANCODE_KP_9 }, + { XKB_KEY_KP_Insert, SDL_SCANCODE_KP_0 }, + { XKB_KEY_KP_Delete, SDL_SCANCODE_KP_PERIOD }, + { XKB_KEY_Execute, SDL_SCANCODE_EXECUTE }, + { XKB_KEY_Hyper_R, SDL_SCANCODE_APPLICATION }, + { XKB_KEY_ISO_Level3_Shift, SDL_SCANCODE_RALT }, + { XKB_KEY_Super_L, SDL_SCANCODE_LGUI }, + { XKB_KEY_Super_R, SDL_SCANCODE_RGUI }, + { XKB_KEY_Mode_switch, SDL_SCANCODE_MODE }, + { 0x1008FF65, SDL_SCANCODE_MENU }, /* XF86MenuKB */ + { 0x1008FF81, SDL_SCANCODE_F13 }, /* XF86Tools */ + { 0x1008FF45, SDL_SCANCODE_F14 }, /* XF86Launch5 */ + { 0x1008FF46, SDL_SCANCODE_F15 }, /* XF86Launch6 */ + { 0x1008FF47, SDL_SCANCODE_F16 }, /* XF86Launch7 */ + { 0x1008FF48, SDL_SCANCODE_F17 }, /* XF86Launch8 */ + { 0x1008FF49, SDL_SCANCODE_F18 }, /* XF86Launch9 */ +}; + +/* This is a mapping from X keysym to Linux keycode */ +static const xkb_keysym_t LinuxKeycodeKeysyms[] = { + /* 0, 0x000 */ 0x0, /* NoSymbol */ + /* 1, 0x001 */ 0xFF1B, /* Escape */ + /* 2, 0x002 */ 0x31, /* 1 */ + /* 3, 0x003 */ 0x32, /* 2 */ + /* 4, 0x004 */ 0x33, /* 3 */ + /* 5, 0x005 */ 0x34, /* 4 */ + /* 6, 0x006 */ 0x35, /* 5 */ + /* 7, 0x007 */ 0x36, /* 6 */ + /* 8, 0x008 */ 0x37, /* 7 */ + /* 9, 0x009 */ 0x38, /* 8 */ + /* 10, 0x00a */ 0x39, /* 9 */ + /* 11, 0x00b */ 0x30, /* 0 */ + /* 12, 0x00c */ 0x2D, /* minus */ + /* 13, 0x00d */ 0x3D, /* equal */ + /* 14, 0x00e */ 0xFF08, /* BackSpace */ + /* 15, 0x00f */ 0xFF09, /* Tab */ + /* 16, 0x010 */ 0x71, /* q */ + /* 17, 0x011 */ 0x77, /* w */ + /* 18, 0x012 */ 0x65, /* e */ + /* 19, 0x013 */ 0x72, /* r */ + /* 20, 0x014 */ 0x74, /* t */ + /* 21, 0x015 */ 0x79, /* y */ + /* 22, 0x016 */ 0x75, /* u */ + /* 23, 0x017 */ 0x69, /* i */ + /* 24, 0x018 */ 0x6F, /* o */ + /* 25, 0x019 */ 0x70, /* p */ + /* 26, 0x01a */ 0x5B, /* bracketleft */ + /* 27, 0x01b */ 0x5D, /* bracketright */ + /* 28, 0x01c */ 0xFF0D, /* Return */ + /* 29, 0x01d */ 0xFFE3, /* Control_L */ + /* 30, 0x01e */ 0x61, /* a */ + /* 31, 0x01f */ 0x73, /* s */ + /* 32, 0x020 */ 0x64, /* d */ + /* 33, 0x021 */ 0x66, /* f */ + /* 34, 0x022 */ 0x67, /* g */ + /* 35, 0x023 */ 0x68, /* h */ + /* 36, 0x024 */ 0x6A, /* j */ + /* 37, 0x025 */ 0x6B, /* k */ + /* 38, 0x026 */ 0x6C, /* l */ + /* 39, 0x027 */ 0x3B, /* semicolon */ + /* 40, 0x028 */ 0x27, /* apostrophe */ + /* 41, 0x029 */ 0x60, /* grave */ + /* 42, 0x02a */ 0xFFE1, /* Shift_L */ + /* 43, 0x02b */ 0x5C, /* backslash */ + /* 44, 0x02c */ 0x7A, /* z */ + /* 45, 0x02d */ 0x78, /* x */ + /* 46, 0x02e */ 0x63, /* c */ + /* 47, 0x02f */ 0x76, /* v */ + /* 48, 0x030 */ 0x62, /* b */ + /* 49, 0x031 */ 0x6E, /* n */ + /* 50, 0x032 */ 0x6D, /* m */ + /* 51, 0x033 */ 0x2C, /* comma */ + /* 52, 0x034 */ 0x2E, /* period */ + /* 53, 0x035 */ 0x2F, /* slash */ + /* 54, 0x036 */ 0xFFE2, /* Shift_R */ + /* 55, 0x037 */ 0xFFAA, /* KP_Multiply */ + /* 56, 0x038 */ 0xFFE9, /* Alt_L */ + /* 57, 0x039 */ 0x20, /* space */ + /* 58, 0x03a */ 0xFFE5, /* Caps_Lock */ + /* 59, 0x03b */ 0xFFBE, /* F1 */ + /* 60, 0x03c */ 0xFFBF, /* F2 */ + /* 61, 0x03d */ 0xFFC0, /* F3 */ + /* 62, 0x03e */ 0xFFC1, /* F4 */ + /* 63, 0x03f */ 0xFFC2, /* F5 */ + /* 64, 0x040 */ 0xFFC3, /* F6 */ + /* 65, 0x041 */ 0xFFC4, /* F7 */ + /* 66, 0x042 */ 0xFFC5, /* F8 */ + /* 67, 0x043 */ 0xFFC6, /* F9 */ + /* 68, 0x044 */ 0xFFC7, /* F10 */ + /* 69, 0x045 */ 0xFF7F, /* Num_Lock */ + /* 70, 0x046 */ 0xFF14, /* Scroll_Lock */ + /* 71, 0x047 */ 0xFFB7, /* KP_7 */ + /* 72, 0x048 */ 0XFFB8, /* KP_8 */ + /* 73, 0x049 */ 0XFFB9, /* KP_9 */ + /* 74, 0x04a */ 0xFFAD, /* KP_Subtract */ + /* 75, 0x04b */ 0xFFB4, /* KP_4 */ + /* 76, 0x04c */ 0xFFB5, /* KP_5 */ + /* 77, 0x04d */ 0xFFB6, /* KP_6 */ + /* 78, 0x04e */ 0xFFAB, /* KP_Add */ + /* 79, 0x04f */ 0xFFB1, /* KP_1 */ + /* 80, 0x050 */ 0xFFB2, /* KP_2 */ + /* 81, 0x051 */ 0xFFB3, /* KP_3 */ + /* 82, 0x052 */ 0xFFB0, /* KP_0 */ + /* 83, 0x053 */ 0xFFAE, /* KP_Decimal */ + /* 84, 0x054 */ 0x0, /* NoSymbol */ + /* 85, 0x055 */ 0x0, /* NoSymbol */ + /* 86, 0x056 */ 0x3C, /* less */ + /* 87, 0x057 */ 0xFFC8, /* F11 */ + /* 88, 0x058 */ 0xFFC9, /* F12 */ + /* 89, 0x059 */ 0x0, /* NoSymbol */ + /* 90, 0x05a */ 0xFF26, /* Katakana */ + /* 91, 0x05b */ 0xFF25, /* Hiragana */ + /* 92, 0x05c */ 0xFF23, /* Henkan_Mode */ + /* 93, 0x05d */ 0xFF27, /* Hiragana_Katakana */ + /* 94, 0x05e */ 0xFF22, /* Muhenkan */ + /* 95, 0x05f */ 0x0, /* NoSymbol */ + /* 96, 0x060 */ 0xFF8D, /* KP_Enter */ + /* 97, 0x061 */ 0xFFE4, /* Control_R */ + /* 98, 0x062 */ 0xFFAF, /* KP_Divide */ + /* 99, 0x063 */ 0xFF15, /* Sys_Req */ + /* 100, 0x064 */ 0xFFEA, /* Alt_R */ + /* 101, 0x065 */ 0xFF0A, /* Linefeed */ + /* 102, 0x066 */ 0xFF50, /* Home */ + /* 103, 0x067 */ 0xFF52, /* Up */ + /* 104, 0x068 */ 0xFF55, /* Prior */ + /* 105, 0x069 */ 0xFF51, /* Left */ + /* 106, 0x06a */ 0xFF53, /* Right */ + /* 107, 0x06b */ 0xFF57, /* End */ + /* 108, 0x06c */ 0xFF54, /* Down */ + /* 109, 0x06d */ 0xFF56, /* Next */ + /* 110, 0x06e */ 0xFF63, /* Insert */ + /* 111, 0x06f */ 0xFFFF, /* Delete */ + /* 112, 0x070 */ 0x0, /* NoSymbol */ + /* 113, 0x071 */ 0x1008FF12, /* XF86AudioMute */ + /* 114, 0x072 */ 0x1008FF11, /* XF86AudioLowerVolume */ + /* 115, 0x073 */ 0x1008FF13, /* XF86AudioRaiseVolume */ + /* 116, 0x074 */ 0x1008FF2A, /* XF86PowerOff */ + /* 117, 0x075 */ 0xFFBD, /* KP_Equal */ + /* 118, 0x076 */ 0xB1, /* plusminus */ + /* 119, 0x077 */ 0xFF13, /* Pause */ + /* 120, 0x078 */ 0x1008FF4A, /* XF86LaunchA */ + /* 121, 0x079 */ 0xFFAC, /* KP_Separator */ + /* 122, 0x07a */ 0xFF31, /* Hangul */ + /* 123, 0x07b */ 0xFF34, /* Hangul_Hanja */ + /* 124, 0x07c */ 0x0, /* NoSymbol */ + /* 125, 0x07d */ 0xFFE7, /* Meta_L */ + /* 126, 0x07e */ 0xFFE8, /* Meta_R */ + /* 127, 0x07f */ 0xFF67, /* Menu */ + /* 128, 0x080 */ 0x00, /* NoSymbol */ + /* 129, 0x081 */ 0xFF66, /* Redo */ + /* 130, 0x082 */ 0x1005FF70, /* SunProps */ + /* 131, 0x083 */ 0xFF65, /* Undo */ + /* 132, 0x084 */ 0x1005FF71, /* SunFront */ + /* 133, 0x085 */ 0x1008FF57, /* XF86Copy */ + /* 134, 0x086 */ 0x1008FF6B, /* XF86Open */ + /* 135, 0x087 */ 0x1008FF6D, /* XF86Paste */ + /* 136, 0x088 */ 0xFF68, /* Find */ + /* 137, 0x089 */ 0x1008FF58, /* XF86Cut */ + /* 138, 0x08a */ 0xFF6A, /* Help */ + /* 139, 0x08b */ 0xFF67, /* Menu */ + /* 140, 0x08c */ 0x1008FF1D, /* XF86Calculator */ + /* 141, 0x08d */ 0x0, /* NoSymbol */ + /* 142, 0x08e */ 0x1008FF2F, /* XF86Sleep */ + /* 143, 0x08f */ 0x1008FF2B, /* XF86WakeUp */ + /* 144, 0x090 */ 0x1008FF5D, /* XF86Explorer */ + /* 145, 0x091 */ 0x1008FF7B, /* XF86Send */ + /* 146, 0x092 */ 0x0, /* NoSymbol */ + /* 147, 0x093 */ 0x1008FF8A, /* XF86Xfer */ + /* 148, 0x094 */ 0x1008FF41, /* XF86Launch1 */ + /* 149, 0x095 */ 0x1008FF42, /* XF86Launch2 */ + /* 150, 0x096 */ 0x1008FF2E, /* XF86WWW */ + /* 151, 0x097 */ 0x1008FF5A, /* XF86DOS */ + /* 152, 0x098 */ 0x1008FF2D, /* XF86ScreenSaver */ + /* 153, 0x099 */ 0x1008FF74, /* XF86RotateWindows */ + /* 154, 0x09a */ 0x1008FF7F, /* XF86TaskPane */ + /* 155, 0x09b */ 0x1008FF19, /* XF86Mail */ + /* 156, 0x09c */ 0x1008FF30, /* XF86Favorites */ + /* 157, 0x09d */ 0x1008FF33, /* XF86MyComputer */ + /* 158, 0x09e */ 0x1008FF26, /* XF86Back */ + /* 159, 0x09f */ 0x1008FF27, /* XF86Forward */ + /* 160, 0x0a0 */ 0x0, /* NoSymbol */ + /* 161, 0x0a1 */ 0x1008FF2C, /* XF86Eject */ + /* 162, 0x0a2 */ 0x1008FF2C, /* XF86Eject */ + /* 163, 0x0a3 */ 0x1008FF17, /* XF86AudioNext */ + /* 164, 0x0a4 */ 0x1008FF14, /* XF86AudioPlay */ + /* 165, 0x0a5 */ 0x1008FF16, /* XF86AudioPrev */ + /* 166, 0x0a6 */ 0x1008FF15, /* XF86AudioStop */ + /* 167, 0x0a7 */ 0x1008FF1C, /* XF86AudioRecord */ + /* 168, 0x0a8 */ 0x1008FF3E, /* XF86AudioRewind */ + /* 169, 0x0a9 */ 0x1008FF6E, /* XF86Phone */ + /* 170, 0x0aa */ 0x0, /* NoSymbol */ + /* 171, 0x0ab */ 0x1008FF81, /* XF86Tools */ + /* 172, 0x0ac */ 0x1008FF18, /* XF86HomePage */ + /* 173, 0x0ad */ 0x1008FF73, /* XF86Reload */ + /* 174, 0x0ae */ 0x1008FF56, /* XF86Close */ + /* 175, 0x0af */ 0x0, /* NoSymbol */ + /* 176, 0x0b0 */ 0x0, /* NoSymbol */ + /* 177, 0x0b1 */ 0x1008FF78, /* XF86ScrollUp */ + /* 178, 0x0b2 */ 0x1008FF79, /* XF86ScrollDown */ + /* 179, 0x0b3 */ 0x28, /* parenleft */ + /* 180, 0x0b4 */ 0x29, /* parenright */ + /* 181, 0x0b5 */ 0x1008FF68, /* XF86New */ + /* 182, 0x0b6 */ 0xFF66, /* Redo */ + /* 183, 0x0b7 */ 0xFFCA, /* F13 */ + /* 184, 0x0b8 */ 0xFFCB, /* F14 */ + /* 185, 0x0b9 */ 0xFFCC, /* F15 */ + /* 186, 0x0ba */ 0xFFCD, /* F16 */ + /* 187, 0x0bb */ 0xFFCE, /* F17 */ + /* 188, 0x0bc */ 0xFFCF, /* F18 */ + /* 189, 0x0bd */ 0xFFD0, /* F19 */ + /* 190, 0x0be */ 0xFFD1, /* F20 */ + /* 191, 0x0bf */ 0xFFD2, /* F21 */ + /* 192, 0x0c0 */ 0xFFD3, /* F22 */ + /* 193, 0x0c1 */ 0xFFD4, /* F23 */ + /* 194, 0x0c2 */ 0xFFD5, /* F24 */ + /* 195, 0x0c3 */ 0x0, /* NoSymbol */ + /* 196, 0x0c4 */ 0x0, /* NoSymbol */ + /* 197, 0x0c5 */ 0x0, /* NoSymbol */ + /* 198, 0x0c6 */ 0x0, /* NoSymbol */ + /* 199, 0x0c7 */ 0x0, /* NoSymbol */ + /* 200, 0x0c8 */ 0x1008FF14, /* XF86AudioPlay */ + /* 201, 0x0c9 */ 0x1008FF31, /* XF86AudioPause */ + /* 202, 0x0ca */ 0x1008FF43, /* XF86Launch3 */ + /* 203, 0x0cb */ 0x1008FF44, /* XF86Launch4 */ + /* 204, 0x0cc */ 0x1008FF4B, /* XF86LaunchB */ + /* 205, 0x0cd */ 0x1008FFA7, /* XF86Suspend */ + /* 206, 0x0ce */ 0x1008FF56, /* XF86Close */ + /* 207, 0x0cf */ 0x1008FF14, /* XF86AudioPlay */ + /* 208, 0x0d0 */ 0x1008FF97, /* XF86AudioForward */ + /* 209, 0x0d1 */ 0x0, /* NoSymbol */ + /* 210, 0x0d2 */ 0xFF61, /* Print */ + /* 211, 0x0d3 */ 0x0, /* NoSymbol */ + /* 212, 0x0d4 */ 0x1008FF8F, /* XF86WebCam */ + /* 213, 0x0d5 */ 0x1008FFB6, /* XF86AudioPreset */ + /* 214, 0x0d6 */ 0x0, /* NoSymbol */ + /* 215, 0x0d7 */ 0x1008FF19, /* XF86Mail */ + /* 216, 0x0d8 */ 0x1008FF8E, /* XF86Messenger */ + /* 217, 0x0d9 */ 0x1008FF1B, /* XF86Search */ + /* 218, 0x0da */ 0x1008FF5F, /* XF86Go */ + /* 219, 0x0db */ 0x1008FF3C, /* XF86Finance */ + /* 220, 0x0dc */ 0x1008FF5E, /* XF86Game */ + /* 221, 0x0dd */ 0x1008FF36, /* XF86Shop */ + /* 222, 0x0de */ 0x0, /* NoSymbol */ + /* 223, 0x0df */ 0xFF69, /* Cancel */ + /* 224, 0x0e0 */ 0x1008FF03, /* XF86MonBrightnessDown */ + /* 225, 0x0e1 */ 0x1008FF02, /* XF86MonBrightnessUp */ + /* 226, 0x0e2 */ 0x1008FF32, /* XF86AudioMedia */ + /* 227, 0x0e3 */ 0x1008FF59, /* XF86Display */ + /* 228, 0x0e4 */ 0x1008FF04, /* XF86KbdLightOnOff */ + /* 229, 0x0e5 */ 0x1008FF06, /* XF86KbdBrightnessDown */ + /* 230, 0x0e6 */ 0x1008FF05, /* XF86KbdBrightnessUp */ + /* 231, 0x0e7 */ 0x1008FF7B, /* XF86Send */ + /* 232, 0x0e8 */ 0x1008FF72, /* XF86Reply */ + /* 233, 0x0e9 */ 0x1008FF90, /* XF86MailForward */ + /* 234, 0x0ea */ 0x1008FF77, /* XF86Save */ + /* 235, 0x0eb */ 0x1008FF5B, /* XF86Documents */ + /* 236, 0x0ec */ 0x1008FF93, /* XF86Battery */ + /* 237, 0x0ed */ 0x1008FF94, /* XF86Bluetooth */ + /* 238, 0x0ee */ 0x1008FF95, /* XF86WLAN */ + /* 239, 0x0ef */ 0x1008FF96, /* XF86UWB */ + /* 240, 0x0f0 */ 0x0, /* NoSymbol */ + /* 241, 0x0f1 */ 0x1008FE22, /* XF86Next_VMode */ + /* 242, 0x0f2 */ 0x1008FE23, /* XF86Prev_VMode */ + /* 243, 0x0f3 */ 0x1008FF07, /* XF86MonBrightnessCycle */ + /* 244, 0x0f4 */ 0x100810F4, /* XF86BrightnessAuto */ + /* 245, 0x0f5 */ 0x100810F5, /* XF86DisplayOff */ + /* 246, 0x0f6 */ 0x1008FFB4, /* XF86WWAN */ + /* 247, 0x0f7 */ 0x1008FFB5, /* XF86RFKill */ +}; + +#if 0 /* Here is a script to generate the ExtendedLinuxKeycodeKeysyms table */ +#!/bin/bash + +function process_line +{ + sym=$(echo "$1" | awk '{print $3}') + code=$(echo "$1" | sed 's,.*_EVDEVK(\(0x[0-9A-Fa-f]*\)).*,\1,') + value=$(egrep "#define ${sym}\s" -R /usr/include/X11 | awk '{print $3}') + printf " { 0x%.8X, 0x%.3x }, /* $sym */\n" $value $code +} + +fgrep "/* Use: " /usr/include/xkbcommon/xkbcommon-keysyms.h | fgrep _EVDEVK | while read line; do + process_line "$line" +done +#endif + +static const struct { + xkb_keysym_t keysym; + int linux_keycode; +} ExtendedLinuxKeycodeKeysyms[] = { + { 0x1008FF2C, 0x0a2 }, /* XF86XK_Eject */ + { 0x1008FF68, 0x0b5 }, /* XF86XK_New */ + { 0x0000FF66, 0x0b6 }, /* XK_Redo */ + { 0x1008FF4B, 0x0cc }, /* XF86XK_LaunchB */ + { 0x1008FF59, 0x0e3 }, /* XF86XK_Display */ + { 0x1008FF04, 0x0e4 }, /* XF86XK_KbdLightOnOff */ + { 0x1008FF06, 0x0e5 }, /* XF86XK_KbdBrightnessDown */ + { 0x1008FF05, 0x0e6 }, /* XF86XK_KbdBrightnessUp */ + { 0x1008FF7B, 0x0e7 }, /* XF86XK_Send */ + { 0x1008FF72, 0x0e8 }, /* XF86XK_Reply */ + { 0x1008FF90, 0x0e9 }, /* XF86XK_MailForward */ + { 0x1008FF77, 0x0ea }, /* XF86XK_Save */ + { 0x1008FF5B, 0x0eb }, /* XF86XK_Documents */ + { 0x1008FF93, 0x0ec }, /* XF86XK_Battery */ + { 0x1008FF94, 0x0ed }, /* XF86XK_Bluetooth */ + { 0x1008FF95, 0x0ee }, /* XF86XK_WLAN */ + { 0x1008FF96, 0x0ef }, /* XF86XK_UWB */ + { 0x1008FE22, 0x0f1 }, /* XF86XK_Next_VMode */ + { 0x1008FE23, 0x0f2 }, /* XF86XK_Prev_VMode */ + { 0x1008FF07, 0x0f3 }, /* XF86XK_MonBrightnessCycle */ + { 0x1008FFB4, 0x0f6 }, /* XF86XK_WWAN */ + { 0x1008FFB5, 0x0f7 }, /* XF86XK_RFKill */ + { 0x1008FFB2, 0x0f8 }, /* XF86XK_AudioMicMute */ + { 0x1008FF9C, 0x173 }, /* XF86XK_CycleAngle */ + { 0x1008FFB8, 0x174 }, /* XF86XK_FullScreen */ + { 0x1008FF87, 0x189 }, /* XF86XK_Video */ + { 0x1008FF20, 0x18d }, /* XF86XK_Calendar */ + { 0x1008FF99, 0x19a }, /* XF86XK_AudioRandomPlay */ + { 0x1008FF5E, 0x1a1 }, /* XF86XK_Game */ + { 0x1008FF8B, 0x1a2 }, /* XF86XK_ZoomIn */ + { 0x1008FF8C, 0x1a3 }, /* XF86XK_ZoomOut */ + { 0x1008FF89, 0x1a5 }, /* XF86XK_Word */ + { 0x1008FF5C, 0x1a7 }, /* XF86XK_Excel */ + { 0x1008FF69, 0x1ab }, /* XF86XK_News */ + { 0x1008FF8E, 0x1ae }, /* XF86XK_Messenger */ + { 0x1008FF61, 0x1b1 }, /* XF86XK_LogOff */ + { 0x00000024, 0x1b2 }, /* XK_dollar */ + { 0x000020AC, 0x1b3 }, /* XK_EuroSign */ + { 0x1008FF9D, 0x1b4 }, /* XF86XK_FrameBack */ + { 0x1008FF9E, 0x1b5 }, /* XF86XK_FrameForward */ + { 0x0000FFF1, 0x1f1 }, /* XK_braille_dot_1 */ + { 0x0000FFF2, 0x1f2 }, /* XK_braille_dot_2 */ + { 0x0000FFF3, 0x1f3 }, /* XK_braille_dot_3 */ + { 0x0000FFF4, 0x1f4 }, /* XK_braille_dot_4 */ + { 0x0000FFF5, 0x1f5 }, /* XK_braille_dot_5 */ + { 0x0000FFF6, 0x1f6 }, /* XK_braille_dot_6 */ + { 0x0000FFF7, 0x1f7 }, /* XK_braille_dot_7 */ + { 0x0000FFF8, 0x1f8 }, /* XK_braille_dot_8 */ + { 0x0000FFF9, 0x1f9 }, /* XK_braille_dot_9 */ + { 0x0000FFF1, 0x1fa }, /* XK_braille_dot_1 */ + { 0x1008FFA9, 0x212 }, /* XF86XK_TouchpadToggle */ + { 0x1008FFB0, 0x213 }, /* XF86XK_TouchpadOn */ + { 0x1008FFB1, 0x214 }, /* XF86XK_TouchpadOff */ + { 0x1008FFB7, 0x231 }, /* XF86XK_RotationLockToggle */ + { 0x0000FE08, 0x248 }, /* XK_ISO_Next_Group */ +}; +/* *INDENT-ON* */ /* clang-format on */ + +SDL_Scancode +SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode) +{ + int i; + Uint32 linux_keycode = 0; + + /* First check our custom list */ + for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) { + if (keysym == KeySymToSDLScancode[i].keysym) { + return KeySymToSDLScancode[i].scancode; + } + } + + if (keysym >= 0x41 && keysym <= 0x5a) { + /* Normalize alphabetic keysyms to the lowercase form */ + keysym += 0x20; + } else if (keysym >= 0x10081000 && keysym <= 0x10081FFF) { + /* The rest of the keysyms map to Linux keycodes, so use that mapping + * Per xkbcommon-keysyms.h, this is actually a linux keycode. + */ + linux_keycode = (keysym - 0x10081000); + } + if (!linux_keycode) { + /* See if this keysym is an exact match in our table */ + i = (keycode - 8); + if (i >= 0 && i < SDL_arraysize(LinuxKeycodeKeysyms) && keysym == LinuxKeycodeKeysyms[i]) { + linux_keycode = i; + } else { + /* Scan the table for this keysym */ + for (i = 0; i < SDL_arraysize(LinuxKeycodeKeysyms); ++i) { + if (keysym == LinuxKeycodeKeysyms[i]) { + linux_keycode = i; + break; + } + } + } + } + if (!linux_keycode) { + /* Scan the extended table for this keysym */ + for (i = 0; i < SDL_arraysize(ExtendedLinuxKeycodeKeysyms); ++i) { + if (keysym == ExtendedLinuxKeycodeKeysyms[i].keysym) { + linux_keycode = ExtendedLinuxKeycodeKeysyms[i].linux_keycode; + break; + } + } + } + return SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, linux_keycode); +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_keysym_to_scancode_c.h b/src/events/SDL_keysym_to_scancode_c.h new file mode 100644 index 000000000..da6c7e19a --- /dev/null +++ b/src/events/SDL_keysym_to_scancode_c.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 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_keysym_to_scancode_c_h_ +#define SDL_keysym_to_scancode_c_h_ + +#include "SDL_scancode.h" + +extern SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode); + +#endif /* SDL_keysym_to_scancode_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 0583f7a81..6f0eb6ab8 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -33,429 +33,31 @@ #include #include "../../events/imKStoUCS.h" +#include "../../events/SDL_keysym_to_scancode_c.h" #ifdef X_HAVE_UTF8_STRING #include #endif -/* *INDENT-OFF* */ /* clang-format off */ -static const struct { - KeySym keysym; - SDL_Scancode scancode; -} KeySymToSDLScancode[] = { - { XK_KP_End, SDL_SCANCODE_KP_1 }, - { XK_KP_Down, SDL_SCANCODE_KP_2 }, - { XK_KP_Next, SDL_SCANCODE_KP_3 }, - { XK_KP_Left, SDL_SCANCODE_KP_4 }, - { XK_KP_Begin, SDL_SCANCODE_KP_5 }, - { XK_KP_Right, SDL_SCANCODE_KP_6 }, - { XK_KP_Home, SDL_SCANCODE_KP_7 }, - { XK_KP_Up, SDL_SCANCODE_KP_8 }, - { XK_KP_Prior, SDL_SCANCODE_KP_9 }, - { XK_KP_Insert, SDL_SCANCODE_KP_0 }, - { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD }, - { XK_Execute, SDL_SCANCODE_EXECUTE }, - { XK_Hyper_R, SDL_SCANCODE_APPLICATION }, - { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, - { XK_Super_L, SDL_SCANCODE_LGUI }, - { XK_Super_R, SDL_SCANCODE_RGUI }, - { XK_Mode_switch, SDL_SCANCODE_MODE }, - { 0x1008FF65, SDL_SCANCODE_MENU }, /* XF86MenuKB */ - { 0x1008FF81, SDL_SCANCODE_F13 }, /* XF86Tools */ - { 0x1008FF45, SDL_SCANCODE_F14 }, /* XF86Launch5 */ - { 0x1008FF46, SDL_SCANCODE_F15 }, /* XF86Launch6 */ - { 0x1008FF47, SDL_SCANCODE_F16 }, /* XF86Launch7 */ - { 0x1008FF48, SDL_SCANCODE_F17 }, /* XF86Launch8 */ - { 0x1008FF49, SDL_SCANCODE_F18 }, /* XF86Launch9 */ -}; - -/* This is a mapping from X keysym to Linux keycode */ -static const KeySym LinuxKeycodeKeysyms[] = { - /* 0, 0x000 */ 0x0, /* NoSymbol */ - /* 1, 0x001 */ 0xFF1B, /* Escape */ - /* 2, 0x002 */ 0x31, /* 1 */ - /* 3, 0x003 */ 0x32, /* 2 */ - /* 4, 0x004 */ 0x33, /* 3 */ - /* 5, 0x005 */ 0x34, /* 4 */ - /* 6, 0x006 */ 0x35, /* 5 */ - /* 7, 0x007 */ 0x36, /* 6 */ - /* 8, 0x008 */ 0x37, /* 7 */ - /* 9, 0x009 */ 0x38, /* 8 */ - /* 10, 0x00a */ 0x39, /* 9 */ - /* 11, 0x00b */ 0x30, /* 0 */ - /* 12, 0x00c */ 0x2D, /* minus */ - /* 13, 0x00d */ 0x3D, /* equal */ - /* 14, 0x00e */ 0xFF08, /* BackSpace */ - /* 15, 0x00f */ 0xFF09, /* Tab */ - /* 16, 0x010 */ 0x71, /* q */ - /* 17, 0x011 */ 0x77, /* w */ - /* 18, 0x012 */ 0x65, /* e */ - /* 19, 0x013 */ 0x72, /* r */ - /* 20, 0x014 */ 0x74, /* t */ - /* 21, 0x015 */ 0x79, /* y */ - /* 22, 0x016 */ 0x75, /* u */ - /* 23, 0x017 */ 0x69, /* i */ - /* 24, 0x018 */ 0x6F, /* o */ - /* 25, 0x019 */ 0x70, /* p */ - /* 26, 0x01a */ 0x5B, /* bracketleft */ - /* 27, 0x01b */ 0x5D, /* bracketright */ - /* 28, 0x01c */ 0xFF0D, /* Return */ - /* 29, 0x01d */ 0xFFE3, /* Control_L */ - /* 30, 0x01e */ 0x61, /* a */ - /* 31, 0x01f */ 0x73, /* s */ - /* 32, 0x020 */ 0x64, /* d */ - /* 33, 0x021 */ 0x66, /* f */ - /* 34, 0x022 */ 0x67, /* g */ - /* 35, 0x023 */ 0x68, /* h */ - /* 36, 0x024 */ 0x6A, /* j */ - /* 37, 0x025 */ 0x6B, /* k */ - /* 38, 0x026 */ 0x6C, /* l */ - /* 39, 0x027 */ 0x3B, /* semicolon */ - /* 40, 0x028 */ 0x27, /* apostrophe */ - /* 41, 0x029 */ 0x60, /* grave */ - /* 42, 0x02a */ 0xFFE1, /* Shift_L */ - /* 43, 0x02b */ 0x5C, /* backslash */ - /* 44, 0x02c */ 0x7A, /* z */ - /* 45, 0x02d */ 0x78, /* x */ - /* 46, 0x02e */ 0x63, /* c */ - /* 47, 0x02f */ 0x76, /* v */ - /* 48, 0x030 */ 0x62, /* b */ - /* 49, 0x031 */ 0x6E, /* n */ - /* 50, 0x032 */ 0x6D, /* m */ - /* 51, 0x033 */ 0x2C, /* comma */ - /* 52, 0x034 */ 0x2E, /* period */ - /* 53, 0x035 */ 0x2F, /* slash */ - /* 54, 0x036 */ 0xFFE2, /* Shift_R */ - /* 55, 0x037 */ 0xFFAA, /* KP_Multiply */ - /* 56, 0x038 */ 0xFFE9, /* Alt_L */ - /* 57, 0x039 */ 0x20, /* space */ - /* 58, 0x03a */ 0xFFE5, /* Caps_Lock */ - /* 59, 0x03b */ 0xFFBE, /* F1 */ - /* 60, 0x03c */ 0xFFBF, /* F2 */ - /* 61, 0x03d */ 0xFFC0, /* F3 */ - /* 62, 0x03e */ 0xFFC1, /* F4 */ - /* 63, 0x03f */ 0xFFC2, /* F5 */ - /* 64, 0x040 */ 0xFFC3, /* F6 */ - /* 65, 0x041 */ 0xFFC4, /* F7 */ - /* 66, 0x042 */ 0xFFC5, /* F8 */ - /* 67, 0x043 */ 0xFFC6, /* F9 */ - /* 68, 0x044 */ 0xFFC7, /* F10 */ - /* 69, 0x045 */ 0xFF7F, /* Num_Lock */ - /* 70, 0x046 */ 0xFF14, /* Scroll_Lock */ - /* 71, 0x047 */ 0xFFB7, /* KP_7 */ - /* 72, 0x048 */ 0XFFB8, /* KP_8 */ - /* 73, 0x049 */ 0XFFB9, /* KP_9 */ - /* 74, 0x04a */ 0xFFAD, /* KP_Subtract */ - /* 75, 0x04b */ 0xFFB4, /* KP_4 */ - /* 76, 0x04c */ 0xFFB5, /* KP_5 */ - /* 77, 0x04d */ 0xFFB6, /* KP_6 */ - /* 78, 0x04e */ 0xFFAB, /* KP_Add */ - /* 79, 0x04f */ 0xFFB1, /* KP_1 */ - /* 80, 0x050 */ 0xFFB2, /* KP_2 */ - /* 81, 0x051 */ 0xFFB3, /* KP_3 */ - /* 82, 0x052 */ 0xFFB0, /* KP_0 */ - /* 83, 0x053 */ 0xFFAE, /* KP_Decimal */ - /* 84, 0x054 */ 0x0, /* NoSymbol */ - /* 85, 0x055 */ 0x0, /* NoSymbol */ - /* 86, 0x056 */ 0x3C, /* less */ - /* 87, 0x057 */ 0xFFC8, /* F11 */ - /* 88, 0x058 */ 0xFFC9, /* F12 */ - /* 89, 0x059 */ 0x0, /* NoSymbol */ - /* 90, 0x05a */ 0xFF26, /* Katakana */ - /* 91, 0x05b */ 0xFF25, /* Hiragana */ - /* 92, 0x05c */ 0xFF23, /* Henkan_Mode */ - /* 93, 0x05d */ 0xFF27, /* Hiragana_Katakana */ - /* 94, 0x05e */ 0xFF22, /* Muhenkan */ - /* 95, 0x05f */ 0x0, /* NoSymbol */ - /* 96, 0x060 */ 0xFF8D, /* KP_Enter */ - /* 97, 0x061 */ 0xFFE4, /* Control_R */ - /* 98, 0x062 */ 0xFFAF, /* KP_Divide */ - /* 99, 0x063 */ 0xFF15, /* Sys_Req */ - /* 100, 0x064 */ 0xFFEA, /* Alt_R */ - /* 101, 0x065 */ 0xFF0A, /* Linefeed */ - /* 102, 0x066 */ 0xFF50, /* Home */ - /* 103, 0x067 */ 0xFF52, /* Up */ - /* 104, 0x068 */ 0xFF55, /* Prior */ - /* 105, 0x069 */ 0xFF51, /* Left */ - /* 106, 0x06a */ 0xFF53, /* Right */ - /* 107, 0x06b */ 0xFF57, /* End */ - /* 108, 0x06c */ 0xFF54, /* Down */ - /* 109, 0x06d */ 0xFF56, /* Next */ - /* 110, 0x06e */ 0xFF63, /* Insert */ - /* 111, 0x06f */ 0xFFFF, /* Delete */ - /* 112, 0x070 */ 0x0, /* NoSymbol */ - /* 113, 0x071 */ 0x1008FF12, /* XF86AudioMute */ - /* 114, 0x072 */ 0x1008FF11, /* XF86AudioLowerVolume */ - /* 115, 0x073 */ 0x1008FF13, /* XF86AudioRaiseVolume */ - /* 116, 0x074 */ 0x1008FF2A, /* XF86PowerOff */ - /* 117, 0x075 */ 0xFFBD, /* KP_Equal */ - /* 118, 0x076 */ 0xB1, /* plusminus */ - /* 119, 0x077 */ 0xFF13, /* Pause */ - /* 120, 0x078 */ 0x1008FF4A, /* XF86LaunchA */ - /* 121, 0x079 */ 0xFFAC, /* KP_Separator */ - /* 122, 0x07a */ 0xFF31, /* Hangul */ - /* 123, 0x07b */ 0xFF34, /* Hangul_Hanja */ - /* 124, 0x07c */ 0x0, /* NoSymbol */ - /* 125, 0x07d */ 0xFFE7, /* Meta_L */ - /* 126, 0x07e */ 0xFFE8, /* Meta_R */ - /* 127, 0x07f */ 0xFF67, /* Menu */ - /* 128, 0x080 */ 0x00, /* NoSymbol */ - /* 129, 0x081 */ 0xFF66, /* Redo */ - /* 130, 0x082 */ 0x1005FF70, /* SunProps */ - /* 131, 0x083 */ 0xFF65, /* Undo */ - /* 132, 0x084 */ 0x1005FF71, /* SunFront */ - /* 133, 0x085 */ 0x1008FF57, /* XF86Copy */ - /* 134, 0x086 */ 0x1008FF6B, /* XF86Open */ - /* 135, 0x087 */ 0x1008FF6D, /* XF86Paste */ - /* 136, 0x088 */ 0xFF68, /* Find */ - /* 137, 0x089 */ 0x1008FF58, /* XF86Cut */ - /* 138, 0x08a */ 0xFF6A, /* Help */ - /* 139, 0x08b */ 0xFF67, /* Menu */ - /* 140, 0x08c */ 0x1008FF1D, /* XF86Calculator */ - /* 141, 0x08d */ 0x0, /* NoSymbol */ - /* 142, 0x08e */ 0x1008FF2F, /* XF86Sleep */ - /* 143, 0x08f */ 0x1008FF2B, /* XF86WakeUp */ - /* 144, 0x090 */ 0x1008FF5D, /* XF86Explorer */ - /* 145, 0x091 */ 0x1008FF7B, /* XF86Send */ - /* 146, 0x092 */ 0x0, /* NoSymbol */ - /* 147, 0x093 */ 0x1008FF8A, /* XF86Xfer */ - /* 148, 0x094 */ 0x1008FF41, /* XF86Launch1 */ - /* 149, 0x095 */ 0x1008FF42, /* XF86Launch2 */ - /* 150, 0x096 */ 0x1008FF2E, /* XF86WWW */ - /* 151, 0x097 */ 0x1008FF5A, /* XF86DOS */ - /* 152, 0x098 */ 0x1008FF2D, /* XF86ScreenSaver */ - /* 153, 0x099 */ 0x1008FF74, /* XF86RotateWindows */ - /* 154, 0x09a */ 0x1008FF7F, /* XF86TaskPane */ - /* 155, 0x09b */ 0x1008FF19, /* XF86Mail */ - /* 156, 0x09c */ 0x1008FF30, /* XF86Favorites */ - /* 157, 0x09d */ 0x1008FF33, /* XF86MyComputer */ - /* 158, 0x09e */ 0x1008FF26, /* XF86Back */ - /* 159, 0x09f */ 0x1008FF27, /* XF86Forward */ - /* 160, 0x0a0 */ 0x0, /* NoSymbol */ - /* 161, 0x0a1 */ 0x1008FF2C, /* XF86Eject */ - /* 162, 0x0a2 */ 0x1008FF2C, /* XF86Eject */ - /* 163, 0x0a3 */ 0x1008FF17, /* XF86AudioNext */ - /* 164, 0x0a4 */ 0x1008FF14, /* XF86AudioPlay */ - /* 165, 0x0a5 */ 0x1008FF16, /* XF86AudioPrev */ - /* 166, 0x0a6 */ 0x1008FF15, /* XF86AudioStop */ - /* 167, 0x0a7 */ 0x1008FF1C, /* XF86AudioRecord */ - /* 168, 0x0a8 */ 0x1008FF3E, /* XF86AudioRewind */ - /* 169, 0x0a9 */ 0x1008FF6E, /* XF86Phone */ - /* 170, 0x0aa */ 0x0, /* NoSymbol */ - /* 171, 0x0ab */ 0x1008FF81, /* XF86Tools */ - /* 172, 0x0ac */ 0x1008FF18, /* XF86HomePage */ - /* 173, 0x0ad */ 0x1008FF73, /* XF86Reload */ - /* 174, 0x0ae */ 0x1008FF56, /* XF86Close */ - /* 175, 0x0af */ 0x0, /* NoSymbol */ - /* 176, 0x0b0 */ 0x0, /* NoSymbol */ - /* 177, 0x0b1 */ 0x1008FF78, /* XF86ScrollUp */ - /* 178, 0x0b2 */ 0x1008FF79, /* XF86ScrollDown */ - /* 179, 0x0b3 */ 0x28, /* parenleft */ - /* 180, 0x0b4 */ 0x29, /* parenright */ - /* 181, 0x0b5 */ 0x1008FF68, /* XF86New */ - /* 182, 0x0b6 */ 0xFF66, /* Redo */ - /* 183, 0x0b7 */ 0xFFCA, /* F13 */ - /* 184, 0x0b8 */ 0xFFCB, /* F14 */ - /* 185, 0x0b9 */ 0xFFCC, /* F15 */ - /* 186, 0x0ba */ 0xFFCD, /* F16 */ - /* 187, 0x0bb */ 0xFFCE, /* F17 */ - /* 188, 0x0bc */ 0xFFCF, /* F18 */ - /* 189, 0x0bd */ 0xFFD0, /* F19 */ - /* 190, 0x0be */ 0xFFD1, /* F20 */ - /* 191, 0x0bf */ 0xFFD2, /* F21 */ - /* 192, 0x0c0 */ 0xFFD3, /* F22 */ - /* 193, 0x0c1 */ 0xFFD4, /* F23 */ - /* 194, 0x0c2 */ 0xFFD5, /* F24 */ - /* 195, 0x0c3 */ 0x0, /* NoSymbol */ - /* 196, 0x0c4 */ 0x0, /* NoSymbol */ - /* 197, 0x0c5 */ 0x0, /* NoSymbol */ - /* 198, 0x0c6 */ 0x0, /* NoSymbol */ - /* 199, 0x0c7 */ 0x0, /* NoSymbol */ - /* 200, 0x0c8 */ 0x1008FF14, /* XF86AudioPlay */ - /* 201, 0x0c9 */ 0x1008FF31, /* XF86AudioPause */ - /* 202, 0x0ca */ 0x1008FF43, /* XF86Launch3 */ - /* 203, 0x0cb */ 0x1008FF44, /* XF86Launch4 */ - /* 204, 0x0cc */ 0x1008FF4B, /* XF86LaunchB */ - /* 205, 0x0cd */ 0x1008FFA7, /* XF86Suspend */ - /* 206, 0x0ce */ 0x1008FF56, /* XF86Close */ - /* 207, 0x0cf */ 0x1008FF14, /* XF86AudioPlay */ - /* 208, 0x0d0 */ 0x1008FF97, /* XF86AudioForward */ - /* 209, 0x0d1 */ 0x0, /* NoSymbol */ - /* 210, 0x0d2 */ 0xFF61, /* Print */ - /* 211, 0x0d3 */ 0x0, /* NoSymbol */ - /* 212, 0x0d4 */ 0x1008FF8F, /* XF86WebCam */ - /* 213, 0x0d5 */ 0x1008FFB6, /* XF86AudioPreset */ - /* 214, 0x0d6 */ 0x0, /* NoSymbol */ - /* 215, 0x0d7 */ 0x1008FF19, /* XF86Mail */ - /* 216, 0x0d8 */ 0x1008FF8E, /* XF86Messenger */ - /* 217, 0x0d9 */ 0x1008FF1B, /* XF86Search */ - /* 218, 0x0da */ 0x1008FF5F, /* XF86Go */ - /* 219, 0x0db */ 0x1008FF3C, /* XF86Finance */ - /* 220, 0x0dc */ 0x1008FF5E, /* XF86Game */ - /* 221, 0x0dd */ 0x1008FF36, /* XF86Shop */ - /* 222, 0x0de */ 0x0, /* NoSymbol */ - /* 223, 0x0df */ 0xFF69, /* Cancel */ - /* 224, 0x0e0 */ 0x1008FF03, /* XF86MonBrightnessDown */ - /* 225, 0x0e1 */ 0x1008FF02, /* XF86MonBrightnessUp */ - /* 226, 0x0e2 */ 0x1008FF32, /* XF86AudioMedia */ - /* 227, 0x0e3 */ 0x1008FF59, /* XF86Display */ - /* 228, 0x0e4 */ 0x1008FF04, /* XF86KbdLightOnOff */ - /* 229, 0x0e5 */ 0x1008FF06, /* XF86KbdBrightnessDown */ - /* 230, 0x0e6 */ 0x1008FF05, /* XF86KbdBrightnessUp */ - /* 231, 0x0e7 */ 0x1008FF7B, /* XF86Send */ - /* 232, 0x0e8 */ 0x1008FF72, /* XF86Reply */ - /* 233, 0x0e9 */ 0x1008FF90, /* XF86MailForward */ - /* 234, 0x0ea */ 0x1008FF77, /* XF86Save */ - /* 235, 0x0eb */ 0x1008FF5B, /* XF86Documents */ - /* 236, 0x0ec */ 0x1008FF93, /* XF86Battery */ - /* 237, 0x0ed */ 0x1008FF94, /* XF86Bluetooth */ - /* 238, 0x0ee */ 0x1008FF95, /* XF86WLAN */ - /* 239, 0x0ef */ 0x1008FF96, /* XF86UWB */ - /* 240, 0x0f0 */ 0x0, /* NoSymbol */ - /* 241, 0x0f1 */ 0x1008FE22, /* XF86Next_VMode */ - /* 242, 0x0f2 */ 0x1008FE23, /* XF86Prev_VMode */ - /* 243, 0x0f3 */ 0x1008FF07, /* XF86MonBrightnessCycle */ - /* 244, 0x0f4 */ 0x100810F4, /* XF86BrightnessAuto */ - /* 245, 0x0f5 */ 0x100810F5, /* XF86DisplayOff */ - /* 246, 0x0f6 */ 0x1008FFB4, /* XF86WWAN */ - /* 247, 0x0f7 */ 0x1008FFB5, /* XF86RFKill */ -}; - -#if 0 /* Here is a script to generate the ExtendedLinuxKeycodeKeysyms table */ -#!/bin/bash - -function process_line -{ - sym=$(echo "$1" | awk '{print $3}') - code=$(echo "$1" | sed 's,.*_EVDEVK(\(0x[0-9A-Fa-f]*\)).*,\1,') - value=$(egrep "#define ${sym}\s" -R /usr/include/X11 | awk '{print $3}') - printf " { 0x%.8X, 0x%.3x }, /* $sym */\n" $value $code -} - -fgrep "/* Use: " /usr/include/xkbcommon/xkbcommon-keysyms.h | fgrep _EVDEVK | while read line; do - process_line "$line" -done -#endif - -static const struct { - KeySym keysym; - int linux_keycode; -} ExtendedLinuxKeycodeKeysyms[] = { - { 0x1008FF2C, 0x0a2 }, /* XF86XK_Eject */ - { 0x1008FF68, 0x0b5 }, /* XF86XK_New */ - { 0x0000FF66, 0x0b6 }, /* XK_Redo */ - { 0x1008FF4B, 0x0cc }, /* XF86XK_LaunchB */ - { 0x1008FF59, 0x0e3 }, /* XF86XK_Display */ - { 0x1008FF04, 0x0e4 }, /* XF86XK_KbdLightOnOff */ - { 0x1008FF06, 0x0e5 }, /* XF86XK_KbdBrightnessDown */ - { 0x1008FF05, 0x0e6 }, /* XF86XK_KbdBrightnessUp */ - { 0x1008FF7B, 0x0e7 }, /* XF86XK_Send */ - { 0x1008FF72, 0x0e8 }, /* XF86XK_Reply */ - { 0x1008FF90, 0x0e9 }, /* XF86XK_MailForward */ - { 0x1008FF77, 0x0ea }, /* XF86XK_Save */ - { 0x1008FF5B, 0x0eb }, /* XF86XK_Documents */ - { 0x1008FF93, 0x0ec }, /* XF86XK_Battery */ - { 0x1008FF94, 0x0ed }, /* XF86XK_Bluetooth */ - { 0x1008FF95, 0x0ee }, /* XF86XK_WLAN */ - { 0x1008FF96, 0x0ef }, /* XF86XK_UWB */ - { 0x1008FE22, 0x0f1 }, /* XF86XK_Next_VMode */ - { 0x1008FE23, 0x0f2 }, /* XF86XK_Prev_VMode */ - { 0x1008FF07, 0x0f3 }, /* XF86XK_MonBrightnessCycle */ - { 0x1008FFB4, 0x0f6 }, /* XF86XK_WWAN */ - { 0x1008FFB5, 0x0f7 }, /* XF86XK_RFKill */ - { 0x1008FFB2, 0x0f8 }, /* XF86XK_AudioMicMute */ - { 0x1008FF9C, 0x173 }, /* XF86XK_CycleAngle */ - { 0x1008FFB8, 0x174 }, /* XF86XK_FullScreen */ - { 0x1008FF87, 0x189 }, /* XF86XK_Video */ - { 0x1008FF20, 0x18d }, /* XF86XK_Calendar */ - { 0x1008FF99, 0x19a }, /* XF86XK_AudioRandomPlay */ - { 0x1008FF5E, 0x1a1 }, /* XF86XK_Game */ - { 0x1008FF8B, 0x1a2 }, /* XF86XK_ZoomIn */ - { 0x1008FF8C, 0x1a3 }, /* XF86XK_ZoomOut */ - { 0x1008FF89, 0x1a5 }, /* XF86XK_Word */ - { 0x1008FF5C, 0x1a7 }, /* XF86XK_Excel */ - { 0x1008FF69, 0x1ab }, /* XF86XK_News */ - { 0x1008FF8E, 0x1ae }, /* XF86XK_Messenger */ - { 0x1008FF61, 0x1b1 }, /* XF86XK_LogOff */ - { 0x00000024, 0x1b2 }, /* XK_dollar */ - { 0x000020AC, 0x1b3 }, /* XK_EuroSign */ - { 0x1008FF9D, 0x1b4 }, /* XF86XK_FrameBack */ - { 0x1008FF9E, 0x1b5 }, /* XF86XK_FrameForward */ - { 0x0000FFF1, 0x1f1 }, /* XK_braille_dot_1 */ - { 0x0000FFF2, 0x1f2 }, /* XK_braille_dot_2 */ - { 0x0000FFF3, 0x1f3 }, /* XK_braille_dot_3 */ - { 0x0000FFF4, 0x1f4 }, /* XK_braille_dot_4 */ - { 0x0000FFF5, 0x1f5 }, /* XK_braille_dot_5 */ - { 0x0000FFF6, 0x1f6 }, /* XK_braille_dot_6 */ - { 0x0000FFF7, 0x1f7 }, /* XK_braille_dot_7 */ - { 0x0000FFF8, 0x1f8 }, /* XK_braille_dot_8 */ - { 0x0000FFF9, 0x1f9 }, /* XK_braille_dot_9 */ - { 0x0000FFF1, 0x1fa }, /* XK_braille_dot_1 */ - { 0x1008FFA9, 0x212 }, /* XF86XK_TouchpadToggle */ - { 0x1008FFB0, 0x213 }, /* XF86XK_TouchpadOn */ - { 0x1008FFB1, 0x214 }, /* XF86XK_TouchpadOff */ - { 0x1008FFB7, 0x231 }, /* XF86XK_RotationLockToggle */ - { 0x0000FE08, 0x248 }, /* XK_ISO_Next_Group */ -}; - static SDL_ScancodeTable scancode_set[] = { SDL_SCANCODE_TABLE_DARWIN, SDL_SCANCODE_TABLE_XFREE86_1, SDL_SCANCODE_TABLE_XFREE86_2, SDL_SCANCODE_TABLE_XVNC, }; -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-ON* */ /* clang-format on */ /* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */ static SDL_Scancode X11_KeyCodeToSDLScancode(_THIS, KeyCode keycode) { - KeySym keysym; - int i; - int linux_keycode = 0; + const KeySym keysym = X11_KeyCodeToSym(_this, keycode, 0); - keysym = X11_KeyCodeToSym(_this, keycode, 0); if (keysym == NoSymbol) { return SDL_SCANCODE_UNKNOWN; } - /* First check our custom list */ - for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) { - if (keysym == KeySymToSDLScancode[i].keysym) { - return KeySymToSDLScancode[i].scancode; - } - } - - /* The rest of the keysyms map to Linux keycodes, so use that mapping */ - if (keysym >= 0x10081000 && keysym <= 0x10081FFF) { - /* Per xkbcommon-keysyms.h, this is actually a linux keycode */ - linux_keycode = (keysym - 0x10081000); - } - if (!linux_keycode) { - /* See if this keysym is an exact match in our table */ - i = (keycode - 8); - if (i >= 0 && i < SDL_arraysize(LinuxKeycodeKeysyms) && keysym == LinuxKeycodeKeysyms[i]) { - linux_keycode = i; - } else { - /* Scan the table for this keysym */ - for (i = 0; i < SDL_arraysize(LinuxKeycodeKeysyms); ++i) { - if (keysym == LinuxKeycodeKeysyms[i]) { - linux_keycode = i; - break; - } - } - } - } - if (!linux_keycode) { - /* Scan the extended table for this keysym */ - for (i = 0; i < SDL_arraysize(ExtendedLinuxKeycodeKeysyms); ++i) { - if (keysym == ExtendedLinuxKeycodeKeysyms[i].keysym) { - linux_keycode = ExtendedLinuxKeycodeKeysyms[i].linux_keycode; - break; - } - } - } - return SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, linux_keycode); + return SDL_GetScancodeFromKeySym(keysym, keycode); } static Uint32 From d1858eb124293ace5783a5e1a6788df7c57c02a8 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 4 Nov 2022 12:33:45 -0400 Subject: [PATCH 346/459] events: Add a helper function to get the default keycode for a scancode Add a helper function to get the keycode for a scancode from the default lookup table. Unlike SDL_GetKeyFromScancode(), this is not affected by the set keymap. --- src/events/SDL_keyboard.c | 11 +++++++++++ src/events/SDL_keyboard_c.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 7dc0fb9b2..30ec14c24 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -1137,6 +1137,17 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) return keyboard->keymap[scancode]; } +SDL_Keycode +SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode) +{ + if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + SDL_InvalidParamError("scancode"); + return 0; + } + + return SDL_default_keymap[scancode]; +} + SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key) { diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index db9703aaf..3ace4af64 100644 --- a/src/events/SDL_keyboard_c.h +++ b/src/events/SDL_keyboard_c.h @@ -32,6 +32,9 @@ extern int SDL_KeyboardInit(void); /* Get the default keymap */ extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap); +/* Get the default key code for a scancode */ +extern SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode); + /* Set the mapping of scancode to key codes */ extern void SDL_SetKeymap(int start, const SDL_Keycode * keys, int length, SDL_bool send_event); From c855184765840c13cb7a3351c616eada10e921f6 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 4 Nov 2022 12:41:46 -0400 Subject: [PATCH 347/459] wayland: Handle virtual keyboards that don't fit the X mapping SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only. --- src/events/SDL_keysym_to_scancode_c.h | 1 + src/video/wayland/SDL_waylandevents.c | 257 +++++++++++++----------- src/video/wayland/SDL_waylandevents_c.h | 9 + src/video/wayland/SDL_waylandsym.h | 1 + src/video/x11/SDL_x11keyboard.c | 1 - 5 files changed, 154 insertions(+), 115 deletions(-) diff --git a/src/events/SDL_keysym_to_scancode_c.h b/src/events/SDL_keysym_to_scancode_c.h index da6c7e19a..d2feb8c7f 100644 --- a/src/events/SDL_keysym_to_scancode_c.h +++ b/src/events/SDL_keysym_to_scancode_c.h @@ -24,6 +24,7 @@ #include "SDL_scancode.h" +/* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */ extern SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode); #endif /* SDL_keysym_to_scancode_c_h_ */ diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 2d37a0e23..5ccffd9dd 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -63,6 +63,7 @@ #include #include #include "../../events/imKStoUCS.h" +#include "../../events/SDL_keysym_to_scancode_c.h" /* Clamp the wl_seat version on older versions of libwayland. */ #if SDL_WAYLAND_CHECK_VERSION(1, 21, 0) @@ -74,28 +75,6 @@ /* Weston uses a ratio of 10 units per scroll tick */ #define WAYLAND_WHEEL_AXIS_UNIT 10 -static const struct { - xkb_keysym_t keysym; - SDL_KeyCode keycode; -} KeySymToSDLKeyCode[] = { - { XKB_KEY_Escape, SDLK_ESCAPE }, - { XKB_KEY_Num_Lock, SDLK_NUMLOCKCLEAR }, - { XKB_KEY_Shift_L, SDLK_LSHIFT }, - { XKB_KEY_Shift_R, SDLK_RSHIFT }, - { XKB_KEY_Control_L, SDLK_LCTRL }, - { XKB_KEY_Control_R, SDLK_RCTRL }, - { XKB_KEY_Caps_Lock, SDLK_CAPSLOCK }, - { XKB_KEY_Alt_L, SDLK_LALT }, - { XKB_KEY_Alt_R, SDLK_RALT }, - { XKB_KEY_Meta_L, SDLK_LGUI }, - { XKB_KEY_Meta_R, SDLK_RGUI }, - { XKB_KEY_Super_L, SDLK_LGUI }, - { XKB_KEY_Super_R, SDLK_RGUI }, - { XKB_KEY_Hyper_L, SDLK_LGUI }, - { XKB_KEY_Hyper_R, SDLK_RGUI }, - { XKB_KEY_BackSpace, SDLK_BACKSPACE }, -}; - struct SDL_WaylandTouchPoint { SDL_TouchID id; float x; @@ -113,19 +92,6 @@ struct SDL_WaylandTouchPointList { static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL}; -static SDL_KeyCode -Wayland_KeySymToSDLKeyCode(xkb_keysym_t keysym) -{ - int i; - - for (i = 0; i < SDL_arraysize(KeySymToSDLKeyCode); ++i) { - if (keysym == KeySymToSDLKeyCode[i].keysym) { - return KeySymToSDLKeyCode[i].keycode; - } - } - return SDLK_UNKNOWN; -} - static void touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface) { @@ -937,6 +903,59 @@ static const struct wl_touch_listener touch_listener = { NULL, /* orientation */ }; +typedef struct Wayland_Keymap +{ + xkb_layout_index_t layout; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; +} Wayland_Keymap; + +static void +Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) +{ + const xkb_keysym_t *syms; + Wayland_Keymap *sdlKeymap = (Wayland_Keymap *)data; + SDL_Scancode scancode; + + scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, (key - 8)); + if (scancode == SDL_SCANCODE_UNKNOWN) { + return; + } + + if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) { + uint32_t keycode = SDL_KeySymToUcs4(syms[0]); + + if (!keycode) { + const SDL_Scancode sc = SDL_GetScancodeFromKeySym(syms[0], key); + keycode = SDL_GetDefaultKeyFromScancode(sc); + } + + if (keycode) { + sdlKeymap->keymap[scancode] = keycode; + } else { + switch (scancode) { + case SDL_SCANCODE_RETURN: + sdlKeymap->keymap[scancode] = SDLK_RETURN; + break; + case SDL_SCANCODE_ESCAPE: + sdlKeymap->keymap[scancode] = SDLK_ESCAPE; + break; + case SDL_SCANCODE_BACKSPACE: + sdlKeymap->keymap[scancode] = SDLK_BACKSPACE; + break; + case SDL_SCANCODE_TAB: + sdlKeymap->keymap[scancode] = SDLK_TAB; + break; + case SDL_SCANCODE_DELETE: + sdlKeymap->keymap[scancode] = SDLK_DELETE; + break; + default: + sdlKeymap->keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(scancode); + break; + } + } + } +} + static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size) @@ -962,9 +981,9 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, } input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context, - map_str, - XKB_KEYMAP_FORMAT_TEXT_V1, - 0); + map_str, + XKB_KEYMAP_FORMAT_TEXT_V1, + 0); munmap(map_str, size); close(fd); @@ -973,6 +992,16 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } +#define GET_MOD_INDEX(mod) \ + WAYLAND_xkb_keymap_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_##mod) + input->xkb.idx_shift = 1 << GET_MOD_INDEX(SHIFT); + input->xkb.idx_ctrl = 1 << GET_MOD_INDEX(CTRL); + input->xkb.idx_alt = 1 << GET_MOD_INDEX(ALT); + input->xkb.idx_gui = 1 << GET_MOD_INDEX(LOGO); + input->xkb.idx_num = 1 << GET_MOD_INDEX(NUM); + input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); +#undef GET_MOD_INDEX + input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { SDL_SetError("failed to create XKB state\n"); @@ -981,6 +1010,25 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } + /* + * Assume that a nameless layout implies a virtual keyboard with an arbitrary layout. + * TODO: Use a better method of detection? + */ + input->keyboard_is_virtual = WAYLAND_xkb_keymap_layout_get_name(input->xkb.keymap, 0) == NULL; + + /* Update the keymap if changed. Virtual keyboards use the default keymap. */ + if (input->xkb.current_group != XKB_GROUP_INVALID) { + Wayland_Keymap keymap; + keymap.layout = input->xkb.current_group; + SDL_GetDefaultKeymap(keymap.keymap); + if (!input->keyboard_is_virtual) { + WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, + Wayland_keymap_iter, + &keymap); + } + SDL_SetKeymap(0, keymap.keymap, SDL_NUM_SCANCODES, SDL_TRUE); + } + /* * See https://blogs.s-osg.org/compose-key-support-weston/ * for further explanation on dead keys in Wayland. @@ -997,11 +1045,11 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, /* Set up XKB compose table */ input->xkb.compose_table = WAYLAND_xkb_compose_table_new_from_locale(input->display->xkb_context, - locale, XKB_COMPOSE_COMPILE_NO_FLAGS); + locale, XKB_COMPOSE_COMPILE_NO_FLAGS); if (input->xkb.compose_table) { /* Set up XKB compose state */ input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table, - XKB_COMPOSE_STATE_NO_FLAGS); + XKB_COMPOSE_STATE_NO_FLAGS); if (!input->xkb.compose_state) { SDL_SetError("could not create XKB compose state\n"); WAYLAND_xkb_compose_table_unref(input->xkb.compose_table); @@ -1010,16 +1058,37 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, } } +/* + * Virtual keyboards can have arbitrary layouts, arbitrary scancodes/keycodes, etc... + * Key presses from these devices must be looked up by their keysym value. + */ +static SDL_Scancode +Wayland_get_scancode_from_key(struct SDL_WaylandInput *input, uint32_t key) +{ + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; + + if (!input->keyboard_is_virtual) { + scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, key - 8); + } else { + const xkb_keysym_t *syms; + if (WAYLAND_xkb_keymap_key_get_syms_by_level(input->xkb.keymap, key, input->xkb.current_group, 0, &syms) > 0) { + scancode = SDL_GetScancodeFromKeySym(syms[0], key); + } + } + + return scancode; +} static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { - // Caps Lock not included because it only makes sense to consider modifiers - // that get held down, for the case where a user clicks on an unfocused - // window with a modifier key like Shift pressed, in a situation where the - // application handles Shift+click differently from a click + /* Caps Lock not included because it only makes sense to consider modifiers + * that get held down, for the case where a user clicks on an unfocused + * window with a modifier key like Shift pressed, in a situation where the + * application handles Shift+click differently from a click + */ const SDL_Scancode mod_scancodes[] = { SDL_SCANCODE_LSHIFT, SDL_SCANCODE_RSHIFT, @@ -1033,7 +1102,6 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, struct SDL_WaylandInput *input = data; SDL_WindowData *window; uint32_t *key; - SDL_Scancode scancode; if (!surface) { /* enter event for a window we've just destroyed */ @@ -1057,12 +1125,15 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, } #endif - wl_array_for_each(key, keys) { - scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, *key); - for (uint32_t i = 0; i < sizeof mod_scancodes / sizeof *mod_scancodes; ++i) { - if (mod_scancodes[i] == scancode) { - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - break; + wl_array_for_each (key, keys) { + const SDL_Scancode scancode = Wayland_get_scancode_from_key(input, *key + 8); + + if (scancode != SDL_SCANCODE_UNKNOWN) { + for (uint32_t i = 0; i < sizeof mod_scancodes / sizeof *mod_scancodes; ++i) { + if (mod_scancodes[i] == scancode) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + break; + } } } } @@ -1156,7 +1227,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, { struct SDL_WaylandInput *input = data; enum wl_keyboard_key_state state = state_w; - uint32_t scancode = SDL_SCANCODE_UNKNOWN; + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; char text[8]; SDL_bool has_text = SDL_FALSE; SDL_bool handled_by_ime = SDL_FALSE; @@ -1177,11 +1248,8 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, } if (!handled_by_ime) { - scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, key); - if (scancode != SDL_SCANCODE_UNKNOWN) { - SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? - SDL_PRESSED : SDL_RELEASED, scancode); - } + scancode = Wayland_get_scancode_from_key(input, key + 8); + SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? SDL_PRESSED : SDL_RELEASED, scancode); } if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { @@ -1198,58 +1266,6 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, } } -typedef struct Wayland_Keymap -{ - xkb_layout_index_t layout; - SDL_Keycode keymap[SDL_NUM_SCANCODES]; -} Wayland_Keymap; - -static void -Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) -{ - const xkb_keysym_t *syms; - Wayland_Keymap *sdlKeymap = (Wayland_Keymap *)data; - SDL_Scancode scancode; - - scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_XFREE86_2, (key - 8)); - if (scancode == SDL_SCANCODE_UNKNOWN) { - return; - } - - if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) { - uint32_t keycode = SDL_KeySymToUcs4(syms[0]); - - if (!keycode) { - keycode = Wayland_KeySymToSDLKeyCode(syms[0]); - } - - if (keycode) { - sdlKeymap->keymap[scancode] = keycode; - } else { - switch (scancode) { - case SDL_SCANCODE_RETURN: - sdlKeymap->keymap[scancode] = SDLK_RETURN; - break; - case SDL_SCANCODE_ESCAPE: - sdlKeymap->keymap[scancode] = SDLK_ESCAPE; - break; - case SDL_SCANCODE_BACKSPACE: - sdlKeymap->keymap[scancode] = SDLK_BACKSPACE; - break; - case SDL_SCANCODE_TAB: - sdlKeymap->keymap[scancode] = SDLK_TAB; - break; - case SDL_SCANCODE_DELETE: - sdlKeymap->keymap[scancode] = SDLK_DELETE; - break; - default: - sdlKeymap->keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(scancode); - break; - } - } - } -} - static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, @@ -1258,10 +1274,21 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, { struct SDL_WaylandInput *input = data; Wayland_Keymap keymap; + const uint32_t modstate = (mods_depressed | mods_latched | mods_locked); WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); + /* Toggle the modifier states for virtual keyboards, as they may not send key presses. */ + if (input->keyboard_is_virtual) { + SDL_ToggleModState(KMOD_SHIFT, modstate & input->xkb.idx_shift); + SDL_ToggleModState(KMOD_CTRL, modstate & input->xkb.idx_ctrl); + SDL_ToggleModState(KMOD_ALT, modstate & input->xkb.idx_alt); + SDL_ToggleModState(KMOD_GUI, modstate & input->xkb.idx_gui); + SDL_ToggleModState(KMOD_NUM, modstate & input->xkb.idx_num); + SDL_ToggleModState(KMOD_CAPS, modstate & input->xkb.idx_caps); + } + /* If a key is repeating, update the text to apply the modifier. */ if(keyboard_repeat_is_set(&input->keyboard_repeat)) { char text[8]; @@ -1276,13 +1303,15 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, return; } - /* The layout changed, remap and fire an event */ + /* The layout changed, remap and fire an event. Virtual keyboards use the default keymap. */ input->xkb.current_group = group; keymap.layout = group; SDL_GetDefaultKeymap(keymap.keymap); - WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, - Wayland_keymap_iter, - &keymap); + if (!input->keyboard_is_virtual) { + WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, + Wayland_keymap_iter, + &keymap); + } SDL_SetKeymap(0, keymap.keymap, SDL_NUM_SCANCODES, SDL_TRUE); } @@ -2394,7 +2423,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(SDL_WL_SEAT_VERSION, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); - input->xkb.current_group = ~0; + input->xkb.current_group = XKB_GROUP_INVALID; d->input = input; if (d->data_device_manager != NULL) { diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index f1f472633..aab2abf43 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -110,6 +110,14 @@ struct SDL_WaylandInput { /* Keyboard layout "group" */ uint32_t current_group; + + /* Modifier bitshift values */ + uint32_t idx_shift; + uint32_t idx_ctrl; + uint32_t idx_alt; + uint32_t idx_gui; + uint32_t idx_num; + uint32_t idx_caps; } xkb; /* information about axis events on current frame */ @@ -129,6 +137,7 @@ struct SDL_WaylandInput { SDL_bool cursor_visible; SDL_bool relative_mode_override; SDL_bool warp_emulation_prohibited; + SDL_bool keyboard_is_virtual; }; extern void Wayland_PumpEvents(_THIS); diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h index 987bc499d..8b31d8cac 100644 --- a/src/video/wayland/SDL_waylandsym.h +++ b/src/video/wayland/SDL_waylandsym.h @@ -155,6 +155,7 @@ SDL_WAYLAND_SYM(int, xkb_keymap_key_get_syms_by_level, (struct xkb_keymap *, SDL_WAYLAND_SYM(uint32_t, xkb_keysym_to_utf32, (xkb_keysym_t) ) SDL_WAYLAND_SYM(uint32_t, xkb_keymap_mod_get_index, (struct xkb_keymap *, const char *) ) +SDL_WAYLAND_SYM(const char *, xkb_keymap_layout_get_name, (struct xkb_keymap*, xkb_layout_index_t)) #ifdef HAVE_LIBDECOR_H SDL_WAYLAND_MODULE(WAYLAND_LIBDECOR) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 6f0eb6ab8..bad202964 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -45,7 +45,6 @@ static SDL_ScancodeTable scancode_set[] = { SDL_SCANCODE_TABLE_XFREE86_2, SDL_SCANCODE_TABLE_XVNC, }; -/* *INDENT-ON* */ /* clang-format on */ /* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */ static SDL_Scancode From 615901dbfee8867ff1eb71f788dd041703b694ca Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 15 Nov 2022 11:19:08 -0800 Subject: [PATCH 348/459] Removed unnecessary header The xkbcommon-keysyms.h header isn't available on some older systems, and we don't actually need it for this code. --- src/events/SDL_keysym_to_scancode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c index 267cc0b3a..53b55891b 100644 --- a/src/events/SDL_keysym_to_scancode.c +++ b/src/events/SDL_keysym_to_scancode.c @@ -26,7 +26,6 @@ #include "SDL_keyboard_c.h" #include "SDL_scancode_tables_c.h" -#include #include /* *INDENT-OFF* */ /* clang-format off */ From 98f93d0aa18328c9290779ef5e995e9c691c52fb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 15 Nov 2022 11:39:06 -0800 Subject: [PATCH 349/459] Fixed building without xkbcommon support --- src/events/SDL_keysym_to_scancode.c | 36 ++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c index 53b55891b..d965a375c 100644 --- a/src/events/SDL_keysym_to_scancode.c +++ b/src/events/SDL_keysym_to_scancode.c @@ -26,13 +26,24 @@ #include "SDL_keyboard_c.h" #include "SDL_scancode_tables_c.h" +#if SDL_VIDEO_DRIVER_WAYLAND #include +typedef xkb_keysym_t SDL_xkb_keysym_t; +#else +#include +#include + +typedef KeySym SDL_xkb_keysym_t; +#endif + + /* *INDENT-OFF* */ /* clang-format off */ static const struct { - xkb_keysym_t keysym; + SDL_xkb_keysym_t keysym; SDL_Scancode scancode; } KeySymToSDLScancode[] = { +#if SDL_VIDEO_DRIVER_WAYLAND { XKB_KEY_KP_End, SDL_SCANCODE_KP_1 }, { XKB_KEY_KP_Down, SDL_SCANCODE_KP_2 }, { XKB_KEY_KP_Next, SDL_SCANCODE_KP_3 }, @@ -50,6 +61,25 @@ static const struct { { XKB_KEY_Super_L, SDL_SCANCODE_LGUI }, { XKB_KEY_Super_R, SDL_SCANCODE_RGUI }, { XKB_KEY_Mode_switch, SDL_SCANCODE_MODE }, +#else + { XK_KP_End, SDL_SCANCODE_KP_1 }, + { XK_KP_Down, SDL_SCANCODE_KP_2 }, + { XK_KP_Next, SDL_SCANCODE_KP_3 }, + { XK_KP_Left, SDL_SCANCODE_KP_4 }, + { XK_KP_Begin, SDL_SCANCODE_KP_5 }, + { XK_KP_Right, SDL_SCANCODE_KP_6 }, + { XK_KP_Home, SDL_SCANCODE_KP_7 }, + { XK_KP_Up, SDL_SCANCODE_KP_8 }, + { XK_KP_Prior, SDL_SCANCODE_KP_9 }, + { XK_KP_Insert, SDL_SCANCODE_KP_0 }, + { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD }, + { XK_Execute, SDL_SCANCODE_EXECUTE }, + { XK_Hyper_R, SDL_SCANCODE_APPLICATION }, + { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, + { XK_Super_L, SDL_SCANCODE_LGUI }, + { XK_Super_R, SDL_SCANCODE_RGUI }, + { XK_Mode_switch, SDL_SCANCODE_MODE }, +#endif { 0x1008FF65, SDL_SCANCODE_MENU }, /* XF86MenuKB */ { 0x1008FF81, SDL_SCANCODE_F13 }, /* XF86Tools */ { 0x1008FF45, SDL_SCANCODE_F14 }, /* XF86Launch5 */ @@ -60,7 +90,7 @@ static const struct { }; /* This is a mapping from X keysym to Linux keycode */ -static const xkb_keysym_t LinuxKeycodeKeysyms[] = { +static const SDL_xkb_keysym_t LinuxKeycodeKeysyms[] = { /* 0, 0x000 */ 0x0, /* NoSymbol */ /* 1, 0x001 */ 0xFF1B, /* Escape */ /* 2, 0x002 */ 0x31, /* 1 */ @@ -328,7 +358,7 @@ done #endif static const struct { - xkb_keysym_t keysym; + SDL_xkb_keysym_t keysym; int linux_keycode; } ExtendedLinuxKeycodeKeysyms[] = { { 0x1008FF2C, 0x0a2 }, /* XF86XK_Eject */ From 02ab7f37458c34b67bbb87b7650e73ab51c01a64 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 15 Nov 2022 12:57:07 -0800 Subject: [PATCH 350/459] Fixed release build using clang on Windows --- src/stdlib/SDL_malloc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 093a2a0e9..ebafb66cf 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -3463,7 +3463,9 @@ add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped) msegmentptr ss = (msegmentptr) (chunk2mem(sp)); mchunkptr tnext = chunk_plus_offset(sp, ssize); mchunkptr p = tnext; +#ifdef DEBUG int nfences = 0; +#endif /* reset top to new space */ init_top(m, (mchunkptr) tbase, tsize - TOP_FOOT_SIZE); @@ -3481,13 +3483,17 @@ add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped) for (;;) { mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); p->head = FENCEPOST_HEAD; +#ifdef DEBUG ++nfences; +#endif if ((char *) (&(nextp->head)) < old_end) p = nextp; else break; } +#ifdef DEBUG assert(nfences >= 2); +#endif /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) { From 06492c598158cf825a18aececaf7511d7fd04f48 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 16 Nov 2022 00:20:28 +0300 Subject: [PATCH 351/459] CI, MSVC: update to use microsoft/setup-msbuild v1.1.3. Fixes github deprecation warnings --- .github/workflows/msvc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index b4644ecc5..78fb73a7c 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -68,7 +68,7 @@ jobs: - name: Add msbuild to PATH if: ${{ matrix.platform.project != '' }} - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.1.3 - name: Build msbuild if: ${{ matrix.platform.project != '' }} run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} From d8b1ef42aee52dad4ac3de69795ca2e8d2fd7704 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 15 Nov 2022 22:18:51 -0500 Subject: [PATCH 352/459] pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small. Fixes #6121. --- src/audio/pulseaudio/SDL_pulseaudio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 288c3d98a..9934a5626 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -630,7 +630,13 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname) paattr.prebuf = -1; paattr.maxlength = -1; paattr.minreq = -1; - flags |= PA_STREAM_ADJUST_LATENCY; + + /* don't let this change the global device's latency if the number is + extremely small, as it will affect other applications. Without this + flag, it only affects this specific stream. */ + if (this->spec.samples >= 512) { + flags |= PA_STREAM_ADJUST_LATENCY; + } if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { return SDL_SetError("Could not connect to PulseAudio server"); From 903301c6aaabd87f9b7cb1c03c323387d25b4eee Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 16 Nov 2022 02:04:59 -0500 Subject: [PATCH 353/459] wayland: Always use integer scaling for cursors. Cursors don't get fractionally scaled, so always scale system cursor sizes to the next whole integer. --- src/video/wayland/SDL_waylandmouse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index c35457b5b..20c5efca0 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -199,8 +199,10 @@ wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float return SDL_FALSE; } focusdata = focus->driverdata; - *scale = focusdata->scale_factor; - size *= focusdata->scale_factor; + + /* Cursors use integer scaling. */ + *scale = SDL_ceilf(focusdata->scale_factor); + size *= *scale; for (i = 0; i < vdata->num_cursor_themes; i += 1) { if (vdata->cursor_themes[i].size == size) { theme = vdata->cursor_themes[i].theme; From 76e3cf384021a986007c653a56f31bb89ca7fb27 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 11:04:45 +0100 Subject: [PATCH 354/459] cmake: use custom add_sdl_test_executable macro to add test --- test/CMakeLists.txt | 334 ++++++++++++++------------------------------ 1 file changed, 105 insertions(+), 229 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 578a422be..d89be52b0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,8 +2,26 @@ cmake_minimum_required(VERSION 3.0) project(SDL2_test) include(CheckCCompilerFlag) +include(CMakeParseArguments) include(CMakePushCheckState) +set(SDL_TEST_EXECUTABLES) +set(SDL_TESTS_NONINTERACTIVE) +set(SDL_TESTS_NEEDS_ESOURCES) + +macro(add_sdl_test_executable TARGET) + cmake_parse_arguments(AST "NONINTERACTIVE;NEEDS_RESOURCES" "" "" ${ARGN}) + add_executable(${TARGET} ${AST_UNPARSED_ARGUMENTS}) + + list(APPEND SDL_TEST_EXECUTABLES ${TARGET}) + if(AST_NONINTERACTIVE) + list(APPEND SDL_TESTS_NONINTERACTIVE ${TARGET}) + endif() + if(AST_NEEDS_RESOURCES) + list(APPEND SDL_TESTS_NEEDS_ESOURCES ${TARGET}) + endif() +endmacro() + if(NOT TARGET SDL2::SDL2-static) find_package(SDL2 2.0.23 REQUIRED COMPONENTS SDL2-static SDL2test) endif() @@ -76,57 +94,59 @@ if (OPENGL_FOUND) add_definitions(-DHAVE_OPENGL) endif() -add_executable(checkkeys checkkeys.c) -add_executable(checkkeysthreads checkkeysthreads.c) -add_executable(loopwave loopwave.c testutils.c) -add_executable(loopwavequeue loopwavequeue.c testutils.c) -add_executable(testsurround testsurround.c) -add_executable(testresample testresample.c) -add_executable(testaudioinfo testaudioinfo.c) +add_sdl_test_executable(checkkeys checkkeys.c) +add_sdl_test_executable(checkkeysthreads checkkeysthreads.c) +add_sdl_test_executable(loopwave NEEDS_RESOURCES loopwave.c testutils.c) +add_sdl_test_executable(loopwavequeue NEEDS_RESOURCES loopwavequeue.c testutils.c) +add_sdl_test_executable(testsurround testsurround.c) +add_sdl_test_executable(testresample NEEDS_RESOURCES testresample.c) +add_sdl_test_executable(testaudioinfo testaudioinfo.c) file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) -add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) -add_executable(testmultiaudio testmultiaudio.c testutils.c) -add_executable(testaudiohotplug testaudiohotplug.c testutils.c) -add_executable(testaudiocapture testaudiocapture.c) -add_executable(testatomic testatomic.c) -add_executable(testintersections testintersections.c) -add_executable(testrelative testrelative.c) -add_executable(testhittesting testhittesting.c) -add_executable(testdraw2 testdraw2.c) -add_executable(testdrawchessboard testdrawchessboard.c) -add_executable(testdropfile testdropfile.c) -add_executable(testerror testerror.c) +add_sdl_test_executable(testautomation NEEDS_RESOURCES ${TESTAUTOMATION_SOURCE_FILES}) +add_sdl_test_executable(testmultiaudio NEEDS_RESOURCES testmultiaudio.c testutils.c) +add_sdl_test_executable(testaudiohotplug NEEDS_RESOURCES testaudiohotplug.c testutils.c) +add_sdl_test_executable(testaudiocapture testaudiocapture.c) +add_sdl_test_executable(testatomic NONINTERACTIVE testatomic.c) +add_sdl_test_executable(testintersections testintersections.c) +add_sdl_test_executable(testrelative testrelative.c) +add_sdl_test_executable(testhittesting testhittesting.c) +add_sdl_test_executable(testdraw2 testdraw2.c) +add_sdl_test_executable(testdrawchessboard testdrawchessboard.c) +add_sdl_test_executable(testdropfile testdropfile.c) +add_sdl_test_executable(testerror NONINTERACTIVE testerror.c) if(LINUX) - add_executable(testevdev testevdev.c) + add_sdl_test_executable(testevdev NONINTERACTIVE testevdev.c) endif() -add_executable(testfile testfile.c) -add_executable(testgamecontroller testgamecontroller.c testutils.c) -add_executable(testgeometry testgeometry.c testutils.c) -add_executable(testgesture testgesture.c) -add_executable(testgl2 testgl2.c) -add_executable(testgles testgles.c) -add_executable(testgles2 testgles2.c) -add_executable(testhaptic testhaptic.c) -add_executable(testhotplug testhotplug.c) -add_executable(testrumble testrumble.c) -add_executable(testthread testthread.c) -add_executable(testiconv testiconv.c testutils.c) -add_executable(testime testime.c testutils.c) -add_executable(testjoystick testjoystick.c) -add_executable(testkeys testkeys.c) -add_executable(testloadso testloadso.c) -add_executable(testlocale testlocale.c) -add_executable(testlock testlock.c) -add_executable(testmouse testmouse.c) +add_sdl_test_executable(testfile testfile.c) +add_sdl_test_executable(testgamecontroller NEEDS_RESOURCES testgamecontroller.c testutils.c) +add_sdl_test_executable(testgeometry testgeometry.c testutils.c) +add_sdl_test_executable(testgesture testgesture.c) +add_sdl_test_executable(testgl2 testgl2.c) +add_sdl_test_executable(testgles testgles.c) +add_sdl_test_executable(testgles2 testgles2.c) +add_sdl_test_executable(testhaptic testhaptic.c) +add_sdl_test_executable(testhotplug testhotplug.c) +add_sdl_test_executable(testrumble testrumble.c) +add_sdl_test_executable(testthread NONINTERACTIVE testthread.c) +add_sdl_test_executable(testiconv NEEDS_RESOURCES testiconv.c testutils.c) +add_sdl_test_executable(testime NEEDS_RESOURCES testime.c testutils.c) +add_sdl_test_executable(testjoystick testjoystick.c) +add_sdl_test_executable(testkeys testkeys.c) +add_sdl_test_executable(testloadso testloadso.c) +add_sdl_test_executable(testlocale NONINTERACTIVE testlocale.c) +add_sdl_test_executable(testlock testlock.c) +add_sdl_test_executable(testmouse testmouse.c) if(APPLE) - add_executable(testnative testnative.c - testnativecocoa.m - testnativex11.c - testutils.c) + add_sdl_test_executable(testnative NEEDS_RESOURCES + testnative.c + testnativecocoa.m + testnativex11.c + testutils.c + ) cmake_push_check_state(RESET) check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) @@ -135,41 +155,41 @@ if(APPLE) set_property(SOURCE "testnativecocoa.m" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-error=deprecated-declarations") endif() elseif(WINDOWS) - add_executable(testnative testnative.c testnativew32.c testutils.c) + add_sdl_test_executable(testnative NEEDS_RESOURCES testnative.c testnativew32.c testutils.c) elseif(HAVE_X11) - add_executable(testnative testnative.c testnativex11.c testutils.c) + add_sdl_test_executable(testnative NEEDS_RESOURCES testnative.c testnativex11.c testutils.c) target_link_libraries(testnative X11) endif() -add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c testutils.c) -add_executable(testplatform testplatform.c) -add_executable(testpower testpower.c) -add_executable(testfilesystem testfilesystem.c) -add_executable(testrendertarget testrendertarget.c testutils.c) -add_executable(testscale testscale.c testutils.c) -add_executable(testsem testsem.c) -add_executable(testsensor testsensor.c) -add_executable(testshader testshader.c) -add_executable(testshape testshape.c) -add_executable(testsprite2 testsprite2.c testutils.c) -add_executable(testspriteminimal testspriteminimal.c testutils.c) -add_executable(teststreaming teststreaming.c testutils.c) -add_executable(testtimer testtimer.c) -add_executable(testurl testurl.c) -add_executable(testver testver.c) -add_executable(testviewport testviewport.c testutils.c) -add_executable(testwm2 testwm2.c) -add_executable(testyuv testyuv.c testyuv_cvt.c) -add_executable(torturethread torturethread.c) -add_executable(testrendercopyex testrendercopyex.c testutils.c) -add_executable(testmessage testmessage.c) -add_executable(testdisplayinfo testdisplayinfo.c) -add_executable(testqsort testqsort.c) -add_executable(testbounds testbounds.c) -add_executable(testcustomcursor testcustomcursor.c) -add_executable(controllermap controllermap.c testutils.c) -add_executable(testvulkan testvulkan.c) -add_executable(testoffscreen testoffscreen.c) +add_sdl_test_executable(testoverlay2 NEEDS_RESOURCES testoverlay2.c testyuv_cvt.c testutils.c) +add_sdl_test_executable(testplatform NONINTERACTIVE testplatform.c) +add_sdl_test_executable(testpower NONINTERACTIVE testpower.c) +add_sdl_test_executable(testfilesystem NONINTERACTIVE testfilesystem.c) +add_sdl_test_executable(testrendertarget NEEDS_RESOURCES testrendertarget.c testutils.c) +add_sdl_test_executable(testscale NEEDS_RESOURCES testscale.c testutils.c) +add_sdl_test_executable(testsem testsem.c) +add_sdl_test_executable(testsensor testsensor.c) +add_sdl_test_executable(testshader NEEDS_RESOURCES testshader.c) +add_sdl_test_executable(testshape NEEDS_RESOURCES testshape.c) +add_sdl_test_executable(testsprite2 NEEDS_RESOURCES testsprite2.c testutils.c) +add_sdl_test_executable(testspriteminimal NEEDS_RESOURCES testspriteminimal.c testutils.c) +add_sdl_test_executable(teststreaming NEEDS_RESOURCES teststreaming.c testutils.c) +add_sdl_test_executable(testtimer NONINTERACTIVE testtimer.c) +add_sdl_test_executable(testurl testurl.c) +add_sdl_test_executable(testver NONINTERACTIVE testver.c) +add_sdl_test_executable(testviewport NEEDS_RESOURCES testviewport.c testutils.c) +add_sdl_test_executable(testwm2 testwm2.c) +add_sdl_test_executable(testyuv NEEDS_RESOURCES testyuv.c testyuv_cvt.c) +add_sdl_test_executable(torturethread torturethread.c) +add_sdl_test_executable(testrendercopyex NEEDS_RESOURCES testrendercopyex.c testutils.c) +add_sdl_test_executable(testmessage testmessage.c) +add_sdl_test_executable(testdisplayinfo testdisplayinfo.c) +add_sdl_test_executable(testqsort NONINTERACTIVE testqsort.c) +add_sdl_test_executable(testbounds testbounds.c) +add_sdl_test_executable(testcustomcursor testcustomcursor.c) +add_sdl_test_executable(controllermap NEEDS_RESOURCES controllermap.c testutils.c) +add_sdl_test_executable(testvulkan testvulkan.c) +add_sdl_test_executable(testoffscreen testoffscreen.c) cmake_push_check_state(RESET) @@ -190,107 +210,15 @@ endif() cmake_pop_check_state() -SET(ALL_TESTS - checkkeys - checkkeysthreads - controllermap - loopwave - loopwavequeue - testatomic - testaudiocapture - testaudiohotplug - testaudioinfo - testautomation - testbounds - testcustomcursor - testdisplayinfo - testdraw2 - testdrawchessboard - testdropfile - testerror - testfile - testfilesystem - testgamecontroller - testgeometry - testgesture - testgl2 - testgles - testgles2 - testhaptic - testhittesting - testhotplug - testiconv - testime - testintersections - testjoystick - testkeys - testloadso - testlocale - testlock - testmessage - testmouse - testmultiaudio - testoffscreen - testoverlay2 - testplatform - testpower - testqsort - testrelative - testrendercopyex - testrendertarget - testresample - testrumble - testscale - testsem - testsensor - testshader - testshape - testsprite2 - testspriteminimal - teststreaming - testsurround - testthread - testtimer - testurl - testver - testviewport - testvulkan - testwm2 - testyuv - torturethread -) - -set(NONINTERACTIVE - testatomic - testerror - testfilesystem - testlocale - testplatform - testpower - testqsort - testthread - testtimer - testver -) - -if(WINDOWS OR APPLE OR SDL_X11) - list(APPEND ALL_TESTS testnative) -endif() - -if(LINUX) - list(APPEND ALL_TESTS testevdev) - list(APPEND NONINTERACTIVE testevdev) -endif() - if(SDL_DUMMYAUDIO) - set(NEEDS_AUDIO + list(APPEND SDL_TESTS_NONINTERACTIVE testaudioinfo testsurround ) endif() if(SDL_DUMMYVIDEO) - set(NEEDS_DISPLAY + list(APPEND SDL_TESTS_NONINTERACTIVE testkeys testbounds testdisplayinfo @@ -304,63 +232,11 @@ endif() file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -if(PSP OR PS2) - set(NEEDS_RESOURCES - testscale - testrendercopyex - controllermap - testyuv - testgamecontroller - testshape - testshader - testspriteminimal - testautomation - testrendertarget - testsprite2 - loopwave - loopwavequeue - testresample - testaudiohotplug - testmultiaudio - testiconv - testoverlay2 - teststreaming - testviewport - ) -else() - set(NEEDS_RESOURCES - testscale - testrendercopyex - controllermap - testyuv - testgamecontroller - testshape - testshader - testspriteminimal - testautomation - testcustomcursor - testrendertarget - testsprite2 - loopwave - loopwavequeue - testresample - testaudiohotplug - testmultiaudio - testime - testiconv - testoverlay2 - teststreaming - testviewport - ) - if(WINDOWS OR APPLE OR HAVE_X11) - list(APPEND NEEDS_RESOURCES testnative) - endif() -endif() if(PSP) # Build EBOOT files if building for PSP set(BUILD_EBOOT - ${NEEDS_RESOURCES} + ${SDL_TESTS_NEEDS_ESOURCES} testatomic testaudiocapture testaudioinfo @@ -438,7 +314,7 @@ if(N3DS) set(ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/romfs") file(COPY ${RESOURCE_FILES} DESTINATION "${ROMFS_DIR}") - foreach(APP IN LISTS ALL_TESTS) + foreach(APP IN LISTS SDL_TEST_EXECUTABLES) get_target_property(TARGET_BINARY_DIR ${APP} BINARY_DIR) set(SMDH_FILE "${TARGET_BINARY_DIR}/${APP}.smdh") ctr_generate_smdh("${SMDH_FILE}" @@ -456,8 +332,8 @@ if(N3DS) endif() if(RISCOS) - set(ALL_TESTS_AIF "") - foreach(APP IN LISTS ALL_TESTS) + set(SDL_TEST_EXECUTABLES_AIF) + foreach(APP IN LISTS SDL_TEST_EXECUTABLES) target_link_options(${APP} PRIVATE -static) add_custom_command( OUTPUT ${APP},ff8 @@ -465,11 +341,11 @@ if(RISCOS) DEPENDS ${APP} ) add_custom_target(${APP}-aif ALL DEPENDS ${APP},ff8) - list(APPEND ALL_TESTS_AIF ${CMAKE_CURRENT_BINARY_DIR}/${APP},ff8) + list(APPEND SDL_TEST_EXECUTABLES_AIF ${CMAKE_CURRENT_BINARY_DIR}/${APP},ff8) endforeach() endif() -foreach(APP IN LISTS NEEDS_RESOURCES) +foreach(APP IN LISTS SDL_TESTS_NEEDS_RESOURCES) foreach(RESOURCE_FILE ${RESOURCE_FILES}) if(PSP OR PS2) add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $/sdl-${APP}) @@ -511,7 +387,7 @@ set(TESTS_ENVIRONMENT SDL_VIDEODRIVER=dummy ) -foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) +foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE}) add_test( NAME ${TESTCASE} COMMAND ${TESTCASE} @@ -535,12 +411,12 @@ endforeach() if(SDL_INSTALL_TESTS) if(RISCOS) install( - FILES ${ALL_TESTS_AIF} + FILES ${SDL_TEST_EXECUTABLES_AIF} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) else() install( - TARGETS ${ALL_TESTS} + TARGETS ${SDL_TEST_EXECUTABLES} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) endif() From cfa76973ff446b3f9a9909be90a140edf3566e42 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 11:33:39 +0100 Subject: [PATCH 355/459] cmake: FindOpenGL.cmake shipped by emscripten does not have OpenGL::GL --- test/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d89be52b0..f358b039b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -226,8 +226,14 @@ if(SDL_DUMMYVIDEO) endif() if(OPENGL_FOUND) - target_link_libraries(testshader OpenGL::GL) - target_link_libraries(testgl2 OpenGL::GL) + if(TARGET OpenGL::GL) + target_link_libraries(testshader OpenGL::GL) + target_link_libraries(testgl2 OpenGL::GL) + else() + # emscripten's FindOpenGL.cmake does not create OpenGL::GL + target_link_libraries(testshader ${OPENGL_gl_LIBRARY}) + target_link_libraries(testgl2 ${OPENGL_gl_LIBRARY}) + endif() endif() file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) From 500bac0b1350f6bec536ddcaf1da0d8149b33c6a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:06:39 +0100 Subject: [PATCH 356/459] cmake: include FIndPkgConfig.cmake through find_package --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3103b01f4..9f3567c41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,9 +67,10 @@ include(CheckCXXCompilerFlag) include(CheckStructHasMember) include(CMakeDependentOption) include(CMakePushCheckState) -include(FindPkgConfig) include(GNUInstallDirs) +find_package(PkgConfig) + list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) From 6e46090a303ffc2d4c9b830304df13a05eb1e58b Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:08:38 +0100 Subject: [PATCH 357/459] cmake: check ALL headers inside the look (including sys/types.h) --- CMakeLists.txt | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f3567c41..51595bc51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1004,12 +1004,30 @@ if(SDL_LIBC) set(STDC_HEADERS 1) else() set(HAVE_LIBC TRUE) - check_include_file(sys/types.h HAVE_SYS_TYPES_H) - foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h - strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) + set(headers_to_check + ctype.h + float.h + iconv.h + inttypes.h + libunwind + limits.h + malloc.h + math.h + memory.h + signal.h + stdarg.h + stddef.h + stdint.h + stdio.h + stdlib.h + string.h + strings.h + sys/types.h + wchar.h + ) + foreach(_HEADER ${headers_to_check}) string(TOUPPER "HAVE_${_HEADER}" _UPPER) - string(REPLACE "." "_" _HAVE_H ${_UPPER}) + string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) endforeach() check_include_file(linux/input.h HAVE_LINUX_INPUT_H) From 55384db8a628b4c3958004977257c9ee9112a17d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:09:29 +0100 Subject: [PATCH 358/459] cmake: emscripten has libunwind.h, libunwind.a has missing symbols --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51595bc51..4eec086ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1009,7 +1009,6 @@ if(SDL_LIBC) float.h iconv.h inttypes.h - libunwind limits.h malloc.h math.h @@ -1025,6 +1024,9 @@ if(SDL_LIBC) sys/types.h wchar.h ) + if(NOT EMSCRIPTEN) + list(APPEND headers_to_check libunwind.h) + endif() foreach(_HEADER ${headers_to_check}) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER}) @@ -1399,6 +1401,10 @@ elseif(EMSCRIPTEN) CheckPTHREAD() + if(HAVE_LIBUNWIND_H) + list(APPEND EXTRA_TEST_LIBS unwind) + endif() + elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) From a71e558d85ddd2fe0d20ca18a1c1c54955485ca7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:09:52 +0100 Subject: [PATCH 359/459] cmake: testshader needs -sLEGACY_GL_EMULATION on Emscripten --- test/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f358b039b..c608f47b1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -235,6 +235,9 @@ if(OPENGL_FOUND) target_link_libraries(testgl2 ${OPENGL_gl_LIBRARY}) endif() endif() +if(EMSCRIPTEN) + target_link_libraries(testshader -sLEGACY_GL_EMULATION) +endif() file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) From d8884b845ecad6985b0551d3bd2d4295a6d0c42a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:10:46 +0100 Subject: [PATCH 360/459] emscripten: fix warnings in tests --- test/loopwave.c | 3 ++- test/testgles2.c | 2 ++ test/testoffscreen.c | 4 ++++ test/testviewport.c | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/loopwave.c b/test/loopwave.c index 354ac2cb7..1b5fa95f0 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -70,12 +70,13 @@ open_audio() SDL_PauseAudioDevice(device, SDL_FALSE); } +#ifndef __EMSCRIPTEN__ static void reopen_audio() { close_audio(); open_audio(); } - +#endif void SDLCALL fillerup(void *unused, Uint8 * stream, int len) diff --git a/test/testgles2.c b/test/testgles2.c index b5c0ec883..721c24b7f 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -472,6 +472,7 @@ render_window(int index) ++frames; } +#ifndef __EMSCRIPTEN__ static int SDLCALL render_thread_fn(void* render_ctx) { @@ -512,6 +513,7 @@ loop_threaded() SDLTest_CommonEvent(state, &event, &done); } } +#endif static void loop() diff --git a/test/testoffscreen.c b/test/testoffscreen.c index e5fd72107..e2a8f4b68 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -100,7 +100,9 @@ loop() int main(int argc, char *argv[]) { +#ifndef __EMSCRIPTEN__ Uint32 then, now, frames; +#endif /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -135,10 +137,12 @@ main(int argc, char *argv[]) srand((unsigned int)time(NULL)); +#ifndef __EMSCRIPTEN__ /* Main render loop */ frames = 0; then = SDL_GetTicks(); done = 0; +#endif SDL_Log("Rendering %u frames offscreen\n", max_frames); diff --git a/test/testviewport.c b/test/testviewport.c index 162b31069..ad5faf77a 100644 --- a/test/testviewport.c +++ b/test/testviewport.c @@ -99,14 +99,14 @@ DrawOnViewport(SDL_Renderer * renderer) void loop() { + SDL_Event event; + int i; #ifdef __EMSCRIPTEN__ /* Avoid using delays */ if(SDL_GetTicks() - wait_start < 1000) return; wait_start = SDL_GetTicks(); #endif - SDL_Event event; - int i; /* Check for events */ while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); From a22fcf77fd9729504ba7ab26198a3707b7d72780 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 13:40:19 +0100 Subject: [PATCH 361/459] cmake: older emscripten releases have a broken FindOpenGL.cmake This is fixed since 3.1.10: https://github.com/emscripten-core/emscripten/commit/485a7b4d6f84d4bc3b594ff81d39b6b143c8d598#diff-034f4d123f23ec5493d0fbf28cba1c36e404a991f286c8d031a22799e4e8b0e5 --- test/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c608f47b1..a396ad54c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -230,6 +230,9 @@ if(OPENGL_FOUND) target_link_libraries(testshader OpenGL::GL) target_link_libraries(testgl2 OpenGL::GL) else() + if(EMSCRIPTEN AND OPENGL_gl_LIBRARY STREQUAL "nul") + set(OPENGL_gl_LIBRARY GL) + endif() # emscripten's FindOpenGL.cmake does not create OpenGL::GL target_link_libraries(testshader ${OPENGL_gl_LIBRARY}) target_link_libraries(testgl2 ${OPENGL_gl_LIBRARY}) From 819b0143e3b576c0dda39a31d1d560446dc88e76 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 10:42:57 +0100 Subject: [PATCH 362/459] cmake: enable SDL_TEST by default for emscripten --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eec086ab..484220f1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,7 +383,6 @@ if(EMSCRIPTEN) set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) - set(SDL_TEST_ENABLED_BY_DEFAULT OFF) endif() if(VITA OR PSP OR PS2 OR N3DS) From 2e47016b01a77c33134a330089fcf2d41838b162 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 15:28:57 +0100 Subject: [PATCH 363/459] ci: use Ninja generator in hop of accelerating the build --- .github/workflows/emscripten.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 5f41cb53d..bb8a134d4 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -10,6 +10,10 @@ jobs: - uses: mymindstorm/setup-emsdk@v10 with: version: 2.0.32 + - name: Install ninja + run: | + sudo apt-get -y update + sudo apt-get install -y ninja-build - name: Configure CMake run: | emcmake cmake -S . -B build \ @@ -17,7 +21,8 @@ jobs: -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix + -DCMAKE_INSTALL_PREFIX=prefix \ + -GNinja - name: Build run: cmake --build build/ --verbose - name: Run build-time tests From 55534e277ef81a917f6b78b680faac7b498e89c8 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 1 Nov 2022 15:39:13 +0100 Subject: [PATCH 364/459] cmake: add time out to tests to avoid ci timeouts --- test/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a396ad54c..676a8e791 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -405,9 +405,10 @@ foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE}) COMMAND ${TESTCASE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - set_tests_properties( - ${TESTCASE} - PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" + set_tests_properties(${TESTCASE} + PROPERTIES + ENVIRONMENT "${TESTS_ENVIRONMENT}" + TIMEOUT 10 ) if(SDL_INSTALL_TESTS) set(exe ${TESTCASE}) @@ -420,6 +421,9 @@ foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE}) endif() endforeach() +set_tests_properties(testthread PROPERTIES TIMEOUT 40) +set_tests_properties(testtimer PROPERTIES TIMEOUT 60) + if(SDL_INSTALL_TESTS) if(RISCOS) install( From 81fd45f723be5ba7765901ee0d794c6b21ac2dd8 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 16 Nov 2022 15:13:04 +0100 Subject: [PATCH 365/459] ci: Disable emscripten build time tests --- .github/workflows/emscripten.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index bb8a134d4..56f77b6ce 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -29,7 +29,8 @@ jobs: run: | set -eu export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ + # FIXME: enable Emscripten build time tests + # ctest -VV --test-dir build/ - name: Install run: | echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV From 6801d676c0ce09e168195ec024e0d7033138b73f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 09:52:33 -0500 Subject: [PATCH 366/459] Revert "pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small." This reverts commit d8b1ef42aee52dad4ac3de69795ca2e8d2fd7704. This turned out to be unnecessary (it was a problem on the user's system, not an SDL bug). Reference Issue #6121. --- src/audio/pulseaudio/SDL_pulseaudio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 9934a5626..288c3d98a 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -630,13 +630,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname) paattr.prebuf = -1; paattr.maxlength = -1; paattr.minreq = -1; - - /* don't let this change the global device's latency if the number is - extremely small, as it will affect other applications. Without this - flag, it only affects this specific stream. */ - if (this->spec.samples >= 512) { - flags |= PA_STREAM_ADJUST_LATENCY; - } + flags |= PA_STREAM_ADJUST_LATENCY; if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { return SDL_SetError("Could not connect to PulseAudio server"); From 9d67686a5b9ceec998e65f63ab60f29687cbc340 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 10:08:40 -0500 Subject: [PATCH 367/459] haptic: Deal with deprecated macOS symbol. --- src/haptic/darwin/SDL_syshaptic.c | 2 +- src/haptic/darwin/SDL_syshaptic_c.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c index 1141bec76..50905e19c 100644 --- a/src/haptic/darwin/SDL_syshaptic.c +++ b/src/haptic/darwin/SDL_syshaptic.c @@ -167,7 +167,7 @@ SDL_SYS_HapticInit(void) } /* Now search I/O Registry for matching devices. */ - result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter); + result = IOServiceGetMatchingServices(kIOMainPortDefault, match, &iter); if (result != kIOReturnSuccess) { return SDL_SetError("Haptic: Couldn't create a HID object iterator."); } diff --git a/src/haptic/darwin/SDL_syshaptic_c.h b/src/haptic/darwin/SDL_syshaptic_c.h index f7f890a7c..5f68a6d63 100644 --- a/src/haptic/darwin/SDL_syshaptic_c.h +++ b/src/haptic/darwin/SDL_syshaptic_c.h @@ -19,6 +19,14 @@ 3. This notice may not be removed or altered from any source distribution. */ +/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ +#if MACOSX_COREAUDIO +#include +#ifndef MAC_OS_VERSION_12_0 +#define kIOMainPortDefault kIOMasterPortDefault +#endif +#endif + extern int MacHaptic_MaybeAddDevice( io_object_t device ); extern int MacHaptic_MaybeRemoveDevice( io_object_t device ); From 1fd66cc890a4cc16d23e34982f6600d403e7a74f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 10:15:21 -0500 Subject: [PATCH 368/459] Revert "cocoa: Backed out CVDisplayLink code for macOS vsync." This reverts commit 04b50f6c6bef67b744b192c78775771b51ff2141. It turns out OpenGL vsync has broken again in macOS 12, so we're reintroducing our CVDisplayLink code to deal with it, again. Reference Issue #4918. --- src/video/cocoa/SDL_cocoaopengl.h | 7 ++- src/video/cocoa/SDL_cocoaopengl.m | 96 +++++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 24 deletions(-) diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index 0f9b1c7f0..a483ac08a 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/video/cocoa/SDL_cocoaopengl.h @@ -42,6 +42,11 @@ struct SDL_GLDriverData @interface SDLOpenGLContext : NSOpenGLContext { SDL_atomic_t dirty; SDL_Window *window; + CVDisplayLinkRef displayLink; + @public SDL_mutex *swapIntervalMutex; + @public SDL_cond *swapIntervalCond; + @public SDL_atomic_t swapIntervalSetting; + @public SDL_atomic_t swapIntervalsPassed; } - (id)initWithFormat:(NSOpenGLPixelFormat *)format @@ -51,7 +56,7 @@ struct SDL_GLDriverData - (void)setWindow:(SDL_Window *)window; - (SDL_Window*)window; - (void)explicitUpdate; - +- (void)dealloc; @end /* OpenGL functions */ diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 8aab0c4cb..af17ae228 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -52,6 +52,23 @@ SDL_OpenGLAsyncDispatchChanged(void *userdata, const char *name, const char *old SDL_opengl_async_dispatch = SDL_GetStringBoolean(hint, SDL_FALSE); } +static CVReturn +DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext) +{ + SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *) displayLinkContext; + + /*printf("DISPLAY LINK! %u\n", (unsigned int) SDL_GetTicks()); */ + const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting); + if (setting != 0) { /* nothing to do if vsync is disabled, don't even lock */ + SDL_LockMutex(nscontext->swapIntervalMutex); + SDL_AtomicAdd(&nscontext->swapIntervalsPassed, 1); + SDL_CondSignal(nscontext->swapIntervalCond); + SDL_UnlockMutex(nscontext->swapIntervalMutex); + } + + return kCVReturnSuccess; +} + @implementation SDLOpenGLContext : NSOpenGLContext - (id)initWithFormat:(NSOpenGLPixelFormat *)format @@ -61,6 +78,19 @@ SDL_OpenGLAsyncDispatchChanged(void *userdata, const char *name, const char *old if (self) { SDL_AtomicSet(&self->dirty, 0); self->window = NULL; + SDL_AtomicSet(&self->swapIntervalSetting, 0); + SDL_AtomicSet(&self->swapIntervalsPassed, 0); + self->swapIntervalCond = SDL_CreateCond(); + self->swapIntervalMutex = SDL_CreateMutex(); + if (!self->swapIntervalCond || !self->swapIntervalMutex) { + return nil; + } + + /* !!! FIXME: check return values. */ + CVDisplayLinkCreateWithActiveCGDisplays(&self->displayLink); + CVDisplayLinkSetOutputCallback(self->displayLink, &DisplayLinkCallback, (__bridge void * _Nullable) self); + CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [format CGLPixelFormatObj]); + CVDisplayLinkStart(displayLink); } SDL_AddHintCallback(SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, SDL_OpenGLAsyncDispatchChanged, NULL); @@ -158,6 +188,15 @@ SDL_OpenGLAsyncDispatchChanged(void *userdata, const char *name, const char *old - (void)dealloc { SDL_DelHintCallback(SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, SDL_OpenGLAsyncDispatchChanged, NULL); + if (self->displayLink) { + CVDisplayLinkRelease(self->displayLink); + } + if (self->swapIntervalCond) { + SDL_DestroyCond(self->swapIntervalCond); + } + if (self->swapIntervalMutex) { + SDL_DestroyMutex(self->swapIntervalMutex); + } } @end @@ -211,6 +250,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) int glversion_major; int glversion_minor; NSOpenGLPixelFormatAttribute profile; + int interval; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { #if SDL_VIDEO_OPENGL_EGL @@ -318,6 +358,10 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) sdlcontext = (SDL_GLContext)CFBridgingRetain(context); + /* vsync is handled separately by synchronizing with a display link. */ + interval = 0; + [context setValues:&interval forParameter:NSOpenGLCPSwapInterval]; + if ( Cocoa_GL_MakeCurrent(_this, window, (__bridge SDL_GLContext)context) < 0 ) { Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError("Failed making OpenGL context current"); @@ -389,21 +433,17 @@ int Cocoa_GL_SetSwapInterval(_THIS, int interval) { @autoreleasepool { - NSOpenGLContext *nscontext; - GLint value; + SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *) SDL_GL_GetCurrentContext(); int status; - if (interval < 0) { /* no extension for this on Mac OS X at the moment. */ - return SDL_SetError("Late swap tearing currently unsupported"); - } - - nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); - if (nscontext != nil) { - value = interval; - [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval]; - status = 0; - } else { + if (nscontext == nil) { status = SDL_SetError("No current OpenGL context"); + } else { + SDL_LockMutex(nscontext->swapIntervalMutex); + SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); + SDL_AtomicSet(&nscontext->swapIntervalSetting, interval); + SDL_UnlockMutex(nscontext->swapIntervalMutex); + status = 0; } return status; @@ -413,17 +453,8 @@ int Cocoa_GL_GetSwapInterval(_THIS) { @autoreleasepool { - NSOpenGLContext *nscontext; - GLint value; - int status = 0; - - nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); - if (nscontext != nil) { - [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval]; - status = (int)value; - } - - return status; + SDLOpenGLContext* nscontext = (__bridge SDLOpenGLContext*)SDL_GL_GetCurrentContext(); + return nscontext ? SDL_AtomicGet(&nscontext->swapIntervalSetting) : 0; }} int @@ -432,6 +463,25 @@ Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { SDLOpenGLContext* nscontext = (__bridge SDLOpenGLContext*)SDL_GL_GetCurrentContext(); SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; + const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting); + + if (setting == 0) { + /* nothing to do if vsync is disabled, don't even lock */ + } else if (setting < 0) { /* late swap tearing */ + SDL_LockMutex(nscontext->swapIntervalMutex); + while (SDL_AtomicGet(&nscontext->swapIntervalsPassed) == 0) { + SDL_CondWait(nscontext->swapIntervalCond, nscontext->swapIntervalMutex); + } + SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); + SDL_UnlockMutex(nscontext->swapIntervalMutex); + } else { + SDL_LockMutex(nscontext->swapIntervalMutex); + do { /* always wait here so we know we just hit a swap interval. */ + SDL_CondWait(nscontext->swapIntervalCond, nscontext->swapIntervalMutex); + } while ((SDL_AtomicGet(&nscontext->swapIntervalsPassed) % setting) != 0); + SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); + SDL_UnlockMutex(nscontext->swapIntervalMutex); + } /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two threads try to swap at the same time, so put a mutex around it. */ From 7c760f7f79f65cc628fc43db9d507f051475a43f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 11:32:08 -0500 Subject: [PATCH 369/459] cocoa: Update CVDisplayLink timing when screen changes. This handles both the window moving to a new display and changing the current display's refresh rate in System Preferences Reference Issue #4918. --- src/video/cocoa/SDL_cocoaopengl.h | 1 + src/video/cocoa/SDL_cocoaopengl.m | 9 +++++++++ src/video/cocoa/SDL_cocoawindow.h | 1 + src/video/cocoa/SDL_cocoawindow.m | 12 ++++++++++++ 4 files changed, 23 insertions(+) diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index a483ac08a..7b900dee6 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/video/cocoa/SDL_cocoaopengl.h @@ -53,6 +53,7 @@ struct SDL_GLDriverData shareContext:(NSOpenGLContext *)share; - (void)scheduleUpdate; - (void)updateIfNeeded; +- (void)movedToNewScreen; - (void)setWindow:(SDL_Window *)window; - (SDL_Window*)window; - (void)explicitUpdate; diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index af17ae228..607f30716 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -97,6 +97,13 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const return self; } +- (void)movedToNewScreen +{ + if (self->displayLink) { + CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [[self pixelFormat] CGLPixelFormatObj]); + } +} + - (void)scheduleUpdate { SDL_AtomicAdd(&self->dirty, 1); @@ -483,6 +490,8 @@ Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) SDL_UnlockMutex(nscontext->swapIntervalMutex); } + /*{ static Uint64 prev = 0; const Uint64 now = SDL_GetTicks64(); const unsigned int diff = (unsigned int) (now - prev); prev = now; printf("GLSWAPBUFFERS TICKS %u\n", diff); }*/ + /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two threads try to swap at the same time, so put a mutex around it. */ SDL_LockMutex(videodata.swaplock); diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index cd76b0cd9..18f7d8587 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -85,6 +85,7 @@ typedef enum -(void) windowDidResignKey:(NSNotification *) aNotification; -(void) windowDidChangeBackingProperties:(NSNotification *) aNotification; -(void) windowDidChangeScreenProfile:(NSNotification *) aNotification; +-(void) windowDidChangeScreen:(NSNotification *) aNotification; -(void) windowWillEnterFullScreen:(NSNotification *) aNotification; -(void) windowDidEnterFullScreen:(NSNotification *) aNotification; -(void) windowWillExitFullScreen:(NSNotification *) aNotification; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index eea7f981a..05cdcbcbd 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -500,6 +500,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; [center addObserver:self selector:@selector(windowDidChangeScreenProfile:) name:NSWindowDidChangeScreenProfileNotification object:window]; + [center addObserver:self selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification object:window]; [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; @@ -632,6 +633,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) [center removeObserver:self name:NSWindowDidResignKeyNotification object:window]; [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; [center removeObserver:self name:NSWindowDidChangeScreenProfileNotification object:window]; + [center removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; @@ -920,6 +922,16 @@ Cocoa_UpdateClipCursor(SDL_Window * window) SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); } +- (void)windowDidChangeScreen:(NSNotification *)aNotification +{ + /*printf("WINDOWDIDCHANGESCREEN\n");*/ + if (_data && _data.nscontexts) { + for (SDLOpenGLContext *context in _data.nscontexts) { + [context movedToNewScreen]; + } + } +} + - (void)windowWillEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data.window; From 7ebdae5dc977b9605ae196bfafa9336b316c739a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 11:45:41 -0500 Subject: [PATCH 370/459] cocoa: Fix OpenGL deprecation warning. --- src/video/cocoa/SDL_cocoawindow.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 05cdcbcbd..ddf2fc9f5 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -260,12 +260,6 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_WindowData *data) { - NSOpenGLContext *currentContext; - NSMutableArray *contexts; - if (!data || !data.nscontexts) { - return; - } - /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ #if SDL_VIDEO_OPENGL @@ -274,6 +268,12 @@ ScheduleContextUpdates(SDL_WindowData *data) #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif + NSOpenGLContext *currentContext; + NSMutableArray *contexts; + if (!data || !data.nscontexts) { + return; + } + currentContext = [NSOpenGLContext currentContext]; contexts = data.nscontexts; @synchronized (contexts) { From ec58a817ef66efc23d7d6e964844317673b23ead Mon Sep 17 00:00:00 2001 From: ulatekh Date: Wed, 5 Oct 2022 19:26:09 -0700 Subject: [PATCH 371/459] Fixes made in response to running a static code analyzer under MS Windows. Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs. SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision. SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer. SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used. SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range. SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it. SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691). SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen. SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL. SDL_pixels.c: Looks like the switch is genuinely missing a break! SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons. SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns. --- src/SDL.c | 15 ++++++++------- src/SDL_hints.c | 6 +++--- src/audio/SDL_audiocvt.c | 3 ++- src/core/windows/SDL_immdevice.c | 4 +++- src/events/SDL_events.c | 12 ++++++------ src/joystick/SDL_gamecontroller.c | 2 +- src/joystick/SDL_joystick.c | 2 +- src/joystick/hidapi/SDL_hidapi_shield.c | 3 ++- src/joystick/windows/SDL_dinputjoystick.c | 1 + src/render/software/SDL_render_sw.c | 14 +++++++------- src/stdlib/SDL_malloc.c | 2 +- src/video/SDL_pixels.c | 1 + src/video/SDL_rect_impl.h | 2 ++ src/video/SDL_video.c | 8 ++++---- src/video/SDL_yuv.c | 7 ++++--- src/video/windows/SDL_windowskeyboard.c | 10 +++++++++- src/video/windows/SDL_windowswindow.c | 12 ++++++++---- 17 files changed, 63 insertions(+), 41 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 67db48c3b..42ebc2cfc 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -125,8 +125,9 @@ static void SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - ++SDL_SubsystemRefCount[subsystem_index]; + SDL_assert(subsystem_index < 0 || SDL_SubsystemRefCount[subsystem_index] < 255); + if (subsystem_index >= 0) + ++SDL_SubsystemRefCount[subsystem_index]; } /* Private helper to decrement a subsystem's ref counter. */ @@ -134,7 +135,7 @@ static void SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] > 0) { + if (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] > 0) { --SDL_SubsystemRefCount[subsystem_index]; } } @@ -144,22 +145,22 @@ static SDL_bool SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; + SDL_assert(subsystem_index < 0 || SDL_SubsystemRefCount[subsystem_index] < 255); + return (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ static SDL_bool SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] == 0) { + if (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 0) { return SDL_FALSE; } /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; + return ((subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 1) || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 4f2f5f61d..4341f8d20 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -112,7 +112,7 @@ SDL_ResetHint(const char *name) if (SDL_strcmp(name, hint->name) == 0) { if ((env == NULL && hint->value != NULL) || (env != NULL && hint->value == NULL) || - (env && SDL_strcmp(env, hint->value) != 0)) { + (env != NULL && SDL_strcmp(env, hint->value) != 0)) { for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -140,7 +140,7 @@ SDL_ResetHints(void) env = SDL_getenv(hint->name); if ((env == NULL && hint->value != NULL) || (env != NULL && hint->value == NULL) || - (env && SDL_strcmp(env, hint->value) != 0)) { + (env != NULL && SDL_strcmp(env, hint->value) != 0)) { for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -169,7 +169,7 @@ SDL_GetHint(const char *name) env = SDL_getenv(name); for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { - if (!env || hint->priority == SDL_HINT_OVERRIDE) { + if (env == NULL || hint->priority == SDL_HINT_OVERRIDE) { return hint->value; } break; diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 0884fa373..196013e11 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -403,7 +403,8 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) cvt->len_mult *= mult; cvt->len_ratio *= mult; } else if (src_bitsize > dst_bitsize) { - cvt->len_ratio /= (src_bitsize / dst_bitsize); + const int div = (src_bitsize / dst_bitsize); + cvt->len_ratio /= div; } retval = 1; /* added a converter. */ } diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c index 0a00a6d02..335596d95 100644 --- a/src/core/windows/SDL_immdevice.c +++ b/src/core/windows/SDL_immdevice.c @@ -399,7 +399,9 @@ static int SDLCALL sort_endpoints(const void *_a, const void *_b) { LPWSTR a = ((const EndpointItem *)_a)->devid; LPWSTR b = ((const EndpointItem *)_b)->devid; - if (!a && b) { + if (!a && !b) { + return 0; + } else if (!a && b) { return -1; } else if (a && !b) { return 1; diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 52b72cd22..9ba5e44b8 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -147,7 +147,7 @@ SDL_AutoUpdateSensorsChanged(void *userdata, const char *name, const char *oldVa static void SDLCALL SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - SDL_EventState(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE) ? SDL_ENABLE : SDL_DISABLE); + (void)SDL_EventState(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE) ? SDL_ENABLE : SDL_DISABLE); } /** @@ -566,12 +566,12 @@ SDL_StartEventLoop(void) #endif /* !SDL_THREADS_DISABLED */ /* Process most event types */ - SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); - SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); - SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); + (void)SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); + (void)SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); + (void)SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); #if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */ - SDL_EventState(SDL_DROPFILE, SDL_DISABLE); - SDL_EventState(SDL_DROPTEXT, SDL_DISABLE); + (void)SDL_EventState(SDL_DROPFILE, SDL_DISABLE); + (void)SDL_EventState(SDL_DROPTEXT, SDL_DISABLE); #endif SDL_EventQ.active = SDL_TRUE; diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 2bb97657b..26979a2ff 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -3009,7 +3009,7 @@ SDL_GameControllerEventState(int state) break; default: for (i = 0; i < SDL_arraysize(event_list); ++i) { - SDL_EventState(event_list[i], state); + (void)SDL_EventState(event_list[i], state); } break; } diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index c6d2bf393..4b9558145 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1798,7 +1798,7 @@ SDL_JoystickEventState(int state) break; default: for (i = 0; i < SDL_arraysize(event_list); ++i) { - SDL_EventState(event_list[i], state); + (void)SDL_EventState(event_list[i], state); } break; } diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c index 1d54676b8..557ca45ab 100644 --- a/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/src/joystick/hidapi/SDL_hidapi_shield.c @@ -169,7 +169,8 @@ HIDAPI_DriverShield_SendCommand(SDL_HIDAPI_Device *device, Uint8 cmd, const void } /* Zero unused data in the payload */ - SDL_memset(&cmd_pkt.payload[size], 0, sizeof(cmd_pkt.payload) - size); + if (size != sizeof(cmd_pkt.payload)) + SDL_memset(&cmd_pkt.payload[size], 0, sizeof(cmd_pkt.payload) - size); if (SDL_HIDAPI_SendRumbleAndUnlock(device, (Uint8*)&cmd_pkt, sizeof(cmd_pkt)) != sizeof(cmd_pkt)) { return SDL_SetError("Couldn't send command packet"); diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 2f0605370..9c5a46bd0 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -329,6 +329,7 @@ QueryDeviceInfo(LPDIRECTINPUTDEVICE8 device, Uint16* vendor_id, Uint16* product_ dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); dipdw.diph.dwObj = 0; dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = 0; if (FAILED(IDirectInputDevice8_GetProperty(device, DIPROP_VIDPID, &dipdw.diph))) { return SDL_FALSE; diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 874f92b33..6ba77d46e 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -733,7 +733,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -760,7 +760,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -787,7 +787,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -815,7 +815,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { dstrect->x += drawstate.viewport->x; dstrect->y += drawstate.viewport->y; } @@ -873,7 +873,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { copydata->dstrect.x += drawstate.viewport->x; copydata->dstrect.y += drawstate.viewport->y; } @@ -901,7 +901,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { SDL_Point vp; vp.x = drawstate.viewport->x; vp.y = drawstate.viewport->y; @@ -924,7 +924,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic GeometryFillData *ptr = (GeometryFillData *) verts; /* Apply viewport */ - if (drawstate.viewport->x || drawstate.viewport->y) { + if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { SDL_Point vp; vp.x = drawstate.viewport->x; vp.y = drawstate.viewport->y; diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index ebafb66cf..de02b5eef 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -2580,7 +2580,7 @@ init_mparams(void) #else /* (FOOTERS && !INSECURE) */ s = (size_t) 0x58585858U; #endif /* (FOOTERS && !INSECURE) */ - ACQUIRE_MAGIC_INIT_LOCK(); + (void)ACQUIRE_MAGIC_INIT_LOCK(); if (mparams.magic == 0) { mparams.magic = s; /* Set up lock for main malloc area */ diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c index 1646d844f..654453278 100644 --- a/src/video/SDL_pixels.c +++ b/src/video/SDL_pixels.c @@ -436,6 +436,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, return SDL_PIXELFORMAT_RGB24; #endif } + break; case 32: if (Rmask == 0) { return SDL_PIXELFORMAT_RGB888; diff --git a/src/video/SDL_rect_impl.h b/src/video/SDL_rect_impl.h index 993bb8eb0..26a54484a 100644 --- a/src/video/SDL_rect_impl.h +++ b/src/video/SDL_rect_impl.h @@ -400,9 +400,11 @@ SDL_INTERSECTRECTANDLINE(const RECTTYPE * rect, SCALARTYPE *X1, SCALARTYPE *Y1, outcode1 = COMPUTEOUTCODE(rect, x, y); } else { if (outcode2 & CODE_TOP) { + SDL_assert(y2 != y1); /* if equal: division by zero. */ y = recty1; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); } else if (outcode2 & CODE_BOTTOM) { + SDL_assert(y2 != y1); /* if equal: division by zero. */ y = recty2; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); } else if (outcode2 & CODE_LEFT) { diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index c75b026d9..1ac9165ad 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4337,8 +4337,8 @@ SDL_StartTextInput(void) SDL_Window *window; /* First, enable text events */ - SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); - SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); + (void)SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); + (void)SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); /* Then show the on-screen keyboard, if any */ window = SDL_GetFocusWindow(); @@ -4393,8 +4393,8 @@ SDL_StopTextInput(void) } /* Finally disable text events */ - SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); - SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); + (void)SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); + (void)SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); } void diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c index 50395ff48..b163216b9 100644 --- a/src/video/SDL_yuv.c +++ b/src/video/SDL_yuv.c @@ -601,9 +601,10 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr Uint8 *plane_interleaved_uv; Uint32 y_stride, uv_stride, y_skip, uv_skip; - GetYUVPlanes(width, height, dst_format, dst, dst_pitch, - (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, - &y_stride, &uv_stride); + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, + &y_stride, &uv_stride) != 0) + return -1; plane_interleaved_uv = (plane_y + height * y_stride); y_skip = (y_stride - width); diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 4f288c77a..3a9988deb 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -389,13 +389,21 @@ WIN_ShouldShowNativeUI() static void IME_Init(SDL_VideoData *videodata, HWND hwnd) { + HRESULT hResult = S_OK; + if (videodata->ime_initialized) return; videodata->ime_hwnd_main = hwnd; if (SUCCEEDED(WIN_CoInitialize())) { videodata->ime_com_initialized = SDL_TRUE; - CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr); + hResult = CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr); + if (hResult != S_OK) + { + videodata->ime_available = SDL_FALSE; + SDL_SetError("CoCreateInstance() failed, HRESULT is %08X", (unsigned int)hResult); + return; + } } videodata->ime_initialized = SDL_TRUE; videodata->ime_himm32 = SDL_LoadObject("imm32.dll"); diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 488b6fe1a..d74f1dda7 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -739,15 +739,18 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ - GetClientRect(hwnd, &rcClient); - GetWindowRect(hwnd, &rcWindow); + if (!GetClientRect(hwnd, &rcClient)) + SDL_SetError("GetClientRect() failed, error %08X", (unsigned int)GetLastError()); + if (!GetWindowRect(hwnd, &rcWindow)) + SDL_SetError("GetWindowRect() failed, error %08X", (unsigned int)GetLastError()); /* convert the top/left values to make them relative to * the window; they will end up being slightly negative */ ptDiff.y = rcWindow.top; ptDiff.x = rcWindow.left; - ScreenToClient(hwnd, &ptDiff); + if (!ScreenToClient(hwnd, &ptDiff)) + SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); rcWindow.top = ptDiff.y; rcWindow.left = ptDiff.x; @@ -757,7 +760,8 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b ptDiff.y = rcWindow.bottom; ptDiff.x = rcWindow.right; - ScreenToClient(hwnd, &ptDiff); + if (!ScreenToClient(hwnd, &ptDiff)) + SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); rcWindow.bottom = ptDiff.y; rcWindow.right = ptDiff.x; From 389ffab733b9e875125313e68ad66be9734223ed Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 12:53:48 -0500 Subject: [PATCH 372/459] Code style fixes, etc. Reference PR #6345. --- src/SDL.c | 25 +++++++++++++------------ src/joystick/hidapi/SDL_hidapi_shield.c | 3 ++- src/video/SDL_yuv.c | 4 +++- src/video/windows/SDL_windowskeyboard.c | 3 +-- src/video/windows/SDL_windowswindow.c | 21 +++++++++++++-------- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 42ebc2cfc..6297159e4 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -124,18 +124,19 @@ static Uint8 SDL_SubsystemRefCount[ 32 ]; static void SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(subsystem_index < 0 || SDL_SubsystemRefCount[subsystem_index] < 255); - if (subsystem_index >= 0) + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert((subsystem_index < 0) || (SDL_SubsystemRefCount[subsystem_index] < 255)); + if (subsystem_index >= 0) { ++SDL_SubsystemRefCount[subsystem_index]; + } } /* Private helper to decrement a subsystem's ref counter. */ static void SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] > 0) { + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] > 0)) { --SDL_SubsystemRefCount[subsystem_index]; } } @@ -144,23 +145,23 @@ SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) static SDL_bool SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(subsystem_index < 0 || SDL_SubsystemRefCount[subsystem_index] < 255); - return (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert((subsystem_index < 0) || (SDL_SubsystemRefCount[subsystem_index] < 255)); + return ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 0)) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ static SDL_bool SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 0) { - return SDL_FALSE; + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 0)) { + return SDL_FALSE; } /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return ((subsystem_index >= 0 && SDL_SubsystemRefCount[subsystem_index] == 1) || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; + return (((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 1)) || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c index 557ca45ab..4fe00901c 100644 --- a/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/src/joystick/hidapi/SDL_hidapi_shield.c @@ -169,8 +169,9 @@ HIDAPI_DriverShield_SendCommand(SDL_HIDAPI_Device *device, Uint8 cmd, const void } /* Zero unused data in the payload */ - if (size != sizeof(cmd_pkt.payload)) + if (size != sizeof(cmd_pkt.payload)) { SDL_memset(&cmd_pkt.payload[size], 0, sizeof(cmd_pkt.payload) - size); + } if (SDL_HIDAPI_SendRumbleAndUnlock(device, (Uint8*)&cmd_pkt, sizeof(cmd_pkt)) != sizeof(cmd_pkt)) { return SDL_SetError("Couldn't send command packet"); diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c index b163216b9..38cf9e733 100644 --- a/src/video/SDL_yuv.c +++ b/src/video/SDL_yuv.c @@ -603,8 +603,10 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, - &y_stride, &uv_stride) != 0) + &y_stride, &uv_stride) != 0) { return -1; + } + plane_interleaved_uv = (plane_y + height * y_stride); y_skip = (y_stride - width); diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 3a9988deb..83a939d64 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -398,8 +398,7 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd) if (SUCCEEDED(WIN_CoInitialize())) { videodata->ime_com_initialized = SDL_TRUE; hResult = CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr); - if (hResult != S_OK) - { + if (hResult != S_OK) { videodata->ime_available = SDL_FALSE; SDL_SetError("CoCreateInstance() failed, HRESULT is %08X", (unsigned int)hResult); return; diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index d74f1dda7..d260f15c6 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -739,18 +739,22 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ - if (!GetClientRect(hwnd, &rcClient)) - SDL_SetError("GetClientRect() failed, error %08X", (unsigned int)GetLastError()); - if (!GetWindowRect(hwnd, &rcWindow)) - SDL_SetError("GetWindowRect() failed, error %08X", (unsigned int)GetLastError()); + if (!GetClientRect(hwnd, &rcClient)) { + return SDL_SetError("GetClientRect() failed, error %08X", (unsigned int)GetLastError()); + } + + if (!GetWindowRect(hwnd, &rcWindow)) { + return SDL_SetError("GetWindowRect() failed, error %08X", (unsigned int)GetLastError()); + } /* convert the top/left values to make them relative to * the window; they will end up being slightly negative */ ptDiff.y = rcWindow.top; ptDiff.x = rcWindow.left; - if (!ScreenToClient(hwnd, &ptDiff)) - SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); + if (!ScreenToClient(hwnd, &ptDiff)) { + return SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); + } rcWindow.top = ptDiff.y; rcWindow.left = ptDiff.x; @@ -760,8 +764,9 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b ptDiff.y = rcWindow.bottom; ptDiff.x = rcWindow.right; - if (!ScreenToClient(hwnd, &ptDiff)) - SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); + if (!ScreenToClient(hwnd, &ptDiff)) { + return SDL_SetError("ScreenToClient() failed, error %08X", (unsigned int)GetLastError()); + } rcWindow.bottom = ptDiff.y; rcWindow.right = ptDiff.x; From 20af698b021b157aa4054d6f23b999b9d0d58dba Mon Sep 17 00:00:00 2001 From: chalonverse Date: Wed, 16 Nov 2022 11:31:35 -0800 Subject: [PATCH 373/459] GDK: Updated MicrosoftGame.config files to use placeholder identifiers from the GDK project template rather than using Microsoft sample identifiers --- .../testgamecontroller/wingdk/MicrosoftGame.config | 8 ++++---- .../xboxone/MicrosoftGame.config | 14 ++++---------- .../xboxseries/MicrosoftGame.config | 8 ++++---- .../tests/testgdk/wingdk/MicrosoftGame.config | 8 ++++---- .../tests/testgdk/xboxone/MicrosoftGame.config | 8 ++++---- .../tests/testgdk/xboxseries/MicrosoftGame.config | 8 ++++---- .../tests/testsprite2/wingdk/MicrosoftGame.config | 8 ++++---- .../tests/testsprite2/xboxone/MicrosoftGame.config | 8 ++++---- .../testsprite2/xboxseries/MicrosoftGame.config | 8 ++++---- 9 files changed, 36 insertions(+), 42 deletions(-) diff --git a/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config b/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config index 6a9ea2bf8..eb4ec4e17 100644 --- a/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config +++ b/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config @@ -2,9 +2,9 @@ - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - - - - - - - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF Date: Wed, 16 Nov 2022 11:32:31 -0500 Subject: [PATCH 374/459] events: Remove X and XKB keysym constants and headers The XKB_KEY_* and XK_* macros resolve to the same constant values, so use the raw values and note what keys they correspond to in the comments, as is done for the other keysym values in this file. This completely eliminates the need for any X or XKB system headers along with the if/else defines. --- src/events/SDL_keysym_to_scancode.c | 72 ++++++++--------------------- 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c index d965a375c..c1c1ba626 100644 --- a/src/events/SDL_keysym_to_scancode.c +++ b/src/events/SDL_keysym_to_scancode.c @@ -26,60 +26,28 @@ #include "SDL_keyboard_c.h" #include "SDL_scancode_tables_c.h" -#if SDL_VIDEO_DRIVER_WAYLAND -#include - -typedef xkb_keysym_t SDL_xkb_keysym_t; -#else -#include -#include - -typedef KeySym SDL_xkb_keysym_t; -#endif - - /* *INDENT-OFF* */ /* clang-format off */ static const struct { - SDL_xkb_keysym_t keysym; + Uint32 keysym; SDL_Scancode scancode; } KeySymToSDLScancode[] = { -#if SDL_VIDEO_DRIVER_WAYLAND - { XKB_KEY_KP_End, SDL_SCANCODE_KP_1 }, - { XKB_KEY_KP_Down, SDL_SCANCODE_KP_2 }, - { XKB_KEY_KP_Next, SDL_SCANCODE_KP_3 }, - { XKB_KEY_KP_Left, SDL_SCANCODE_KP_4 }, - { XKB_KEY_KP_Begin, SDL_SCANCODE_KP_5 }, - { XKB_KEY_KP_Right, SDL_SCANCODE_KP_6 }, - { XKB_KEY_KP_Home, SDL_SCANCODE_KP_7 }, - { XKB_KEY_KP_Up, SDL_SCANCODE_KP_8 }, - { XKB_KEY_KP_Prior, SDL_SCANCODE_KP_9 }, - { XKB_KEY_KP_Insert, SDL_SCANCODE_KP_0 }, - { XKB_KEY_KP_Delete, SDL_SCANCODE_KP_PERIOD }, - { XKB_KEY_Execute, SDL_SCANCODE_EXECUTE }, - { XKB_KEY_Hyper_R, SDL_SCANCODE_APPLICATION }, - { XKB_KEY_ISO_Level3_Shift, SDL_SCANCODE_RALT }, - { XKB_KEY_Super_L, SDL_SCANCODE_LGUI }, - { XKB_KEY_Super_R, SDL_SCANCODE_RGUI }, - { XKB_KEY_Mode_switch, SDL_SCANCODE_MODE }, -#else - { XK_KP_End, SDL_SCANCODE_KP_1 }, - { XK_KP_Down, SDL_SCANCODE_KP_2 }, - { XK_KP_Next, SDL_SCANCODE_KP_3 }, - { XK_KP_Left, SDL_SCANCODE_KP_4 }, - { XK_KP_Begin, SDL_SCANCODE_KP_5 }, - { XK_KP_Right, SDL_SCANCODE_KP_6 }, - { XK_KP_Home, SDL_SCANCODE_KP_7 }, - { XK_KP_Up, SDL_SCANCODE_KP_8 }, - { XK_KP_Prior, SDL_SCANCODE_KP_9 }, - { XK_KP_Insert, SDL_SCANCODE_KP_0 }, - { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD }, - { XK_Execute, SDL_SCANCODE_EXECUTE }, - { XK_Hyper_R, SDL_SCANCODE_APPLICATION }, - { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, - { XK_Super_L, SDL_SCANCODE_LGUI }, - { XK_Super_R, SDL_SCANCODE_RGUI }, - { XK_Mode_switch, SDL_SCANCODE_MODE }, -#endif + { 0xFF9C, SDL_SCANCODE_KP_1 }, /* XK_KP_End */ + { 0xFF99, SDL_SCANCODE_KP_2 }, /* XK_KP_Down */ + { 0xFF9B, SDL_SCANCODE_KP_3 }, /* XK_KP_Next */ + { 0xFF96, SDL_SCANCODE_KP_4 }, /* XK_KP_Left */ + { 0xFF9D, SDL_SCANCODE_KP_5 }, /* XK_KP_Begin */ + { 0xFF98, SDL_SCANCODE_KP_6 }, /* XK_KP_Right */ + { 0xFF95, SDL_SCANCODE_KP_7 }, /* XK_KP_Home */ + { 0xFF97, SDL_SCANCODE_KP_8 }, /* XK_KP_Up */ + { 0xFF9A, SDL_SCANCODE_KP_9 }, /* XK_KP_Prior */ + { 0xFF9E, SDL_SCANCODE_KP_0 }, /* XK_KP_Insert */ + { 0xFF9F, SDL_SCANCODE_KP_PERIOD }, /* XK_KP_Delete */ + { 0xFF62, SDL_SCANCODE_EXECUTE }, /* XK_Execute */ + { 0xFFEE, SDL_SCANCODE_APPLICATION }, /* XK_Hyper_R */ + { 0xFE03, SDL_SCANCODE_RALT }, /* XK_ISO_Level3_Shift */ + { 0xFFEB, SDL_SCANCODE_LGUI }, /* XK_Super_L */ + { 0xFFEC, SDL_SCANCODE_RGUI }, /* XK_Super_R */ + { 0xFF7E, SDL_SCANCODE_MODE }, /* XK_Mode_switch */ { 0x1008FF65, SDL_SCANCODE_MENU }, /* XF86MenuKB */ { 0x1008FF81, SDL_SCANCODE_F13 }, /* XF86Tools */ { 0x1008FF45, SDL_SCANCODE_F14 }, /* XF86Launch5 */ @@ -90,7 +58,7 @@ static const struct { }; /* This is a mapping from X keysym to Linux keycode */ -static const SDL_xkb_keysym_t LinuxKeycodeKeysyms[] = { +static const Uint32 LinuxKeycodeKeysyms[] = { /* 0, 0x000 */ 0x0, /* NoSymbol */ /* 1, 0x001 */ 0xFF1B, /* Escape */ /* 2, 0x002 */ 0x31, /* 1 */ @@ -358,7 +326,7 @@ done #endif static const struct { - SDL_xkb_keysym_t keysym; + Uint32 keysym; int linux_keycode; } ExtendedLinuxKeycodeKeysyms[] = { { 0x1008FF2C, 0x0a2 }, /* XF86XK_Eject */ From 1d7966df150eac7e5bfc98c84d5ce0327f33dccc Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 16 Nov 2022 21:27:16 +0100 Subject: [PATCH 375/459] Remove un-needed check for NULL pointer. They were previously checked just before. --- src/core/linux/SDL_ibus.c | 6 ++---- src/power/linux/SDL_syspower.c | 4 +--- src/render/SDL_render.c | 2 +- src/video/SDL_video.c | 5 ++--- src/video/kmsdrm/SDL_kmsdrmvideo.c | 4 ++-- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 8b74f575a..b4fe23154 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -549,10 +549,8 @@ SDL_IBus_Init(void) inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY); SDL_free(addr_file); - if (addr) { - result = IBus_SetupConnection(dbus, addr); - SDL_free(addr); - } + result = IBus_SetupConnection(dbus, addr); + SDL_free(addr); } return result; diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index f4e1ecc3d..c33ab5c94 100644 --- a/src/power/linux/SDL_syspower.c +++ b/src/power/linux/SDL_syspower.c @@ -648,9 +648,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second check_upower_device(dbus->system_conn, paths[i], state, seconds, percent); } - if (dbus) { - dbus->free_string_array(paths); - } + dbus->free_string_array(paths); #endif /* SDL_USE_LIBDBUS */ return retval; diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 722147c3e..5f821b33e 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1078,7 +1078,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */ renderer->render_command_generation = 1; - if (window && renderer->GetOutputSize) { + if (renderer->GetOutputSize) { int window_w, window_h; int output_w, output_h; if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 1ac9165ad..45965e32d 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1302,9 +1302,8 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) return SDL_SetError("Couldn't find display mode match"); } - if (mode) { - *mode = fullscreen_mode; - } + *mode = fullscreen_mode; + return 0; } diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 4293e46e2..eae721455 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -308,8 +308,8 @@ KMSDRM_CreateDevice(void) return device; cleanup: - if (device) - SDL_free(device); + SDL_free(device); + if (viddata) SDL_free(viddata); return NULL; From ce5da5d579dd4a27dd7eb19ce4edb07d49bc058f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 16 Nov 2022 21:47:43 +0100 Subject: [PATCH 376/459] Don't compare pointer against '0', but NULL --- Xcode-iOS/Demos/src/accelerometer.c | 4 ++-- Xcode-iOS/Demos/src/happy.c | 2 +- Xcode-iOS/Demos/src/keyboard.c | 2 +- Xcode-iOS/Demos/src/rectangles.c | 2 +- Xcode-iOS/Demos/src/touch.c | 2 +- src/audio/arts/SDL_artsaudio.c | 2 +- src/render/ps2/SDL_render_ps2.c | 4 ++-- src/render/psp/SDL_render_psp.c | 4 ++-- src/render/vitagxm/SDL_render_vita_gxm.c | 6 +++--- src/stdlib/SDL_qsort.c | 6 +++--- src/video/os2/SDL_os2dive.c | 2 +- src/video/x11/SDL_x11events.c | 2 +- src/video/x11/SDL_x11window.c | 2 +- test/testautomation_render.c | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c index 925aee4e3..0af153676 100644 --- a/Xcode-iOS/Demos/src/accelerometer.c +++ b/Xcode-iOS/Demos/src/accelerometer.c @@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer) /* create ship texture from surface */ ship = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (ship == 0) { + if (!ship) { fatalError("could not create ship texture"); } SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND); @@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer) } /* create space texture from surface */ space = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (space == 0) { + if (!space) { fatalError("could not create space texture"); } SDL_FreeSurface(bmp_surface); diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c index 658a65f01..73d4d4feb 100644 --- a/Xcode-iOS/Demos/src/happy.c +++ b/Xcode-iOS/Demos/src/happy.c @@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer) /* convert RGBA surface to texture */ texture = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (texture == 0) { + if (!texture) { fatalError("could not create texture"); } SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c index cfbe4e66b..4d630bae5 100644 --- a/Xcode-iOS/Demos/src/keyboard.c +++ b/Xcode-iOS/Demos/src/keyboard.c @@ -183,7 +183,7 @@ loadFont(void) SDL_BlitSurface(surface, NULL, converted, NULL); /* create our texture */ texture = SDL_CreateTextureFromSurface(renderer, converted); - if (texture == 0) { + if (!texture) { printf("texture creation failed: %s\n", SDL_GetError()); } else { /* set blend mode for our texture */ diff --git a/Xcode-iOS/Demos/src/rectangles.c b/Xcode-iOS/Demos/src/rectangles.c index 10f9f851b..a08f99790 100644 --- a/Xcode-iOS/Demos/src/rectangles.c +++ b/Xcode-iOS/Demos/src/rectangles.c @@ -58,7 +58,7 @@ main(int argc, char *argv[]) /* create window and renderer */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI); - if (window == 0) { + if (!window) { fatalError("Could not initialize Window"); } renderer = SDL_CreateRenderer(window, -1, 0); diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c index 918240b82..6c184630d 100644 --- a/Xcode-iOS/Demos/src/touch.c +++ b/Xcode-iOS/Demos/src/touch.c @@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer) brush = SDL_CreateTextureFromSurface(renderer, bmp_surface); SDL_FreeSurface(bmp_surface); - if (brush == 0) { + if (!brush) { fatalError("could not create brush texture"); } /* additive blending -- laying strokes on top of eachother makes them brighter */ diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c index ce74b7d4d..82d84e320 100644 --- a/src/audio/arts/SDL_artsaudio.c +++ b/src/audio/arts/SDL_artsaudio.c @@ -318,7 +318,7 @@ ARTS_Init(SDL_AudioDriverImpl * impl) if (LoadARTSLibrary() < 0) { return SDL_FALSE; } else { - if (SDL_NAME(arts_init) () != 0) { + if (SDL_NAME(arts_init) () != NULL) { UnloadARTSLibrary(); SDL_SetError("ARTS: arts_init failed (no audio server?)"); return SDL_FALSE; diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index 54ace06f3..f385f5354 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -546,10 +546,10 @@ PS2_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata; PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - if (data == 0) + if (data == NULL) return; - if(ps2_texture == 0) + if(ps2_texture == NULL) return; // Free from vram diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 6644230ec..9a4e5c7bb 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -1280,10 +1280,10 @@ PSP_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata; PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata; - if (renderdata == 0) + if (renderdata == NULL) return; - if(psp_texture == 0) + if(psp_texture == NULL) return; LRUTargetRemove(renderdata, psp_texture); diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index 55ffe0cde..1391b19a4 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -1236,13 +1236,13 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata; VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; - if (data == 0) + if (data == NULL) return; - if(vita_texture == 0) + if(vita_texture == NULL) return; - if(vita_texture->tex == 0) + if(vita_texture->tex == NULL) return; sceGxmFinish(data->gxm_context); diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c index 26e97c908..b0f92fde8 100644 --- a/src/stdlib/SDL_qsort.c +++ b/src/stdlib/SDL_qsort.c @@ -414,7 +414,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_nonaligned*size; - assert(pivot!=0); + assert(pivot); first=(char*)base; last=first+(nmemb-1)*size; @@ -445,7 +445,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size, char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_aligned*size; - assert(pivot!=0); + assert(pivot); first=(char*)base; last=first+(nmemb-1)*size; @@ -475,7 +475,7 @@ static void qsort_words(void *base, size_t nmemb, int stacktop=0; char *first,*last; char *pivot=malloc(WORD_BYTES); - assert(pivot!=0); + assert(pivot); first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c index 95aae6f05..56cfde1b3 100644 --- a/src/video/os2/SDL_os2dive.c +++ b/src/video/os2/SDL_os2dive.c @@ -296,7 +296,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, return FALSE; } - if (pSDLRects != 0) { + if (pSDLRects != NULL) { PBYTE pbLineMask; pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight); diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 38e1a7965..6b6b834b4 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -100,7 +100,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop) int bytes_fetch = 0; do { - if (ret != 0) X11_XFree(ret); + if (ret != NULL) X11_XFree(ret); X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret); bytes_fetch += bytes_left; } while (bytes_left != 0); diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 9b007e79d..6d4e53f20 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1562,7 +1562,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop) int bytes_fetch = 0; do { - if (ret != 0) X11_XFree(ret); + if (ret != NULL) X11_XFree(ret); X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret); bytes_fetch += bytes_left; } while (bytes_left != 0); diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 0117334a2..50142f26b 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -53,7 +53,7 @@ void InitCreateRenderer(void *arg) renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDLTest_AssertPass("SDL_CreateRenderer()"); - SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result"); + SDLTest_AssertCheck(renderer, "Check SDL_CreateRenderer result"); if (renderer == NULL) { SDL_DestroyWindow(window); return; From 4192d1a1c71dc70f9ebc69d3280253437ccefbde Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 16 Nov 2022 21:56:19 +0100 Subject: [PATCH 377/459] Fix compilation. It needs to be casted to 'int' type --- test/testautomation_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 50142f26b..0117334a2 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -53,7 +53,7 @@ void InitCreateRenderer(void *arg) renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDLTest_AssertPass("SDL_CreateRenderer()"); - SDLTest_AssertCheck(renderer, "Check SDL_CreateRenderer result"); + SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result"); if (renderer == NULL) { SDL_DestroyWindow(window); return; From fcc994e132a9fa83eb0e2cd385d7fd98a25f0dd8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 16 Nov 2022 17:39:55 -0800 Subject: [PATCH 378/459] ensure that SDL2 does not set conflicting window flags (thanks @pionere!) --- src/video/SDL_video.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 45965e32d..18b7bfc58 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -202,6 +202,22 @@ typedef struct { } SDL_WindowTextureData; +static Uint32 +SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this) +{ +#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ + if (_this->GL_CreateContext != NULL) { + return SDL_WINDOW_OPENGL; + } +#endif +#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) + if (_this->Metal_CreateView != NULL) { + return SDL_WINDOW_METAL; + } +#endif + return 0; +} + static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) { @@ -1635,16 +1651,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* Some platforms have certain graphics backends enabled by default */ if (!graphics_flags && !SDL_IsVideoContextExternal()) { -#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ - if (_this->GL_CreateContext != NULL) { - flags |= SDL_WINDOW_OPENGL; - } -#endif -#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) - if (_this->Metal_CreateView != NULL) { - flags |= SDL_WINDOW_METAL; - } -#endif + flags |= SDL_DefaultGraphicsBackends(_this); } if (flags & SDL_WINDOW_OPENGL) { From 913e403f2aa5a23beee878b6b13f7603b884c18a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 16 Nov 2022 18:03:29 -0800 Subject: [PATCH 379/459] Fixed error message when trying to create an OpenGLES2 renderer on macOS Testing: testsprite2 --renderer opengles2 OpenGLES2 isn't available by default, and we want to see the error "Could not load EGL library" --- src/video/cocoa/SDL_cocoawindow.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index ddf2fc9f5..c73827656 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -2274,7 +2274,9 @@ Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window) /* Not recognized via CHECK_WINDOW_MAGIC */ if (data == nil) { - return SDL_SetError("Window data not set"); + /* Don't set the error here, it hides other errors and is ignored anyway */ + /*return SDL_SetError("Window data not set");*/ + return -1; } /* NSWindow.screen may be nil when the window is off-screen. */ From bb0b8adacc7a082d1a530f9ac912771cb1c09a97 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 22:02:21 -0500 Subject: [PATCH 380/459] mac: Fix handling of deprecated symbol. This needs to check what our deployment target is, not what SDK is available, since this is a linker symbol and not an enum value or whatever. Also removed a copy/paste error that mentioned CoreAudio in the haptic subsystem. Fixes #6534. --- src/haptic/darwin/SDL_syshaptic_c.h | 4 +--- src/hidapi/SDL_hidapi.c | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/haptic/darwin/SDL_syshaptic_c.h b/src/haptic/darwin/SDL_syshaptic_c.h index 5f68a6d63..8e3a6ca95 100644 --- a/src/haptic/darwin/SDL_syshaptic_c.h +++ b/src/haptic/darwin/SDL_syshaptic_c.h @@ -20,12 +20,10 @@ */ /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ -#if MACOSX_COREAUDIO #include -#ifndef MAC_OS_VERSION_12_0 +#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000 #define kIOMainPortDefault kIOMasterPortDefault #endif -#endif extern int MacHaptic_MaybeAddDevice( io_object_t device ); extern int MacHaptic_MaybeRemoveDevice( io_object_t device ); diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 52ee67027..47818d4dc 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -47,6 +47,11 @@ #include #include #include +#include +/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000 +#define kIOMainPortDefault kIOMasterPortDefault +#endif #endif #include "../core/linux/SDL_udev.h" @@ -250,7 +255,7 @@ HIDAPI_InitializeDiscovery() #endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) - SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault); + SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault); if (SDL_HIDAPI_discovery.m_notificationPort) { { io_iterator_t portIterator = 0; From a1702d463ce85d064ea679272b5a02c0a9304a3a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Nov 2022 23:39:41 -0500 Subject: [PATCH 381/459] ibus: Try to use org.freedesktop.portal.IBus first if available. This should fix apps that want ibus support inside sandboxed environments like FlatPak or Snaps. Fixes #4706. --- src/core/linux/SDL_ibus.c | 111 +++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 30 deletions(-) diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index b4fe23154..94f7aa626 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -37,17 +37,27 @@ #include #include -static const char IBUS_SERVICE[] = "org.freedesktop.IBus"; static const char IBUS_PATH[] = "/org/freedesktop/IBus"; + +static const char IBUS_SERVICE[] = "org.freedesktop.IBus"; static const char IBUS_INTERFACE[] = "org.freedesktop.IBus"; static const char IBUS_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; +static const char IBUS_PORTAL_SERVICE[] = "org.freedesktop.portal.IBus"; +static const char IBUS_PORTAL_INTERFACE[] = "org.freedesktop.IBus.Portal"; +static const char IBUS_PORTAL_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; + +static const char *ibus_service = NULL; +static const char *ibus_interface = NULL; +static const char *ibus_input_interface = NULL; static char *input_ctx_path = NULL; static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; static DBusConnection *ibus_conn = NULL; +static SDL_bool ibus_is_portal_interface = SDL_FALSE; static char *ibus_addr_file = NULL; static int inotify_fd = -1, inotify_wd = -1; + static Uint32 IBus_ModState(void) { @@ -202,7 +212,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; - if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) { + if (dbus->message_is_signal(msg, ibus_input_interface, "CommitText")) { DBusMessageIter iter; const char *text; @@ -224,7 +234,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) return DBUS_HANDLER_RESULT_HANDLED; } - if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) { + if (dbus->message_is_signal(msg, ibus_input_interface, "UpdatePreeditText")) { DBusMessageIter iter; const char *text; @@ -273,7 +283,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) return DBUS_HANDLER_RESULT_HANDLED; } - if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) { + if (dbus->message_is_signal(msg, ibus_input_interface, "HidePreeditText")) { SDL_SendEditingText("", 0, 0); return DBUS_HANDLER_RESULT_HANDLED; } @@ -415,7 +425,7 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, caps |= IBUS_CAP_PREEDIT_TEXT; } - SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "SetCapabilities", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } } @@ -428,36 +438,56 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) const char *path = NULL; SDL_bool result = SDL_FALSE; DBusObjectPathVTable ibus_vtable; - + SDL_zero(ibus_vtable); ibus_vtable.message_function = &IBus_MessageHandler; - ibus_conn = dbus->connection_open_private(addr, NULL); + /* try the portal interface first. Modern systems have this in general, + and sandbox things like FlakPak and Snaps, etc, require it. */ - if (!ibus_conn) { - return SDL_FALSE; + ibus_is_portal_interface = SDL_TRUE; + ibus_service = IBUS_PORTAL_SERVICE; + ibus_interface = IBUS_PORTAL_INTERFACE; + ibus_input_interface = IBUS_PORTAL_INPUT_INTERFACE; + ibus_conn = dbus->session_conn; + + result = SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, IBUS_PATH, ibus_interface, "CreateInputContext", + DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, + DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); + if (!result) { + ibus_is_portal_interface = SDL_FALSE; + ibus_service = IBUS_SERVICE; + ibus_interface = IBUS_INTERFACE; + ibus_input_interface = IBUS_INPUT_INTERFACE; + ibus_conn = dbus->connection_open_private(addr, NULL); + + if (!ibus_conn) { + return SDL_FALSE; /* oh well. */ + } + + dbus->connection_flush(ibus_conn); + + if (!dbus->bus_register(ibus_conn, NULL)) { + ibus_conn = NULL; + return SDL_FALSE; + } + + dbus->connection_flush(ibus_conn); + + result = SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, IBUS_PATH, ibus_interface, "CreateInputContext", + DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, + DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); } - dbus->connection_flush(ibus_conn); - - if (!dbus->bus_register(ibus_conn, NULL)) { - ibus_conn = NULL; - return SDL_FALSE; - } - - dbus->connection_flush(ibus_conn); - - if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext", - DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, - DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { + if (result) { + char matchstr[128]; + SDL_snprintf(matchstr, sizeof (matchstr), "type='signal',interface='%s'", ibus_input_interface); SDL_free(input_ctx_path); input_ctx_path = SDL_strdup(path); SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); - - dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); + dbus->bus_add_match(ibus_conn, matchstr, NULL); dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); dbus->connection_flush(ibus_conn); - result = SDL_TRUE; } SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); @@ -551,6 +581,18 @@ SDL_IBus_Init(void) result = IBus_SetupConnection(dbus, addr); SDL_free(addr); + + /* don't use the addr_file if using the portal interface. */ + if (result && ibus_is_portal_interface) { + if (inotify_fd > 0) { + if (inotify_wd > 0) { + inotify_rm_watch(inotify_fd, inotify_wd); + inotify_wd = -1; + } + close(inotify_fd); + inotify_fd = -1; + } + } } return result; @@ -573,16 +615,25 @@ SDL_IBus_Quit(void) dbus = SDL_DBus_GetContext(); - if (dbus && ibus_conn) { + /* if using portal, ibus_conn == session_conn; don't release it here. */ + if (dbus && ibus_conn && !ibus_is_portal_interface) { dbus->connection_close(ibus_conn); dbus->connection_unref(ibus_conn); } - + + ibus_conn = NULL; + ibus_service = NULL; + ibus_interface = NULL; + ibus_input_interface = NULL; + ibus_is_portal_interface = SDL_FALSE; + if (inotify_fd > 0 && inotify_wd > 0) { inotify_rm_watch(inotify_fd, inotify_wd); inotify_wd = -1; } - + + /* !!! FIXME: should we close(inotify_fd) here? */ + SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); @@ -594,7 +645,7 @@ IBus_SimpleMessage(const char *method) SDL_DBusContext *dbus = SDL_DBus_GetContext(); if ((input_ctx_path != NULL) && (IBus_CheckConnection(dbus))) { - SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID); + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, method, DBUS_TYPE_INVALID); } } @@ -624,7 +675,7 @@ SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) if (state == SDL_RELEASED) { mods |= (1 << 30); // IBUS_RELEASE_MASK } - if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", + if (!SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "ProcessKeyEvent", DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &ibus_keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { result = 0; @@ -679,7 +730,7 @@ SDL_IBus_UpdateTextRect(const SDL_Rect *rect) dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation", + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "SetCursorLocation", DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); } } From 77bcd269beccdd281789673313c4bb677e70bb12 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 16 Nov 2022 22:23:16 -0800 Subject: [PATCH 382/459] Allow creating an empty surface with pitch 0 This fixes Maelstrom, which creates an empty staging surface and then uses it for transfer to texture --- src/video/SDL_surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index f3ee6a4c4..5930e4055 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -230,7 +230,7 @@ SDL_CreateRGBSurfaceFrom(void *pixels, minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); - if (pitch < 0 || ((size_t) pitch) < minimalPitch) { + if (pitch < 0 || (pitch > 0 && ((size_t) pitch) < minimalPitch)) { SDL_InvalidParamError("pitch"); return NULL; } @@ -272,7 +272,7 @@ SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); - if (pitch < 0 || ((size_t) pitch) < minimalPitch) { + if (pitch < 0 || (pitch > 0 && ((size_t) pitch) < minimalPitch)) { SDL_InvalidParamError("pitch"); return NULL; } From b7358e47d57f921e09d1db55371b3111ee2b7bff Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 09:18:49 +0100 Subject: [PATCH 383/459] Don't compare pointer against '0', but NULL --- test/testautomation_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 0117334a2..52da1bfe1 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -53,7 +53,7 @@ void InitCreateRenderer(void *arg) renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDLTest_AssertPass("SDL_CreateRenderer()"); - SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result"); + SDLTest_AssertCheck(renderer != NULL, "Check SDL_CreateRenderer result"); if (renderer == NULL) { SDL_DestroyWindow(window); return; From 60c6cd554d910b997150c63b2e626ed9c4e40d00 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 09:34:27 +0100 Subject: [PATCH 384/459] Fixed bug #6533 - PS2_JoystickUpdate: some invalid condition --- src/joystick/ps2/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/ps2/SDL_sysjoystick.c b/src/joystick/ps2/SDL_sysjoystick.c index c43a1ef10..3847d79c5 100644 --- a/src/joystick/ps2/SDL_sysjoystick.c +++ b/src/joystick/ps2/SDL_sysjoystick.c @@ -275,7 +275,7 @@ static void PS2_JoystickUpdate(SDL_Joystick *joystick) struct JoyInfo *info = &joyInfo[index]; int state = padGetState(info->port, info->slot); - if (state != PAD_STATE_DISCONN || state != PAD_STATE_EXECCMD || state != PAD_STATE_ERROR) { + if (state != PAD_STATE_DISCONN && state != PAD_STATE_EXECCMD && state != PAD_STATE_ERROR) { int ret = padRead(info->port, info->slot, &buttons); /* port, slot, buttons */ if (ret != 0) { /* Buttons */ From ddad901c0ddd107757353a0ffe097d3af7118ca1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 10:43:45 +0100 Subject: [PATCH 385/459] Remove unneeded semicolon --- src/events/SDL_events.c | 4 ++-- src/hidapi/libusb/hid.c | 2 +- src/hidapi/linux/hid.c | 2 +- src/main/ps2/SDL_ps2_main.c | 6 ++++-- src/render/software/SDL_triangle.c | 4 ++-- src/video/SDL_video.c | 2 +- src/video/windows/SDL_windowskeyboard.c | 1 - src/video/x11/edid-parse.c | 2 +- test/testrelative.c | 2 +- visualtest/src/windows/windows_screenshot.c | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 9ba5e44b8..493ae7665 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -406,7 +406,7 @@ SDL_LogEvent(const SDL_Event *event) SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \ (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \ (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ - event->dgesture.error, event->dgesture.x, event->dgesture.y); + event->dgesture.error, event->dgesture.x, event->dgesture.y) SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; #undef PRINT_DOLLAR_EVENT @@ -425,7 +425,7 @@ SDL_LogEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; #undef PRINT_DROP_EVENT - #define PRINT_AUDIODEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); + #define PRINT_AUDIODEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false") SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; #undef PRINT_AUDIODEV_EVENT diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index 1f08aedfa..9e2a43589 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -322,7 +322,7 @@ static int get_usage(uint8_t *report_descriptor, size_t size, /* Can't ever happen since size_code is & 0x3 */ data_len = 0; break; - }; + } key_size = 1; } diff --git a/src/hidapi/linux/hid.c b/src/hidapi/linux/hid.c index fbd010144..cf857a675 100644 --- a/src/hidapi/linux/hid.c +++ b/src/hidapi/linux/hid.c @@ -200,7 +200,7 @@ static int uses_numbered_reports(__u8 *report_descriptor, __u32 size) { /* Can't ever happen since size_code is & 0x3 */ data_len = 0; break; - }; + } key_size = 1; } diff --git a/src/main/ps2/SDL_ps2_main.c b/src/main/ps2/SDL_ps2_main.c index 6d5c43a03..e9a4b513d 100644 --- a/src/main/ps2/SDL_ps2_main.c +++ b/src/main/ps2/SDL_ps2_main.c @@ -28,8 +28,10 @@ __attribute__((weak)) void reset_IOP() { SifInitRpc(0); - while(!SifIopReset(NULL, 0)){}; - while(!SifIopSync()){}; + while(!SifIopReset(NULL, 0)) { + } + while(!SifIopSync()){ + } } static void prepare_IOP() diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c index 694cb4d91..f70c07933 100644 --- a/src/render/software/SDL_triangle.c +++ b/src/render/software/SDL_triangle.c @@ -533,7 +533,7 @@ int SDL_SW_BlitTriangle( if (is_uniform) { // SDL_GetSurfaceColorMod(src, &r, &g, &b); - has_modulation = c0.r != 255 || c0.g != 255 || c0.b != 255 || c0.a != 255;; + has_modulation = c0.r != 255 || c0.g != 255 || c0.b != 255 || c0.a != 255; } else { has_modulation = SDL_TRUE; } @@ -759,7 +759,7 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, Uint32 ckey = info->colorkey & rgbmask; Uint8 *dst_ptr = info->dst; - int dst_pitch = info->dst_pitch;; + int dst_pitch = info->dst_pitch; srcfmt_val = detect_format(src_fmt); dstfmt_val = detect_format(dst_fmt); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 18b7bfc58..0804c9cfb 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3754,7 +3754,7 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); } else { SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0); - }; + } break; case SDL_GL_CONTEXT_FLAGS: if (value & ~(SDL_GL_CONTEXT_DEBUG_FLAG | diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 83a939d64..a62ba0717 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -1634,7 +1634,6 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) (candcount * candborder * 2) + (candcount * candpadding * 2) + ((candcount - 1) * horzcandspacing); - ; for (i = 0; i < candcount; ++i) size.cx += candsizes[i].cx; diff --git a/src/video/x11/edid-parse.c b/src/video/x11/edid-parse.c index c717f1b1f..52c5d5f80 100644 --- a/src/video/x11/edid-parse.c +++ b/src/video/x11/edid-parse.c @@ -623,7 +623,7 @@ dump_monitor_info (MonitorInfo *info) case RGB: s = "rgb"; break; case OTHER_COLOR: s = "other color"; break; default: s = "unknown"; break; - }; + } printf ("Color: %s\n", s); } diff --git a/test/testrelative.c b/test/testrelative.c index 59a563eea..40c670bc9 100644 --- a/test/testrelative.c +++ b/test/testrelative.c @@ -104,7 +104,7 @@ main(int argc, char *argv[]) srand((unsigned int)time(NULL)); if(SDL_SetRelativeMouseMode(SDL_TRUE) < 0) { return 3; - }; + } rect.x = DEFAULT_WINDOW_WIDTH / 2; rect.y = DEFAULT_WINDOW_HEIGHT / 2; diff --git a/visualtest/src/windows/windows_screenshot.c b/visualtest/src/windows/windows_screenshot.c index 6d9189dc4..d4ac7d3a1 100644 --- a/visualtest/src/windows/windows_screenshot.c +++ b/visualtest/src/windows/windows_screenshot.c @@ -261,7 +261,7 @@ screenshotwindow_cleanup_windowdc: if(!ReleaseDC(hwnd, windowdc)) { SDLTest_LogError("ReleaseDC() failed"); - return_code = 0;; + return_code = 0; } screenshotwindow_cleanup_generic: From cd0d5a5fc58a195f15c02a96f67fd55c4a60974b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 11:23:15 +0100 Subject: [PATCH 386/459] Don't compare pointer against '0', but NULL --- src/stdlib/SDL_qsort.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c index b0f92fde8..d17b6a31c 100644 --- a/src/stdlib/SDL_qsort.c +++ b/src/stdlib/SDL_qsort.c @@ -414,7 +414,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_nonaligned*size; - assert(pivot); + assert(pivot != NULL); first=(char*)base; last=first+(nmemb-1)*size; @@ -445,7 +445,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size, char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_aligned*size; - assert(pivot); + assert(pivot != NULL); first=(char*)base; last=first+(nmemb-1)*size; @@ -475,7 +475,7 @@ static void qsort_words(void *base, size_t nmemb, int stacktop=0; char *first,*last; char *pivot=malloc(WORD_BYTES); - assert(pivot); + assert(pivot != NULL); first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; From 89572af6a8b7e01559e5eefe730b74c3da9d3285 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 11:43:46 +0100 Subject: [PATCH 387/459] Fixed bug #6537 - AIX: use PAUDIO_WaitDevice --- src/audio/paudio/SDL_paudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c index ae2fc2950..c77db085a 100644 --- a/src/audio/paudio/SDL_paudio.c +++ b/src/audio/paudio/SDL_paudio.c @@ -477,7 +477,7 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) /* Set the function pointers */ impl->OpenDevice = PAUDIO_OpenDevice; impl->PlayDevice = PAUDIO_PlayDevice; - impl->PlayDevice = PAUDIO_WaitDevice; + impl->WaitDevice = PAUDIO_WaitDevice; impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; impl->CloseDevice = PAUDIO_CloseDevice; impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* !!! FIXME: add device enum! */ From 71f2864b3a24e144eaf4ae6e86eee0dd5e9f89b1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 17 Nov 2022 14:55:49 +0100 Subject: [PATCH 388/459] Fix usage of sizeof() in test/testgles*.c files --- test/testgles.c | 2 +- test/testgles2.c | 2 +- test/testgles2_sdf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/testgles.c b/test/testgles.c index cb989f44f..745cf8919 100644 --- a/test/testgles.c +++ b/test/testgles.c @@ -173,7 +173,7 @@ main(int argc, char *argv[]) quit(2); } - context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (context == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); diff --git a/test/testgles2.c b/test/testgles2.c index 721c24b7f..903f7a822 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -614,7 +614,7 @@ main(int argc, char *argv[]) return 0; } - context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (context == NULL) { SDL_Log("Out of memory!\n"); quit(2); diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index 064b6bc2c..e9e79d6e6 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -522,7 +522,7 @@ main(int argc, char *argv[]) return 0; } - context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (context == NULL) { SDL_Log("Out of memory!\n"); quit(2); From 1f87e9e24eba5e2443b2ed677462a70b6605482e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 17 Nov 2022 09:00:27 -0800 Subject: [PATCH 389/459] Updated patch notes for 2.26 release --- WhatsNew.txt | 33 ++++++++++++++++++++++++++++++++- include/SDL_hints.h | 4 ++-- include/SDL_video.h | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/WhatsNew.txt b/WhatsNew.txt index 0318b90de..1f95f0592 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -6,9 +6,40 @@ This is a list of major changes in SDL's version history. --------------------------------------------------------------------------- General: +* Updated OpenGL headers to the latest API from The Khronos Group Inc. +* Added SDL_GetWindowSizeInPixels() to get the window size in pixels, which may differ from the window coordinate size for windows with high-DPI support +* Added simulated vsync synchronization for the software renderer +* Added the mouse position to SDL_MouseWheelEvent +* Added SDL_ResetHints() to reset all hints to their default values * Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID -* Added support for Nintendo Wii controllers to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_WII to control whether this is used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 to control whether the HIDAPI driver for XBox 360 controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED to control whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS to control whether the HIDAPI driver for XBox 360 wireless controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE to control whether the HIDAPI driver for XBox One controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED to control the brightness of the XBox One guide button LED +* Added support for PS3 controllers to the HIDAPI driver, enabled by default on macOS, controlled by the SDL_HINT_JOYSTICK_HIDAPI_PS3 hint +* Added support for Nintendo Wii controllers to the HIDAPI driver, not enabled by default, controlled by the SDL_HINT_JOYSTICK_HIDAPI_WII hint * Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS to control whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver +* Added access to the individual left and right gyro sensors of the combined Joy-Cons controller +* Added a microsecond timestamp to SDL_SensorEvent and SDL_ControllerSensorEvent, when the hardware provides that information +* Added SDL_SensorGetDataWithTimestamp() and SDL_GameControllerGetSensorDataWithTimestamp() to retrieve the last sensor data with the associated microsecond timestamp +* Added the hint SDL_HINT_HIDAPI_IGNORE_DEVICES to have the SDL HID API ignore specific devices +* SDL_GetRevision() now includes more information about the SDL build, including the git commit hash if available + +Windows: +* Added the hint SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE to control whether the system mouse acceleration curve is used for relative mouse motion + +macOS: +* Implemented vsync synchronization on macOS 12 + +Linux: +* Added SDL_SetPrimarySelectionText(), SDL_GetPrimarySelectionText(), and SDL_HasPrimarySelectionText() to interact with the X11 primary selection clipboard +* Added the hint SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP to control whether mouse pointer warp emulation is enabled under Wayland + +Android: +* Enabled IME soft keyboard input +* Added version checking to make sure the SDL Java and C code are compatible --------------------------------------------------------------------------- diff --git a/include/SDL_hints.h b/include/SDL_hints.h index d51525936..76a74f0ff 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -278,7 +278,7 @@ extern "C" { * If this hint isn't specified to a valid setting, or libsamplerate isn't * available, SDL will use the default, internal resampling algorithm. * - * As of SDL 2.26, SDL_AudioCVT now respects this hint. + * As of SDL 2.26, SDL_ConvertAudio() respects this hint when libsamplerate is available. * * This hint is currently only checked at audio subsystem initialization. * @@ -933,7 +933,7 @@ extern "C" { #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS" /** - * \brief A variable controlling whether the HIDAPI driver for XBox One should be used. + * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. * * This variable can be set to the following values: * "0" - HIDAPI driver is not used diff --git a/include/SDL_video.h b/include/SDL_video.h index 79d572fcc..b2f1509f7 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1064,7 +1064,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, * \sa SDL_CreateWindow * \sa SDL_GetWindowSize */ -extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, +extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, int *w, int *h); /** From 78ea6af2cddfa050a394ff9030d0ddd631099848 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 17 Nov 2022 09:01:35 -0800 Subject: [PATCH 390/459] Updated to version 2.25.1 for release candidate --- CMakeLists.txt | 2 +- Makefile.os2 | 2 +- Makefile.w32 | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 16 ++++++++-------- .../main/java/org/libsdl/app/SDLActivity.java | 2 +- configure | 2 +- configure.ac | 2 +- include/SDL_version.h | 2 +- src/main/windows/version.rc | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 484220f1f..408bc2f14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ endif() # See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 25) -set(SDL_MICRO_VERSION 0) +set(SDL_MICRO_VERSION 1) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Set defaults preventing destination file conflicts diff --git a/Makefile.os2 b/Makefile.os2 index 76b2b398d..111ea0eef 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -15,7 +15,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 25 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 diff --git a/Makefile.w32 b/Makefile.w32 index 68c3a3731..628ee7ed6 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -6,7 +6,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 25 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index ada597b7d..16ca1d1b7 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.25.0 + 2.25.1 CFBundleSignature SDLX CFBundleVersion - 2.25.0 + 2.25.1 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index a0741e06c..e0f747ab7 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -9528,8 +9528,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 2502.0.0; + DYLIB_CURRENT_VERSION = 2502.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9613,8 +9613,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 2502.0.0; + DYLIB_CURRENT_VERSION = 2502.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9862,8 +9862,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 2502.0.0; + DYLIB_CURRENT_VERSION = 2502.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9914,8 +9914,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 2502.0.0; + DYLIB_CURRENT_VERSION = 2502.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 666ea3164..e749d6b77 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 25; - private static final int SDL_MICRO_VERSION = 0; + private static final int SDL_MICRO_VERSION = 1; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/configure b/configure index 4f4253cf1..9461408e8 100755 --- a/configure +++ b/configure @@ -3454,7 +3454,7 @@ orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=25 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/configure.ac b/configure.ac index 60ab5b6f1..a4252d2ed 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=25 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/include/SDL_version.h b/include/SDL_version.h index b817be1a2..612d2f53d 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 25 -#define SDL_PATCHLEVEL 0 +#define SDL_PATCHLEVEL 1 /** * Macro to determine SDL version program was compiled against. diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index f13b89759..97930ca04 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,25,0,0 - PRODUCTVERSION 2,25,0,0 + FILEVERSION 2,25,1,0 + PRODUCTVERSION 2,25,1,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 25, 0, 0\0" + VALUE "FileVersion", "2, 25, 1, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 25, 0, 0\0" + VALUE "ProductVersion", "2, 25, 1, 0\0" END END BLOCK "VarFileInfo" From 769ae185d608b72d70c8caa54deeede7ddcdf7b1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 06:52:12 -0800 Subject: [PATCH 391/459] Revert "sdl2.m4: Deprecate AM_PATH_SDL2 in favour of PKG_CHECK_MODULES" This reverts commit a66cb8cf216536b4e5e35c98c3f114d1787131b1. SDL 3 will have the recommended path forward, we don't need to nag in SDL 2. --- sdl2.m4 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdl2.m4 b/sdl2.m4 index 737a5e5e8..75b60f6ea 100644 --- a/sdl2.m4 +++ b/sdl2.m4 @@ -10,7 +10,7 @@ # * removed HP/UX 9 support. # * updated for newer autoconf. -# serial 3 +# serial 2 dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS @@ -19,7 +19,6 @@ AC_DEFUN([AM_PATH_SDL2], [dnl dnl Get the cflags and libraries from the sdl2-config script dnl -AC_MSG_WARN([[$0 is deprecated, please use PKG_CHECK_MODULES([SDL], [sdl2 >= MINIMUM_VERSION]) instead]]) AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], From 9209942949a2a7c2b117c22cf970e58bf587e109 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 06:53:13 -0800 Subject: [PATCH 392/459] Revert "sdl2-config.in: Deprecate sdl2-config" This reverts commit e0d904e90b15c7be45210e51b8969d3beab71437. SDL 3 will have the recommended path forward, we don't need to nag in SDL 2. --- sdl2-config.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sdl2-config.in b/sdl2-config.in index f7e5cd059..f6eca7668 100644 --- a/sdl2-config.in +++ b/sdl2-config.in @@ -19,11 +19,6 @@ if test $# -eq 0; then exit 1 fi -echo "sdl2-config: This script is deprecated" >&2 -echo "sdl2-config: In Autotools builds, use PKG_CHECK_MODULES([SDL], [sdl2 >= 2.x.y])" >&2 -echo "sdl2-config: In CMake builds, use find_package(SDL2 CONFIG)" >&2 -echo "sdl2-config: In other build systems, look for 'sdl2' with pkg-config(1) or pkgconf(1)" >&2 - while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; From 3e70553c48032f6bf4b6acfa61e4ef87d563c1a1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 18 Nov 2022 11:06:49 +0100 Subject: [PATCH 393/459] Unneed test before calling SDL_FreeSurface --- src/video/SDL_bmp.c | 4 +--- test/testutils.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index d52d6e84e..369b925a6 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -574,9 +574,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) if (src) { SDL_RWseek(src, fp_offset, RW_SEEK_SET); } - if (surface) { - SDL_FreeSurface(surface); - } + SDL_FreeSurface(surface); surface = NULL; } if (freesrc && src) { diff --git a/test/testutils.c b/test/testutils.c index ab58824d0..a93afc1ad 100644 --- a/test/testutils.c +++ b/test/testutils.c @@ -143,9 +143,7 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); } } - if (temp) { - SDL_FreeSurface(temp); - } + SDL_FreeSurface(temp); if (path) { SDL_free(path); } From 16824865c234f3fec9af4fded0f89cb1f147d014 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 18 Nov 2022 11:01:21 +0100 Subject: [PATCH 394/459] Cleanup of SDL_SetError that already return -1 value --- src/core/gdk/SDL_gdk.cpp | 6 ++---- src/thread/ngage/SDL_sysmutex.cpp | 6 ++---- src/thread/ngage/SDL_syssem.cpp | 6 ++---- src/video/haiku/SDL_bopengl.cc | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/core/gdk/SDL_gdk.cpp b/src/core/gdk/SDL_gdk.cpp index 4058a9b8f..5d94c9bda 100644 --- a/src/core/gdk/SDL_gdk.cpp +++ b/src/core/gdk/SDL_gdk.cpp @@ -42,8 +42,7 @@ SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue) &GDK_GlobalTaskQueue ); if (FAILED(hr)) { - SDL_SetError("[GDK] Could not create global task queue"); - return -1; + return SDL_SetError("[GDK] Could not create global task queue"); } /* The initial call gets the non-duplicated handle so they can clean it up */ @@ -51,8 +50,7 @@ SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue) } else { /* Duplicate the global task queue handle into outTaskQueue */ if (FAILED(XTaskQueueDuplicateHandle(GDK_GlobalTaskQueue, outTaskQueue))) { - SDL_SetError("[GDK] Unable to acquire global task queue"); - return -1; + return SDL_SetError("[GDK] Unable to acquire global task queue"); } } diff --git a/src/thread/ngage/SDL_sysmutex.cpp b/src/thread/ngage/SDL_sysmutex.cpp index 34cf4510d..6893fc628 100644 --- a/src/thread/ngage/SDL_sysmutex.cpp +++ b/src/thread/ngage/SDL_sysmutex.cpp @@ -92,8 +92,7 @@ SDL_LockMutex(SDL_mutex * mutex) { if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex."); - return -1; + return SDL_SetError("Passed a NULL mutex."); } RMutex rmutex; @@ -109,8 +108,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) { if ( mutex == NULL ) { - SDL_SetError("Passed a NULL mutex."); - return -1; + return SDL_SetError("Passed a NULL mutex."); } RMutex rmutex; diff --git a/src/thread/ngage/SDL_syssem.cpp b/src/thread/ngage/SDL_syssem.cpp index ab277ca5d..622d6239a 100644 --- a/src/thread/ngage/SDL_syssem.cpp +++ b/src/thread/ngage/SDL_syssem.cpp @@ -119,8 +119,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) { if (! sem) { - SDL_SetError("Passed a NULL sem"); - return -1; + return SDL_SetError("Passed a NULL sem"); } if (timeout == SDL_MUTEX_MAXWAIT) @@ -182,8 +181,7 @@ SDL_SemPost(SDL_sem * sem) { if (! sem) { - SDL_SetError("Passed a NULL sem."); - return -1; + return SDL_SetError("Passed a NULL sem."); } sem->count++; RSemaphore sema; diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc index 0c7a704d8..72bdb77f4 100644 --- a/src/video/haiku/SDL_bopengl.cc +++ b/src/video/haiku/SDL_bopengl.cc @@ -94,8 +94,7 @@ int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { // printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL)); if (glView != NULL) { if ((glView->Window() == NULL) || (window == NULL) || (_ToBeWin(window)->GetGLView() != glView)) { - SDL_SetError("MakeCurrent failed"); - return -1; + return SDL_SetError("MakeCurrent failed"); } } _GetBeApp()->SetCurrentContext(glView); From 6dc96aa7455d00a3556618a4a459851424ae5d44 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 18 Nov 2022 18:02:10 +0300 Subject: [PATCH 395/459] SDL_UDEV_DelCallback: return early if _this is NULL Fixes https://github.com/libsdl-org/SDL/issues/6548 --- src/core/linux/SDL_udev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c index 311cdd1eb..85cde8959 100644 --- a/src/core/linux/SDL_udev.c +++ b/src/core/linux/SDL_udev.c @@ -545,6 +545,10 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) SDL_UDEV_CallbackList *item; SDL_UDEV_CallbackList *prev = NULL; + if (_this == NULL) { + return; + } + for (item = _this->first; item != NULL; item = item->next) { /* found it, remove it. */ if (item->callback == cb) { From 81479d8784d0e1a61eafb3a444dd3865ad762fb2 Mon Sep 17 00:00:00 2001 From: David Gow Date: Fri, 18 Nov 2022 21:08:36 +0800 Subject: [PATCH 396/459] wayland: keyboard: Cache text input parameters. Some applications (and embarrassingly, testime is one of them) call SDL_StartTextInput() or SDL_SetTextInputRect() every frame. On KDE/KWin with fcitx5, this causes there to be several preedit events every frame (particularly given some of the workarounds in Wayland_StartTextInput), which slows testime down to an unusable crawl. Instead, make SDL_StartTextInput() a no-op if text input is already enabled, and cache the input rect, only changing it when the new rect is actually different. With these changes, we only get preedit events (and hence SDL_TEXTEDITING events) when the preedit string actually changes. This matches the behaviour under XWayland, and works very smoothly. --- src/video/wayland/SDL_waylandkeyboard.c | 23 ++++++++++++++++------- src/video/wayland/SDL_waylandkeyboard.h | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c index 6f6115d22..5cea5effc 100644 --- a/src/video/wayland/SDL_waylandkeyboard.c +++ b/src/video/wayland/SDL_waylandkeyboard.c @@ -61,6 +61,10 @@ Wayland_StartTextInput(_THIS) if (input != NULL && input->text_input) { const SDL_Rect *rect = &input->text_input->cursor_rect; + /* Don't re-enable if we're already enabled. */ + if (input->text_input->is_enabled) + return; + /* For some reason this has to be done twice, it appears to be a * bug in mutter? Maybe? * -flibit @@ -83,6 +87,7 @@ Wayland_StartTextInput(_THIS) rect->h); } zwp_text_input_v3_commit(input->text_input->text_input); + input->text_input->is_enabled = SDL_TRUE; } } } @@ -97,6 +102,7 @@ Wayland_StopTextInput(_THIS) if (input != NULL && input->text_input) { zwp_text_input_v3_disable(input->text_input->text_input); zwp_text_input_v3_commit(input->text_input->text_input); + input->text_input->is_enabled = SDL_FALSE; } } @@ -120,13 +126,16 @@ Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect) if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; if (input != NULL && input->text_input) { - SDL_copyp(&input->text_input->cursor_rect, rect); - zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, - rect->x, - rect->y, - rect->w, - rect->h); - zwp_text_input_v3_commit(input->text_input->text_input); + if (!SDL_RectEquals(rect, &input->text_input->cursor_rect)) + { + SDL_copyp(&input->text_input->cursor_rect, rect); + zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, + rect->x, + rect->y, + rect->w, + rect->h); + zwp_text_input_v3_commit(input->text_input->text_input); + } } } diff --git a/src/video/wayland/SDL_waylandkeyboard.h b/src/video/wayland/SDL_waylandkeyboard.h index 5909a2497..a56ccba6d 100644 --- a/src/video/wayland/SDL_waylandkeyboard.h +++ b/src/video/wayland/SDL_waylandkeyboard.h @@ -28,6 +28,7 @@ typedef struct SDL_WaylandTextInput struct zwp_text_input_v3 *text_input; SDL_Rect cursor_rect; SDL_bool has_preedit; + SDL_bool is_enabled; } SDL_WaylandTextInput; extern int Wayland_InitKeyboard(_THIS); From ea4ea27a59ddc0adab4d3d0bb6fbe8fa425f5a21 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 11:14:14 -0800 Subject: [PATCH 397/459] Don't trigger an error if we try to delete a touch device after shutting down the touch system This can happen on Raspberry Pi if the display system fails to initialize. --- src/events/SDL_touch.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index ebf26e091..bc77b7354 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -456,10 +456,16 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, void SDL_DelTouch(SDL_TouchID id) { - int i; - int index = SDL_GetTouchIndex(id); - SDL_Touch *touch = SDL_GetTouch(id); + int i, index; + SDL_Touch *touch; + if (SDL_num_touch == 0) { + /* We've already cleaned up, we won't find this device */ + return; + } + + index = SDL_GetTouchIndex(id); + touch = SDL_GetTouch(id); if (!touch) { return; } From da9ba3a2a1536017e4ce1ee0f4276578d1ce6e29 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 12:17:27 -0800 Subject: [PATCH 398/459] If a CRTC doesn't have a mode configured, use the preferred or largest mode as the default mode Fixes https://github.com/libsdl-org/SDL/issues/6421 --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 35 +++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index eae721455..eeeefef2b 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -666,8 +666,8 @@ KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id) /* Gets a DRM connector, builds an SDL_Display with it, and adds it to the list of SDL Displays in _this->displays[] */ static void -KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) { - +KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) +{ SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata); SDL_DisplayData *dispdata = NULL; SDL_VideoDisplay display = {0}; @@ -770,14 +770,37 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) { drmModeModeInfo *mode = &connector->modes[i]; if (!SDL_memcmp(mode, &crtc->mode, sizeof(crtc->mode))) { - mode_index = i; - break; + mode_index = i; + break; } } if (mode_index == -1) { - ret = SDL_SetError("Failed to find index of mode attached to the CRTC."); - goto cleanup; + int current_area, largest_area = 0; + + /* Find the preferred mode or the highest resolution mode */ + for (i = 0; i < connector->count_modes; i++) { + drmModeModeInfo *mode = &connector->modes[i]; + + if (mode->type & DRM_MODE_TYPE_PREFERRED) { + mode_index = i; + break; + } + + current_area = mode->hdisplay * mode->vdisplay; + if (current_area > largest_area) { + mode_index = i; + largest_area = current_area; + } + } + if (mode_index != -1) { + crtc->mode = connector->modes[mode_index]; + } + } + + if (mode_index == -1) { + ret = SDL_SetError("Failed to find index of mode attached to the CRTC."); + goto cleanup; } /*********************************************/ From ff99e56d3af276f8fa199d57a64cc863d9c9f798 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 12:54:55 -0800 Subject: [PATCH 399/459] Fixed KMSDRM window creation failing if OpenGL libraries are not available, but GLES 2.0 libraries are --- src/video/SDL_egl.c | 33 ++++++++++++++++-------- src/video/kmsdrm/SDL_kmsdrmvideo.c | 40 +++++++++++++++++------------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 2438faf00..41ae6ec01 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -292,8 +292,8 @@ SDL_EGL_UnloadLibrary(_THIS) } } -int -SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) +static int +SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) { void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; const char *path = NULL; @@ -304,15 +304,6 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); #endif - if (_this->egl_data) { - return SDL_SetError("EGL context already created"); - } - - _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); - if (!_this->egl_data) { - return SDL_OutOfMemory(); - } - #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER); if (d3dcompiler) { @@ -473,6 +464,26 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) return 0; } +int +SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) +{ + if (_this->egl_data) { + return SDL_SetError("EGL context already created"); + } + + _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); + if (!_this->egl_data) { + return SDL_OutOfMemory(); + } + + if (SDL_EGL_LoadLibraryInternal(_this, egl_path) < 0) { + SDL_free(_this->egl_data); + _this->egl_data = NULL; + return -1; + } + return 0; +} + static void SDL_EGL_GetVersion(_THIS) { if (_this->egl_data->eglQueryString) { diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index eeeefef2b..6c05bbd9b 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1456,28 +1456,34 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window) } } - /* Manually load the GL library. KMSDRM_EGL_LoadLibrary() has already - been called by SDL_CreateWindow() but we don't do anything there, - out KMSDRM_EGL_LoadLibrary() is a dummy precisely to be able to load it here. - If we let SDL_CreateWindow() load the lib, it would be loaded - before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */ - if (!_this->egl_data) { - egl_display = (NativeDisplayType)((SDL_VideoData *)_this->driverdata)->gbm_dev; - if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA)) { - return (SDL_SetError("Can't load EGL/GL library on window creation.")); - } + /* Manually load the GL library. KMSDRM_EGL_LoadLibrary() has already + been called by SDL_CreateWindow() but we don't do anything there, + our KMSDRM_EGL_LoadLibrary() is a dummy precisely to be able to load it here. + If we let SDL_CreateWindow() load the lib, it would be loaded + before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */ + if (!_this->egl_data) { + egl_display = (NativeDisplayType)((SDL_VideoData *)_this->driverdata)->gbm_dev; + if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) { + /* Try again with OpenGL ES 2.0 */ + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 0; + if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) { + return (SDL_SetError("Can't load EGL/GL library on window creation.")); + } + } - _this->gl_config.driver_loaded = 1; + _this->gl_config.driver_loaded = 1; - } + } - /* Create the cursor BO for the display of this window, - now that we know this is not a VK window. */ - KMSDRM_CreateCursorBO(display); + /* Create the cursor BO for the display of this window, + now that we know this is not a VK window. */ + KMSDRM_CreateCursorBO(display); - /* Create and set the default cursor for the display + /* Create and set the default cursor for the display of this window, now that we know this is not a VK window. */ - KMSDRM_InitMouse(_this, display); + KMSDRM_InitMouse(_this, display); /* The FULLSCREEN flags are cut out from window->flags at this point, so we can't know if a window is fullscreen or not, hence all windows From 509939b1b63e16c21094f550a4627be6a8bf0d72 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 18 Nov 2022 18:20:53 -0800 Subject: [PATCH 400/459] Disable the third party PS3 HIDAPI driver by default, the L3/R3 buttons are unknown --- src/joystick/hidapi/SDL_hidapi_ps3.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_ps3.c b/src/joystick/hidapi/SDL_hidapi_ps3.c index 49913d9df..10e3bc548 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps3.c +++ b/src/joystick/hidapi/SDL_hidapi_ps3.c @@ -596,9 +596,13 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS3 = static SDL_bool HIDAPI_DriverPS3ThirdParty_IsEnabled(void) { +#if 1 /* Not enabled by default, we don't know what the L3/R3 buttons are */ + return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS3, SDL_FALSE); +#else return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS3, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)); +#endif } static SDL_bool From fe396e306effb170b1abd093111d3f5c5338ae4b Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 19 Nov 2022 11:28:31 -0500 Subject: [PATCH 401/459] wayland: Use the cached window size when switching from non-floating to floating window state When changing the window state from non-floating to floating (e.g. leaving fullscreen), libdecor can send bogus content sizes that are +/- the height of the window title bar and start 'walking' the window height in one direction or the other with every transition. The floating window size is known, so use the cached value instead of the size reported by libdecor when restoring the floating state. --- src/video/wayland/SDL_waylandwindow.c | 16 ++++++++++++---- src/video/wayland/SDL_waylandwindow.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index a329ad357..a31f6baf6 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -878,11 +878,17 @@ decoration_frame_configure(struct libdecor_frame *frame, wind->floating_resize_pending = SDL_FALSE; } else { /* - * XXX: When hiding a floating window, libdecor can send bogus content sizes that - * are +/- the height of the title bar, which distorts the window size. - * Ignore any values from libdecor when hiding a floating window. + * XXX: libdecor can send bogus content sizes that are +/- the height + * of the title bar when hiding a window or transitioning from + * non-floating to floating state, which distorts the window size. + * + * Ignore any size values from libdecor in these scenarios in + * favor of the cached window size. + * + * https://gitlab.gnome.org/jadahl/libdecor/-/issues/40 */ - const SDL_bool use_cached_size = (window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN)); + const SDL_bool use_cached_size = (floating && !wind->was_floating) || + (window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN)); /* This will never set 0 for width/height unless the function returns false */ if (use_cached_size || !libdecor_configuration_get_content_size(configuration, frame, &width, &height)) { @@ -905,6 +911,8 @@ decoration_frame_configure(struct libdecor_frame *frame, wind->floating_height = height; } + wind->was_floating = floating; + /* Do the resize on the SDL side (this will set window->w/h)... */ Wayland_HandleResize(window, width, height, scale_factor); wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE; diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index b6a3aa28c..6e2701048 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -102,6 +102,7 @@ typedef struct { int window_width, window_height; SDL_bool needs_resize_event; SDL_bool floating_resize_pending; + SDL_bool was_floating; SDL_bool is_fullscreen; SDL_bool in_fullscreen_transition; Uint32 fullscreen_flags; From 3bc4bad8fb2b0be328f1c00628867a81a089aa2f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 20 Nov 2022 23:50:10 +0300 Subject: [PATCH 402/459] add missing strcasestr checks to cmake and autotools build systems, and update config files. --- CMakeLists.txt | 2 +- configure | 6 ++++++ configure.ac | 2 +- include/SDL_config.h.cmake | 1 + include/SDL_config.h.in | 1 + include/SDL_config_android.h | 1 + include/SDL_config_iphoneos.h | 1 + include/SDL_config_macosx.h | 1 + 8 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 408bc2f14..05bbac494 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1045,7 +1045,7 @@ if(SDL_LIBC) bsearch qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull - atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp + atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr wcscmp _wcsdup wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit diff --git a/configure b/configure index 9461408e8..59d347f3e 100755 --- a/configure +++ b/configure @@ -19535,6 +19535,12 @@ if test "x$ac_cv_func_strncasecmp" = xyes then : printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr" +if test "x$ac_cv_func_strcasestr" = xyes +then : + printf "%s\n" "#define HAVE_STRCASESTR 1" >>confdefs.h + fi ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf" if test "x$ac_cv_func_vsscanf" = xyes diff --git a/configure.ac b/configure.ac index a4252d2ed..d8e3dc3da 100644 --- a/configure.ac +++ b/configure.ac @@ -348,7 +348,7 @@ dnl Checks for library functions. AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ],[]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index b85c5672b..8fcb63d18 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -140,6 +140,7 @@ #cmakedefine HAVE_STRCASECMP 1 #cmakedefine HAVE__STRNICMP 1 #cmakedefine HAVE_STRNCASECMP 1 +#cmakedefine HAVE_STRCASESTR 1 #cmakedefine HAVE_SSCANF 1 #cmakedefine HAVE_VSSCANF 1 #cmakedefine HAVE_VSNPRINTF 1 diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 67e50745b..7b8d848e0 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -143,6 +143,7 @@ #undef HAVE_STRCASECMP #undef HAVE__STRNICMP #undef HAVE_STRNCASECMP +#undef HAVE_STRCASESTR #undef HAVE_SSCANF #undef HAVE_VSSCANF #undef HAVE_SNPRINTF diff --git a/include/SDL_config_android.h b/include/SDL_config_android.h index 5a9cfc045..64918ae0b 100644 --- a/include/SDL_config_android.h +++ b/include/SDL_config_android.h @@ -85,6 +85,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_ACOS 1 diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h index 48f9f9f9b..6db16eb4c 100644 --- a/include/SDL_config_iphoneos.h +++ b/include/SDL_config_iphoneos.h @@ -85,6 +85,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h index 023ecaae3..e7189f3a1 100644 --- a/include/SDL_config_macosx.h +++ b/include/SDL_config_macosx.h @@ -88,6 +88,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 From 802c624ab38494c3e27093af528710b6da28d12f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 20 Nov 2022 14:37:05 -0800 Subject: [PATCH 403/459] Strip trailing newline when reading the VERSION file --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05bbac494..bf0c5e9ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2962,6 +2962,7 @@ set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION") file(READ "${PROJECT_SOURCE_DIR}/VERSION" SDL_SOURCE_VERSION) + string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION) endif() find_package(Git) From 8ae46a49ea52839e0fe96b03ab183fe3ad99863b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Nov 2022 06:57:02 -0800 Subject: [PATCH 404/459] Save the version in VERSION.txt instead of VERSION Fixes https://github.com/libsdl-org/SDL/issues/6558 --- .gitignore | 2 +- Android.mk | 2 +- CMakeLists.txt | 4 ++-- build-scripts/showrev.sh | 4 ++-- build-scripts/updaterev.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 1ab87fbc9..a746abbc1 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ build gen Build buildbot -/VERSION +/VERSION.txt *.so *.so.* diff --git a/Android.mk b/Android.mk index facc54afb..06146cd40 100644 --- a/Android.mk +++ b/Android.mk @@ -12,7 +12,7 @@ LOCAL_MODULE := SDL2 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)/include LOCAL_SRC_FILES := \ $(subst $(LOCAL_PATH)/,, \ diff --git a/CMakeLists.txt b/CMakeLists.txt index bf0c5e9ea..ffd9de7ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2960,8 +2960,8 @@ set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) # Compat helpers for the configuration files -if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION") - file(READ "${PROJECT_SOURCE_DIR}/VERSION" SDL_SOURCE_VERSION) +if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt") + file(READ "${PROJECT_SOURCE_DIR}/VERSION.txt" SDL_SOURCE_VERSION) string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION) endif() diff --git a/build-scripts/showrev.sh b/build-scripts/showrev.sh index 02cbbb0c6..a061df423 100755 --- a/build-scripts/showrev.sh +++ b/build-scripts/showrev.sh @@ -5,8 +5,8 @@ SDL_ROOT=$(dirname $0)/.. cd $SDL_ROOT -if [ -e ./VERSION ]; then - cat ./VERSION +if [ -e ./VERSION.txt ]; then + cat ./VERSION.txt exit 0 fi diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index 3ab034fd5..cc8638210 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -29,7 +29,7 @@ done rev=`sh showrev.sh 2>/dev/null` if [ "$rev" != "" ]; then if [ -n "$dist" ]; then - echo "$rev" > "$outdir/VERSION" + echo "$rev" > "$outdir/VERSION.txt" fi echo "/* Generated by updaterev.sh, do not edit */" >"$header.new" if [ -n "$vendor" ]; then From 8b20b568b0104cf1695a5a35c5e24110fe34d4c0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Nov 2022 07:41:35 -0800 Subject: [PATCH 405/459] Don't report battery level for disconnected batteries Fixes https://github.com/libsdl-org/SDL/issues/6536 --- src/core/windows/SDL_xinput.h | 5 ++++- src/joystick/SDL_joystick.c | 2 +- src/joystick/windows/SDL_rawinputjoystick.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/windows/SDL_xinput.h b/src/core/windows/SDL_xinput.h index 461d99b48..5f6d36a98 100644 --- a/src/core/windows/SDL_xinput.h +++ b/src/core/windows/SDL_xinput.h @@ -133,10 +133,13 @@ using namespace XInputOnGameInput; #ifndef BATTERY_DEVTYPE_GAMEPAD #define BATTERY_DEVTYPE_GAMEPAD 0x00 #endif + +#ifndef BATTERY_TYPE_DISCONNECTED +#define BATTERY_TYPE_DISCONNECTED 0x00 +#endif #ifndef BATTERY_TYPE_WIRED #define BATTERY_TYPE_WIRED 0x01 #endif - #ifndef BATTERY_TYPE_UNKNOWN #define BATTERY_TYPE_UNKNOWN 0xFF #endif diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 4b9558145..c882a1a40 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2901,7 +2901,7 @@ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLe { CHECK_JOYSTICK_MAGIC(joystick, ); - SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialisation */ + SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */ if (ePowerLevel != joystick->epowerlevel) { #if !SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 120a361f1..fc738b07f 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -1775,7 +1775,8 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) } has_trigger_data = SDL_TRUE; - if (battery_info->BatteryType != BATTERY_TYPE_UNKNOWN) { + if (battery_info->BatteryType != BATTERY_TYPE_UNKNOWN && + battery_info->BatteryType != BATTERY_TYPE_DISCONNECTED) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; if (battery_info->BatteryType == BATTERY_TYPE_WIRED) { ePowerLevel = SDL_JOYSTICK_POWER_WIRED; From d167cd67159eac93aaa892c5b124c6c53718d408 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Nov 2022 09:02:10 -0800 Subject: [PATCH 406/459] =?UTF-8?q?Added=20the=20Gunfighter=20Mk.III=20?= =?UTF-8?q?=E2=80=98Space=20Combat=20Edition=E2=80=99=20as=20a=20flight=20?= =?UTF-8?q?stick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/joystick/SDL_joystick.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index c882a1a40..033929694 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2479,6 +2479,8 @@ static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid) MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ MAKE_VIDPID(0x044f, 0xb10a), /* ThrustMaster, Inc. T.16000M Joystick */ MAKE_VIDPID(0x046d, 0xc215), /* Logitech Extreme 3D */ + MAKE_VIDPID(0x231d, 0x0126), /* Gunfighter Mk.III ‘Space Combat Edition’ (right) */ + MAKE_VIDPID(0x231d, 0x0127), /* Gunfighter Mk.III ‘Space Combat Edition’ (left) */ }; int i; From 0bfeed061b10ea7dd37c88d9bae1824bad760f3a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Nov 2022 16:15:58 -0800 Subject: [PATCH 407/459] Updated to version 2.26.0 for release --- CMakeLists.txt | 4 ++-- Makefile.os2 | 4 ++-- Makefile.w32 | 4 ++-- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 16 ++++++++-------- .../main/java/org/libsdl/app/SDLActivity.java | 4 ++-- configure | 4 ++-- configure.ac | 4 ++-- include/SDL_version.h | 4 ++-- src/main/windows/version.rc | 8 ++++---- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffd9de7ef..021b66cd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,8 @@ endif() # See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 25) -set(SDL_MICRO_VERSION 1) +set(SDL_MINOR_VERSION 26) +set(SDL_MICRO_VERSION 0) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Set defaults preventing destination file conflicts diff --git a/Makefile.os2 b/Makefile.os2 index 111ea0eef..2e38ed0d4 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -14,8 +14,8 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 -MINOR_VERSION = 25 -MICRO_VERSION = 1 +MINOR_VERSION = 26 +MICRO_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 diff --git a/Makefile.w32 b/Makefile.w32 index 628ee7ed6..82609036b 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -5,8 +5,8 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 -MINOR_VERSION = 25 -MICRO_VERSION = 1 +MINOR_VERSION = 26 +MICRO_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 16ca1d1b7..09bae6c16 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.25.1 + 2.26.0 CFBundleSignature SDLX CFBundleVersion - 2.25.1 + 2.26.0 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index e0f747ab7..b59a594fb 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -9528,8 +9528,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 2502.0.0; - DYLIB_CURRENT_VERSION = 2502.0.0; + DYLIB_COMPATIBILITY_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9613,8 +9613,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_COMPATIBILITY_VERSION = 2502.0.0; - DYLIB_CURRENT_VERSION = 2502.0.0; + DYLIB_COMPATIBILITY_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9862,8 +9862,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2502.0.0; - DYLIB_CURRENT_VERSION = 2502.0.0; + DYLIB_COMPATIBILITY_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9914,8 +9914,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2502.0.0; - DYLIB_CURRENT_VERSION = 2502.0.0; + DYLIB_COMPATIBILITY_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index e749d6b77..90e3ac60b 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,8 +60,8 @@ import java.util.Locale; public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; - private static final int SDL_MINOR_VERSION = 25; - private static final int SDL_MICRO_VERSION = 1; + private static final int SDL_MINOR_VERSION = 26; + private static final int SDL_MICRO_VERSION = 0; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/configure b/configure index 59d347f3e..87c576def 100755 --- a/configure +++ b/configure @@ -3453,8 +3453,8 @@ orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=25 -SDL_MICRO_VERSION=1 +SDL_MINOR_VERSION=26 +SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/configure.ac b/configure.ac index d8e3dc3da..cc30f9a16 100644 --- a/configure.ac +++ b/configure.ac @@ -12,8 +12,8 @@ orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=25 -SDL_MICRO_VERSION=1 +SDL_MINOR_VERSION=26 +SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/include/SDL_version.h b/include/SDL_version.h index 612d2f53d..e85fceb34 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -58,8 +58,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 25 -#define SDL_PATCHLEVEL 1 +#define SDL_MINOR_VERSION 26 +#define SDL_PATCHLEVEL 0 /** * Macro to determine SDL version program was compiled against. diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index 97930ca04..fb2c26890 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,25,1,0 - PRODUCTVERSION 2,25,1,0 + FILEVERSION 2,26,0,0 + PRODUCTVERSION 2,26,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 25, 1, 0\0" + VALUE "FileVersion", "2, 26, 0, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 25, 1, 0\0" + VALUE "ProductVersion", "2, 26, 0, 0\0" END END BLOCK "VarFileInfo" From 2c4159b99adf72c428347a7dea6e704314b5b6f1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Nov 2022 20:28:58 -0800 Subject: [PATCH 408/459] First pass at changing SDL 2.0 to SDL 3.0 --- .editorconfig | 2 +- Android.mk | 10 +- CMakeLists.txt | 754 +++++++-------- Makefile.in | 60 +- Makefile.minimal | 4 +- Makefile.os2 | 16 +- Makefile.pandora | 2 +- Makefile.w32 | 18 +- README.md | 2 +- SDL2Config.cmake.in | 65 -- SDL2.spec.in => SDL3.spec.in | 6 +- SDL3Config.cmake.in | 65 ++ VisualC-GDK/SDL.sln | 6 +- VisualC-GDK/SDL/SDL.vcxproj | 2 +- VisualC-GDK/SDLmain/SDLmain.vcxproj | 4 +- VisualC-GDK/SDLtest/SDLtest.vcxproj | 4 +- VisualC-WinRT/SDL-UWP.sln | 2 +- VisualC-WinRT/SDL-UWP.vcxproj | 20 +- VisualC/SDL.sln | 6 +- VisualC/SDL/SDL.vcxproj | 2 +- VisualC/SDLmain/SDLmain.vcxproj | 2 +- VisualC/SDLtest/SDLtest.vcxproj | 2 +- VisualC/pkg-support/cmake/sdl2-config.cmake | 111 --- ...ersion.cmake => sdl3-config-version.cmake} | 6 +- VisualC/pkg-support/cmake/sdl3-config.cmake | 111 +++ .../Demos/Demos.xcodeproj/project.pbxproj | 98 +- Xcode-iOS/Demos/README | 2 +- Xcode-iOS/Demos/config.xcconfig | 2 +- Xcode/SDL/Info-Framework.plist | 4 +- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 126 +-- .../xcschemes/Framework-iOS.xcscheme | 4 +- .../xcschemes/xcFramework-iOS.xcscheme | 4 +- Xcode/SDL/{SDL2 => SDL3}/Info.plist | 0 Xcode/SDL/pkg-support/SDL.info | 2 +- .../resources/CMake/sdl2-config.cmake | 69 -- ...ersion.cmake => sdl3-config-version.cmake} | 6 +- .../resources/CMake/sdl3-config.cmake | 69 ++ Xcode/SDL/pkg-support/resources/ReadMe.txt | 10 +- Xcode/SDL/pkg-support/resources/SDL_DS_Store | Bin 15364 -> 15365 bytes .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 66 +- Xcode/SDLTest/config.xcconfig | 6 +- android-project-ant/jni/src/Android.mk | 2 +- android-project-ant/jni/src/Android_static.mk | 2 +- android-project/app/jni/src/Android.mk | 2 +- android-project/app/jni/src/CMakeLists.txt | 4 +- .../main/java/org/libsdl/app/SDLActivity.java | 18 +- build-scripts/android-prefab.sh | 4 +- build-scripts/androidbuildlibs.sh | 2 +- build-scripts/emscripten-buildbot.sh | 6 +- build-scripts/nacl-buildbot.sh | 8 +- build-scripts/naclbuild.sh | 12 +- build-scripts/raspberrypi-buildbot.sh | 14 +- build-scripts/windows-buildbot-zipper.bat | 6 +- cmake/macros.cmake | 2 +- cmake/sdlchecks.cmake | 58 +- cmake/test/CMakeLists.txt | 84 +- cmake/test/jni/Android.mk | 6 +- cmake/test/main_cli.c | 2 +- cmake/test/main_gui.c | 4 +- cmake/test/main_lib.c | 2 +- cmake/test/test_pkgconfig.sh | 6 +- cmake/test/test_sdlconfig.sh | 6 +- configure | 64 +- configure.ac | 44 +- docs/README-android.md | 8 +- docs/README-cmake.md | 30 +- docs/README-dynapi.md | 24 +- docs/README-emscripten.md | 4 +- docs/README-gdk.md | 20 +- docs/README-ios.md | 8 +- docs/README-kmsbsd.md | 2 +- docs/README-n3ds.md | 2 +- docs/README-ngage.md | 4 +- docs/README-os2.md | 13 +- docs/README-ps2.md | 6 +- docs/README-psp.md | 6 +- docs/README-raspberrypi.md | 4 +- docs/README-riscos.md | 6 +- docs/README-visualc.md | 16 +- docs/README-winrt.md | 6 +- docs/doxyfile | 8 +- include/SDL.h | 2 +- include/SDL_audio.h | 2 +- include/SDL_hints.h | 2 +- include/SDL_main.h | 2 +- include/SDL_test.h | 2 +- include/SDL_test_assert.h | 2 +- include/SDL_test_common.h | 2 +- include/SDL_test_compare.h | 2 +- include/SDL_test_crc32.h | 2 +- include/SDL_test_font.h | 2 +- include/SDL_test_fuzzer.h | 2 +- include/SDL_test_harness.h | 2 +- include/SDL_test_images.h | 2 +- include/SDL_test_log.h | 2 +- include/SDL_test_md5.h | 2 +- include/SDL_test_memory.h | 2 +- include/SDL_test_random.h | 2 +- include/SDL_thread.h | 8 +- include/SDL_version.h | 6 +- .../cmake/sdl2-config-version.cmake | 19 - mingw/pkg-support/cmake/sdl2-config.cmake | 19 - .../cmake/sdl3-config-version.cmake | 19 + mingw/pkg-support/cmake/sdl3-config.cmake | 19 + sdl2-config.cmake.in | 206 ----- ...n.cmake.in => sdl3-config-version.cmake.in | 2 +- sdl3-config.cmake.in | 206 +++++ sdl2-config.in => sdl3-config.in | 4 +- sdl2.m4 => sdl3.m4 | 76 +- sdl2.pc.in => sdl3.pc.in | 4 +- src/SDL_internal.h | 2 +- src/audio/emscripten/SDL_emscriptenaudio.c | 134 +-- src/audio/qsa/SDL_qsa_audio.c | 2 +- src/core/linux/SDL_ibus.c | 2 +- src/dynapi/SDL2.exports | 869 ------------------ src/dynapi/SDL3.exports | 869 ++++++++++++++++++ src/dynapi/SDL_dynapi.c | 16 +- src/dynapi/gendynapi.pl | 8 +- src/main/windows/version.rc | 10 +- ...cur => SDL3-WinRTResource_BlankCursor.cur} | Bin ...nRTResources.rc => SDL3-WinRTResources.rc} | 2 +- src/stdlib/SDL_mslibc.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.c | 36 +- src/video/haiku/SDL_bmessagebox.cc | 2 +- src/video/kmsdrm/SDL_kmsdrmopengles.c | 2 +- src/video/kmsdrm/SDL_kmsdrmvideo.c | 2 +- src/video/os2/SDL_os2video.c | 4 +- src/video/raspberry/SDL_rpiopengles.c | 2 +- src/video/windows/SDL_windowswindow.c | 3 +- src/video/winrt/SDL_winrtmouse.cpp | 4 +- src/video/x11/SDL_x11video.c | 2 +- test/CMakeLists.txt | 40 +- test/Makefile.in | 4 +- test/Makefile.os2 | 2 +- test/Makefile.w32 | 2 +- test/acinclude.m4 | 54 +- test/configure | 108 +-- test/configure.ac | 20 +- test/nacl/Makefile | 4 +- test/testautomation_audio.c | 2 +- test/testver.c | 6 +- test/watcom.mif | 8 +- visualtest/COPYING.txt | 2 +- visualtest/acinclude.m4 | 54 +- visualtest/configure | 86 +- visualtest/configure.ac | 6 +- 146 files changed, 2633 insertions(+), 2635 deletions(-) delete mode 100644 SDL2Config.cmake.in rename SDL2.spec.in => SDL3.spec.in (97%) create mode 100644 SDL3Config.cmake.in delete mode 100644 VisualC/pkg-support/cmake/sdl2-config.cmake rename VisualC/pkg-support/cmake/{sdl2-config-version.cmake => sdl3-config-version.cmake} (92%) create mode 100644 VisualC/pkg-support/cmake/sdl3-config.cmake rename Xcode/SDL/{SDL2 => SDL3}/Info.plist (100%) delete mode 100644 Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake rename Xcode/SDL/pkg-support/resources/CMake/{sdl2-config-version.cmake => sdl3-config-version.cmake} (94%) create mode 100644 Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake delete mode 100644 mingw/pkg-support/cmake/sdl2-config-version.cmake delete mode 100644 mingw/pkg-support/cmake/sdl2-config.cmake create mode 100644 mingw/pkg-support/cmake/sdl3-config-version.cmake create mode 100644 mingw/pkg-support/cmake/sdl3-config.cmake delete mode 100644 sdl2-config.cmake.in rename sdl2-config-version.cmake.in => sdl3-config-version.cmake.in (81%) create mode 100644 sdl3-config.cmake.in rename sdl2-config.in => sdl3-config.in (94%) rename sdl2.m4 => sdl3.m4 (73%) rename sdl2.pc.in => sdl3.pc.in (86%) delete mode 100644 src/dynapi/SDL2.exports create mode 100644 src/dynapi/SDL3.exports rename src/main/winrt/{SDL2-WinRTResource_BlankCursor.cur => SDL3-WinRTResource_BlankCursor.cur} (100%) rename src/main/winrt/{SDL2-WinRTResources.rc => SDL3-WinRTResources.rc} (54%) diff --git a/.editorconfig b/.editorconfig index 636c54453..5f3849ca4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,7 +16,7 @@ indent_style = space indent_size = 4 indent_style = space -[{CMakeLists.txt,sdl2-config*.cmake.in,cmake/*.cmake}] +[{CMakeLists.txt,sdl3-config*.cmake.in,cmake/*.cmake}] indent_size = 2 indent_style = space diff --git a/Android.mk b/Android.mk index 06146cd40..658e15951 100644 --- a/Android.mk +++ b/Android.mk @@ -8,7 +8,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := SDL2 +LOCAL_MODULE := SDL3 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include @@ -97,9 +97,9 @@ include $(BUILD_SHARED_LIBRARY) # ########################### -LOCAL_MODULE := SDL2_static +LOCAL_MODULE := SDL3_static -LOCAL_MODULE_FILENAME := libSDL2 +LOCAL_MODULE_FILENAME := libSDL3 LOCAL_LDLIBS := @@ -120,9 +120,9 @@ include $(CLEAR_VARS) LOCAL_C_INCLUDES := $(LOCAL_PATH)/include -LOCAL_MODULE := SDL2_main +LOCAL_MODULE := SDL3_main -LOCAL_MODULE_FILENAME := libSDL2main +LOCAL_MODULE_FILENAME := libSDL3main include $(BUILD_STATIC_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index 021b66cd5..60a4782ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,12 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) endif() cmake_minimum_required(VERSION 3.0.0) -project(SDL2 C CXX) +project(SDL3 C CXX) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(SDL2_SUBPROJECT OFF) + set(SDL3_SUBPROJECT OFF) else() - set(SDL2_SUBPROJECT ON) + set(SDL3_SUBPROJECT ON) endif() if (HAIKU) @@ -46,7 +46,7 @@ if(POLICY CMP0054) endif() # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property -# !!! FIXME: for the SDL2 shared library (so you get an +# !!! FIXME: for the SDL shared library (so you get an # !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib" # !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm # !!! FIXME: punting for now and leaving the existing behavior. Until this @@ -71,10 +71,10 @@ include(GNUInstallDirs) find_package(PkgConfig) -list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") -include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) -include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) -include(${SDL2_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake) +list(APPEND CMAKE_MODULE_PATH "${SDL3_SOURCE_DIR}/cmake") +include(${SDL3_SOURCE_DIR}/cmake/macros.cmake) +include(${SDL3_SOURCE_DIR}/cmake/sdlchecks.cmake) +include(${SDL3_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake) # Enable large file support on 32-bit glibc, so that we can access files # with large inode numbers @@ -84,8 +84,8 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) endif() # See docs/release_checklist.md -set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 26) +set(SDL_MAJOR_VERSION 3) +set(SDL_MINOR_VERSION 0) set(SDL_MICRO_VERSION 0) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") @@ -98,15 +98,15 @@ mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) # Calculate a libtool-like version number math(EXPR SDL_BINARY_AGE "${SDL_MINOR_VERSION} * 100 + ${SDL_MICRO_VERSION}") if(SDL_MINOR_VERSION MATCHES "[02468]$") - # Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + # Stable branch, 3.24.1 -> libSDL3-3.0.so.0.2400.1 set(SDL_INTERFACE_AGE ${SDL_MICRO_VERSION}) else() - # Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + # Development branch, 3.23.1 -> libSDL3-3.0.so.0.2301.0 set(SDL_INTERFACE_AGE 0) endif() # Increment this if there is an incompatible change - but if that happens, -# we should rename the library from SDL2 to SDL3, at which point this would +# we should rename the library from SDL3 to SDL4, at which point this would # reset to 0 anyway. set(LT_MAJOR "0") @@ -114,10 +114,10 @@ math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") set(LT_REVISION "${SDL_INTERFACE_AGE}") # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify # it to libSDL3.so.0 -set(LT_RELEASE "2.0") +set(LT_RELEASE "3.0") set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") # The following should match the versions in the Xcode project file. @@ -146,7 +146,7 @@ else() set(ARCH_64 FALSE) set(PROCESSOR_ARCH "x86") endif() -set(LIBNAME SDL2) +set(LIBNAME SDL3) if(NOT LIBTYPE) set(LIBTYPE SHARED) endif() @@ -325,9 +325,9 @@ if(MSVC) endif() endif() -# Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config, +# Those are used for pkg-config and friends, so that the sdl3.pc, sdl3-config, # etc. are created correctly. -set(SDL_LIBS "-lSDL2") +set(SDL_LIBS "-lSDL3") set(SDL_CFLAGS ) # When building shared lib for Windows with MinGW, @@ -358,13 +358,13 @@ endif() # General includes target_compile_definitions(sdl-build-options INTERFACE "-DUSING_GENERATED_CONFIG_H") -target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL2_BINARY_DIR}/include" "${SDL2_BINARY_DIR}/include-config-$>") +target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL3_BINARY_DIR}/include" "${SDL3_BINARY_DIR}/include-config-$>") # Note: The clang toolset for Visual Studio does not support the '-idirafter' option. if(USE_GCC OR (USE_CLANG AND NOT MSVC_CLANG)) # !!! FIXME: do we _need_ to mess with CMAKE_C_FLAGS here? - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter \"${SDL2_SOURCE_DIR}/src/video/khronos\"") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter \"${SDL3_SOURCE_DIR}/src/video/khronos\"") else() - target_include_directories(sdl-build-options INTERFACE "${SDL2_SOURCE_DIR}/src/video/khronos") + target_include_directories(sdl-build-options INTERFACE "${SDL3_SOURCE_DIR}/src/video/khronos") endif() # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so @@ -427,9 +427,9 @@ foreach(_SUB ${SDL_SUBSYSTEMS}) endforeach() # Allow some projects to be built conditionally. -set_option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF) -set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" ${SDL2_SUBPROJECT}) -set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" OFF) +set_option(SDL3_DISABLE_SDL3MAIN "Disable building/installation of SDL3main" OFF) +set_option(SDL3_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT}) +set_option(SDL3_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF) option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") #set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) @@ -519,7 +519,7 @@ option(SDL_WERROR "Enable -Werror" OFF) option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_ENABLED_BY_DEFAULT}) option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_ENABLED_BY_DEFAULT}) -option(SDL_TEST "Build the SDL2_test library" ${SDL_TEST_ENABLED_BY_DEFAULT}) +option(SDL_TEST "Build the SDL3_test library" ${SDL_TEST_ENABLED_BY_DEFAULT}) dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF) dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF) @@ -562,28 +562,28 @@ endif() # General source files file(GLOB SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/*.c - ${SDL2_SOURCE_DIR}/src/atomic/*.c - ${SDL2_SOURCE_DIR}/src/audio/*.c - ${SDL2_SOURCE_DIR}/src/cpuinfo/*.c - ${SDL2_SOURCE_DIR}/src/dynapi/*.c - ${SDL2_SOURCE_DIR}/src/events/*.c - ${SDL2_SOURCE_DIR}/src/file/*.c - ${SDL2_SOURCE_DIR}/src/joystick/*.c - ${SDL2_SOURCE_DIR}/src/haptic/*.c - ${SDL2_SOURCE_DIR}/src/hidapi/*.c - ${SDL2_SOURCE_DIR}/src/libm/*.c - ${SDL2_SOURCE_DIR}/src/locale/*.c - ${SDL2_SOURCE_DIR}/src/misc/*.c - ${SDL2_SOURCE_DIR}/src/power/*.c - ${SDL2_SOURCE_DIR}/src/render/*.c - ${SDL2_SOURCE_DIR}/src/render/*/*.c - ${SDL2_SOURCE_DIR}/src/sensor/*.c - ${SDL2_SOURCE_DIR}/src/stdlib/*.c - ${SDL2_SOURCE_DIR}/src/thread/*.c - ${SDL2_SOURCE_DIR}/src/timer/*.c - ${SDL2_SOURCE_DIR}/src/video/*.c - ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) + ${SDL3_SOURCE_DIR}/src/*.c + ${SDL3_SOURCE_DIR}/src/atomic/*.c + ${SDL3_SOURCE_DIR}/src/audio/*.c + ${SDL3_SOURCE_DIR}/src/cpuinfo/*.c + ${SDL3_SOURCE_DIR}/src/dynapi/*.c + ${SDL3_SOURCE_DIR}/src/events/*.c + ${SDL3_SOURCE_DIR}/src/file/*.c + ${SDL3_SOURCE_DIR}/src/joystick/*.c + ${SDL3_SOURCE_DIR}/src/haptic/*.c + ${SDL3_SOURCE_DIR}/src/hidapi/*.c + ${SDL3_SOURCE_DIR}/src/libm/*.c + ${SDL3_SOURCE_DIR}/src/locale/*.c + ${SDL3_SOURCE_DIR}/src/misc/*.c + ${SDL3_SOURCE_DIR}/src/power/*.c + ${SDL3_SOURCE_DIR}/src/render/*.c + ${SDL3_SOURCE_DIR}/src/render/*/*.c + ${SDL3_SOURCE_DIR}/src/sensor/*.c + ${SDL3_SOURCE_DIR}/src/stdlib/*.c + ${SDL3_SOURCE_DIR}/src/thread/*.c + ${SDL3_SOURCE_DIR}/src/timer/*.c + ${SDL3_SOURCE_DIR}/src/video/*.c + ${SDL3_SOURCE_DIR}/src/video/yuv2rgb/*.c) set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1) @@ -924,7 +924,7 @@ if(SDL_ASSEMBLY) if(ARMSIMD_FOUND) set(HAVE_ARMSIMD TRUE) set(SDL_ARM_SIMD_BLITTERS 1) - file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) + file(GLOB ARMSIMD_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE) endif() @@ -952,7 +952,7 @@ if(SDL_ASSEMBLY) if(ARMNEON_FOUND) set(HAVE_ARMNEON TRUE) set(SDL_ARM_NEON_BLITTERS 1) - file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) + file(GLOB ARMNEON_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE) endif() @@ -1141,14 +1141,14 @@ if(SDL_AUDIO) # CheckDummyAudio/CheckDiskAudio - valid for all platforms if(SDL_DUMMYAUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) - file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) + file(GLOB DUMMYAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/dummy/*.c) list(APPEND SOURCE_FILES ${DUMMYAUDIO_SOURCES}) set(HAVE_DUMMYAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_DISKAUDIO) set(SDL_AUDIO_DRIVER_DISK 1) - file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) + file(GLOB DISKAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/disk/*.c) list(APPEND SOURCE_FILES ${DISKAUDIO_SOURCES}) set(HAVE_DISKAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) @@ -1161,7 +1161,7 @@ if(UNIX OR APPLE) CheckDLOPEN() if(SDL_LOADSO AND HAVE_DLOPEN) set(SDL_LOADSO_DLOPEN 1) - file(GLOB DLOPEN_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + file(GLOB DLOPEN_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c) list(APPEND SOURCE_FILES ${DLOPEN_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() @@ -1175,7 +1175,7 @@ if(SDL_JOYSTICK) if(SDL_VIRTUAL_JOYSTICK) set(HAVE_VIRTUAL_JOYSTICK TRUE) set(SDL_JOYSTICK_VIRTUAL 1) - file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) + file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/virtual/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_VIRTUAL_SOURCES}) endif() endif() @@ -1183,14 +1183,14 @@ endif() if(SDL_VIDEO) if(SDL_DUMMYVIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) - file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) + file(GLOB VIDEO_DUMMY_SOURCES ${SDL3_SOURCE_DIR}/src/video/dummy/*.c) list(APPEND SOURCE_FILES ${VIDEO_DUMMY_SOURCES}) set(HAVE_DUMMYVIDEO TRUE) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_OFFSCREEN) set(SDL_VIDEO_DRIVER_OFFSCREEN 1) - file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c) + file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL3_SOURCE_DIR}/src/video/offscreen/*.c) list(APPEND SOURCE_FILES ${VIDEO_OFFSCREEN_SOURCES}) set(HAVE_OFFSCREEN TRUE) set(HAVE_SDL_VIDEO TRUE) @@ -1199,12 +1199,12 @@ endif() # Platform-specific options and settings if(ANDROID) - file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) + file(GLOB ANDROID_CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) set_property(SOURCE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-declaration-after-statement") if(SDL_MISC) - file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) + file(GLOB ANDROID_MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1217,39 +1217,39 @@ if(ANDROID) set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_property(SOURCE "${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") + set_property(SOURCE "${SDL3_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() cmake_pop_check_state() - file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) + file(GLOB ANDROID_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/android/*.c) list(APPEND SDLMAIN_SOURCES ${ANDROID_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) - file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) + file(GLOB ANDROID_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_AUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_OPENSLES 1) - file(GLOB OPENSLES_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/openslES/*.c) + file(GLOB OPENSLES_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/openslES/*.c) list(APPEND SOURCE_FILES ${OPENSLES_AUDIO_SOURCES}) list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} OpenSLES) set(SDL_AUDIO_DRIVER_AAUDIO 1) - file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c) + file(GLOB AAUDIO_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/aaudio/*.c) list(APPEND SOURCE_FILES ${AAUDIO_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_ANDROID 1) - file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/android/*.c) + file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_HAPTIC) set(SDL_HAPTIC_ANDROID 1) - file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) + file(GLOB ANDROID_HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1258,42 +1258,42 @@ if(ANDROID) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) - file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/android/*.c ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_DLOPEN 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) - file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) + file(GLOB ANDROID_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB ANDROID_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/android/*.c) + file(GLOB ANDROID_LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_ANDROID 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB ANDROID_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/android/*.c) + file(GLOB ANDROID_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) - file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) + file(GLOB ANDROID_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -1340,42 +1340,42 @@ elseif(EMSCRIPTEN) target_compile_options(sdl-build-options INTERFACE "-Wno-warn-absolute-paths") if(SDL_MISC) - file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/emscripten/*.c) + file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/emscripten/*.c) list(APPEND SOURCE_FILES ${EMSRIPTEN_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_EMSCRIPTEN 1) - file(GLOB EM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/emscripten/*.c) + file(GLOB EM_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_EMSCRIPTEN 1) - file(GLOB EM_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/emscripten/*.c) + file(GLOB EM_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_EMSCRIPTEN 1) - file(GLOB EM_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/emscripten/*.c) + file(GLOB EM_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_EMSCRIPTEN 1) - file(GLOB EM_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/emscripten/*.c) + file(GLOB EM_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/emscripten/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/emscripten/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) @@ -1385,7 +1385,7 @@ elseif(EMSCRIPTEN) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) - file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) + file(GLOB EM_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -1408,17 +1408,17 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) - file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) + file(GLOB SUN_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sun/*.c) list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(NETBSD) set(SDL_AUDIO_DRIVER_NETBSD 1) - file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) + file(GLOB NETBSD_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/netbsd/*.c) list(APPEND SOURCE_FILES ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) - file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c) + file(GLOB AIX_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/paudio/*.c) list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() @@ -1455,7 +1455,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(UNIX) - file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) + file(GLOB CORE_UNIX_SOURCES ${SDL3_SOURCE_DIR}/src/core/unix/*.c) list(APPEND SOURCE_FILES ${CORE_UNIX_SOURCES}) check_c_source_compiles(" @@ -1493,7 +1493,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) set(SDL_HAPTIC_LINUX 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/linux/*.c) list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1561,38 +1561,38 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(HAVE_DBUS_DBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_dbus.c") endif() if(SDL_USE_IME) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_ime.c") endif() if(HAVE_IBUS_IBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_ibus.c") endif() if(HAVE_FCITX) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") endif() if(HAVE_LIBUDEV_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_udev.c") endif() if(HAVE_INPUT_EVENTS) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") endif() if(HAVE_INPUT_KBIO) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") endif() # Always compiled for Linux, unconditionally: - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_sandbox.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_sandbox.c") # src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere. endif() @@ -1607,7 +1607,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/linux/*.c ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1634,7 +1634,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/unix/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1642,28 +1642,28 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_POWER) if(LINUX) set(SDL_POWER_LINUX 1) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/linux/*.c) list(APPEND SOURCE_FILES ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/unix/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_UNIX 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/unix/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() @@ -1693,11 +1693,11 @@ elseif(WINDOWS) #include int main(int argc, char **argv) { return 0; }" HAVE_WIN32_CC) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/windows/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(WINDOWS_STORE) - file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp) + file(GLOB WINRT_SOURCE_FILES ${SDL3_SOURCE_DIR}/src/core/winrt/*.c ${SDL3_SOURCE_DIR}/src/core/winrt/*.cpp) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) endif() @@ -1711,9 +1711,9 @@ elseif(WINDOWS) if(SDL_MISC) if(WINDOWS_STORE) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/winrt/*.cpp) else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/windows/*.c) endif() list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) @@ -1793,14 +1793,14 @@ elseif(WINDOWS) if(SDL_AUDIO) if(NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_WINMM 1) - file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) + file(GLOB WINMM_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/winmm/*.c) list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_DSOUND 1) - file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) + file(GLOB DSOUND_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/directsound/*.c) list(APPEND SOURCE_FILES ${DSOUND_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() @@ -1808,9 +1808,9 @@ elseif(WINDOWS) if(SDL_WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) set(SDL_AUDIO_DRIVER_WASAPI 1) set(HAVE_WASAPI TRUE) - file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) + file(GLOB WASAPI_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/wasapi/*.c) if(WINDOWS_STORE) - list(APPEND WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) + list(APPEND WASAPI_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) endif() list(APPEND SOURCE_FILES ${WASAPI_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) @@ -1825,13 +1825,13 @@ elseif(WINDOWS) if(WINDOWS_STORE) set(SDL_VIDEO_DRIVER_WINRT 1) file(GLOB WIN_VIDEO_SOURCES - ${SDL2_SOURCE_DIR}/src/video/winrt/*.c - ${SDL2_SOURCE_DIR}/src/video/winrt/*.cpp - ${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp + ${SDL3_SOURCE_DIR}/src/video/winrt/*.c + ${SDL3_SOURCE_DIR}/src/video/winrt/*.cpp + ${SDL3_SOURCE_DIR}/src/render/direct3d11/*.cpp ) else() set(SDL_VIDEO_DRIVER_WINDOWS 1) - file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) + file(GLOB WIN_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/windows/*.c) endif() list(APPEND SOURCE_FILES ${WIN_VIDEO_SOURCES}) @@ -1854,38 +1854,38 @@ elseif(WINDOWS) set(SDL_THREAD_GENERIC_COND_SUFFIX 1) set(SDL_THREAD_WINDOWS 1) list(APPEND SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syssem.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c) + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT WINDOWS_STORE) set(SDL_SENSOR_WINDOWS 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c) + file(GLOB WINDOWS_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/windows/*.c) list(APPEND SOURCE_FILES ${WINDOWS_SENSOR_SOURCES}) endif() if(SDL_POWER) if(WINDOWS_STORE) set(SDL_POWER_WINRT 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) else() set(SDL_POWER_WINDOWS 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) if(WINDOWS_STORE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/winrt/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/winrt/*.c) else() - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/windows/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/windows/*.c) endif() list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) @@ -1894,9 +1894,9 @@ elseif(WINDOWS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_WINDOWS 1) if(WINDOWS_STORE) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/winrt/*.cpp) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/winrt/*.cpp) else() - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c) endif() list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) @@ -1918,19 +1918,19 @@ elseif(WINDOWS) if(SDL_TIMERS) set(SDL_TIMER_WINDOWS 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/windows/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_WINDOWS 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/windows/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/windows/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(SDL_VIDEO) @@ -1959,7 +1959,7 @@ elseif(WINDOWS) endif() if(SDL_JOYSTICK) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/windows/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) if(NOT WINDOWS_STORE) @@ -1982,7 +1982,7 @@ elseif(WINDOWS) if(SDL_HAPTIC) if((HAVE_DINPUT_H OR HAVE_XINPUT_H) AND NOT WINDOWS_STORE) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/windows/*.c) if(HAVE_DINPUT_H) set(SDL_HAPTIC_DINPUT 1) endif() @@ -1990,7 +1990,7 @@ elseif(WINDOWS) set(SDL_HAPTIC_XINPUT 1) endif() else() - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) endif() list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) @@ -1998,13 +1998,13 @@ elseif(WINDOWS) endif() endif() - file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) + file(GLOB VERSION_SOURCES ${SDL3_SOURCE_DIR}/src/main/windows/*.rc) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/windows/*.c) if(MINGW OR CYGWIN) - if(NOT SDL2_DISABLE_SDL2MAIN) + if(NOT SDL3_DISABLE_SDL3MAIN) list(APPEND SDL_CFLAGS "-Dmain=SDL_main") - list(INSERT SDL_LIBS 0 "-lSDL2main") - endif(NOT SDL2_DISABLE_SDL2MAIN) + list(INSERT SDL_LIBS 0 "-lSDL3main") + endif(NOT SDL3_DISABLE_SDL3MAIN) list(INSERT SDL_LIBS 0 "-lmingw32" "-mwindows") endif() @@ -2024,20 +2024,20 @@ elseif(APPLE) # Requires the darwin file implementation if(SDL_FILE) - file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) + file(GLOB EXTRA_SOURCES ${SDL3_SOURCE_DIR}/src/file/cocoa/*.m) list(APPEND SOURCE_FILES ${EXTRA_SOURCES}) set(HAVE_SDL_FILE TRUE) endif() if(IOS OR TVOS) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/uikit/*.c) endif() if(SDL_MISC) if(IOS OR TVOS) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/ios/*.m) else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/macosx/*.m) endif() list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) @@ -2045,7 +2045,7 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) + file(GLOB AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/coreaudio/*.m) list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) @@ -2058,9 +2058,9 @@ elseif(APPLE) endif() if(SDL_JOYSTICK) - file(GLOB MFI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) + file(GLOB MFI_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/iphoneos/*.m) if(IOS OR TVOS) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) set(SDL_JOYSTICK_MFI 1) if(IOS) set(SDL_FRAMEWORK_COREMOTION 1) @@ -2068,7 +2068,7 @@ elseif(APPLE) set(SDL_FRAMEWORK_GAMECONTROLLER 1) set(SDL_FRAMEWORK_COREHAPTICS 1) else() - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/darwin/*.c) set_property(SOURCE ${MFI_JOYSTICK_SOURCES} APPEND_STRING PROPERTY COMPILE_FLAGS " -fobjc-weak") check_objc_source_compiles(" #include @@ -2104,10 +2104,10 @@ elseif(APPLE) if(SDL_HAPTIC) if (IOS OR TVOS) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) else() - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/darwin/*.c) set(SDL_HAPTIC_IOKIT 1) set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) @@ -2118,10 +2118,10 @@ elseif(APPLE) if(SDL_POWER) if (IOS OR TVOS) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/uikit/*.m) set(SDL_POWER_UIKIT 1) else() - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/macosx/*.c) set(SDL_POWER_MACOSX 1) set(SDL_FRAMEWORK_IOKIT 1) endif() @@ -2130,21 +2130,21 @@ elseif(APPLE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/macosx/*.m) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/macosx/*.m) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif(SDL_TIMERS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/cocoa/*.m) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -2153,7 +2153,7 @@ elseif(APPLE) if(IOS) set(SDL_SENSOR_COREMOTION 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m) + file(GLOB SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/coremotion/*.m) list(APPEND SOURCE_FILES ${SENSOR_SOURCES}) endif() endif() @@ -2167,7 +2167,7 @@ elseif(APPLE) set(SDL_FRAMEWORK_UIKIT 1) set(SDL_IPHONE_KEYBOARD 1) set(SDL_IPHONE_LAUNCHSCREEN 1) - file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) + file(GLOB UIKITVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/uikit/*.m) list(APPEND SOURCE_FILES ${UIKITVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) else() @@ -2215,7 +2215,7 @@ elseif(APPLE) set(HAVE_METAL TRUE) endif() if(SDL_RENDER_METAL) - file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) + file(GLOB RENDER_METAL_SOURCES ${SDL3_SOURCE_DIR}/src/render/metal/*.m) list(APPEND SOURCE_FILES ${RENDER_METAL_SOURCES}) set(SDL_VIDEO_RENDER_METAL 1) set(HAVE_RENDER_METAL TRUE) @@ -2299,27 +2299,27 @@ elseif(APPLE) elseif(HAIKU) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_HAIKU 1) - file(GLOB HAIKU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/haiku/*.cc) + file(GLOB HAIKU_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKU_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_HAIKU 1) - file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/haiku/*.cc) + file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKU_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/haiku/*.cc) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_HAIKU 1) - file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.cc) + file(GLOB HAIKUVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKUVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -2335,32 +2335,32 @@ elseif(HAIKU) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_HAIKU 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/haiku/*.cc) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_HAIKU 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/haiku/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/haiku/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_POWER) set(SDL_POWER_HAIKU 1) - file(GLOB HAIKU_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/haiku/*.c) + file(GLOB HAIKU_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/haiku/*.c) list(APPEND SOURCE_FILES ${HAIKU_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/haiku/*.cc) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() - file(GLOB MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/haiku/*.cc) + file(GLOB MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/haiku/*.cc) list(APPEND SOURCE_FILES ${MAIN_SOURCES}) CheckPTHREAD() @@ -2368,28 +2368,28 @@ elseif(HAIKU) elseif(RISCOS) if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/riscos/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_RISCOS 1) - file(GLOB RISCOSVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/riscos/*.c) + file(GLOB RISCOSVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/riscos/*.c) list(APPEND SOURCE_FILES ${RISCOSVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_RISCOS 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/riscos/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/riscos/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) @@ -2410,70 +2410,70 @@ elseif(VITA) set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_property(SOURCE "${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") + set_property(SOURCE "${SDL3_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() cmake_pop_check_state() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/vita/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_VITA 1) - file(GLOB VITA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/vita/*.c) + file(GLOB VITA_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/vita/*.c) list(APPEND SOURCE_FILES ${VITA_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_VITA 1) - file(GLOB VITA_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/vita/*.c) + file(GLOB VITA_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/vita/*.c) list(APPEND SOURCE_FILES ${VITA_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_VITA 1) - file(GLOB VITA_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/vita/*.c) + file(GLOB VITA_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/vita/*.c) list(APPEND SOURCE_FILES ${VITA_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_VITA 1) - file(GLOB VITA_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/vita/*.c) + file(GLOB VITA_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/vita/*.c) list(APPEND SOURCE_FILES ${VITA_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_VITA 1) list(APPEND SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syssem.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syscond.c - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_syssem.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_syscond.c + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/vita/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/vita/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_VITA 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/vita/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/vita/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_VITA 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB VITA_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/vita/*.c) + file(GLOB VITA_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/vita/*.c) list(APPEND SOURCE_FILES ${VITA_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_VITA 1) - file(GLOB VITA_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/vita/*.c) + file(GLOB VITA_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/vita/*.c) list(APPEND SOURCE_FILES ${VITA_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -2564,65 +2564,65 @@ elseif(VITA) set(HAVE_ARMSIMD TRUE) # set(SDL_ARM_SIMD_BLITTERS 1) -# file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) +# file(GLOB ARMSIMD_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) # list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) set(HAVE_ARMNEON TRUE) # set(SDL_ARM_NEON_BLITTERS 1) -# file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) +# file(GLOB ARMNEON_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) # list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) -# set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) -# set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) +# set_property(SOURCE ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) +# set_property(SOURCE ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) target_compile_definitions(sdl-build-options INTERFACE "-D__VITA__") # CheckPTHREAD() elseif(PSP) - file(GLOB PSP_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/psp/*.c) + file(GLOB PSP_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/psp/*.c) list(APPEND SDLMAIN_SOURCES ${PSP_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PSP 1) - file(GLOB PSP_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/psp/*.c) + file(GLOB PSP_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/psp/*.c) list(APPEND SOURCE_FILES ${PSP_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PSP 1) - file(GLOB PSP_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/psp/*.c) + file(GLOB PSP_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/psp/*.c) list(APPEND SOURCE_FILES ${PSP_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PSP 1) - file(GLOB PSP_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/psp/*.c) + file(GLOB PSP_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/psp/*.c) list(APPEND SOURCE_FILES ${PSP_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_PSP 1) - file(GLOB PSP_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/psp/*.c) + file(GLOB PSP_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/psp/*.c) list(APPEND SOURCE_FILES ${PSP_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PSP 1) - file(GLOB PSP_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) + file(GLOB PSP_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL3_SOURCE_DIR}/src/thread/psp/*.c) list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PSP 1) - file(GLOB PSP_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/psp/*.c) + file(GLOB PSP_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/psp/*.c) list(APPEND SOURCE_FILES ${PSP_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PSP 1) set(SDL_VIDEO_RENDER_PSP 1) - file(GLOB PSP_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/psp/*.c) + file(GLOB PSP_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/psp/*.c) list(APPEND SOURCE_FILES ${PSP_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 1) set(HAVE_SDL_VIDEO TRUE) @@ -2640,50 +2640,50 @@ elseif(PSP) pspctrl psppower ) - if(NOT SDL2_DISABLE_SDL2MAIN) - list(INSERT SDL_LIBS 0 "-lSDL2main") - endif(NOT SDL2_DISABLE_SDL2MAIN) + if(NOT SDL3_DISABLE_SDL3MAIN) + list(INSERT SDL_LIBS 0 "-lSDL3main") + endif(NOT SDL3_DISABLE_SDL3MAIN) elseif(PS2) list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include") - file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c) + file(GLOB PS2_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/ps2/*.c) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PS2 1) - file(GLOB PS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/ps2/*.c) + file(GLOB PS2_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/ps2/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${PS2_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PS2 1) - file(GLOB PS2_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/ps2/*.c) + file(GLOB PS2_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PS2 1) - file(GLOB PS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/ps2/*.c) + file(GLOB PS2_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PS2 1) - file(GLOB PS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) + file(GLOB PS2_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL3_SOURCE_DIR}/src/thread/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PS2 1) - file(GLOB PS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/ps2/*.c) + file(GLOB PS2_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PS2 1) set(SDL_VIDEO_RENDER_PS2 1) - file(GLOB PS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/ps2/*.c ${SDL2_SOURCE_DIR}/src/render/ps2/*.c) + file(GLOB PS2_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/ps2/*.c ${SDL3_SOURCE_DIR}/src/render/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 0) set(HAVE_SDL_VIDEO TRUE) @@ -2699,57 +2699,57 @@ elseif(PS2) elseif(OS2) list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/geniconv/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/geniconv/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) endif() if(SDL_THREADS) set(SDL_THREAD_OS2 1) - file(GLOB OS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/os2/*.c) + file(GLOB OS2_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/os2/*.c) list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB OS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/os2/*.c) + file(GLOB OS2_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/os2/*.c) list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_OS2 1) - file(GLOB OS2_LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/os2/*.c) + file(GLOB OS2_LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/os2/*.c) list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_OS2 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/os2/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/os2/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/unix/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_OS2 1) - file(GLOB OS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/os2/*.c) + file(GLOB OS2_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/os2/*.c) list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_OS2 1) - file(GLOB OS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/os2/*.c) + file(GLOB OS2_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/os2/*.c) list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) list(APPEND EXTRA_LIBS mmpm2) @@ -2757,7 +2757,7 @@ elseif(OS2) if(SDL_JOYSTICK) set(SDL_JOYSTICK_OS2 1) - file(GLOB OS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/os2/*.c) + file(GLOB OS2_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/os2/*.c) list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -2767,74 +2767,74 @@ elseif(OS2) endif() elseif(N3DS) - file(GLOB N3DS_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/n3ds/*.c) + file(GLOB N3DS_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/n3ds/*.c) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${N3DS_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_N3DS 1) - file(GLOB N3DS_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/n3ds/*.c) + file(GLOB N3DS_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_N3DS 1) - file(GLOB N3DS_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/n3ds/*.c) + file(GLOB N3DS_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_N3DS 1) - file(GLOB N3DS_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/n3ds/*.c) + file(GLOB N3DS_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_N3DS 1) - file(GLOB N3DS_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/n3ds/*.c) + file(GLOB N3DS_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_N3DS 1) - file(GLOB N3DS_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/n3ds/*.c) - list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) + file(GLOB N3DS_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_N3DS 1) - file(GLOB N3DS_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/n3ds/*.c) + file(GLOB N3DS_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_N3DS 1) - file(GLOB N3DS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/n3ds/*.c) + file(GLOB N3DS_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_SENSOR_SOURCES}) set(HAVE_SDL_SENSORS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_N3DS 1) - file(GLOB N3DS_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/n3ds/*.c) + file(GLOB N3DS_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_LOCALE) - file(GLOB N3DS_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/n3ds/*.c) + file(GLOB N3DS_LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() # Requires the n3ds file implementation if(SDL_FILE) - file(GLOB N3DS_FILE_SOURCES ${SDL2_SOURCE_DIR}/src/file/n3ds/*.c) + file(GLOB N3DS_FILE_SOURCES ${SDL3_SOURCE_DIR}/src/file/n3ds/*.c) list(APPEND SOURCE_FILES ${N3DS_FILE_SOURCES}) set(HAVE_SDL_FILE TRUE) else() @@ -2861,47 +2861,47 @@ CheckLibSampleRate() # src/X/*.c does not get included. if(NOT HAVE_SDL_AUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) + file(GLOB AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/dummy/*.c) list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) endif() if(NOT HAVE_SDL_VIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) - file(GLOB VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) + file(GLOB VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/dummy/*.c) list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) endif() if(NOT HAVE_SDL_JOYSTICK) set(SDL_JOYSTICK_DUMMY 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/dummy/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) endif() if(NOT HAVE_SDL_HAPTIC) set(SDL_HAPTIC_DUMMY 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) endif() if(NOT HAVE_SDL_SENSORS) set(SDL_SENSOR_DUMMY 1) - file(GLOB SENSORS_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/dummy/*.c) + file(GLOB SENSORS_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/dummy/*.c) list(APPEND SOURCE_FILES ${SENSORS_SOURCES}) endif() if(NOT HAVE_SDL_LOADSO) set(SDL_LOADSO_DUMMY 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dummy/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) endif() if(NOT HAVE_SDL_FILESYSTEM) set(SDL_FILESYSTEM_DUMMY 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/dummy/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) endif() if(NOT HAVE_SDL_LOCALE) set(SDL_LOCALE_DUMMY 1) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/dummy/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) endif() if(NOT HAVE_SDL_MISC) set(SDL_MISC_DUMMY 1) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/dummy/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) endif() @@ -2910,7 +2910,7 @@ if(NOT HAVE_SDL_THREADS) # The emscripten platform has been carefully vetted to work without threads if (EMSCRIPTEN) set(SDL_THREADS_DISABLED 1) - file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) + file(GLOB THREADS_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/*.c) list(APPEND SOURCE_FILES ${THREADS_SOURCES}) else() message_error("Threads are needed by many SDL subsystems and may not be disabled") @@ -2918,12 +2918,12 @@ if(NOT HAVE_SDL_THREADS) endif() if(NOT HAVE_SDL_TIMERS) set(SDL_TIMER_DUMMY 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/dummy/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) endif() if(NOT SDLMAIN_SOURCES) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/dummy/*.c) endif() # Append the -MMD -MT flags @@ -2935,15 +2935,15 @@ endif() # config variables may contain generator expression, so we need to generate SDL_config.h in 2 steps: # 1. replace all `#cmakedefine`'s and `@abc@` -configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake" - "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") +configure_file("${SDL3_SOURCE_DIR}/include/SDL_config.h.cmake" + "${SDL3_BINARY_DIR}/SDL_config.h.intermediate") # 2. Create the "include-config-${CMAKE_BUILD_TYPE}" folder (fails on older CMake versions when it does not exist) string(TOLOWER "${CMAKE_BUILD_TYPE}" lower_build_type) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}") # 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path) file(GENERATE - OUTPUT "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" - INPUT "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") + OUTPUT "${SDL3_BINARY_DIR}/include-config-$>/SDL_config.h" + INPUT "${SDL3_BINARY_DIR}/SDL_config.h.intermediate") # Prepare the flags and remove duplicates if(EXTRA_LDFLAGS) @@ -2992,32 +2992,32 @@ else() set(SDL_REVISION "SDL-${SDL_VERSION}-no-vcs") endif() -configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" - "${SDL2_BINARY_DIR}/include/SDL_revision.h") +configure_file("${SDL3_SOURCE_DIR}/include/SDL_revision.h.cmake" + "${SDL3_BINARY_DIR}/include/SDL_revision.h") -# Copy all non-generated headers to "${SDL2_BINARY_DIR}/include" +# Copy all non-generated headers to "${SDL3_BINARY_DIR}/include" # This is done to avoid the inclusion of a pre-generated SDL_config.h -file(GLOB SDL2_INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) -set(SDL2_COPIED_INCLUDE_FILES) -foreach(_hdr IN LISTS SDL2_INCLUDE_FILES) +file(GLOB SDL3_INCLUDE_FILES ${SDL3_SOURCE_DIR}/include/*.h) +set(SDL3_COPIED_INCLUDE_FILES) +foreach(_hdr IN LISTS SDL3_INCLUDE_FILES) if(_hdr MATCHES ".*(SDL_config|SDL_revision).*") - list(REMOVE_ITEM SDL2_INCLUDE_FILES "${_hdr}") + list(REMOVE_ITEM SDL3_INCLUDE_FILES "${_hdr}") else() get_filename_component(_name "${_hdr}" NAME) - set(_bin_hdr "${SDL2_BINARY_DIR}/include/${_name}") - list(APPEND SDL2_COPIED_INCLUDE_FILES "${_bin_hdr}") + set(_bin_hdr "${SDL3_BINARY_DIR}/include/${_name}") + list(APPEND SDL3_COPIED_INCLUDE_FILES "${_bin_hdr}") add_custom_command(OUTPUT "${_bin_hdr}" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_hdr}" "${_bin_hdr}" DEPENDS "${_hdr}") endif() endforeach() -list(APPEND SDL_GENERATED_HEADERS ${SDL2_COPIED_INCLUDE_FILES}) +list(APPEND SDL_GENERATED_HEADERS ${SDL3_COPIED_INCLUDE_FILES}) if(CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "" AND CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL ".lib") # Avoid conflict between the dll import library and the static library - set(sdl_static_libname "SDL2-static") + set(sdl_static_libname "SDL3-static") else() - set(sdl_static_libname "SDL2") + set(sdl_static_libname "SDL3") endif() set(prefix ${CMAKE_INSTALL_PREFIX}) @@ -3055,24 +3055,24 @@ listtostr(SDL_LIBS _SDL_LIBS) set(SDL_LIBS ${_SDL_LIBS}) listtostr(SDL_CFLAGS _SDL_CFLAGS "") set(SDL_CFLAGS ${_SDL_CFLAGS}) -string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "${SDL_STATIC_LIBS}") +string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "${SDL_STATIC_LIBS}") if(NOT SDL_SHARED) - string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}") + string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}") endif() -if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL2") - message(STATUS "\"pkg-config --static --libs sdl2\" will return invalid information") +if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL3") + message(STATUS "\"pkg-config --static --libs sdl3\" will return invalid information") endif() # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") -configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in" - "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY) -configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" - "${SDL2_BINARY_DIR}/sdl2-config" @ONLY) -configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in" - "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY) +configure_file("${SDL3_SOURCE_DIR}/sdl3.pc.in" + "${SDL3_BINARY_DIR}/sdl3.pc" @ONLY) +configure_file("${SDL3_SOURCE_DIR}/sdl3-config.in" + "${SDL3_BINARY_DIR}/sdl3-config" @ONLY) +configure_file("${SDL3_SOURCE_DIR}/SDL3.spec.in" + "${SDL3_BINARY_DIR}/SDL3.spec" @ONLY) macro(check_add_debug_flag FLAG SUFFIX) check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX}) @@ -3162,7 +3162,7 @@ add_custom_target(sdl_headers_copy ##### Info output ##### message(STATUS "") -message(STATUS "SDL2 was configured with the following options:") +message(STATUS "SDL3 was configured with the following options:") message(STATUS "") message(STATUS "Platform: ${CMAKE_SYSTEM}") message(STATUS "64-bit: ${ARCH_64}") @@ -3229,27 +3229,27 @@ endif() # Ensure that the extra cflags are used at compile time set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${EXTRA_CFLAGS_BUILD}") -if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) +if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) # Build SDLmain - add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) - add_dependencies(SDL2main sdl_headers_copy) + add_library(SDL3main STATIC ${SDLMAIN_SOURCES}) + add_dependencies(SDL3main sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2main ALIAS SDL2main) - target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include" PRIVATE "${SDL2_BINARY_DIR}/include-config-$>") - target_include_directories(SDL2main PUBLIC "$" $ $) + add_library(SDL3::SDL3main ALIAS SDL3main) + target_include_directories(SDL3main BEFORE PRIVATE "${SDL3_BINARY_DIR}/include" PRIVATE "${SDL3_BINARY_DIR}/include-config-$>") + target_include_directories(SDL3main PUBLIC "$" $ $) if (WIN32) - target_link_libraries(SDL2main PRIVATE shell32) + target_link_libraries(SDL3main PRIVATE shell32) endif() if(MINGW OR CYGWIN) cmake_minimum_required(VERSION 3.13) if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") + target_link_options(SDL3main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") else() - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") + target_link_options(SDL3main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") endif() endif() if (NOT ANDROID) - set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() endif() @@ -3275,98 +3275,98 @@ if(APPLE) endif() if(SDL_SHARED) - add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) - add_dependencies(SDL2 sdl_headers_copy) + add_library(SDL3 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + add_dependencies(SDL3 sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2 ALIAS SDL2) - set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + add_library(SDL3::SDL3 ALIAS SDL3) + set_target_properties(SDL3 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) if(NOT SDL_LIBC) check_cpu_architecture(x86 HAS_X86) if(HAS_X86) # FIXME: should be added for all architectures (missing symbols for ARM) - target_link_libraries(SDL2 PRIVATE "-nodefaultlib:MSVCRT") + target_link_libraries(SDL3 PRIVATE "-nodefaultlib:MSVCRT") endif() endif() if(APPLE) # FIXME: Remove SOVERSION in SDL3 - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES MACOSX_RPATH 1 SOVERSION 0 - OUTPUT_NAME "SDL2-${LT_RELEASE}") + OUTPUT_NAME "SDL3-${LT_RELEASE}") elseif(UNIX AND NOT ANDROID) - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES VERSION ${LT_VERSION} SOVERSION ${LT_MAJOR} - OUTPUT_NAME "SDL2-${LT_RELEASE}") + OUTPUT_NAME "SDL3-${LT_RELEASE}") else() if(WINDOWS OR CYGWIN) - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES DEFINE_SYMBOL DLL_EXPORT) elseif(OS2) - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES DEFINE_SYMBOL BUILD_SDL) endif() - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES VERSION ${SDL_VERSION} SOVERSION ${LT_REVISION} - OUTPUT_NAME "SDL2") + OUTPUT_NAME "SDL3") endif() # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") # Don't try to link with the default set of libraries. if(NOT WINDOWS_STORE) - set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") - set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") endif() - set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") endif() # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS - target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) - target_include_directories(SDL2 PUBLIC - "$" - "$>>" + target_link_libraries(SDL3 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) + target_include_directories(SDL3 PUBLIC + "$" + "$>>" "$" - "$") + "$") # This picks up all the compiler options and such we've accumulated up to here. - target_link_libraries(SDL2 PRIVATE $) + target_link_libraries(SDL3 PRIVATE $) if(MINGW OR CYGWIN) if(NOT CMAKE_VERSION VERSION_LESS "3.13") - target_link_options(SDL2 PRIVATE -static-libgcc) + target_link_options(SDL3 PRIVATE -static-libgcc) endif() endif() if(NOT ANDROID) - set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE) - set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) + set_property(TARGET SDL3 PROPERTY INTERFACE_SDL3_SHARED TRUE) + set_property(TARGET SDL3 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED) endif() if(SDL_STATIC) - add_library(SDL2-static STATIC ${SOURCE_FILES}) - add_dependencies(SDL2-static sdl_headers_copy) + add_library(SDL3-static STATIC ${SOURCE_FILES}) + add_dependencies(SDL3-static sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2-static ALIAS SDL2-static) - set_target_properties(SDL2-static PROPERTIES + add_library(SDL3::SDL3-static ALIAS SDL3-static) + set_target_properties(SDL3-static PROPERTIES OUTPUT_NAME "${sdl_static_libname}" POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") - target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) + target_compile_definitions(SDL3-static PRIVATE SDL_STATIC_LIB) # TODO: Win32 platforms keep the same suffix .lib for import and static # libraries - do we need to consider this? - target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2-static PUBLIC - "$" - "$>>" + target_link_libraries(SDL3-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL3-static PUBLIC + "$" + "$>>" "$" - "$") + "$") # This picks up all the compiler options and such we've accumulated up to here. - target_link_libraries(SDL2-static PRIVATE $) + target_link_libraries(SDL3-static PRIVATE $) if(NOT ANDROID) - set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE) - set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) + set_property(TARGET SDL3-static PROPERTY INTERFACE_SDL3_SHARED FALSE) + set_property(TARGET SDL3-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}") @@ -3376,45 +3376,45 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSIO ##### Tests ##### if(SDL_TEST) - file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) - add_library(SDL2_test STATIC ${TEST_SOURCES}) - add_dependencies(SDL2_test sdl_headers_copy) - add_library(SDL2::SDL2test ALIAS SDL2_test) - set_target_properties(SDL2_test PROPERTIES - EXPORT_NAME SDL2test) - target_include_directories(SDL2_test PUBLIC - "$" - "$>>" + file(GLOB TEST_SOURCES ${SDL3_SOURCE_DIR}/src/test/*.c) + add_library(SDL3_test STATIC ${TEST_SOURCES}) + add_dependencies(SDL3_test sdl_headers_copy) + add_library(SDL3::SDL3test ALIAS SDL3_test) + set_target_properties(SDL3_test PROPERTIES + EXPORT_NAME SDL3test) + target_include_directories(SDL3_test PUBLIC + "$" + "$>>" "$" - "$") - target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) + "$") + target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS}) endif() ##### Installation targets ##### -if(NOT SDL2_DISABLE_INSTALL) +if(NOT SDL3_DISABLE_INSTALL) if(SDL_SHARED) - install(TARGETS SDL2 EXPORT SDL2Targets + install(TARGETS SDL3 EXPORT SDL3Targets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(TARGETS SDL2main EXPORT SDL2mainTargets + if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) + install(TARGETS SDL3main EXPORT SDL3mainTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() if(SDL_STATIC) - install(TARGETS SDL2-static EXPORT SDL2staticTargets + install(TARGETS SDL3-static EXPORT SDL3staticTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() if(SDL_TEST) - install(TARGETS SDL2_test EXPORT SDL2testTargets + install(TARGETS SDL3_test EXPORT SDL3testTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") @@ -3423,85 +3423,85 @@ if(NOT SDL2_DISABLE_INSTALL) ##### Export files ##### if (WINDOWS AND NOT MINGW) set(SDL_INSTALL_CMAKEDIR_DEFAULT "cmake") - set(LICENSES_PREFIX "licenses/SDL2") + set(LICENSES_PREFIX "licenses/SDL3") else () - set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL3") set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") endif () - set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL2Config.cmake") + set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL3Config.cmake") include(CMakePackageConfigHelpers) - configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake" + configure_package_config_file(SDL3Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake" PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake" + write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake" VERSION ${SDL_VERSION} COMPATIBILITY AnyNewerVersion ) if(SDL_SHARED) - install(EXPORT SDL2Targets - FILE SDL2Targets.cmake - NAMESPACE SDL2:: + install(EXPORT SDL3Targets + FILE SDL3Targets.cmake + NAMESPACE SDL3:: DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2Targets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2") + install(EXPORT_ANDROID_MK SDL3Targets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3") endif() endif() - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(EXPORT SDL2mainTargets - FILE SDL2mainTargets.cmake - NAMESPACE SDL2:: + if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) + install(EXPORT SDL3mainTargets + FILE SDL3mainTargets.cmake + NAMESPACE SDL3:: DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2mainTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2main") + install(EXPORT_ANDROID_MK SDL3mainTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3main") endif() endif() if(SDL_STATIC) - install(EXPORT SDL2staticTargets - FILE SDL2staticTargets.cmake - NAMESPACE SDL2:: + install(EXPORT SDL3staticTargets + FILE SDL3staticTargets.cmake + NAMESPACE SDL3:: DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2staticTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2-static") + install(EXPORT_ANDROID_MK SDL3staticTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3-static") endif() endif() if(SDL_TEST) - install(EXPORT SDL2testTargets - FILE SDL2testTargets.cmake - NAMESPACE SDL2:: + install(EXPORT SDL3testTargets + FILE SDL3testTargets.cmake + NAMESPACE SDL3:: DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2testTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2test") + install(EXPORT_ANDROID_MK SDL3testTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3test") endif() endif() install( FILES - ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake DESTINATION "${SDL_INSTALL_CMAKEDIR}" COMPONENT Devel ) install( FILES - ${SDL2_INCLUDE_FILES} - "${SDL2_BINARY_DIR}/include/SDL_revision.h" - "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) + ${SDL3_INCLUDE_FILES} + "${SDL3_BINARY_DIR}/include/SDL_revision.h" + "${SDL3_BINARY_DIR}/include-config-$>/SDL_config.h" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) if (UPPER_BUILD_TYPE MATCHES DEBUG) @@ -3513,32 +3513,32 @@ if(NOT SDL2_DISABLE_INSTALL) install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}") if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") + install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "libdata/pkgconfig") else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc + install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() if(NOT (WINDOWS OR CYGWIN) OR MINGW) if(SDL_SHARED) set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) + get_target_property(SONAME SDL3 OUTPUT_NAME) if(NOT ANDROID AND NOT MINGW AND NOT OS2) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" - WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL3${SOPOSTFIX}${SOEXT}\" + WORKING_DIRECTORY \"${SDL3_BINARY_DIR}\")") + install(FILES ${SDL3_BINARY_DIR}/libSDL3${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() endif() - install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(PROGRAMS ${SDL3_BINARY_DIR}/sdl3-config DESTINATION "${CMAKE_INSTALL_BINDIR}") # TODO: what about the .spec file? Is it only needed for RPM creation? - install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") + install(FILES "${SDL3_SOURCE_DIR}/sdl3.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") endif() endif() ##### Uninstall target ##### -if(NOT SDL2_DISABLE_UNINSTALL) +if(NOT SDL3_DISABLE_UNINSTALL) if(NOT TARGET uninstall) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" @@ -3561,7 +3561,7 @@ endif() ##### Fix Objective C builds ##### set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${CMAKE_C_FLAGS}") -# Make sure SDL2::SDL2 always exists -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 ALIAS SDL2-static) +# Make sure SDL3::SDL3 always exists +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 ALIAS SDL3-static) endif() diff --git a/Makefile.in b/Makefile.in index d4eeee402..f72a044c2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,7 +13,7 @@ datarootdir = @datarootdir@ datadir = @datadir@ auxdir = @ac_aux_dir@ distpath = $(srcdir)/.. -distdir = SDL2-@SDL_VERSION@ +distdir = SDL3-@SDL_VERSION@ distfile = $(distdir).tar.gz @SET_MAKE@ @@ -34,25 +34,25 @@ LINKER = @LINKER@ LIBTOOLLINKERTAG = @LIBTOOLLINKERTAG@ SDL_VENDOR_INFO = @SDL_VENDOR_INFO@ -TARGET = libSDL2.la +TARGET = libSDL3.la OBJECTS = @OBJECTS@ GEN_HEADERS = @GEN_HEADERS@ GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ -SDLMAIN_TARGET = libSDL2main.la +SDLMAIN_TARGET = libSDL3main.la SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ -SDLTEST_TARGET = libSDL2_test.la +SDLTEST_TARGET = libSDL3_test.la SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@ -INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ +INSTALL_SDL3_CONFIG = @INSTALL_SDL3_CONFIG@ -SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols -GEN_DIST = SDL2.spec +SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl3-config.cmake.in sdl3-config-version.cmake.in sdl3-config.in sdl3.m4 sdl3.pc.in SDL3.spec.in SDL3Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +GEN_DIST = SDL3.spec ifneq ($V,1) RUN_CMD_AR = @echo " AR " $@; @@ -168,21 +168,21 @@ $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) install: all install-bin install-hdrs install-lib install-data install-bin: -ifeq ($(INSTALL_SDL2_CONFIG),TRUE) +ifeq ($(INSTALL_SDL3_CONFIG),TRUE) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir) - $(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config + $(INSTALL) -m 755 sdl3-config $(DESTDIR)$(bindir)/sdl3-config endif install-hdrs: update-revision - $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2 + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL3 for file in $(HDRS) $(SDLTEST_HDRS); do \ - $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \ + $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL3/$$file; \ done - $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h + $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL3/SDL_config.h if test -f include/SDL_revision.h; then \ - $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \ + $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL3/SDL_revision.h; \ else \ - $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \ + $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL3/SDL_revision.h; \ fi install-lib: $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) @@ -192,34 +192,34 @@ install-lib: $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLT $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) install-data: $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal - $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 + $(INSTALL) -m 644 $(srcdir)/sdl3.m4 $(DESTDIR)$(datadir)/aclocal/sdl3.m4 $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig - $(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig -ifeq ($(INSTALL_SDL2_CONFIG),TRUE) - $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2 - $(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2 - $(INSTALL) -m 644 sdl2-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL2 + $(INSTALL) -m 644 sdl3.pc $(DESTDIR)$(libdir)/pkgconfig +ifeq ($(INSTALL_SDL3_CONFIG),TRUE) + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL3 + $(INSTALL) -m 644 sdl3-config.cmake $(DESTDIR)$(libdir)/cmake/SDL3 + $(INSTALL) -m 644 sdl3-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL3 endif uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-bin: - rm -f $(DESTDIR)$(bindir)/sdl2-config + rm -f $(DESTDIR)$(bindir)/sdl3-config uninstall-hdrs: for file in $(HDRS) $(SDLTEST_HDRS); do \ - rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \ + rm -f $(DESTDIR)$(includedir)/SDL3/$$file; \ done - rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h - rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h - -rmdir $(DESTDIR)$(includedir)/SDL2 + rm -f $(DESTDIR)$(includedir)/SDL3/SDL_config.h + rm -f $(DESTDIR)$(includedir)/SDL3/SDL_revision.h + -rmdir $(DESTDIR)$(includedir)/SDL3 uninstall-lib: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET) rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) uninstall-data: - rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4 - rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc - rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake - rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config-version.cmake + rm -f $(DESTDIR)$(datadir)/aclocal/sdl3.m4 + rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl3.pc + rm -f $(DESTDIR)$(libdir)/cmake/SDL3/sdl3-config.cmake + rm -f $(DESTDIR)$(libdir)/cmake/SDL3/sdl3-config-version.cmake clean: rm -rf $(objects) @@ -227,7 +227,7 @@ clean: if test -f test/Makefile; then (cd test; $(MAKE) $@); fi distclean: clean - rm -f Makefile Makefile.rules sdl2-config + rm -f Makefile Makefile.rules sdl3-config rm -f config.status config.cache config.log libtool rm -rf $(srcdir)/autom4te* find $(srcdir) \( \ diff --git a/Makefile.minimal b/Makefile.minimal index 97ce201ea..0a69413dd 100644 --- a/Makefile.minimal +++ b/Makefile.minimal @@ -5,8 +5,8 @@ CFLAGS = -g -O2 $(INCLUDE) AR = ar RANLIB = ranlib -TARGET = libSDL2.a -TESTTARGET = libSDL2_test.a +TARGET = libSDL3.a +TESTTARGET = libSDL3_test.a SOURCES = \ src/*.c \ diff --git a/Makefile.os2 b/Makefile.os2 index 2e38ed0d4..0cefb4b3e 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -1,4 +1,4 @@ -# Open Watcom makefile to build SDL2.dll for OS/2 +# Open Watcom makefile to build SDL3.dll for OS/2 # wmake -f Makefile.os2 # # If you have GNU libiconv installed (iconv2.dll), you @@ -12,9 +12,9 @@ # # To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 -LIBNAME = SDL2 -MAJOR_VERSION = 2 -MINOR_VERSION = 26 +LIBNAME = SDL3 +MAJOR_VERSION = 3 +MINOR_VERSION = 0 MICRO_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 @@ -30,8 +30,8 @@ LNKFILE = $(LIBNAME).lnk INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" INCPATH+= -Iinclude -LIBM = SDL2libm.lib -TLIB = SDL2test.lib +LIBM = SDL3libm.lib +TLIB = SDL3test.lib LIBS = mmpm2.lib $(LIBM) CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei # Debug options: @@ -162,7 +162,7 @@ $(LIBICONV_LIB): "src/core/os2/iconv2.lbc" @echo * Creating: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ @$< -# SDL2libm +# SDL3libm MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & k_cos.c k_rem_pio2.c k_sin.c k_tan.c & s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c @@ -216,7 +216,7 @@ $(LIBM): build_libm $(MOBJS) @echo * Creating: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) -# SDL2test +# SDL3test TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & diff --git a/Makefile.pandora b/Makefile.pandora index fe2249979..4e6465eb5 100644 --- a/Makefile.pandora +++ b/Makefile.pandora @@ -10,7 +10,7 @@ CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ -I./include -I$(PNDSDK)/usr/include -TARGET = libSDL2.a +TARGET = libSDL3.a SOURCES = ./src/*.c \ diff --git a/Makefile.w32 b/Makefile.w32 index 82609036b..b89a44e57 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -1,11 +1,11 @@ -# Open Watcom makefile to build SDL2.dll for Win32 +# Open Watcom makefile to build SDL3.dll for Win32 # wmake -f Makefile.w32 # # To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 -LIBNAME = SDL2 -MAJOR_VERSION = 2 -MINOR_VERSION = 26 +LIBNAME = SDL3 +MAJOR_VERSION = 3 +MINOR_VERSION = 0 MICRO_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) @@ -19,8 +19,8 @@ INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" INCPATH+= -Iinclude INCPATH+= -I"src/video/khronos" -LIBM = SDL2libm.lib -TLIB = SDL2test.lib +LIBM = SDL3libm.lib +TLIB = SDL3test.lib # user32.lib, gdi32.lib, ole32.lib and oleaut32.lib are actually # among the default libraries in wlink.lnk for nt_dll linkage... LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) @@ -147,7 +147,7 @@ SDL_RLEaccel.obj: SDL_RLEaccel.c SDL_malloc.obj: SDL_malloc.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -# SDL2libm +# SDL3libm MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & k_cos.c k_rem_pio2.c k_sin.c k_tan.c & s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c @@ -201,7 +201,7 @@ $(LIBM): build_libm $(MOBJS) @echo * Creating: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) -# SDL2test +# SDL3test TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & @@ -257,7 +257,7 @@ $(LNKFILE): Makefile.w32 @for %i in ($(OBJS)) do @%append $@ FILE %i @for %i in ($(LIBS)) do @%append $@ LIB %i @%append $@ OPTION RESOURCE=$(RCOBJS) - @%append $@ EXPORT=src/dynapi/SDL2.exports + @%append $@ EXPORT=src/dynapi/SDL3.exports @%append $@ OPTION QUIET @%append $@ OPTION IMPF=$(EXPFILE) @%append $@ OPTION MAP=$(LIBHOME)/$^&.map diff --git a/README.md b/README.md index fa7f7ba0b..fac8663cb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Simple DirectMedia Layer (SDL) Version 2.0 +# Simple DirectMedia Layer (SDL) Version 3.0 https://www.libsdl.org/ diff --git a/SDL2Config.cmake.in b/SDL2Config.cmake.in deleted file mode 100644 index 8c18aa5d4..000000000 --- a/SDL2Config.cmake.in +++ /dev/null @@ -1,65 +0,0 @@ -# sdl2 cmake project-config input for CMakeLists.txt script - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -@PACKAGE_INIT@ - -set(SDL2_FOUND TRUE) - -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") - set(SDL2_SDL2_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") - if(ANDROID) - enable_language(CXX) - endif() - include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") - set(SDL2_SDL2-static_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") - set(SDL2_SDL2main_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") - set(SDL2_SDL2test_FOUND TRUE) -endif() - -check_required_components(SDL2) - -# Create SDL2::SDL2 alias for static-only builds -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - if(CMAKE_VERSION VERSION_LESS "3.18") - # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") - else() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) - endif() -endif() - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") -set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") -set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") -set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") -set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") -set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") -set(SDL2_LIBRARIES SDL2::SDL2) -set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -set(SDL2_STATIC_PRIVATE_LIBS) - -set(SDL2MAIN_LIBRARY) -if(TARGET SDL2::SDL2main) - set(SDL2MAIN_LIBRARY SDL2::SDL2main) - list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) - list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) -endif() - -set(SDL2TEST_LIBRARY SDL2::SDL2test) \ No newline at end of file diff --git a/SDL2.spec.in b/SDL3.spec.in similarity index 97% rename from SDL2.spec.in rename to SDL3.spec.in index 812d2d861..533af702c 100644 --- a/SDL2.spec.in +++ b/SDL3.spec.in @@ -1,5 +1,5 @@ Summary: Simple DirectMedia Layer -Name: SDL2 +Name: SDL3 Version: @SDL_VERSION@ Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz @@ -9,7 +9,7 @@ Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot Prefix: %{_prefix} %ifos linux -Provides: libSDL2-2.0.so.0 +Provides: libSDL3-3.0.so.0 %endif %define __defattr %defattr(-,root,root) @@ -75,7 +75,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/lib*.%{__soext} %{_includedir}/*/*.h %{_libdir}/cmake/* -%{_libdir}/pkgconfig/SDL2/* +%{_libdir}/pkgconfig/SDL3/* %{_datadir}/aclocal/* %changelog diff --git a/SDL3Config.cmake.in b/SDL3Config.cmake.in new file mode 100644 index 000000000..52dcfb198 --- /dev/null +++ b/SDL3Config.cmake.in @@ -0,0 +1,65 @@ +# SDL cmake project-config input for CMakeLists.txt script + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +@PACKAGE_INIT@ + +set(SDL3_FOUND TRUE) + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake") + set(SDL3_SDL3_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake") + if(ANDROID) + enable_language(CXX) + endif() + include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake") + set(SDL3_SDL3-static_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3mainTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3mainTargets.cmake") + set(SDL3_SDL3main_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake") + set(SDL3_SDL3test_FOUND TRUE) +endif() + +check_required_components(SDL3) + +# Create SDL3::SDL3 alias for static-only builds +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL3::SDL3-static") + else() + add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static) + endif() +endif() + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set(SDL3_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL3_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3") +set(SDL3_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3") +set(SDL3_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") +set(SDL3_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") +set(SDL3_LIBRARIES SDL3::SDL3) +set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) +set(SDL3_STATIC_PRIVATE_LIBS) + +set(SDL3MAIN_LIBRARY) +if(TARGET SDL3::SDL3main) + set(SDL3MAIN_LIBRARY SDL3::SDL3main) + list(INSERT SDL3_LIBRARIES 0 SDL3::SDL3main) + list(INSERT SDL3_STATIC_LIBRARIES 0 SDL3::SDL3main) +endif() + +set(SDL3TEST_LIBRARY SDL3::SDL3test) diff --git a/VisualC-GDK/SDL.sln b/VisualC-GDK/SDL.sln index 258421950..827c9ff4b 100644 --- a/VisualC-GDK/SDL.sln +++ b/VisualC-GDK/SDL.sln @@ -4,13 +4,13 @@ VisualStudioVersion = 17.1.32414.318 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" EndProject diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index c8208b41f..b183f6225 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -27,7 +27,7 @@ - SDL2 + SDL3 {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} SDL 10.0 diff --git a/VisualC-GDK/SDLmain/SDLmain.vcxproj b/VisualC-GDK/SDLmain/SDLmain.vcxproj index a2c05b1c3..df88a7741 100644 --- a/VisualC-GDK/SDLmain/SDLmain.vcxproj +++ b/VisualC-GDK/SDLmain/SDLmain.vcxproj @@ -30,7 +30,7 @@ - SDL2main + SDL3main {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} SDLmain 10.0 @@ -208,4 +208,4 @@ - \ No newline at end of file + diff --git a/VisualC-GDK/SDLtest/SDLtest.vcxproj b/VisualC-GDK/SDLtest/SDLtest.vcxproj index c2e9348c3..9ed131a38 100644 --- a/VisualC-GDK/SDLtest/SDLtest.vcxproj +++ b/VisualC-GDK/SDLtest/SDLtest.vcxproj @@ -27,7 +27,7 @@ - SDL2test + SDL3test {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} SDLtest 10.0 @@ -223,4 +223,4 @@ - \ No newline at end of file + diff --git a/VisualC-WinRT/SDL-UWP.sln b/VisualC-WinRT/SDL-UWP.sln index 472c4f01b..62f9f0417 100644 --- a/VisualC-WinRT/SDL-UWP.sln +++ b/VisualC-WinRT/SDL-UWP.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-UWP", "SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3-UWP", "SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj index 9d7c01351..a34357e73 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ b/VisualC-WinRT/SDL-UWP.vcxproj @@ -349,8 +349,8 @@ {89e9b32e-a86a-47c3-a948-d2b1622925ce} DynamicLibrary - SDL2-UWP - SDL2 + SDL3-UWP + SDL3 en-US 14.0 true @@ -439,42 +439,42 @@ false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 diff --git a/VisualC/SDL.sln b/VisualC/SDL.sln index 87b2cf520..ebb836d47 100644 --- a/VisualC/SDL.sln +++ b/VisualC/SDL.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys.vcxproj", "{26828762-C95D-4637-9CB1-7F0979523813}" EndProject @@ -40,7 +40,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testshape", "tests\testshap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" EndProject diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 2c85790e2..64f1341a4 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -19,7 +19,7 @@ - SDL2 + SDL3 {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} SDL 10.0 diff --git a/VisualC/SDLmain/SDLmain.vcxproj b/VisualC/SDLmain/SDLmain.vcxproj index ad63dc6c6..6da048b69 100644 --- a/VisualC/SDLmain/SDLmain.vcxproj +++ b/VisualC/SDLmain/SDLmain.vcxproj @@ -19,7 +19,7 @@ - SDL2main + SDL3main {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} SDLmain 10.0 diff --git a/VisualC/SDLtest/SDLtest.vcxproj b/VisualC/SDLtest/SDLtest.vcxproj index 042baf131..3faca9916 100644 --- a/VisualC/SDLtest/SDLtest.vcxproj +++ b/VisualC/SDLtest/SDLtest.vcxproj @@ -19,7 +19,7 @@ - SDL2test + SDL3test {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} SDLtest 10.0 diff --git a/VisualC/pkg-support/cmake/sdl2-config.cmake b/VisualC/pkg-support/cmake/sdl2-config.cmake deleted file mode 100644 index 1a25259c0..000000000 --- a/VisualC/pkg-support/cmake/sdl2-config.cmake +++ /dev/null @@ -1,111 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC - -cmake_minimum_required(VERSION 3.0) - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -set(SDL2_FOUND TRUE) - -if(CMAKE_SIZEOF_VOID_P STREQUAL "4") - set(_sdl_arch_subdir "x86") -elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8") - set(_sdl_arch_subdir "x64") -else() - set(SDL2_FOUND FALSE) - return() -endif() - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set_and_check(SDL2_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") -set_and_check(SDL2_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") -set_and_check(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include") -set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}") -set_and_check(SDL2_BINDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}") -set_and_check(SDL2_LIBDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}") - -set(SDL2_LIBRARIES SDL2::SDL2main SDL2::SDL2) -set(SDL2MAIN_LIBRARY SDL2::SDL2main) -set(SDL2TEST_LIBRARY SDL2::SDL2test) - - -# All targets are created, even when some might not be requested though COMPONENTS. -# This is done for compatibility with CMake generated SDL2-target.cmake files. - -set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib") -set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll") -if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_IMPLIB "${_sdl2_library}" - IMPORTED_LOCATION "${_sdl2_dll_library}" - COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" - INTERFACE_SDL2_SHARED "ON" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2_library) -unset(_sdl2_dll_library) - -set(_sdl2main_library "${SDL2_LIBDIR}/SDL2main.lib") -if(EXISTS "${_sdl2main_library}") - if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main - PROPERTIES - IMPORTED_LOCATION "${_sdl2main_library}" - ) - endif() - set(SDL2_SDL2main_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2main_library) - -set(_sdl2test_library "${SDL2_LIBDIR}/SDL2test.lib") -if(EXISTS "${_sdl2test_library}") - if(NOT TARGET SDL2::SDL2test) - add_library(SDL2::SDL2test STATIC IMPORTED) - set_target_properties(SDL2::SDL2test - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LOCATION "${_sdl2test_library}" - ) - endif() - set(SDL2_SDL2test_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2test_library) - -check_required_components(SDL2) diff --git a/VisualC/pkg-support/cmake/sdl2-config-version.cmake b/VisualC/pkg-support/cmake/sdl3-config-version.cmake similarity index 92% rename from VisualC/pkg-support/cmake/sdl2-config-version.cmake rename to VisualC/pkg-support/cmake/sdl3-config-version.cmake index 42bb6e743..500e88fdb 100644 --- a/VisualC/pkg-support/cmake/sdl2-config-version.cmake +++ b/VisualC/pkg-support/cmake/sdl3-config-version.cmake @@ -1,10 +1,10 @@ # based on the files generated by CMake's write_basic_package_version_file -# SDL2 CMake version configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC +# SDL CMake version configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h") - message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL2-devel-2.x.y-VC") + message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC") return() endif() diff --git a/VisualC/pkg-support/cmake/sdl3-config.cmake b/VisualC/pkg-support/cmake/sdl3-config.cmake new file mode 100644 index 000000000..c35d6b873 --- /dev/null +++ b/VisualC/pkg-support/cmake/sdl3-config.cmake @@ -0,0 +1,111 @@ +# SDL CMake configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC + +cmake_minimum_required(VERSION 3.0) + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +set(SDL3_FOUND TRUE) + +if(CMAKE_SIZEOF_VOID_P STREQUAL "4") + set(_sdl_arch_subdir "x86") +elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8") + set(_sdl_arch_subdir "x64") +else() + set(SDL3_FOUND FALSE) + return() +endif() + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set_and_check(SDL3_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") +set_and_check(SDL3_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") +set_and_check(SDL3_INCLUDE_DIR "${SDL3_PREFIX}/include") +set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR}") +set_and_check(SDL3_BINDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}") +set_and_check(SDL3_LIBDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}") + +set(SDL3_LIBRARIES SDL3::SDL3main SDL3::SDL3) +set(SDL3MAIN_LIBRARY SDL3::SDL3main) +set(SDL3TEST_LIBRARY SDL3::SDL3test) + + +# All targets are created, even when some might not be requested though COMPONENTS. +# This is done for compatibility with CMake generated SDL3-target.cmake files. + +set(_sdl3_library "${SDL3_LIBDIR}/SDL3.lib") +set(_sdl3_dll_library "${SDL3_BINDIR}/SDL3.dll") +if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_sdl3_library}" + IMPORTED_LOCATION "${_sdl3_dll_library}" + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" + INTERFACE_SDL3_SHARED "ON" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3_library) +unset(_sdl3_dll_library) + +set(_sdl3main_library "${SDL3_LIBDIR}/SDL3main.lib") +if(EXISTS "${_sdl3main_library}") + if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main STATIC IMPORTED) + set_target_properties(SDL3::SDL3main + PROPERTIES + IMPORTED_LOCATION "${_sdl3main_library}" + ) + endif() + set(SDL3_SDL3main_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3main_library) + +set(_sdl3test_library "${SDL3_LIBDIR}/SDL3test.lib") +if(EXISTS "${_sdl3test_library}") + if(NOT TARGET SDL3::SDL3test) + add_library(SDL3::SDL3test STATIC IMPORTED) + set_target_properties(SDL3::SDL3test + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_sdl3test_library}" + ) + endif() + set(SDL3_SDL3test_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3test_library) + +check_required_components(SDL3) diff --git a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj index 8fc664b8c..0104d6e0b 100644 --- a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj +++ b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj @@ -7,14 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - F3A497102555EE4800E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4972F2555EE8A00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497422555EEBE00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497442555EECD00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497462555EEDF00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A4959B2555ED0500E92A8B /* libSDL2.a */; }; - F3A497492555EF0B00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4974B2555EF1B00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4974E2555EF9F00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; + F3A497102555EE4800E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4972F2555EE8A00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497422555EEBE00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497442555EECD00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497462555EEDF00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A4959B2555ED0500E92A8B /* libSDL3.a */; }; + F3A497492555EF0B00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4974B2555EF1B00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4974E2555EF9F00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; }; FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; }; FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; }; @@ -188,7 +188,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497102555EE4800E92A8B /* libSDL2.a in Frameworks */, + F3A497102555EE4800E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -196,7 +196,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497462555EEDF00E92A8B /* libSDL2.a in Frameworks */, + F3A497462555EEDF00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -204,7 +204,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497442555EECD00E92A8B /* libSDL2.a in Frameworks */, + F3A497442555EECD00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -212,7 +212,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4972F2555EE8A00E92A8B /* libSDL2.a in Frameworks */, + F3A4972F2555EE8A00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -220,7 +220,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497492555EF0B00E92A8B /* libSDL2.a in Frameworks */, + F3A497492555EF0B00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -228,7 +228,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4974E2555EF9F00E92A8B /* libSDL2.a in Frameworks */, + F3A4974E2555EF9F00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -236,7 +236,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497422555EEBE00E92A8B /* libSDL2.a in Frameworks */, + F3A497422555EEBE00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,7 +244,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4974B2555EF1B00E92A8B /* libSDL2.a in Frameworks */, + F3A4974B2555EF1B00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -292,17 +292,17 @@ F3A495812555ED0400E92A8B /* Products */ = { isa = PBXGroup; children = ( - F3A495912555ED0500E92A8B /* SDL2.framework */, - F3A495932555ED0500E92A8B /* SDL2.framework */, - F3A495952555ED0500E92A8B /* SDL2.framework */, - F3C17D9228E4355900E1A26D /* SDL2.framework */, - F3A495972555ED0500E92A8B /* libSDL2.a */, - F3A495992555ED0500E92A8B /* libSDL2.a */, - F3A4959B2555ED0500E92A8B /* libSDL2.a */, - F3A4959D2555ED0500E92A8B /* libSDL2.dylib */, - F3A4959F2555ED0500E92A8B /* libSDL2.dylib */, - F3A495A12555ED0500E92A8B /* libSDL2.dylib */, - F3A495A32555ED0500E92A8B /* SDL2 */, + F3A495912555ED0500E92A8B /* SDL3.framework */, + F3A495932555ED0500E92A8B /* SDL3.framework */, + F3A495952555ED0500E92A8B /* SDL3.framework */, + F3C17D9228E4355900E1A26D /* SDL3.framework */, + F3A495972555ED0500E92A8B /* libSDL3.a */, + F3A495992555ED0500E92A8B /* libSDL3.a */, + F3A4959B2555ED0500E92A8B /* libSDL3.a */, + F3A4959D2555ED0500E92A8B /* libSDL3.dylib */, + F3A4959F2555ED0500E92A8B /* libSDL3.dylib */, + F3A495A12555ED0500E92A8B /* libSDL3.dylib */, + F3A495A32555ED0500E92A8B /* SDL3 */, ); name = Products; sourceTree = ""; @@ -565,80 +565,80 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - F3A495912555ED0500E92A8B /* SDL2.framework */ = { + F3A495912555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495902555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495932555ED0500E92A8B /* SDL2.framework */ = { + F3A495932555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495922555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495952555ED0500E92A8B /* SDL2.framework */ = { + F3A495952555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495942555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495972555ED0500E92A8B /* libSDL2.a */ = { + F3A495972555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A495962555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495992555ED0500E92A8B /* libSDL2.a */ = { + F3A495992555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A495982555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959B2555ED0500E92A8B /* libSDL2.a */ = { + F3A4959B2555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A4959A2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959D2555ED0500E92A8B /* libSDL2.dylib */ = { + F3A4959D2555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A4959C2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959F2555ED0500E92A8B /* libSDL2.dylib */ = { + F3A4959F2555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A4959E2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495A12555ED0500E92A8B /* libSDL2.dylib */ = { + F3A495A12555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A495A02555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495A32555ED0500E92A8B /* SDL2 */ = { + F3A495A32555ED0500E92A8B /* SDL3 */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.executable"; - path = SDL2; + path = SDL3; remoteRef = F3A495A22555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17D9228E4355900E1A26D /* SDL2.framework */ = { + F3C17D9228E4355900E1A26D /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3C17D9128E4355900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; diff --git a/Xcode-iOS/Demos/README b/Xcode-iOS/Demos/README index da6fb7490..d0f4ea179 100644 --- a/Xcode-iOS/Demos/README +++ b/Xcode-iOS/Demos/README @@ -2,7 +2,7 @@ About the iPhone OS Demo Applications ============================================================================== -Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 2.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. +Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 3.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. Common files: diff --git a/Xcode-iOS/Demos/config.xcconfig b/Xcode-iOS/Demos/config.xcconfig index 563917290..5b7da5271 100644 --- a/Xcode-iOS/Demos/config.xcconfig +++ b/Xcode-iOS/Demos/config.xcconfig @@ -9,6 +9,6 @@ // Include any optional config for this build #include? "build.xcconfig" -CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL2 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal +CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL3 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 09bae6c16..65acdef21 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.26.0 + 3.0.0 CFBundleSignature SDLX CFBundleVersion - 2.26.0 + 3.0.0 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index b59a594fb..40b04d63f 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3704,8 +3704,8 @@ A1BB8B6227F6CF330057CFA8 /* SDL_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_list.h; sourceTree = ""; }; A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; - A75FCEB323E25AB700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - A75FD06C23E25AC700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + A75FCEB323E25AB700529352 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + A75FD06C23E25AC700529352 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; A75FDAA523E2792500529352 /* hid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = hid.m; sourceTree = ""; }; A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam.c; sourceTree = ""; }; A75FDAB923E28A7A00529352 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; @@ -3723,11 +3723,11 @@ A75FDBA723E4CB6F00529352 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; A75FDBC323EA380300529352 /* SDL_hidapi_rumble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_rumble.h; sourceTree = ""; }; A75FDBC423EA380300529352 /* SDL_hidapi_rumble.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_rumble.c; sourceTree = ""; }; - A769B23D23E259AE00872273 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A769B23D23E259AE00872273 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; - A7D88B5423E2437C00DCD162 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A7D88D1523E24BED00DCD162 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A7D88E5423E24D3B00DCD162 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88B5423E2437C00DCD162 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88D1523E24BED00DCD162 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88E5423E24D3B00DCD162 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = ""; }; A7D8A57123E2513D00DCD162 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL.c; sourceTree = ""; }; A7D8A57323E2513D00DCD162 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; @@ -4098,11 +4098,11 @@ AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_khrplatform.h; sourceTree = ""; }; AADA5B8616CCAB3000107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; - BECDF66C0761BA81005FE872 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6BE0761BA81005FE872 /* SDL2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL2; sourceTree = BUILT_PRODUCTS_DIR; }; - DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - E2D187CF28A5673500D2B4F1 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF66C0761BA81005FE872 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF6B30761BA81005FE872 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF6BE0761BA81005FE872 /* SDL3 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL3; sourceTree = BUILT_PRODUCTS_DIR; }; + DB31407717554B71006C0E22 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + E2D187CF28A5673500D2B4F1 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E2D187D228A5673500D2B4F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_offscreenopengles.h; sourceTree = ""; }; F31A92C728D4CB39003BFD6A /* SDL_offscreenopengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_offscreenopengles.c; sourceTree = ""; }; @@ -4386,17 +4386,17 @@ 034768DDFF38A45A11DB9C8B /* Products */ = { isa = PBXGroup; children = ( - BECDF66C0761BA81005FE872 /* SDL2.framework */, - BECDF6B30761BA81005FE872 /* libSDL2.a */, - BECDF6BE0761BA81005FE872 /* SDL2 */, - DB31407717554B71006C0E22 /* libSDL2.dylib */, - A7D88B5423E2437C00DCD162 /* SDL2.framework */, - A7D88D1523E24BED00DCD162 /* SDL2.framework */, - A7D88E5423E24D3B00DCD162 /* libSDL2.a */, - A769B23D23E259AE00872273 /* libSDL2.a */, - A75FCEB323E25AB700529352 /* libSDL2.dylib */, - A75FD06C23E25AC700529352 /* libSDL2.dylib */, - E2D187CF28A5673500D2B4F1 /* SDL2.framework */, + BECDF66C0761BA81005FE872 /* SDL3.framework */, + BECDF6B30761BA81005FE872 /* libSDL3.a */, + BECDF6BE0761BA81005FE872 /* SDL3 */, + DB31407717554B71006C0E22 /* libSDL3.dylib */, + A7D88B5423E2437C00DCD162 /* SDL3.framework */, + A7D88D1523E24BED00DCD162 /* SDL3.framework */, + A7D88E5423E24D3B00DCD162 /* libSDL3.a */, + A769B23D23E259AE00872273 /* libSDL3.a */, + A75FCEB323E25AB700529352 /* libSDL3.dylib */, + A75FD06C23E25AC700529352 /* libSDL3.dylib */, + E2D187CF28A5673500D2B4F1 /* SDL3.framework */, ); name = Products; sourceTree = ""; @@ -4408,7 +4408,7 @@ F59C70FC00D5CB5801000001 /* pkg-support */, 0153844A006D81B07F000001 /* Public Headers */, 08FB77ACFE841707C02AAC07 /* Library Source */, - E2D187D028A5673500D2B4F1 /* SDL2 */, + E2D187D028A5673500D2B4F1 /* SDL3 */, 034768DDFF38A45A11DB9C8B /* Products */, BECDF66B0761BA81005FE872 /* Info-Framework.plist */, 564624341FF821B70074AC87 /* Frameworks */, @@ -5344,12 +5344,12 @@ path = events; sourceTree = ""; }; - E2D187D028A5673500D2B4F1 /* SDL2 */ = { + E2D187D028A5673500D2B4F1 /* SDL3 */ = { isa = PBXGroup; children = ( E2D187D228A5673500D2B4F1 /* Info.plist */, ); - path = SDL2; + path = SDL3; sourceTree = ""; }; F3ADAB8C2576F08500A6B1D9 /* ios */ = { @@ -7299,13 +7299,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library-iOS"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = A75FCEB323E25AB700529352 /* libSDL2.dylib */; + productReference = A75FCEB323E25AB700529352 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; A75FCEB423E25AC700529352 /* Shared Library-tvOS */ = { @@ -7319,13 +7319,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library-tvOS"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = A75FD06C23E25AC700529352 /* libSDL2.dylib */; + productReference = A75FD06C23E25AC700529352 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; A769B08223E259AE00872273 /* Static Library-tvOS */ = { @@ -7345,7 +7345,7 @@ name = "Static Library-tvOS"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = A769B23D23E259AE00872273 /* libSDL2.a */; + productReference = A769B23D23E259AE00872273 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; A7D88A1423E2437C00DCD162 /* Framework-iOS */ = { @@ -7367,7 +7367,7 @@ name = "Framework-iOS"; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = A7D88B5423E2437C00DCD162 /* SDL2.framework */; + productReference = A7D88B5423E2437C00DCD162 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; A7D88BC923E24BED00DCD162 /* Framework-tvOS */ = { @@ -7389,7 +7389,7 @@ name = "Framework-tvOS"; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = A7D88D1523E24BED00DCD162 /* SDL2.framework */; + productReference = A7D88D1523E24BED00DCD162 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; A7D88D1723E24D3B00DCD162 /* Static Library-iOS */ = { @@ -7409,7 +7409,7 @@ name = "Static Library-iOS"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = A7D88E5423E24D3B00DCD162 /* libSDL2.a */; + productReference = A7D88E5423E24D3B00DCD162 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; BECDF5FE0761BA81005FE872 /* Framework */ = { @@ -7431,7 +7431,7 @@ name = Framework; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = BECDF66C0761BA81005FE872 /* SDL2.framework */; + productReference = BECDF66C0761BA81005FE872 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; BECDF66D0761BA81005FE872 /* Static Library */ = { @@ -7451,7 +7451,7 @@ name = "Static Library"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = BECDF6B30761BA81005FE872 /* libSDL2.a */; + productReference = BECDF6B30761BA81005FE872 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; BECDF6BB0761BA81005FE872 /* Standard DMG */ = { @@ -7468,7 +7468,7 @@ name = "Standard DMG"; productInstallPath = /usr/local/bin; productName = "Standard Package"; - productReference = BECDF6BE0761BA81005FE872 /* SDL2 */; + productReference = BECDF6BE0761BA81005FE872 /* SDL3 */; productType = "com.apple.product-type.tool"; }; DB313F7217554B71006C0E22 /* Shared Library */ = { @@ -7482,13 +7482,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = DB31407717554B71006C0E22 /* libSDL2.dylib */; + productReference = DB31407717554B71006C0E22 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; E2D187CE28A5673500D2B4F1 /* xcFramework-iOS */ = { @@ -7506,8 +7506,8 @@ dependencies = ( ); name = "xcFramework-iOS"; - productName = SDL2; - productReference = E2D187CF28A5673500D2B4F1 /* SDL2.framework */; + productName = SDL3; + productReference = E2D187CF28A5673500D2B4F1 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -7645,7 +7645,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; + shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL3.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL3.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; E2D187E728A5685000D2B4F1 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -7662,7 +7662,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n\techo \"error: Building an xcframework requires Xcode 11 minimum.\"\n\texit 1\nfi\n\nSCHEME_NAME=\"Framework-iOS\"\nFRAMEWORK_NAME=\"SDL2\"\nPROJECT_NAME=\"SDL\"\n\nSIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nDEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\n\nOUTPUT_DIR=\"./Products/\"\n\n# Simulator xcarchive (arm64, i386, x86_64)\nxcodebuild archive \\\n\tONLY_ACTIVE_ARCH=NO \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${SIMULATOR_ARCHIVE_PATH} \\\n\t-sdk iphonesimulator \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Device xcarchive (arm64, armv7)\nxcodebuild archive \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${DEVICE_ARCHIVE_PATH} \\\n\t-sdk iphoneos \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n\t-framework \"${DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-framework \"${SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n"; + shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n\techo \"error: Building an xcframework requires Xcode 11 minimum.\"\n\texit 1\nfi\n\nSCHEME_NAME=\"Framework-iOS\"\nFRAMEWORK_NAME=\"SDL3\"\nPROJECT_NAME=\"SDL\"\n\nSIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nDEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\n\nOUTPUT_DIR=\"./Products/\"\n\n# Simulator xcarchive (arm64, i386, x86_64)\nxcodebuild archive \\\n\tONLY_ACTIVE_ARCH=NO \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${SIMULATOR_ARCHIVE_PATH} \\\n\t-sdk iphonesimulator \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Device xcarchive (arm64, armv7)\nxcodebuild archive \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${DEVICE_ARCHIVE_PATH} \\\n\t-sdk iphoneos \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n\t-framework \"${DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-framework \"${SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n"; }; F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7680,7 +7680,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7698,7 +7698,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7716,7 +7716,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -9528,8 +9528,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9559,8 +9559,8 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; + PRODUCT_NAME = SDL3; STRIP_STYLE = "non-global"; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -9570,7 +9570,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.0.17; + MARKETING_VERSION = 3.0.0; OTHER_LDFLAGS = "-liconv"; }; name = Release; @@ -9613,8 +9613,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9645,8 +9645,8 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; + PRODUCT_NAME = SDL3; STRIP_INSTALLED_PRODUCT = NO; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -9656,7 +9656,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.0.17; + MARKETING_VERSION = 3.0.0; OTHER_LDFLAGS = "-liconv"; }; name = Debug; @@ -9862,8 +9862,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9873,7 +9873,7 @@ ); GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = SDL2/Info.plist; + INFOPLIST_FILE = SDL3/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( @@ -9885,7 +9885,7 @@ MTL_FAST_MATH = YES; OTHER_LDFLAGS = "-liconv"; PRODUCT_BUNDLE_IDENTIFIER = ""; - PRODUCT_NAME = SDL2; + PRODUCT_NAME = SDL3; SDKROOT = iphoneos; SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = NO; @@ -9914,14 +9914,14 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = SDL2/Info.plist; + INFOPLIST_FILE = SDL3/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( @@ -9933,7 +9933,7 @@ MTL_FAST_MATH = YES; OTHER_LDFLAGS = "-liconv"; PRODUCT_BUNDLE_IDENTIFIER = ""; - PRODUCT_NAME = SDL2; + PRODUCT_NAME = SDL3; SDKROOT = iphoneos; SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = NO; diff --git a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme index b797feacb..9c01052f2 100644 --- a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme +++ b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ diff --git a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme index 82b464373..36ddd8e2a 100644 --- a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme +++ b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ diff --git a/Xcode/SDL/SDL2/Info.plist b/Xcode/SDL/SDL3/Info.plist similarity index 100% rename from Xcode/SDL/SDL2/Info.plist rename to Xcode/SDL/SDL3/Info.plist diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index f08facd23..c60abf3a3 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 2.0.0 +Title SDL 3.0.0 Version 1 Description SDL Library for Mac OS X (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake deleted file mode 100644 index 28c34bc70..000000000 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake +++ /dev/null @@ -1,69 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in Resources/CMake of a SDL2 framework - -# INTERFACE_LINK_OPTIONS needs CMake 3.12 -cmake_minimum_required(VERSION 3.12) - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -set(SDL2_FOUND TRUE) - -string(REGEX REPLACE "SDL2\\.framework.*" "SDL2.framework" SDL2_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}") -string(REGEX REPLACE "SDL2\\.framework.*" "" SDL2_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}") - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set_and_check(SDL2_PREFIX "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_EXEC_PREFIX "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_INCLUDE_DIR "${SDL2_FRAMEWORK_PATH}/Headers") -set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR};${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_BINDIR "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_LIBDIR "${SDL2_FRAMEWORK_PATH}") - -set(SDL2_LIBRARIES "SDL2::SDL2") - -# All targets are created, even when some might not be requested though COMPONENTS. -# This is done for compatibility with CMake generated SDL2-target.cmake files. - -if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 - PROPERTIES - INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\"" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2" - COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" - INTERFACE_SDL2_SHARED "ON" - ) -endif() -set(SDL2_SDL2_FOUND TRUE) - -if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main INTERFACE IMPORTED) -endif() -set(SDL2_SDL2main_FOUND TRUE) - -check_required_components(SDL2) diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake similarity index 94% rename from Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake rename to Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake index feea76e5f..6dbcf1298 100644 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake @@ -1,10 +1,10 @@ # based on the files generated by CMake's write_basic_package_version_file -# SDL2 CMake version configuration file: -# This file is meant to be placed in Resources/CMake of a SDL2 framework +# SDL CMake version configuration file: +# This file is meant to be placed in Resources/CMake of a SDL3 framework if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h") - message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework") + message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL3.framework") return() endif() diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake new file mode 100644 index 000000000..c62043a2e --- /dev/null +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake @@ -0,0 +1,69 @@ +# SDL CMake configuration file: +# This file is meant to be placed in Resources/CMake of a SDL3 framework + +# INTERFACE_LINK_OPTIONS needs CMake 3.12 +cmake_minimum_required(VERSION 3.12) + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +set(SDL3_FOUND TRUE) + +string(REGEX REPLACE "SDL3\\.framework.*" "SDL3.framework" SDL3_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}") +string(REGEX REPLACE "SDL3\\.framework.*" "" SDL3_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}") + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set_and_check(SDL3_PREFIX "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_EXEC_PREFIX "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_INCLUDE_DIR "${SDL3_FRAMEWORK_PATH}/Headers") +set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR};${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_BINDIR "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_LIBDIR "${SDL3_FRAMEWORK_PATH}") + +set(SDL3_LIBRARIES "SDL3::SDL3") + +# All targets are created, even when some might not be requested though COMPONENTS. +# This is done for compatibility with CMake generated SDL3-target.cmake files. + +if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 + PROPERTIES + INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\"" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL3" + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" + INTERFACE_SDL3_SHARED "ON" + ) +endif() +set(SDL3_SDL3_FOUND TRUE) + +if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main INTERFACE IMPORTED) +endif() +set(SDL3_SDL3main_FOUND TRUE) + +check_required_components(SDL3) diff --git a/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Xcode/SDL/pkg-support/resources/ReadMe.txt index 9f495913c..9e2976c60 100644 --- a/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ b/Xcode/SDL/pkg-support/resources/ReadMe.txt @@ -15,20 +15,20 @@ contains both the SDL runtime component and development header files. To Install: -Copy the SDL2.framework to /Library/Frameworks +Copy the SDL3.framework to /Library/Frameworks You may alternatively install it in /Library/Frameworks if your access privileges are not high enough. Use in CMake projects: -SDL2.framework can be used in CMake projects using the following pattern: +SDL3.framework can be used in CMake projects using the following pattern: ``` -find_package(SDL2 REQUIRED COMPONENTS SDL2) +find_package(SDL3 REQUIRED COMPONENTS SDL3) add_executable(my_game ${MY_SOURCES}) -target_link_libraries(my_game PRIVATE SDL2::SDL2) +target_link_libraries(my_game PRIVATE SDL3::SDL3) ``` -If SDL2.framework is installed in a non-standard location, +If SDL3.framework is installed in a non-standard location, please refer to the following link for ways to configure CMake: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure diff --git a/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/Xcode/SDL/pkg-support/resources/SDL_DS_Store index 5658d15e4f13fbfd8a786e55c8b7a04cd1229cf8..99e0b237aef593f57ba9edeb417f27a0c07cee93 100644 GIT binary patch delta 86 zcmZpvXsy`bCd6nwu~2++oX|o><4M99jK-5Qg{?V^b&JaNQgYKL7Mf0eD7+jf+9{IF iXuSEW$Rqe;RUj7F0)g{?V^bc@RMQgYKL7Mf0eD7+jf+9{IF gXtepO$R=0.3.20) if(PKG_PIPEWIRE_FOUND) set(HAVE_PIPEWIRE TRUE) - file(GLOB PIPEWIRE_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pipewire/*.c) + file(GLOB PIPEWIRE_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pipewire/*.c) list(APPEND SOURCE_FILES ${PIPEWIRE_SOURCES}) set(SDL_AUDIO_DRIVER_PIPEWIRE 1) list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS}) @@ -146,7 +146,7 @@ macro(CheckPulseAudio) pkg_check_modules(PKG_PULSEAUDIO libpulse-simple) if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) - file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) + file(GLOB PULSEAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pulseaudio/*.c) list(APPEND SOURCE_FILES ${PULSEAUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_PULSEAUDIO 1) list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS}) @@ -175,7 +175,7 @@ macro(CheckJACK) pkg_check_modules(PKG_JACK jack) if(PKG_JACK_FOUND) set(HAVE_JACK TRUE) - file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) + file(GLOB JACK_SOURCES ${SDL3_SOURCE_DIR}/src/audio/jack/*.c) list(APPEND SOURCE_FILES ${JACK_SOURCES}) set(SDL_AUDIO_DRIVER_JACK 1) list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) @@ -204,7 +204,7 @@ macro(CheckESD) pkg_check_modules(PKG_ESD esound) if(PKG_ESD_FOUND) set(HAVE_ESD TRUE) - file(GLOB ESD_SOURCES ${SDL2_SOURCE_DIR}/src/audio/esd/*.c) + file(GLOB ESD_SOURCES ${SDL3_SOURCE_DIR}/src/audio/esd/*.c) list(APPEND SOURCE_FILES ${ESD_SOURCES}) set(SDL_AUDIO_DRIVER_ESD 1) list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) @@ -237,7 +237,7 @@ macro(CheckARTS) list(APPEND EXTRA_CFLAGS ${ARTS_CFLAGS}) execute_process(CMD_ARTSLIBS ${ARTS_CONFIG} --libs OUTPUT_VARIABLE ARTS_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) - file(GLOB ARTS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/arts/*.c) + file(GLOB ARTS_SOURCES ${SDL3_SOURCE_DIR}/src/audio/arts/*.c) list(APPEND SOURCE_FILES ${ARTS_SOURCES}) set(SDL_AUDIO_DRIVER_ARTS 1) set(HAVE_ARTS TRUE) @@ -269,7 +269,7 @@ macro(CheckNAS) find_library(D_NAS_LIB audio) if(HAVE_NAS_H AND D_NAS_LIB) set(HAVE_NAS TRUE) - file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c) + file(GLOB NAS_SOURCES ${SDL3_SOURCE_DIR}/src/audio/nas/*.c) list(APPEND SOURCE_FILES ${NAS_SOURCES}) set(SDL_AUDIO_DRIVER_NAS 1) if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO) @@ -297,7 +297,7 @@ macro(CheckSNDIO) pkg_check_modules(PKG_SNDIO sndio) if(PKG_SNDIO_FOUND) set(HAVE_SNDIO TRUE) - file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) + file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c) list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) set(SDL_AUDIO_DRIVER_SNDIO 1) list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS}) @@ -326,7 +326,7 @@ macro(CheckFusionSound) pkg_check_modules(PKG_FUSIONSOUND fusionsound>=1.0.0) if(PKG_FUSIONSOUND_FOUND) set(HAVE_FUSIONSOUND TRUE) - file(GLOB FUSIONSOUND_SOURCES ${SDL2_SOURCE_DIR}/src/audio/fusionsound/*.c) + file(GLOB FUSIONSOUND_SOURCES ${SDL3_SOURCE_DIR}/src/audio/fusionsound/*.c) list(APPEND SOURCE_FILES ${FUSIONSOUND_SOURCES}) set(SDL_AUDIO_DRIVER_FUSIONSOUND 1) list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS}) @@ -442,7 +442,7 @@ macro(CheckX11) set(HAVE_X11 TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c) + file(GLOB X11_SOURCES ${SDL3_SOURCE_DIR}/src/video/x11/*.c) list(APPEND SOURCE_FILES ${X11_SOURCES}) set(SDL_VIDEO_DRIVER_X11 1) @@ -662,17 +662,17 @@ macro(CheckWayland) set(HAVE_WAYLAND TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) + file(GLOB WAYLAND_SOURCES ${SDL3_SOURCE_DIR}/src/video/wayland/*.c) list(APPEND SOURCE_FILES ${WAYLAND_SOURCES}) # We have to generate some protocol interface code for some unstable Wayland features. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") target_include_directories(sdl-build-options INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") - file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml") + file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL3_SOURCE_DIR}/wayland-protocols/" "${SDL3_SOURCE_DIR}/wayland-protocols/*.xml") foreach(_XML ${WAYLAND_PROTOCOLS_XML}) string(REGEX REPLACE "\\.xml$" "" _PROTL "${_XML}") - WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") + WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL3_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") endforeach() if(SDL_WAYLAND_QT_TOUCH) @@ -731,7 +731,7 @@ macro(CheckCOCOA) set(HAVE_COCOA TRUE) endif() if(HAVE_COCOA) - file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m) + file(GLOB COCOA_SOURCES ${SDL3_SOURCE_DIR}/src/video/cocoa/*.m) list(APPEND SOURCE_FILES ${COCOA_SOURCES}) set(SDL_VIDEO_DRIVER_COCOA 1) set(HAVE_SDL_VIDEO TRUE) @@ -749,7 +749,7 @@ macro(CheckDirectFB) pkg_check_modules(PKG_DIRECTFB directfb>=1.0.0) if(PKG_DIRECTFB_FOUND) set(HAVE_DIRECTFB TRUE) - file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c) + file(GLOB DIRECTFB_SOURCES ${SDL3_SOURCE_DIR}/src/video/directfb/*.c) list(APPEND SOURCE_FILES ${DIRECTFB_SOURCES}) set(SDL_VIDEO_DRIVER_DIRECTFB 1) set(SDL_VIDEO_RENDER_DIRECTFB 1) @@ -786,7 +786,7 @@ macro(CheckVivante) set(HAVE_VIVANTE TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c) + file(GLOB VIVANTE_SOURCES ${SDL3_SOURCE_DIR}/src/video/vivante/*.c) list(APPEND SOURCE_FILES ${VIVANTE_SOURCES}) set(SDL_VIDEO_DRIVER_VIVANTE 1) if(HAVE_VIVANTE_VDK) @@ -1000,17 +1000,17 @@ macro(CheckPTHREAD) endif() set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_sysmutex.c # Can be faked, if necessary - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syscond.c # Can be faked, if necessary - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systls.c + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_sysmutex.c # Can be faked, if necessary + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_syscond.c # Can be faked, if necessary + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_systls.c ) if(HAVE_PTHREADS_SEM) set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c) + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c) else() set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syssem.c) + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syssem.c) endif() set(HAVE_SDL_THREADS TRUE) endif() @@ -1147,7 +1147,7 @@ macro(CheckUSBHID) set(SDL_HAVE_MACHINE_JOYSTICK_H 1) endif() set(SDL_JOYSTICK_USBHID 1) - file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c) + file(GLOB BSD_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/bsd/*.c) list(APPEND SOURCE_FILES ${BSD_JOYSTICK_SOURCES}) list(APPEND EXTRA_CFLAGS ${USB_CFLAGS}) list(APPEND EXTRA_LIBS ${USB_LIBS}) @@ -1191,10 +1191,10 @@ macro(CheckHIDAPI) if(HAVE_HIDAPI) if(ANDROID) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/hidapi/android/hid.cpp) endif() if(IOS OR TVOS) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/hidapi/ios/hid.m) set(SDL_FRAMEWORK_COREBLUETOOTH 1) endif() set(HAVE_SDL_HIDAPI TRUE) @@ -1203,7 +1203,7 @@ macro(CheckHIDAPI) set(SDL_JOYSTICK_HIDAPI 1) set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_HIDAPI_JOYSTICK TRUE) - file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) + file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/hidapi/*.c) list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) endif() else() @@ -1244,7 +1244,7 @@ macro(CheckRPI) if(SDL_VIDEO AND HAVE_RPI) set(HAVE_SDL_VIDEO TRUE) set(SDL_VIDEO_DRIVER_RPI 1) - file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) + file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c) list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) # !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right? @@ -1269,7 +1269,7 @@ macro(CheckKMSDRM) set(HAVE_KMSDRM TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + file(GLOB KMSDRM_SOURCES ${SDL3_SOURCE_DIR}/src/video/kmsdrm/*.c) list(APPEND SOURCE_FILES ${KMSDRM_SOURCES}) list(APPEND EXTRA_CFLAGS ${PKG_KMSDRM_CFLAGS}) diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 388e86c54..d4e488c54 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -16,109 +16,109 @@ endif() cmake_policy(SET CMP0074 NEW) -# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot +# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3 outside of sysroot set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) include(FeatureSummary) -option(TEST_SHARED "Test linking to shared SDL2 library" ON) +option(TEST_SHARED "Test linking to shared SDL3 library" ON) add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") -option(TEST_STATIC "Test linking to static SDL2 library" ON) +option(TEST_STATIC "Test linking to static SDL3 library" ON) add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") if(TEST_SHARED) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() add_executable(gui-shared WIN32 main_gui.c) - if(TARGET SDL2::SDL2main) - target_link_libraries(gui-shared PRIVATE SDL2::SDL2main) + if(TARGET SDL3::SDL3main) + target_link_libraries(gui-shared PRIVATE SDL3::SDL3main) endif() - target_link_libraries(gui-shared PRIVATE SDL2::SDL2) + target_link_libraries(gui-shared PRIVATE SDL3::SDL3) if(WIN32) add_custom_command(TARGET gui-shared POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) endif() add_library(sharedlib-shared SHARED main_lib.c) - target_link_libraries(sharedlib-shared PRIVATE SDL2::SDL2) + target_link_libraries(sharedlib-shared PRIVATE SDL3::SDL3) generate_export_header(sharedlib-shared EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-shared PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared_export.h\"") set_target_properties(sharedlib-shared PROPERTIES C_VISIBILITY_PRESET "hidden") add_executable(gui-shared-vars WIN32 main_gui.c) - target_link_libraries(gui-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(gui-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(gui-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(gui-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) add_executable(cli-shared main_cli.c) - target_link_libraries(cli-shared PRIVATE SDL2::SDL2) + target_link_libraries(cli-shared PRIVATE SDL3::SDL3) if(WIN32) add_custom_command(TARGET cli-shared POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) endif() - # SDL2_LIBRARIES does not support creating a cli SDL2 application - # (it is possible that SDL2main is a stub, but we don't know for sure) - if(NOT TARGET SDL2::SDL2main) + # SDL3_LIBRARIES does not support creating a cli SDL3 application + # (it is possible that SDL3main is a stub, but we don't know for sure) + if(NOT TARGET SDL3::SDL3main) add_executable(cli-shared-vars main_cli.c) - target_link_libraries(cli-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(cli-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(cli-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(cli-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) endif() add_library(sharedlib-shared-vars SHARED main_lib.c) - target_link_libraries(sharedlib-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(sharedlib-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(sharedlib-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(sharedlib-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) generate_export_header(sharedlib-shared-vars EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-shared-vars PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared-vars_export.h\"") set_target_properties(sharedlib-shared-vars PROPERTIES C_VISIBILITY_PRESET "hidden") endif() if(TEST_STATIC) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2-static) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3-static) if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() add_executable(gui-static WIN32 main_gui.c) - if(TARGET SDL2::SDL2main) - target_link_libraries(gui-static PRIVATE SDL2::SDL2main) + if(TARGET SDL3::SDL3main) + target_link_libraries(gui-static PRIVATE SDL3::SDL3main) endif() - target_link_libraries(gui-static PRIVATE SDL2::SDL2-static) + target_link_libraries(gui-static PRIVATE SDL3::SDL3-static) option(SDL_STATIC_PIC "SDL static library has been built with PIC") if(SDL_STATIC_PIC OR WIN32) add_library(sharedlib-static SHARED main_lib.c) - target_link_libraries(sharedlib-static PRIVATE SDL2::SDL2-static) + target_link_libraries(sharedlib-static PRIVATE SDL3::SDL3-static) generate_export_header(sharedlib-static EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-static PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-static_export.h\"") set_target_properties(sharedlib-static PROPERTIES C_VISIBILITY_PRESET "hidden") endif() add_executable(gui-static-vars WIN32 main_gui.c) - target_link_libraries(gui-static-vars PRIVATE ${SDL2MAIN_LIBRARY} ${SDL2_STATIC_LIBRARIES}) - target_include_directories(gui-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(gui-static-vars PRIVATE ${SDL3MAIN_LIBRARY} ${SDL3_STATIC_LIBRARIES}) + target_include_directories(gui-static-vars PRIVATE ${SDL3_INCLUDE_DIRS}) add_executable(cli-static main_cli.c) - target_link_libraries(cli-static PRIVATE SDL2::SDL2-static) + target_link_libraries(cli-static PRIVATE SDL3::SDL3-static) - # SDL2_LIBRARIES does not support creating a cli SDL2 application (when SDL2::SDL2main is available) - # (it is possible that SDL2main is a stub, but we don't know for sure) - if(NOT TARGET SDL2::SDL2main) + # SDL3_LIBRARIES does not support creating a cli SDL3 application (when SDL3::SDL3main is available) + # (it is possible that SDL3main is a stub, but we don't know for sure) + if(NOT TARGET SDL3::SDL3main) add_executable(cli-static-vars main_cli.c) - target_link_libraries(cli-static-vars PRIVATE ${SDL2_STATIC_LIBRARIES}) - target_include_directories(cli-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(cli-static-vars PRIVATE ${SDL3_STATIC_LIBRARIES}) + target_include_directories(cli-static-vars PRIVATE ${SDL3_INCLUDE_DIRS}) endif() endif() -message(STATUS "SDL2_PREFIX: ${SDL2_PREFIX}") -message(STATUS "SDL2_INCLUDE_DIR: ${SDL2_INCLUDE_DIR}") -message(STATUS "SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}") -message(STATUS "SDL2_LIBRARIES: ${SDL2_LIBRARIES}") -message(STATUS "SDL2_STATIC_LIBRARIES: ${SDL2_STATIC_LIBRARIES}") -message(STATUS "SDL2MAIN_LIBRARY: ${SDL2MAIN_LIBRARY}") -message(STATUS "SDL2TEST_LIBRARY: ${SDL2TEST_LIBRARY}") +message(STATUS "SDL3_PREFIX: ${SDL3_PREFIX}") +message(STATUS "SDL3_INCLUDE_DIR: ${SDL3_INCLUDE_DIR}") +message(STATUS "SDL3_INCLUDE_DIRS: ${SDL3_INCLUDE_DIRS}") +message(STATUS "SDL3_LIBRARIES: ${SDL3_LIBRARIES}") +message(STATUS "SDL3_STATIC_LIBRARIES: ${SDL3_STATIC_LIBRARIES}") +message(STATUS "SDL3MAIN_LIBRARY: ${SDL3MAIN_LIBRARY}") +message(STATUS "SDL3TEST_LIBRARY: ${SDL3TEST_LIBRARY}") feature_summary(WHAT ALL) diff --git a/cmake/test/jni/Android.mk b/cmake/test/jni/Android.mk index c4956d685..393498857 100644 --- a/cmake/test/jni/Android.mk +++ b/cmake/test/jni/Android.mk @@ -4,8 +4,8 @@ include $(CLEAR_VARS) LOCAL_MODULE := main_gui_androidmk LOCAL_SRC_FILES := ../main_gui.c -LOCAL_SHARED_LIBRARIES += SDL2 +LOCAL_SHARED_LIBRARIES += SDL3 include $(BUILD_SHARED_LIBRARY) -$(call import-module,SDL2main) -$(call import-module,SDL2) +$(call import-module,SDL3main) +$(call import-module,SDL3) diff --git a/cmake/test/main_cli.c b/cmake/test/main_cli.c index f6b083606..2bbedde88 100644 --- a/cmake/test/main_cli.c +++ b/cmake/test/main_cli.c @@ -5,7 +5,7 @@ int main(int argc, char *argv[]) { SDL_SetMainReady(); if (SDL_Init(0) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } SDL_Delay(100); diff --git a/cmake/test/main_gui.c b/cmake/test/main_gui.c index 4ffe9be1c..3ba0adbee 100644 --- a/cmake/test/main_gui.c +++ b/cmake/test/main_gui.c @@ -5,11 +5,11 @@ int main(int argc, char *argv[]) { SDL_Window *window = NULL; SDL_Surface *screenSurface = NULL; if (SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } window = SDL_CreateWindow( - "hello_sdl2", + "Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN diff --git a/cmake/test/main_lib.c b/cmake/test/main_lib.c index 9801ed56c..0f8928b8d 100644 --- a/cmake/test/main_lib.c +++ b/cmake/test/main_lib.c @@ -17,7 +17,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void); int mylibrary_init(void) { SDL_SetMainReady(); if (SDL_Init(0) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } return 0; diff --git a/cmake/test/test_pkgconfig.sh b/cmake/test/test_pkgconfig.sh index 7afc00b09..c2aa3408c 100755 --- a/cmake/test/test_pkgconfig.sh +++ b/cmake/test/test_pkgconfig.sh @@ -25,9 +25,9 @@ set -e # Get the canonical path of the folder containing this script testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") -CFLAGS="$( pkg-config sdl2 --cflags )" -LDFLAGS="$( pkg-config sdl2 --libs )" -STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )" +CFLAGS="$( pkg-config sdl3 --cflags )" +LDFLAGS="$( pkg-config sdl3 --libs )" +STATIC_LDFLAGS="$( pkg-config sdl3 --libs --static )" compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS" link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS" diff --git a/cmake/test/test_sdlconfig.sh b/cmake/test/test_sdlconfig.sh index 8de5421dc..67b62f5c2 100755 --- a/cmake/test/test_sdlconfig.sh +++ b/cmake/test/test_sdlconfig.sh @@ -25,9 +25,9 @@ set -e # Get the canonical path of the folder containing this script testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") -CFLAGS="$( sdl2-config --cflags )" -LDFLAGS="$( sdl2-config --libs )" -STATIC_LDFLAGS="$( sdl2-config --static-libs )" +CFLAGS="$( sdl3-config --cflags )" +LDFLAGS="$( sdl3-config --libs )" +STATIC_LDFLAGS="$( sdl3-config --static-libs )" compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS" link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS" diff --git a/configure b/configure index 87c576def..677132988 100755 --- a/configure +++ b/configure @@ -684,7 +684,7 @@ SDL_CFLAGS bin_prefix_relpath cmake_prefix_relpath SDL_VENDOR_INFO -INSTALL_SDL2_CONFIG +INSTALL_SDL3_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS IBUS_LIBS @@ -954,7 +954,7 @@ enable_backgrounding_signal enable_foregrounding_signal enable_joystick_virtual enable_render_d3d -enable_sdl2_config +enable_sdl3_config enable_vendor_info ' ac_precious_vars='build_alias @@ -1782,7 +1782,7 @@ Optional Features: --enable-joystick-virtual enable virtual joystick APIs [default=yes] --enable-render-d3d enable the Direct3D render driver [default=yes] - --enable-sdl2-config Install sdl2-config [default=yes] + --enable-sdl3-config Install sdl3-config [default=yes] --enable-vendor-info=STRING Add vendor info to SDL_REVISION @@ -3452,8 +3452,8 @@ ac_config_headers="$ac_config_headers include/SDL_config.h" orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md -SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=26 +SDL_MAJOR_VERSION=3 +SDL_MINOR_VERSION=0 SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -13073,9 +13073,9 @@ CFLAGS=$lt_save_CFLAGS # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 +LT_RELEASE=3.0 # Increment this if there is an incompatible change - but if that happens, # we should rename the library from SDL2 to SDL3, at which point this would # reset to 0 anyway. @@ -18276,7 +18276,7 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2" +SDL_LIBS="-lSDL3" if test "x$BASE_LDFLAGS" != x; then SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" fi @@ -28848,7 +28848,7 @@ printf "%s\n" "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" - SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows" + SDL_LIBS="-lSDL3main $SDL_LIBS -mwindows" # Check to see if this is a mingw or cygwin build have_mingw32= @@ -29464,29 +29464,29 @@ esac CheckVirtualJoystick -# Check whether to install sdl2-config -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 -printf %s "checking whether to install sdl2-config... " >&6; } -# Check whether --enable-sdl2-config was given. -if test ${enable_sdl2_config+y} +# Check whether to install sdl3-config +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl3-config" >&5 +printf %s "checking whether to install sdl3-config... " >&6; } +# Check whether --enable-sdl3-config was given. +if test ${enable_sdl3_config+y} then : - enableval=$enable_sdl2_config; case "${enableval}" in - yes) enable_sdl2_config="TRUE" ;; - no) enable_sdl2_config="FALSE" ;; - *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;; + enableval=$enable_sdl3_config; case "${enableval}" in + yes) enable_sdl3_config="TRUE" ;; + no) enable_sdl3_config="FALSE" ;; + *) as_fn_error $? "bad value '${enableval}' for --enable-sdl3-config" "$LINENO" 5 ;; esac else $as_nop - enable_sdl2_config="TRUE" + enable_sdl3_config="TRUE" fi -if test "$enable_sdl2_config" = "TRUE"; then +if test "$enable_sdl3_config" = "TRUE"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi -INSTALL_SDL2_CONFIG=$enable_sdl2_config +INSTALL_SDL3_CONFIG=$enable_sdl3_config # Check whether --enable-vendor-info was given. @@ -29700,7 +29700,7 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" -pkg_cmakedir='$libdir/cmake/SDL2' +pkg_cmakedir='$libdir/cmake/SDL3' for _lcl_i in pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath; do _lcl_from=\$`echo "$_lcl_i" | sed 's,:.*$,,'` _lcl_to=\$`echo "$_lcl_i" | sed 's,^[^:]*:,,' | sed 's,:[^:]*$,,'` @@ -29852,12 +29852,12 @@ $SDLTEST_DEPENDS $WAYLAND_PROTOCOLS_DEPENDS __EOF__ -ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc" +ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl3-config sdl3-config.cmake sdl3-config-version.cmake SDL3.spec sdl3.pc" -ac_config_commands="$ac_config_commands sdl2_config" +ac_config_commands="$ac_config_commands sdl3_config" -SUMMARY="SDL2 Configure Summary:\n" +SUMMARY="SDL3 Configure Summary:\n" if test x$enable_shared = xyes; then SUMMARY="${SUMMARY}Building Shared Libraries\n" fi @@ -31093,12 +31093,12 @@ do "include/SDL_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/SDL_config.h" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in:Makefile.rules" ;; - "sdl2-config") CONFIG_FILES="$CONFIG_FILES sdl2-config" ;; - "sdl2-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config.cmake" ;; - "sdl2-config-version.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config-version.cmake" ;; - "SDL2.spec") CONFIG_FILES="$CONFIG_FILES SDL2.spec" ;; - "sdl2.pc") CONFIG_FILES="$CONFIG_FILES sdl2.pc" ;; - "sdl2_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl2_config" ;; + "sdl3-config") CONFIG_FILES="$CONFIG_FILES sdl3-config" ;; + "sdl3-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl3-config.cmake" ;; + "sdl3-config-version.cmake") CONFIG_FILES="$CONFIG_FILES sdl3-config-version.cmake" ;; + "SDL3.spec") CONFIG_FILES="$CONFIG_FILES SDL3.spec" ;; + "sdl3.pc") CONFIG_FILES="$CONFIG_FILES sdl3.pc" ;; + "sdl3_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl3_config" ;; "summary") CONFIG_COMMANDS="$CONFIG_COMMANDS summary" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -32522,7 +32522,7 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX _LT_EOF ;; - "sdl2_config":C) chmod a+x sdl2-config ;; + "sdl3_config":C) chmod a+x sdl3-config ;; "summary":C) printf "$SUMMARY" ;; esac diff --git a/configure.ac b/configure.ac index cc30f9a16..9d2cc2934 100644 --- a/configure.ac +++ b/configure.ac @@ -11,18 +11,18 @@ orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md -SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=26 +SDL_MAJOR_VERSION=3 +SDL_MINOR_VERSION=0 SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` AS_CASE(["$SDL_MINOR_VERSION"], [*@<:@02468@:>@], - dnl Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + dnl Stable branch, 3.24.1 -> libSDL3-3.0.so.0.2400.1 [SDL_INTERFACE_AGE="$SDL_MICRO_VERSION"], [*], - dnl Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + dnl Development branch, 3.23.1 -> libSDL3-3.0.so.0.2301.0 [SDL_INTERFACE_AGE=0]) AC_SUBST(SDL_MAJOR_VERSION) @@ -37,9 +37,9 @@ LT_INIT([win32-dll]) LT_LANG([Windows Resource]) # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 +LT_RELEASE=3.0 # Increment this if there is an incompatible change - but if that happens, # we should rename the library from SDL2 to SDL3, at which point this would # reset to 0 anyway. @@ -162,7 +162,7 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2" +SDL_LIBS="-lSDL3" if test "x$BASE_LDFLAGS" != x; then SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" fi @@ -4168,7 +4168,7 @@ case "$host" in VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" - SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows" + SDL_LIBS="-lSDL3main $SDL_LIBS -mwindows" # Check to see if this is a mingw or cygwin build have_mingw32= @@ -4670,21 +4670,21 @@ esac dnl Permit use of virtual joystick APIs on any platform (subject to configure options) CheckVirtualJoystick -# Check whether to install sdl2-config -AC_MSG_CHECKING(whether to install sdl2-config) -AC_ARG_ENABLE([sdl2-config], - [AS_HELP_STRING([--enable-sdl2-config],[Install sdl2-config [default=yes]])], +# Check whether to install sdl3-config +AC_MSG_CHECKING(whether to install sdl3-config) +AC_ARG_ENABLE([sdl3-config], + [AS_HELP_STRING([--enable-sdl3-config],[Install sdl3-config [default=yes]])], [case "${enableval}" in - yes) enable_sdl2_config="TRUE" ;; - no) enable_sdl2_config="FALSE" ;; - *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl2-config]) ;; - esac], [enable_sdl2_config="TRUE"]) -if test "$enable_sdl2_config" = "TRUE"; then + yes) enable_sdl3_config="TRUE" ;; + no) enable_sdl3_config="FALSE" ;; + *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl3-config]) ;; + esac], [enable_sdl3_config="TRUE"]) +if test "$enable_sdl3_config" = "TRUE"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) +AC_SUBST([INSTALL_SDL3_CONFIG], [$enable_sdl3_config]) AC_ARG_ENABLE([vendor-info], [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])], @@ -4850,7 +4850,7 @@ SDL_STATIC_LIBS="$EXTRA_LDFLAGS" dnl Calculate the location of the prefix, relative to the cmake folder dnl Calculate the location of the prefix, relative to bindir -pkg_cmakedir='$libdir/cmake/SDL2' +pkg_cmakedir='$libdir/cmake/SDL3' AX_COMPUTE_RELATIVE_PATHS([pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath]) AC_SUBST([cmake_prefix_relpath]) AC_SUBST([bin_prefix_relpath]) @@ -4914,11 +4914,11 @@ $WAYLAND_PROTOCOLS_DEPENDS __EOF__ AC_CONFIG_FILES([ - Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc + Makefile:Makefile.in:Makefile.rules sdl3-config sdl3-config.cmake sdl3-config-version.cmake SDL3.spec sdl3.pc ]) -AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config]) +AC_CONFIG_COMMANDS([sdl3_config],[chmod a+x sdl3-config]) -SUMMARY="SDL2 Configure Summary:\n" +SUMMARY="SDL3 Configure Summary:\n" if test x$enable_shared = xyes; then SUMMARY="${SUMMARY}Building Shared Libraries\n" fi diff --git a/docs/README-android.md b/docs/README-android.md index a247e5721..03d2d8778 100644 --- a/docs/README-android.md +++ b/docs/README-android.md @@ -86,8 +86,8 @@ If you already have a project that uses CMake, the instructions change somewhat: 2. Edit "/app/build.gradle" to comment out or remove sections containing ndk-build and uncomment the cmake sections. Add arguments to the CMake invocation as needed. 3. Edit "/app/jni/CMakeLists.txt" to include your project (it defaults to - adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static - as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)" + adding the "src" subdirectory). Note that you'll have SDL3, SDL3main and SDL3-static + as targets in your project, so you should have "target_link_libraries(yourgame SDL3 SDL3main)" in your CMakeLists.txt file. Also be aware that you should use add_library() instead of add_executable() for the target containing your "main" function. @@ -414,10 +414,10 @@ Graphics debugging ================================================================================ If you are developing on a compatible Tegra-based tablet, NVidia provides -Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL +Tegra Graphics Debugger at their website. Because SDL3 dynamically loads EGL and GLES libraries, you must follow their instructions for installing the interposer library on a rooted device. The non-rooted instructions are not -compatible with applications that use SDL2 for video. +compatible with applications that use SDL3 for video. The Tegra Graphics Debugger is available from NVidia here: https://developer.nvidia.com/tegra-graphics-debugger diff --git a/docs/README-cmake.md b/docs/README-cmake.md index b10751c1a..10e60b365 100644 --- a/docs/README-cmake.md +++ b/docs/README-cmake.md @@ -57,24 +57,24 @@ option(MYGAME_VENDORED "Use vendored libraries" OFF) if(MYGAME_VENDORED) add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL) else() - # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found - find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2) + # 1. Look for a SDL3 package, 2. look for the SDL3 component and 3. fail if none can be found + find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) - # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + # 1. Look for a SDL3 package, 2. Look for the SDL3maincomponent and 3. DO NOT fail when SDL3main is not available + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() # Create your game executable target as usual add_executable(mygame WIN32 mygame.c) -# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications -if(TARGET SDL2::SDL2main) - # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static) - target_link_libraries(mygame PRIVATE SDL2::SDL2main) +# SDL3::SDL3main may or may not be available. It is e.g. required by Windows GUI applications +if(TARGET SDL3::SDL3main) + # It has an implicit dependency on SDL3 functions, so it MUST be added before SDL3::SDL3 (or SDL3::SDL3-static) + target_link_libraries(mygame PRIVATE SDL3::SDL3main) endif() -# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary. -target_link_libraries(mygame PRIVATE SDL2::SDL2) +# Link to the actual SDL3 library. SDL3::SDL3 is the shared SDL library, SDL3::SDL3-static is the static SDL libarary. +target_link_libraries(mygame PRIVATE SDL3::SDL3) ``` ### A system SDL library @@ -85,10 +85,10 @@ The following components are available, to be used as an argument of `find_packa | Component name | Description | |----------------|--------------------------------------------------------------------------------------------| -| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] | -| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target | -| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target | -| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target | +| SDL3 | The SDL3 shared library, available through the `SDL3::SDL3` target [^SDL_TARGET_EXCEPTION] | +| SDL3-static | The SDL3 static library, available through the `SDL3::SDL3-static` target | +| SDL3main | The SDL3main static library, available through the `SDL3::SDL3main` target | +| SDL3test | The SDL3test static library, available through the `SDL3::SDL3test` target | ### Using a vendored SDL @@ -160,4 +160,4 @@ To use, set the following CMake variables when running CMake's configuration sta ``` -[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons. +[^SDL_TARGET_EXCEPTION]: `SDL3::SDL3` can be an ALIAS to a static `SDL3::SDL3-static` target for multiple reasons. diff --git a/docs/README-dynapi.md b/docs/README-dynapi.md index 47b726b1d..99f5074ee 100644 --- a/docs/README-dynapi.md +++ b/docs/README-dynapi.md @@ -4,22 +4,22 @@ Originally posted on Ryan's Google+ account. Background: -- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, - but developers are shipping their own SDL2 with individual Steam games. - These games might stop getting updates, but a newer SDL2 might be needed later. +- The Steam Runtime has (at least in theory) a really kick-ass build of SDL, + but developers are shipping their own SDL with individual Steam games. + These games might stop getting updates, but a newer SDL might be needed later. Certainly we'll always be fixing bugs in SDL, even if a new video target isn't ever needed, and these fixes won't make it to a game shipping its own SDL. -- Even if we replace the SDL2 in those games with a compatible one, that is to +- Even if we replace the SDL in those games with a compatible one, that is to say, edit a developer's Steam depot (yuck!), there are developers that are - statically linking SDL2 that we can't do this for. We can't even force the - dynamic loader to ignore their SDL2 in this case, of course. -- If you don't ship an SDL2 with the game in some form, people that disabled the + statically linking SDL that we can't do this for. We can't even force the + dynamic loader to ignore their SDL in this case, of course. +- If you don't ship an SDL with the game in some form, people that disabled the Steam Runtime, or just tried to run the game from the command line instead of Steam might find themselves unable to run the game, due to a missing dependency. - If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target - generic Linux boxes that may or may not have SDL2 installed, you have to ship + generic Linux boxes that may or may not have SDL installed, you have to ship the library or risk a total failure to launch. So now, you might have to have - a non-Steam build plus a Steam build (that is, one with and one without SDL2 + a non-Steam build plus a Steam build (that is, one with and one without SDL included), which is inconvenient if you could have had one universal build that works everywhere. - We like the zlib license, but the biggest complaint from the open source @@ -65,8 +65,8 @@ system's dynamic loader was supposed to do for us? Yes, but now we've got this level of indirection, we can do things like this: ```bash -export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 -./MyGameThatIsStaticallyLinkedToSDL2 +export SDL_DYNAMIC_API=/my/actual/libSDL3.so.0 +./MyGameThatIsStaticallyLinkedToSDL ``` And now, this game that is statically linked to SDL, can still be overridden @@ -108,7 +108,7 @@ the jump table, and the size, in bytes, of the table. Now, we've got policy here: this table's layout never changes; new stuff gets added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all the needed functions if tablesize <= sizeof its own jump table. If tablesize is -bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but +bigger (say, SDL 3.0.4 is trying to load SDL 3.0.3), then we know to abort, but if it's smaller, we know we can provide the entire API that the caller needs. The version variable is a failsafe switch. diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md index 5f8c27786..f73c6090e 100644 --- a/docs/README-emscripten.md +++ b/docs/README-emscripten.md @@ -59,11 +59,11 @@ Or with cmake: To build one of the tests: $ cd test/ - $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html + $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL3.a ../build/libSDL3_test.a -o a.html Uses GLES2 renderer or software -Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): +Some other SDL3 libraries can be easily built (assuming SDL3 is installed somewhere): SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): diff --git a/docs/README-gdk.md b/docs/README-gdk.md index 5f6b18be3..e172adf07 100644 --- a/docs/README-gdk.md +++ b/docs/README-gdk.md @@ -25,7 +25,7 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers * Initializing/uninitializing the game runtime, and initializing Xbox Live services * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue. - * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. + * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL3main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`). * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak). @@ -36,8 +36,8 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration: -* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64. -* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs. +* SDL3 (DLL) - This is the typical SDL3.dll, but for Gaming.Desktop.x64. +* SDL3main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs. * tests/testgamecontroller - Standard SDL test program demonstrating controller functionality. * tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live. *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this. @@ -54,21 +54,21 @@ These steps assume you already have a game using SDL that runs on Windows x64 al In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration. -### 2. Build SDL2 and SDL2main for GDK ### +### 2. Build SDL3 and SDL3main for GDK ### -Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project. +Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL3 and SDL3main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL3.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL3.lib`, and `SDL3main.lib` output files for your game project. -*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. +*Alternatively*, you could setup your solution file to instead reference the SDL3/SDL3main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL3 and SDL3main would both be built when your game is built. ### 3. Configuring Project Settings ### While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration: * Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced -* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are +* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL3.lib and SDL3main.lib are * Under Linker > Input > Additional Dependencies, you need the following: - * `SDL2.lib` - * `SDL2main.lib` (unless not using) + * `SDL3.lib` + * `SDL3main.lib` (unless not using) * `xgameruntime.lib` * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib` * Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK. @@ -81,7 +81,7 @@ Rather than using your own implementation of `WinMain`, it's recommended that yo The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory: -* Your SDL2.dll +* Your SDL3.dll * "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" * XCurl.dll diff --git a/docs/README-ios.md b/docs/README-ios.md index e13f8baae..d06e3b518 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -20,7 +20,7 @@ Using the Simple DirectMedia Layer for iOS 3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj 4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name" 5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left -6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS" +6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL3.framework from "Framework-iOS" 7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library. 8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files 9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function. @@ -194,15 +194,15 @@ http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOS Notes -- xcFramework ============================================================================== -The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. +The SDL.xcodeproj file now includes a target to build SDL3.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package. -The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac. +The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL3.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac. This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes. -In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this: +In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL3.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this: #ifndef SDL_MAIN_HANDLED #ifdef main diff --git a/docs/README-kmsbsd.md b/docs/README-kmsbsd.md index 01db5e8aa..760481707 100644 --- a/docs/README-kmsbsd.md +++ b/docs/README-kmsbsd.md @@ -8,7 +8,7 @@ WSCONS support has been brought back, but only as an input backend. It will not OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices. -SDL2 WSCONS input backend features +SDL WSCONS input backend features =================================================== 1. It is keymap-aware; it will work properly with different keymaps. 2. It has mouse support. diff --git a/docs/README-n3ds.md b/docs/README-n3ds.md index 66e194d0b..1fa8e15a6 100644 --- a/docs/README-n3ds.md +++ b/docs/README-n3ds.md @@ -22,6 +22,6 @@ cmake --install build ## Notes - Currently only software rendering is supported. -- SDL2main should be used to ensure ROMFS is enabled. +- SDL3main should be used to ensure ROMFS is enabled. - By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function. - `SDL_GetBasePath` returns the romfs root instead of the executable's directory. diff --git a/docs/README-ngage.md b/docs/README-ngage.md index 83c2e3384..363760b99 100644 --- a/docs/README-ngage.md +++ b/docs/README-ngage.md @@ -1,7 +1,7 @@ Nokia N-Gage ============ -SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage +SDL port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage (Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev). Compiling @@ -12,7 +12,7 @@ The library is included in the [toolchain](https://github.com/ngagesdk/ngage-toolchain) as a sub-module. -A complete example project based on SDL2 can be found in the GitHub +A complete example project based on SDL can be found in the GitHub account of the SDK: [Wordle](https://github.com/ngagesdk/wordle). Current level of implementation diff --git a/docs/README-os2.md b/docs/README-os2.md index 1815b944d..3024f1125 100644 --- a/docs/README-os2.md +++ b/docs/README-os2.md @@ -42,24 +42,21 @@ Installing: - eComStation: - If you have previously installed SDL2, make a Backup copy of SDL2.dll + If you have previously installed SDL3, make a Backup copy of SDL3.dll located in D:\ecs\dll (where D: is disk on which installed eComStation). - Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll + Stop all programs running with SDL3. Copy SDL3.dll to D:\ecs\dll - OS/2: - Copy SDL2.dll to any directory on your LIBPATH. If you have a previous - version installed, close all SDL2 applications before replacing the old + Copy SDL3.dll to any directory on your LIBPATH. If you have a previous + version installed, close all SDL3 applications before replacing the old copy. Also make sure that any other older versions of DLLs are removed from your system. -Joysticks in SDL2: +Joysticks: ------------------ -The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version. -Here is the original documentation from SDL-1.2: - The Joystick detection only works for standard joysticks (2 buttons, 2 axes and the like). Therefore, if you use a non-standard joystick, you should specify its features in the SDL_OS2_JOYSTICK environment variable in a batch diff --git a/docs/README-ps2.md b/docs/README-ps2.md index b27b57d1a..095e5685b 100644 --- a/docs/README-ps2.md +++ b/docs/README-ps2.md @@ -1,6 +1,6 @@ PS2 ====== -SDL2 port for the Sony Playstation 2 contributed by: +SDL port for the Sony Playstation 2 contributed by: - Francisco Javier Trujillo Mata @@ -9,7 +9,7 @@ Credit to - David G. F. for helping me with several issues and tests. ## Building -To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run: +To build SDL library for the PS2, make sure you have the latest PS2Dev status and run: ```bash cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake cmake --build build @@ -48,4 +48,4 @@ Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_ ## To Do - PS2 Screen Keyboard - Dialogs -- Others \ No newline at end of file +- Others diff --git a/docs/README-psp.md b/docs/README-psp.md index 0c84f866b..5d9b34f8d 100644 --- a/docs/README-psp.md +++ b/docs/README-psp.md @@ -1,6 +1,6 @@ PSP ====== -SDL2 port for the Sony PSP contributed by: +SDL port for the Sony PSP contributed by: - Captian Lex - Francisco Javier Trujillo Mata - Wouter Wijsman @@ -11,7 +11,7 @@ Credit to Geecko for his PSP GU lib "Glib2d" ## Building -To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run: +To build SDL library for the PSP, make sure you have the latest PSPDev status and run: ```bash cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake cmake --build build @@ -33,4 +33,4 @@ cmake --install build ## To Do - PSP Screen Keyboard -- Dialogs \ No newline at end of file +- Dialogs diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md index d2eddb862..fe13a1be6 100644 --- a/docs/README-raspberrypi.md +++ b/docs/README-raspberrypi.md @@ -81,13 +81,13 @@ The final step is compiling SDL itself. export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" cd mkdir -p build;cd build - LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd + LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd make make install To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: - perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config + perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc ./rpi-sdl3-installed/bin/sdl3-config Apps don't work or poor video/audio performance ----------------------------------------------- diff --git a/docs/README-riscos.md b/docs/README-riscos.md index 76b27e0aa..f7ddb2e20 100644 --- a/docs/README-riscos.md +++ b/docs/README-riscos.md @@ -12,15 +12,15 @@ Requirements: Compiling: ---------- -Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported. +Currently, SDL for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported. -The following commands can be used to build SDL2 for RISC OS using autoconf: +The following commands can be used to build SDL for RISC OS using autoconf: ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics make make install -The following commands can be used to build SDL2 for RISC OS using CMake: +The following commands can be used to build SDL for RISC OS using CMake: cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF cmake --build build-riscos diff --git a/docs/README-visualc.md b/docs/README-visualc.md index 759752a56..04ab63ff8 100644 --- a/docs/README-visualc.md +++ b/docs/README-visualc.md @@ -27,9 +27,9 @@ You may get a few warnings, but you should not get any errors. Later, we will refer to the following `.lib` and `.dll` files that have just been generated: -- `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll` -- `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib` -- `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib` +- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll` +- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib` +- `./VisualC/Win32/Debug/SDL3main.lib` or `./VisualC/Win32/Release/SDL3main.lib` _Note for the `x64` versions, just replace `Win32` in the path with `x64`_ @@ -59,12 +59,12 @@ Now we're going to use the files that we had created earlier in the *Build SDL* Copy the following file into your Project directory: -- `SDL2.dll` +- `SDL3.dll` Add the following files to your project (It is not necessary to copy them to your project directory): -- `SDL2.lib` -- `SDL2main.lib` +- `SDL3.lib` +- `SDL3main.lib` To add them to your project, right click on your project, and select `Add files to project`. @@ -73,7 +73,7 @@ To add them to your project, right click on your project, and select and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration (e.g. Release,Debug).** -### Hello SDL2 +### Hello SDL Here's a sample SDL snippet to verify everything is setup in your IDE: @@ -88,7 +88,7 @@ Here's a sample SDL snippet to verify everything is setup in your IDE: SDL_Renderer* renderer = NULL; SDL_Init(SDL_INIT_VIDEO); - window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); + window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_DestroyRenderer(renderer); diff --git a/docs/README-winrt.md b/docs/README-winrt.md index c05c77e02..68271cc65 100644 --- a/docs/README-winrt.md +++ b/docs/README-winrt.md @@ -272,8 +272,8 @@ To include these files for C/C++ projects: 2. navigate to the directory containing SDL's source code, then into its subdirectory, 'src/main/winrt/'. Select, then add, the following files: - `SDL_winrt_main_NonXAML.cpp` - - `SDL2-WinRTResources.rc` - - `SDL2-WinRTResource_BlankCursor.cur` + - `SDL3-WinRTResources.rc` + - `SDL3-WinRTResource_BlankCursor.cur` 3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your project), then click on "Properties...". 4. in the drop-down box next to "Configuration", choose, "All Configurations" @@ -287,7 +287,7 @@ app's project. This is to make sure that Visual C++'s linker builds a 'Windows Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's -main function, and generate SDL2-WinRTResources.res manually by using `rc` via +main function, and generate SDL3-WinRTResources.res manually by using `rc` via the Developer Command Prompt and including it as a within the first block in your Visual Studio project file. diff --git a/docs/doxyfile b/docs/doxyfile index 7b80a3a8d..a9d837c32 100644 --- a/docs/doxyfile +++ b/docs/doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = SDL # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0 +PROJECT_NUMBER = 3.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -868,14 +868,14 @@ GENERATE_DOCSET = NO # documentation sets from a single provider (such as a company or product suite) # can be grouped. -DOCSET_FEEDNAME = "SDL 2.0 Doxygen" +DOCSET_FEEDNAME = "SDL 3.0 Doxygen" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. -DOCSET_BUNDLE_ID = org.libsdl.sdl20 +DOCSET_BUNDLE_ID = org.libsdl.sdl30 # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the @@ -889,7 +889,7 @@ GENERATE_HTMLHELP = NO # can add a path in front of the file if the result should not be # written to the html output directory. -CHM_FILE = ./sdl20.chm +CHM_FILE = ./sdl30.chm # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of diff --git a/include/SDL.h b/include/SDL.h index 12e7f31a2..90e173822 100644 --- a/include/SDL.h +++ b/include/SDL.h @@ -146,7 +146,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); /** * Compatibility function to initialize the SDL library. * - * In SDL2, this function and SDL_Init() are interchangeable. + * This function and SDL_Init() are interchangeable. * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * \returns 0 on success or a negative error code on failure; call diff --git a/include/SDL_audio.h b/include/SDL_audio.h index c42de3ed9..ee6c5e092 100644 --- a/include/SDL_audio.h +++ b/include/SDL_audio.h @@ -1211,7 +1211,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * You should not call SDL_LockAudio() on the device before queueing; SDL * handles locking internally for this function. * - * Note that SDL2 does not support planar audio. You will need to resample + * Note that SDL does not support planar audio. You will need to resample * from planar audio formats into a non-planar one (see SDL_AudioFormat) * before queuing audio. * diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 76a74f0ff..a7ab663a8 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -352,7 +352,7 @@ extern "C" { * \brief Disable giving back control to the browser automatically * when running with asyncify * - * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations + * With -s ASYNCIFY, SDL calls emscripten_sleep during operations * such as refreshing the screen or polling events. * * This hint only applies to the emscripten platform diff --git a/include/SDL_main.h b/include/SDL_main.h index 113d11de0..b35b07536 100644 --- a/include/SDL_main.h +++ b/include/SDL_main.h @@ -55,7 +55,7 @@ /* On GDK, SDL provides a main function that initializes the game runtime. Please note that #include'ing SDL_main.h is not enough to get a main() - function working. You must either link against SDL2main or, if not possible, + function working. You must either link against SDL3main or, if not possible, call the SDL_GDKRunApp function from your entry point. */ #define SDL_MAIN_NEEDED diff --git a/include/SDL_test.h b/include/SDL_test.h index 8cc9d616a..ae4eb5b23 100644 --- a/include/SDL_test.h +++ b/include/SDL_test.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_h_ diff --git a/include/SDL_test_assert.h b/include/SDL_test_assert.h index 734230529..dd820edef 100644 --- a/include/SDL_test_assert.h +++ b/include/SDL_test_assert.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_common.h b/include/SDL_test_common.h index b86520d32..0d4307096 100644 --- a/include/SDL_test_common.h +++ b/include/SDL_test_common.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* Ported from original test\common.h file. */ diff --git a/include/SDL_test_compare.h b/include/SDL_test_compare.h index 8a7a07008..400a9da89 100644 --- a/include/SDL_test_compare.h +++ b/include/SDL_test_compare.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_crc32.h b/include/SDL_test_crc32.h index 049da7406..86f6ce661 100644 --- a/include/SDL_test_crc32.h +++ b/include/SDL_test_crc32.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_font.h b/include/SDL_test_font.h index 6e7247dd7..2f02ae937 100644 --- a/include/SDL_test_font.h +++ b/include/SDL_test_font.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_font_h_ diff --git a/include/SDL_test_fuzzer.h b/include/SDL_test_fuzzer.h index bbe8eb874..ea0d14b2f 100644 --- a/include/SDL_test_fuzzer.h +++ b/include/SDL_test_fuzzer.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_harness.h b/include/SDL_test_harness.h index 1fd4236be..453fe336f 100644 --- a/include/SDL_test_harness.h +++ b/include/SDL_test_harness.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_images.h b/include/SDL_test_images.h index e2bfc3600..6cc3aaa99 100644 --- a/include/SDL_test_images.h +++ b/include/SDL_test_images.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_log.h b/include/SDL_test_log.h index e3d39ad27..5e670d151 100644 --- a/include/SDL_test_log.h +++ b/include/SDL_test_log.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_md5.h b/include/SDL_test_md5.h index 17b1d2be7..3005b8bcd 100644 --- a/include/SDL_test_md5.h +++ b/include/SDL_test_md5.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_memory.h b/include/SDL_test_memory.h index cc2edc1b9..4158ce34e 100644 --- a/include/SDL_test_memory.h +++ b/include/SDL_test_memory.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_memory_h_ diff --git a/include/SDL_test_random.h b/include/SDL_test_random.h index b1d6060cb..6da8b9ef5 100644 --- a/include/SDL_test_random.h +++ b/include/SDL_test_random.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 7364f8137..6bedcb555 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -94,15 +94,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL2.DLL will + * API. There is a problem with this, that only the RTL of the SDL3.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL2.DLL which uses this API, - * then the RTL of SDL2.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL3.DLL which uses this API, + * then the RTL of SDL3.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -147,7 +147,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, #elif defined(__OS2__) /* - * just like the windows case above: We compile SDL2 + * just like the windows case above: We compile SDL3 * into a dll with Watcom's runtime statically linked. */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD diff --git a/include/SDL_version.h b/include/SDL_version.h index e85fceb34..75cc89149 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -57,8 +57,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ -#define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 26 +#define SDL_MAJOR_VERSION 3 +#define SDL_MINOR_VERSION 0 #define SDL_PATCHLEVEL 0 /** @@ -84,7 +84,7 @@ typedef struct SDL_version } /* TODO: Remove this whole block in SDL 3 */ -#if SDL_MAJOR_VERSION < 3 +#if SDL_MAJOR_VERSION <= 3 /** * This macro turns the version numbers into a numeric value: * \verbatim diff --git a/mingw/pkg-support/cmake/sdl2-config-version.cmake b/mingw/pkg-support/cmake/sdl2-config-version.cmake deleted file mode 100644 index 9f7a8b34d..000000000 --- a/mingw/pkg-support/cmake/sdl2-config-version.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# SDL2 CMake version configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw - -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") -else() - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -if(NOT EXISTS "${sdl2_config_path}") - message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -include("${sdl2_config_path}") diff --git a/mingw/pkg-support/cmake/sdl2-config.cmake b/mingw/pkg-support/cmake/sdl2-config.cmake deleted file mode 100644 index 3c0799fbc..000000000 --- a/mingw/pkg-support/cmake/sdl2-config.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw - -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") -else() - set(SDL2_FOUND FALSE) - return() -endif() - -if(NOT EXISTS "${sdl2_config_path}") - message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") - set(SDL2_FOUND FALSE) - return() -endif() - -include("${sdl2_config_path}") diff --git a/mingw/pkg-support/cmake/sdl3-config-version.cmake b/mingw/pkg-support/cmake/sdl3-config-version.cmake new file mode 100644 index 000000000..2f2bdffd4 --- /dev/null +++ b/mingw/pkg-support/cmake/sdl3-config-version.cmake @@ -0,0 +1,19 @@ +# SDL3 CMake version configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake") +else() + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +if(NOT EXISTS "${sdl3_config_path}") + message(WARNING "${sdl3_config_path} does not exist: MinGW development package is corrupted") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +include("${sdl3_config_path}") diff --git a/mingw/pkg-support/cmake/sdl3-config.cmake b/mingw/pkg-support/cmake/sdl3-config.cmake new file mode 100644 index 000000000..291845f99 --- /dev/null +++ b/mingw/pkg-support/cmake/sdl3-config.cmake @@ -0,0 +1,19 @@ +# SDL3 CMake configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake") +else() + set(SDL3_FOUND FALSE) + return() +endif() + +if(NOT EXISTS "${sdl3_config_path}") + message(WARNING "${sdl3_config_path} does not exist: MinGW development package is corrupted") + set(SDL3_FOUND FALSE) + return() +endif() + +include("${sdl3_config_path}") diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in deleted file mode 100644 index 5d6cf4335..000000000 --- a/sdl2-config.cmake.in +++ /dev/null @@ -1,206 +0,0 @@ -# sdl2 cmake project-config input for ./configure script - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/@cmake_prefix_relpath@" ABSOLUTE) - -set(exec_prefix "@exec_prefix@") -set(bindir "@bindir@") -set(libdir "@libdir@") -set(includedir "@includedir@") - -set_and_check(SDL2_PREFIX "${prefix}") -set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}") -set_and_check(SDL2_BINDIR "${bindir}") -set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2") -set_and_check(SDL2_LIBDIR "${libdir}") -set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}") - -set(SDL2_LIBRARIES SDL2::SDL2) -set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -set(SDL2MAIN_LIBRARY) -set(SDL2TEST_LIBRARY SDL2::SDL2test) - -unset(prefix) -unset(exec_prefix) -unset(bindir) -unset(libdir) -unset(includedir) - -set(_sdl2_libraries_in "@SDL_LIBS@") -set(_sdl2_static_private_libs_in "@SDL_STATIC_LIBS@") - -# Convert _sdl2_libraries to list and keep only libraries + library directories -string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl2_libraries "${_sdl2_libraries_in}") -string(REGEX REPLACE "^-l" "" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX REPLACE ";-l" ";" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl2_libdirs "${_sdl2_libraries_in}") -string(REGEX REPLACE "^-L" "" _sdl2_libdirs "${_sdl2_libdirs}") -string(REGEX REPLACE ";-L" ";" _sdl2_libdirs "${_sdl2_libdirs}") -list(APPEND _sdl2_libdirs "${SDL2_LIBDIR}") - -# Convert _sdl2_static_private_libs to list and keep only libraries + library directories -string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)|(-pthread)" _sdl2_static_private_libs "${_sdl2_static_private_libs_in}") -string(REGEX REPLACE "^-l" "" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX REPLACE ";-l" ";" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl2_static_private_libdirs "${_sdl2_static_private_libs_in}") -string(REGEX REPLACE "^-L" "" _sdl2_static_private_libdirs "${_sdl2_static_private_libdirs}") -string(REGEX REPLACE ";-L" ";" _sdl2_static_private_libdirs "${_sdl2_static_private_libdirs}") - -if(_sdl2_libraries MATCHES ".*SDL2main.*") - list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) - list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) -endif() - -set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}) -if(EXISTS "${_sdl2main_library}") - set(SDL2MAIN_LIBRARY SDL2::SDL2main) - if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main - PROPERTIES - IMPORTED_LOCATION "${_sdl2main_library}" - ) - if(WIN32) - # INTERFACE_LINK_OPTIONS needs CMake 3.13 - cmake_minimum_required(VERSION 3.13) - # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>" - ) - else() - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>" - ) - endif() - endif() - endif() - set(SDL2_SDL2main_FOUND TRUE) -else() - set(SDL2_SDL2main_FOUND FALSE) -endif() -unset(_sdl2main_library) - -# Remove SDL2 since this is the "central" library -# Remove SDL2main since this will be provided by SDL2::SDL2main (if available) -# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` -set(_sdl2_link_libraries ${_sdl2_libraries}) -list(REMOVE_ITEM _sdl2_link_libraries SDL2 SDL2main mingw32 cygwin) - -if(WIN32) - set(_sdl2_implib "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(_sdl2_dll "${SDL2_BINDIR}/SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_implib}" AND EXISTS "${_sdl2_dll}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_IMPLIB "${_sdl2_implib}" - IMPORTED_LOCATION "${_sdl2_dll}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_implib) - unset(_sdl2_dll) -else() - set(_sdl2_shared "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_shared}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${_sdl2_shared}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_shared) -endif() - -set(_sdl2_static "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2_static}") - if(NOT TARGET SDL2::SDL2-static) - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static - PROPERTIES - IMPORTED_LOCATION "${_sdl2_static}" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries};${_sdl2_static_private_libs}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs};${_sdl2_static_private_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2-static_FOUND TRUE) -else() - set(SDL2_SDL2-static_FOUND FALSE) -endif() -unset(_sdl2_static) - -unset(_sdl2_link_libraries) - -set(_sdl2test_library "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_test${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2test_library}") - if(NOT TARGET SDL2::SDL2test) - add_library(SDL2::SDL2test STATIC IMPORTED) - set_target_properties(SDL2::SDL2test - PROPERTIES - IMPORTED_LOCATION "${_sdl2test_library}" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2test_FOUND TRUE) -else() - set(SDL2_SDL2test_FOUND FALSE) -endif() -unset(_sdl2test_library) - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -check_required_components(SDL2) - -# Create SDL2::SDL2 alias for static-only builds -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - if(CMAKE_VERSION VERSION_LESS "3.18") - # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") - else() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) - endif() -endif() diff --git a/sdl2-config-version.cmake.in b/sdl3-config-version.cmake.in similarity index 81% rename from sdl2-config-version.cmake.in rename to sdl3-config-version.cmake.in index 5c6aee44d..cdb37b1dd 100644 --- a/sdl2-config-version.cmake.in +++ b/sdl3-config-version.cmake.in @@ -1,4 +1,4 @@ -# sdl2 cmake project-config-version input for ./configure scripts +# sdl3 cmake project-config-version input for ./configure scripts set(PACKAGE_VERSION "@SDL_VERSION@") diff --git a/sdl3-config.cmake.in b/sdl3-config.cmake.in new file mode 100644 index 000000000..0e1184fb5 --- /dev/null +++ b/sdl3-config.cmake.in @@ -0,0 +1,206 @@ +# sdl3 cmake project-config input for ./configure script + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/@cmake_prefix_relpath@" ABSOLUTE) + +set(exec_prefix "@exec_prefix@") +set(bindir "@bindir@") +set(libdir "@libdir@") +set(includedir "@includedir@") + +set_and_check(SDL3_PREFIX "${prefix}") +set_and_check(SDL3_EXEC_PREFIX "${exec_prefix}") +set_and_check(SDL3_BINDIR "${bindir}") +set_and_check(SDL3_INCLUDE_DIR "${includedir}/SDL3") +set_and_check(SDL3_LIBDIR "${libdir}") +set(SDL3_INCLUDE_DIRS "${includedir};${SDL3_INCLUDE_DIR}") + +set(SDL3_LIBRARIES SDL3::SDL3) +set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) +set(SDL3MAIN_LIBRARY) +set(SDL3TEST_LIBRARY SDL3::SDL3test) + +unset(prefix) +unset(exec_prefix) +unset(bindir) +unset(libdir) +unset(includedir) + +set(_sdl3_libraries_in "@SDL_LIBS@") +set(_sdl3_static_private_libs_in "@SDL_STATIC_LIBS@") + +# Convert _sdl3_libraries to list and keep only libraries + library directories +string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl3_libraries "${_sdl3_libraries_in}") +string(REGEX REPLACE "^-l" "" _sdl3_libraries "${_sdl3_libraries}") +string(REGEX REPLACE ";-l" ";" _sdl3_libraries "${_sdl3_libraries}") +string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl3_libdirs "${_sdl3_libraries_in}") +string(REGEX REPLACE "^-L" "" _sdl3_libdirs "${_sdl3_libdirs}") +string(REGEX REPLACE ";-L" ";" _sdl3_libdirs "${_sdl3_libdirs}") +list(APPEND _sdl3_libdirs "${SDL3_LIBDIR}") + +# Convert _sdl3_static_private_libs to list and keep only libraries + library directories +string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)|(-pthread)" _sdl3_static_private_libs "${_sdl3_static_private_libs_in}") +string(REGEX REPLACE "^-l" "" _sdl3_static_private_libs "${_sdl3_static_private_libs}") +string(REGEX REPLACE ";-l" ";" _sdl3_static_private_libs "${_sdl3_static_private_libs}") +string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl3_static_private_libdirs "${_sdl3_static_private_libs_in}") +string(REGEX REPLACE "^-L" "" _sdl3_static_private_libdirs "${_sdl3_static_private_libdirs}") +string(REGEX REPLACE ";-L" ";" _sdl3_static_private_libdirs "${_sdl3_static_private_libdirs}") + +if(_sdl3_libraries MATCHES ".*SDL3main.*") + list(INSERT SDL3_LIBRARIES 0 SDL3::SDL3main) + list(INSERT SDL3_STATIC_LIBRARIES 0 SDL3::SDL3main) +endif() + +set(_sdl3main_library ${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3main${CMAKE_STATIC_LIBRARY_SUFFIX}) +if(EXISTS "${_sdl3main_library}") + set(SDL3MAIN_LIBRARY SDL3::SDL3main) + if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main STATIC IMPORTED) + set_target_properties(SDL3::SDL3main + PROPERTIES + IMPORTED_LOCATION "${_sdl3main_library}" + ) + if(WIN32) + # INTERFACE_LINK_OPTIONS needs CMake 3.13 + cmake_minimum_required(VERSION 3.13) + # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set_target_properties(SDL3::SDL3main + PROPERTIES + INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>" + ) + else() + set_target_properties(SDL3::SDL3main + PROPERTIES + INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>" + ) + endif() + endif() + endif() + set(SDL3_SDL3main_FOUND TRUE) +else() + set(SDL3_SDL3main_FOUND FALSE) +endif() +unset(_sdl3main_library) + +# Remove SDL3 since this is the "central" library +# Remove SDL3main since this will be provided by SDL3::SDL3main (if available) +# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` +set(_sdl3_link_libraries ${_sdl3_libraries}) +list(REMOVE_ITEM _sdl3_link_libraries SDL3 SDL3main mingw32 cygwin) + +if(WIN32) + set(_sdl3_implib "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(_sdl3_dll "${SDL3_BINDIR}/SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl3_implib}" AND EXISTS "${_sdl3_dll}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_IMPLIB "${_sdl3_implib}" + IMPORTED_LOCATION "${_sdl3_dll}" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) + else() + set(SDL3_SDL3_FOUND FALSE) + endif() + unset(_sdl3_implib) + unset(_sdl3_dll) +else() + set(_sdl3_shared "${SDL3_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl3_shared}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${_sdl3_shared}" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) + else() + set(SDL3_SDL3_FOUND FALSE) + endif() + unset(_sdl3_shared) +endif() + +set(_sdl3_static "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl3_static}") + if(NOT TARGET SDL3::SDL3-static) + add_library(SDL3::SDL3-static STATIC IMPORTED) + set_target_properties(SDL3::SDL3-static + PROPERTIES + IMPORTED_LOCATION "${_sdl3_static}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries};${_sdl3_static_private_libs}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs};${_sdl3_static_private_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL3_SDL3-static_FOUND TRUE) +else() + set(SDL3_SDL3-static_FOUND FALSE) +endif() +unset(_sdl3_static) + +unset(_sdl3_link_libraries) + +set(_sdl3test_library "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3_test${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl3test_library}") + if(NOT TARGET SDL3::SDL3test) + add_library(SDL3::SDL3test STATIC IMPORTED) + set_target_properties(SDL3::SDL3test + PROPERTIES + IMPORTED_LOCATION "${_sdl3test_library}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL3_SDL3test_FOUND TRUE) +else() + set(SDL3_SDL3test_FOUND FALSE) +endif() +unset(_sdl3test_library) + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +check_required_components(SDL3) + +# Create SDL3::SDL3 alias for static-only builds +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL3::SDL3-static") + else() + add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static) + endif() +endif() diff --git a/sdl2-config.in b/sdl3-config.in similarity index 94% rename from sdl2-config.in rename to sdl3-config.in index f6eca7668..46aff2df6 100644 --- a/sdl2-config.in +++ b/sdl3-config.in @@ -46,14 +46,14 @@ while test $# -gt 0; do echo @SDL_VERSION@ ;; --cflags) - echo -I@includedir@/SDL2 @SDL_CFLAGS@ + echo -I@includedir@/SDL3 @SDL_CFLAGS@ ;; @ENABLE_SHARED_TRUE@ --libs) @ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ @ENABLE_SHARED_TRUE@ ;; @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) -@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g") +@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL3[ $]#$libdir/libSDL3.a #g") @ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs @ENABLE_STATIC_TRUE@ ;; *) diff --git a/sdl2.m4 b/sdl3.m4 similarity index 73% rename from sdl2.m4 rename to sdl3.m4 index 75b60f6ea..88d426f13 100644 --- a/sdl2.m4 +++ b/sdl3.m4 @@ -6,18 +6,18 @@ # Shamelessly stolen from Owen Taylor # # Changelog: -# * also look for SDL2.framework under Mac OS X +# * also look for SDL3.framework under Mac OS X # * removed HP/UX 9 support. # * updated for newer autoconf. # serial 2 -dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl AM_PATH_SDL3([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl -AC_DEFUN([AM_PATH_SDL2], +AC_DEFUN([AM_PATH_SDL3], [dnl -dnl Get the cflags and libraries from the sdl2-config script +dnl Get the cflags and libraries from the sdl3-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") @@ -25,53 +25,53 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) -AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL3.framework], , search_sdl_framework=yes) -AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) +AC_ARG_VAR(SDL3_FRAMEWORK, [Path to SDL3.framework]) - min_sdl_version=ifelse([$1], ,2.0.0,$1) + min_sdl_version=ifelse([$1], ,3.0.0,$1) if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + PKG_CHECK_MODULES([SDL], [sdl3 >= $min_sdl_version], [sdl_pc=yes], [sdl_pc=no]) else sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + AC_PATH_PROG(SDL3_CONFIG, sdl3-config, no, [$PATH]) PATH="$as_save_PATH" no_sdl="" - if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then - AC_MSG_CHECKING(for SDL2.framework) - if test "x$SDL2_FRAMEWORK" != x; then - sdl_framework=$SDL2_FRAMEWORK + if test "$SDL3_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL3.framework) + if test "x$SDL3_FRAMEWORK" != x; then + sdl_framework=$SDL3_FRAMEWORK else for d in / ~/ /System/; do - if test -d "${d}Library/Frameworks/SDL2.framework"; then - sdl_framework="${d}Library/Frameworks/SDL2.framework" + if test -d "${d}Library/Frameworks/SDL3.framework"; then + sdl_framework="${d}Library/Frameworks/SDL3.framework" fi done fi @@ -79,25 +79,25 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) if test x"$sdl_framework" != x && test -d "$sdl_framework"; then AC_MSG_RESULT($sdl_framework) sdl_framework_dir=`dirname $sdl_framework` - SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" - SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL3 -I$sdl_framework/include" + SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL3" else no_sdl=yes fi fi - if test "$SDL2_CONFIG" != "no"; then + if test "$SDL3_CONFIG" != "no"; then if test "x$sdl_pc" = "xno"; then AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` fi - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -108,7 +108,7 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl2-config to some extent +dnl checks the results of sdl3-config to some extent dnl rm -f conf.sdltest AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -136,11 +136,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -164,11 +164,11 @@ int main (int argc, char *argv[]) if test "x$no_sdl" = x ; then ifelse([$2], , :, [$2]) else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" diff --git a/sdl2.pc.in b/sdl3.pc.in similarity index 86% rename from sdl2.pc.in rename to sdl3.pc.in index ad1a9574f..96a480c86 100644 --- a/sdl2.pc.in +++ b/sdl3.pc.in @@ -5,10 +5,10 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: sdl2 +Name: sdl3 Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. Version: @SDL_VERSION@ Requires: Conflicts: Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ -Cflags: -I${includedir} -I${includedir}/SDL2 @SDL_CFLAGS@ +Cflags: -I${includedir} -I${includedir}/SDL3 @SDL_CFLAGS@ diff --git a/src/SDL_internal.h b/src/SDL_internal.h index 43e407f87..1055151d0 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -55,7 +55,7 @@ #define O_CLOEXEC 0 #endif -/* A few #defines to reduce SDL2 footprint. +/* A few #defines to reduce SDL footprint. Only effective when library is statically linked. You have to manually edit this file. */ #ifndef SDL_LEAN_AND_MEAN diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index bfe42821a..8a07f6c7f 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -38,10 +38,10 @@ FeedAudioDevice(_THIS, const void *buf, const int buflen) { const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; + var SDL3 = Module['SDL3']; + var numChannels = SDL3.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); + var channelData = SDL3.audio.currentOutputBuffer['getChannelData'](c); if (channelData.length != $1) { throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } @@ -107,10 +107,10 @@ HandleCaptureProcess(_THIS) } MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; + var SDL3 = Module['SDL3']; + var numChannels = SDL3.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); + var channelData = SDL3.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } @@ -153,45 +153,45 @@ static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; if ($0) { - if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); + if (SDL3.capture.silenceTimer !== undefined) { + clearTimeout(SDL3.capture.silenceTimer); } - if (SDL2.capture.stream !== undefined) { - var tracks = SDL2.capture.stream.getAudioTracks(); + if (SDL3.capture.stream !== undefined) { + var tracks = SDL3.capture.stream.getAudioTracks(); for (var i = 0; i < tracks.length; i++) { - SDL2.capture.stream.removeTrack(tracks[i]); + SDL3.capture.stream.removeTrack(tracks[i]); } - SDL2.capture.stream = undefined; + SDL3.capture.stream = undefined; } - if (SDL2.capture.scriptProcessorNode !== undefined) { - SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; - SDL2.capture.scriptProcessorNode.disconnect(); - SDL2.capture.scriptProcessorNode = undefined; + if (SDL3.capture.scriptProcessorNode !== undefined) { + SDL3.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; + SDL3.capture.scriptProcessorNode.disconnect(); + SDL3.capture.scriptProcessorNode = undefined; } - if (SDL2.capture.mediaStreamNode !== undefined) { - SDL2.capture.mediaStreamNode.disconnect(); - SDL2.capture.mediaStreamNode = undefined; + if (SDL3.capture.mediaStreamNode !== undefined) { + SDL3.capture.mediaStreamNode.disconnect(); + SDL3.capture.mediaStreamNode = undefined; } - if (SDL2.capture.silenceBuffer !== undefined) { - SDL2.capture.silenceBuffer = undefined + if (SDL3.capture.silenceBuffer !== undefined) { + SDL3.capture.silenceBuffer = undefined } - SDL2.capture = undefined; + SDL3.capture = undefined; } else { - if (SDL2.audio.scriptProcessorNode != undefined) { - SDL2.audio.scriptProcessorNode.disconnect(); - SDL2.audio.scriptProcessorNode = undefined; + if (SDL3.audio.scriptProcessorNode != undefined) { + SDL3.audio.scriptProcessorNode.disconnect(); + SDL3.audio.scriptProcessorNode = undefined; } - SDL2.audio = undefined; + SDL3.audio = undefined; } - if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) { - SDL2.audioContext.close(); - SDL2.audioContext = undefined; + if ((SDL3.audioContext !== undefined) && (SDL3.audio === undefined) && (SDL3.capture === undefined)) { + SDL3.audioContext.close(); + SDL3.audioContext = undefined; } }, this->iscapture); -#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL3 namespace? --ryan. */ SDL_free(this->hidden); #endif } @@ -207,27 +207,27 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) /* create context */ result = MAIN_THREAD_EM_ASM_INT({ - if(typeof(Module['SDL2']) === 'undefined') { - Module['SDL2'] = {}; + if(typeof(Module['SDL3']) === 'undefined') { + Module['SDL3'] = {}; } - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; if (!$0) { - SDL2.audio = {}; + SDL3.audio = {}; } else { - SDL2.capture = {}; + SDL3.capture = {}; } - if (!SDL2.audioContext) { + if (!SDL3.audioContext) { if (typeof(AudioContext) !== 'undefined') { - SDL2.audioContext = new AudioContext(); + SDL3.audioContext = new AudioContext(); } else if (typeof(webkitAudioContext) !== 'undefined') { - SDL2.audioContext = new webkitAudioContext(); + SDL3.audioContext = new webkitAudioContext(); } - if (SDL2.audioContext) { - autoResumeAudioContext(SDL2.audioContext); + if (SDL3.audioContext) { + autoResumeAudioContext(SDL3.audioContext); } } - return SDL2.audioContext === undefined ? -1 : 0; + return SDL3.audioContext === undefined ? -1 : 0; }, iscapture); if (result < 0) { return SDL_SetError("Web Audio API is not available!"); @@ -250,7 +250,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) this->spec.format = test_format; /* Initialize all variables that we clean on shutdown */ -#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL3 namespace? --ryan. */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { @@ -262,8 +262,8 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) /* limit to native freq */ this->spec.freq = EM_ASM_INT_V({ - var SDL2 = Module['SDL2']; - return SDL2.audioContext.sampleRate; + var SDL3 = Module['SDL3']; + return SDL3.audioContext.sampleRate; }); SDL_CalculateAudioSpec(&this->spec); @@ -286,24 +286,24 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) to be honest. */ MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); - if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); - SDL2.capture.silenceTimer = undefined; + if (SDL3.capture.silenceTimer !== undefined) { + clearTimeout(SDL3.capture.silenceTimer); + SDL3.capture.silenceTimer = undefined; } - SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); - SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); - SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { - if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } + SDL3.capture.mediaStreamNode = SDL3.audioContext.createMediaStreamSource(stream); + SDL3.capture.scriptProcessorNode = SDL3.audioContext.createScriptProcessor($1, $0, 1); + SDL3.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { + if ((SDL3 === undefined) || (SDL3.capture === undefined)) { return; } audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); - SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; + SDL3.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; dynCall('vi', $2, [$3]); }; - SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); - SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); - SDL2.capture.stream = stream; + SDL3.capture.mediaStreamNode.connect(SDL3.capture.scriptProcessorNode); + SDL3.capture.scriptProcessorNode.connect(SDL3.audioContext.destination); + SDL3.capture.stream = stream; }; var no_microphone = function(error) { @@ -311,14 +311,14 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) }; /* we write silence to the audio callback until the microphone is available (user approves use, etc). */ - SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); - SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); + SDL3.capture.silenceBuffer = SDL3.audioContext.createBuffer($0, $1, SDL3.audioContext.sampleRate); + SDL3.capture.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { - SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; + SDL3.capture.currentCaptureBuffer = SDL3.capture.silenceBuffer; dynCall('vi', $2, [$3]); }; - SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); + SDL3.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL3.audioContext.sampleRate) * 1000); if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); @@ -329,14 +329,14 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) } else { /* setup a ScriptProcessorNode */ MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); - SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { - if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } - SDL2.audio.currentOutputBuffer = e['outputBuffer']; + var SDL3 = Module['SDL3']; + SDL3.audio.scriptProcessorNode = SDL3.audioContext['createScriptProcessor']($1, 0, $0); + SDL3.audio.scriptProcessorNode['onaudioprocess'] = function (e) { + if ((SDL3 === undefined) || (SDL3.audio === undefined)) { return; } + SDL3.audio.currentOutputBuffer = e['outputBuffer']; dynCall('vi', $2, [$3]); }; - SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); + SDL3.audio.scriptProcessorNode['connect'](SDL3.audioContext['destination']); }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); } diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 7a843f364..38db66cf0 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -26,7 +26,7 @@ */ /* !!! FIXME: can this target support hotplugging? */ -/* !!! FIXME: ...does SDL2 even support QNX? */ +/* !!! FIXME: ...does SDL even support QNX? */ #include "../../SDL_internal.h" diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 94f7aa626..1478de880 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -434,7 +434,7 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { - const char *client_name = "SDL2_Application"; + const char *client_name = "SDL3_Application"; const char *path = NULL; SDL_bool result = SDL_FALSE; DBusObjectPathVTable ibus_vtable; diff --git a/src/dynapi/SDL2.exports b/src/dynapi/SDL2.exports deleted file mode 100644 index 5085bffd9..000000000 --- a/src/dynapi/SDL2.exports +++ /dev/null @@ -1,869 +0,0 @@ -# Windows exports file for Watcom -# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. -++'_SDL_DYNAPI_entry'.'SDL2.dll'.'SDL_DYNAPI_entry' -++'_SDL_SetError'.'SDL2.dll'.'SDL_SetError' -++'_SDL_Log'.'SDL2.dll'.'SDL_Log' -++'_SDL_LogVerbose'.'SDL2.dll'.'SDL_LogVerbose' -++'_SDL_LogDebug'.'SDL2.dll'.'SDL_LogDebug' -++'_SDL_LogInfo'.'SDL2.dll'.'SDL_LogInfo' -++'_SDL_LogWarn'.'SDL2.dll'.'SDL_LogWarn' -++'_SDL_LogError'.'SDL2.dll'.'SDL_LogError' -++'_SDL_LogCritical'.'SDL2.dll'.'SDL_LogCritical' -++'_SDL_LogMessage'.'SDL2.dll'.'SDL_LogMessage' -++'_SDL_sscanf'.'SDL2.dll'.'SDL_sscanf' -++'_SDL_snprintf'.'SDL2.dll'.'SDL_snprintf' -++'_SDL_CreateThread'.'SDL2.dll'.'SDL_CreateThread' -++'_SDL_RWFromFP'.'SDL2.dll'.'SDL_RWFromFP' -++'_SDL_RegisterApp'.'SDL2.dll'.'SDL_RegisterApp' -++'_SDL_UnregisterApp'.'SDL2.dll'.'SDL_UnregisterApp' -++'_SDL_Direct3D9GetAdapterIndex'.'SDL2.dll'.'SDL_Direct3D9GetAdapterIndex' -++'_SDL_RenderGetD3D9Device'.'SDL2.dll'.'SDL_RenderGetD3D9Device' -# ++'_SDL_iPhoneSetAnimationCallback'.'SDL2.dll'.'SDL_iPhoneSetAnimationCallback' -# ++'_SDL_iPhoneSetEventPump'.'SDL2.dll'.'SDL_iPhoneSetEventPump' -# ++'_SDL_AndroidGetJNIEnv'.'SDL2.dll'.'SDL_AndroidGetJNIEnv' -# ++'_SDL_AndroidGetActivity'.'SDL2.dll'.'SDL_AndroidGetActivity' -# ++'_SDL_AndroidGetInternalStoragePath'.'SDL2.dll'.'SDL_AndroidGetInternalStoragePath' -# ++'_SDL_AndroidGetExternalStorageState'.'SDL2.dll'.'SDL_AndroidGetExternalStorageState' -# ++'_SDL_AndroidGetExternalStoragePath'.'SDL2.dll'.'SDL_AndroidGetExternalStoragePath' -++'_SDL_Init'.'SDL2.dll'.'SDL_Init' -++'_SDL_InitSubSystem'.'SDL2.dll'.'SDL_InitSubSystem' -++'_SDL_QuitSubSystem'.'SDL2.dll'.'SDL_QuitSubSystem' -++'_SDL_WasInit'.'SDL2.dll'.'SDL_WasInit' -++'_SDL_Quit'.'SDL2.dll'.'SDL_Quit' -++'_SDL_ReportAssertion'.'SDL2.dll'.'SDL_ReportAssertion' -++'_SDL_SetAssertionHandler'.'SDL2.dll'.'SDL_SetAssertionHandler' -++'_SDL_GetAssertionReport'.'SDL2.dll'.'SDL_GetAssertionReport' -++'_SDL_ResetAssertionReport'.'SDL2.dll'.'SDL_ResetAssertionReport' -++'_SDL_AtomicTryLock'.'SDL2.dll'.'SDL_AtomicTryLock' -++'_SDL_AtomicLock'.'SDL2.dll'.'SDL_AtomicLock' -++'_SDL_AtomicUnlock'.'SDL2.dll'.'SDL_AtomicUnlock' -++'_SDL_AtomicCAS'.'SDL2.dll'.'SDL_AtomicCAS' -++'_SDL_AtomicSet'.'SDL2.dll'.'SDL_AtomicSet' -++'_SDL_AtomicGet'.'SDL2.dll'.'SDL_AtomicGet' -++'_SDL_AtomicAdd'.'SDL2.dll'.'SDL_AtomicAdd' -++'_SDL_AtomicCASPtr'.'SDL2.dll'.'SDL_AtomicCASPtr' -++'_SDL_AtomicSetPtr'.'SDL2.dll'.'SDL_AtomicSetPtr' -++'_SDL_AtomicGetPtr'.'SDL2.dll'.'SDL_AtomicGetPtr' -++'_SDL_GetNumAudioDrivers'.'SDL2.dll'.'SDL_GetNumAudioDrivers' -++'_SDL_GetAudioDriver'.'SDL2.dll'.'SDL_GetAudioDriver' -++'_SDL_AudioInit'.'SDL2.dll'.'SDL_AudioInit' -++'_SDL_AudioQuit'.'SDL2.dll'.'SDL_AudioQuit' -++'_SDL_GetCurrentAudioDriver'.'SDL2.dll'.'SDL_GetCurrentAudioDriver' -++'_SDL_OpenAudio'.'SDL2.dll'.'SDL_OpenAudio' -++'_SDL_GetNumAudioDevices'.'SDL2.dll'.'SDL_GetNumAudioDevices' -++'_SDL_GetAudioDeviceName'.'SDL2.dll'.'SDL_GetAudioDeviceName' -++'_SDL_OpenAudioDevice'.'SDL2.dll'.'SDL_OpenAudioDevice' -++'_SDL_GetAudioStatus'.'SDL2.dll'.'SDL_GetAudioStatus' -++'_SDL_GetAudioDeviceStatus'.'SDL2.dll'.'SDL_GetAudioDeviceStatus' -++'_SDL_PauseAudio'.'SDL2.dll'.'SDL_PauseAudio' -++'_SDL_PauseAudioDevice'.'SDL2.dll'.'SDL_PauseAudioDevice' -++'_SDL_LoadWAV_RW'.'SDL2.dll'.'SDL_LoadWAV_RW' -++'_SDL_FreeWAV'.'SDL2.dll'.'SDL_FreeWAV' -++'_SDL_BuildAudioCVT'.'SDL2.dll'.'SDL_BuildAudioCVT' -++'_SDL_ConvertAudio'.'SDL2.dll'.'SDL_ConvertAudio' -++'_SDL_MixAudio'.'SDL2.dll'.'SDL_MixAudio' -++'_SDL_MixAudioFormat'.'SDL2.dll'.'SDL_MixAudioFormat' -++'_SDL_LockAudio'.'SDL2.dll'.'SDL_LockAudio' -++'_SDL_LockAudioDevice'.'SDL2.dll'.'SDL_LockAudioDevice' -++'_SDL_UnlockAudio'.'SDL2.dll'.'SDL_UnlockAudio' -++'_SDL_UnlockAudioDevice'.'SDL2.dll'.'SDL_UnlockAudioDevice' -++'_SDL_CloseAudio'.'SDL2.dll'.'SDL_CloseAudio' -++'_SDL_CloseAudioDevice'.'SDL2.dll'.'SDL_CloseAudioDevice' -++'_SDL_SetClipboardText'.'SDL2.dll'.'SDL_SetClipboardText' -++'_SDL_GetClipboardText'.'SDL2.dll'.'SDL_GetClipboardText' -++'_SDL_HasClipboardText'.'SDL2.dll'.'SDL_HasClipboardText' -++'_SDL_GetCPUCount'.'SDL2.dll'.'SDL_GetCPUCount' -++'_SDL_GetCPUCacheLineSize'.'SDL2.dll'.'SDL_GetCPUCacheLineSize' -++'_SDL_HasRDTSC'.'SDL2.dll'.'SDL_HasRDTSC' -++'_SDL_HasAltiVec'.'SDL2.dll'.'SDL_HasAltiVec' -++'_SDL_HasMMX'.'SDL2.dll'.'SDL_HasMMX' -++'_SDL_Has3DNow'.'SDL2.dll'.'SDL_Has3DNow' -++'_SDL_HasSSE'.'SDL2.dll'.'SDL_HasSSE' -++'_SDL_HasSSE2'.'SDL2.dll'.'SDL_HasSSE2' -++'_SDL_HasSSE3'.'SDL2.dll'.'SDL_HasSSE3' -++'_SDL_HasSSE41'.'SDL2.dll'.'SDL_HasSSE41' -++'_SDL_HasSSE42'.'SDL2.dll'.'SDL_HasSSE42' -++'_SDL_GetSystemRAM'.'SDL2.dll'.'SDL_GetSystemRAM' -++'_SDL_GetError'.'SDL2.dll'.'SDL_GetError' -++'_SDL_ClearError'.'SDL2.dll'.'SDL_ClearError' -++'_SDL_Error'.'SDL2.dll'.'SDL_Error' -++'_SDL_PumpEvents'.'SDL2.dll'.'SDL_PumpEvents' -++'_SDL_PeepEvents'.'SDL2.dll'.'SDL_PeepEvents' -++'_SDL_HasEvent'.'SDL2.dll'.'SDL_HasEvent' -++'_SDL_HasEvents'.'SDL2.dll'.'SDL_HasEvents' -++'_SDL_FlushEvent'.'SDL2.dll'.'SDL_FlushEvent' -++'_SDL_FlushEvents'.'SDL2.dll'.'SDL_FlushEvents' -++'_SDL_PollEvent'.'SDL2.dll'.'SDL_PollEvent' -++'_SDL_WaitEvent'.'SDL2.dll'.'SDL_WaitEvent' -++'_SDL_WaitEventTimeout'.'SDL2.dll'.'SDL_WaitEventTimeout' -++'_SDL_PushEvent'.'SDL2.dll'.'SDL_PushEvent' -++'_SDL_SetEventFilter'.'SDL2.dll'.'SDL_SetEventFilter' -++'_SDL_GetEventFilter'.'SDL2.dll'.'SDL_GetEventFilter' -++'_SDL_AddEventWatch'.'SDL2.dll'.'SDL_AddEventWatch' -++'_SDL_DelEventWatch'.'SDL2.dll'.'SDL_DelEventWatch' -++'_SDL_FilterEvents'.'SDL2.dll'.'SDL_FilterEvents' -++'_SDL_EventState'.'SDL2.dll'.'SDL_EventState' -++'_SDL_RegisterEvents'.'SDL2.dll'.'SDL_RegisterEvents' -++'_SDL_GetBasePath'.'SDL2.dll'.'SDL_GetBasePath' -++'_SDL_GetPrefPath'.'SDL2.dll'.'SDL_GetPrefPath' -++'_SDL_GameControllerAddMapping'.'SDL2.dll'.'SDL_GameControllerAddMapping' -++'_SDL_GameControllerMappingForGUID'.'SDL2.dll'.'SDL_GameControllerMappingForGUID' -++'_SDL_GameControllerMapping'.'SDL2.dll'.'SDL_GameControllerMapping' -++'_SDL_IsGameController'.'SDL2.dll'.'SDL_IsGameController' -++'_SDL_GameControllerNameForIndex'.'SDL2.dll'.'SDL_GameControllerNameForIndex' -++'_SDL_GameControllerOpen'.'SDL2.dll'.'SDL_GameControllerOpen' -++'_SDL_GameControllerName'.'SDL2.dll'.'SDL_GameControllerName' -++'_SDL_GameControllerGetAttached'.'SDL2.dll'.'SDL_GameControllerGetAttached' -++'_SDL_GameControllerGetJoystick'.'SDL2.dll'.'SDL_GameControllerGetJoystick' -++'_SDL_GameControllerEventState'.'SDL2.dll'.'SDL_GameControllerEventState' -++'_SDL_GameControllerUpdate'.'SDL2.dll'.'SDL_GameControllerUpdate' -++'_SDL_GameControllerGetAxisFromString'.'SDL2.dll'.'SDL_GameControllerGetAxisFromString' -++'_SDL_GameControllerGetStringForAxis'.'SDL2.dll'.'SDL_GameControllerGetStringForAxis' -++'_SDL_GameControllerGetBindForAxis'.'SDL2.dll'.'SDL_GameControllerGetBindForAxis' -++'_SDL_GameControllerGetAxis'.'SDL2.dll'.'SDL_GameControllerGetAxis' -++'_SDL_GameControllerGetButtonFromString'.'SDL2.dll'.'SDL_GameControllerGetButtonFromString' -++'_SDL_GameControllerGetStringForButton'.'SDL2.dll'.'SDL_GameControllerGetStringForButton' -++'_SDL_GameControllerGetBindForButton'.'SDL2.dll'.'SDL_GameControllerGetBindForButton' -++'_SDL_GameControllerGetButton'.'SDL2.dll'.'SDL_GameControllerGetButton' -++'_SDL_GameControllerClose'.'SDL2.dll'.'SDL_GameControllerClose' -++'_SDL_RecordGesture'.'SDL2.dll'.'SDL_RecordGesture' -++'_SDL_SaveAllDollarTemplates'.'SDL2.dll'.'SDL_SaveAllDollarTemplates' -++'_SDL_SaveDollarTemplate'.'SDL2.dll'.'SDL_SaveDollarTemplate' -++'_SDL_LoadDollarTemplates'.'SDL2.dll'.'SDL_LoadDollarTemplates' -++'_SDL_NumHaptics'.'SDL2.dll'.'SDL_NumHaptics' -++'_SDL_HapticName'.'SDL2.dll'.'SDL_HapticName' -++'_SDL_HapticOpen'.'SDL2.dll'.'SDL_HapticOpen' -++'_SDL_HapticOpened'.'SDL2.dll'.'SDL_HapticOpened' -++'_SDL_HapticIndex'.'SDL2.dll'.'SDL_HapticIndex' -++'_SDL_MouseIsHaptic'.'SDL2.dll'.'SDL_MouseIsHaptic' -++'_SDL_HapticOpenFromMouse'.'SDL2.dll'.'SDL_HapticOpenFromMouse' -++'_SDL_JoystickIsHaptic'.'SDL2.dll'.'SDL_JoystickIsHaptic' -++'_SDL_HapticOpenFromJoystick'.'SDL2.dll'.'SDL_HapticOpenFromJoystick' -++'_SDL_HapticClose'.'SDL2.dll'.'SDL_HapticClose' -++'_SDL_HapticNumEffects'.'SDL2.dll'.'SDL_HapticNumEffects' -++'_SDL_HapticNumEffectsPlaying'.'SDL2.dll'.'SDL_HapticNumEffectsPlaying' -++'_SDL_HapticQuery'.'SDL2.dll'.'SDL_HapticQuery' -++'_SDL_HapticNumAxes'.'SDL2.dll'.'SDL_HapticNumAxes' -++'_SDL_HapticEffectSupported'.'SDL2.dll'.'SDL_HapticEffectSupported' -++'_SDL_HapticNewEffect'.'SDL2.dll'.'SDL_HapticNewEffect' -++'_SDL_HapticUpdateEffect'.'SDL2.dll'.'SDL_HapticUpdateEffect' -++'_SDL_HapticRunEffect'.'SDL2.dll'.'SDL_HapticRunEffect' -++'_SDL_HapticStopEffect'.'SDL2.dll'.'SDL_HapticStopEffect' -++'_SDL_HapticDestroyEffect'.'SDL2.dll'.'SDL_HapticDestroyEffect' -++'_SDL_HapticGetEffectStatus'.'SDL2.dll'.'SDL_HapticGetEffectStatus' -++'_SDL_HapticSetGain'.'SDL2.dll'.'SDL_HapticSetGain' -++'_SDL_HapticSetAutocenter'.'SDL2.dll'.'SDL_HapticSetAutocenter' -++'_SDL_HapticPause'.'SDL2.dll'.'SDL_HapticPause' -++'_SDL_HapticUnpause'.'SDL2.dll'.'SDL_HapticUnpause' -++'_SDL_HapticStopAll'.'SDL2.dll'.'SDL_HapticStopAll' -++'_SDL_HapticRumbleSupported'.'SDL2.dll'.'SDL_HapticRumbleSupported' -++'_SDL_HapticRumbleInit'.'SDL2.dll'.'SDL_HapticRumbleInit' -++'_SDL_HapticRumblePlay'.'SDL2.dll'.'SDL_HapticRumblePlay' -++'_SDL_HapticRumbleStop'.'SDL2.dll'.'SDL_HapticRumbleStop' -++'_SDL_SetHintWithPriority'.'SDL2.dll'.'SDL_SetHintWithPriority' -++'_SDL_SetHint'.'SDL2.dll'.'SDL_SetHint' -++'_SDL_GetHint'.'SDL2.dll'.'SDL_GetHint' -++'_SDL_AddHintCallback'.'SDL2.dll'.'SDL_AddHintCallback' -++'_SDL_DelHintCallback'.'SDL2.dll'.'SDL_DelHintCallback' -++'_SDL_ClearHints'.'SDL2.dll'.'SDL_ClearHints' -++'_SDL_NumJoysticks'.'SDL2.dll'.'SDL_NumJoysticks' -++'_SDL_JoystickNameForIndex'.'SDL2.dll'.'SDL_JoystickNameForIndex' -++'_SDL_JoystickOpen'.'SDL2.dll'.'SDL_JoystickOpen' -++'_SDL_JoystickName'.'SDL2.dll'.'SDL_JoystickName' -++'_SDL_JoystickGetDeviceGUID'.'SDL2.dll'.'SDL_JoystickGetDeviceGUID' -++'_SDL_JoystickGetGUID'.'SDL2.dll'.'SDL_JoystickGetGUID' -++'_SDL_JoystickGetGUIDString'.'SDL2.dll'.'SDL_JoystickGetGUIDString' -++'_SDL_JoystickGetGUIDFromString'.'SDL2.dll'.'SDL_JoystickGetGUIDFromString' -++'_SDL_JoystickGetAttached'.'SDL2.dll'.'SDL_JoystickGetAttached' -++'_SDL_JoystickInstanceID'.'SDL2.dll'.'SDL_JoystickInstanceID' -++'_SDL_JoystickNumAxes'.'SDL2.dll'.'SDL_JoystickNumAxes' -++'_SDL_JoystickNumBalls'.'SDL2.dll'.'SDL_JoystickNumBalls' -++'_SDL_JoystickNumHats'.'SDL2.dll'.'SDL_JoystickNumHats' -++'_SDL_JoystickNumButtons'.'SDL2.dll'.'SDL_JoystickNumButtons' -++'_SDL_JoystickUpdate'.'SDL2.dll'.'SDL_JoystickUpdate' -++'_SDL_JoystickEventState'.'SDL2.dll'.'SDL_JoystickEventState' -++'_SDL_JoystickGetAxis'.'SDL2.dll'.'SDL_JoystickGetAxis' -++'_SDL_JoystickGetHat'.'SDL2.dll'.'SDL_JoystickGetHat' -++'_SDL_JoystickGetBall'.'SDL2.dll'.'SDL_JoystickGetBall' -++'_SDL_JoystickGetButton'.'SDL2.dll'.'SDL_JoystickGetButton' -++'_SDL_JoystickClose'.'SDL2.dll'.'SDL_JoystickClose' -++'_SDL_GetKeyboardFocus'.'SDL2.dll'.'SDL_GetKeyboardFocus' -++'_SDL_GetKeyboardState'.'SDL2.dll'.'SDL_GetKeyboardState' -++'_SDL_GetModState'.'SDL2.dll'.'SDL_GetModState' -++'_SDL_SetModState'.'SDL2.dll'.'SDL_SetModState' -++'_SDL_GetKeyFromScancode'.'SDL2.dll'.'SDL_GetKeyFromScancode' -++'_SDL_GetScancodeFromKey'.'SDL2.dll'.'SDL_GetScancodeFromKey' -++'_SDL_GetScancodeName'.'SDL2.dll'.'SDL_GetScancodeName' -++'_SDL_GetScancodeFromName'.'SDL2.dll'.'SDL_GetScancodeFromName' -++'_SDL_GetKeyName'.'SDL2.dll'.'SDL_GetKeyName' -++'_SDL_GetKeyFromName'.'SDL2.dll'.'SDL_GetKeyFromName' -++'_SDL_StartTextInput'.'SDL2.dll'.'SDL_StartTextInput' -++'_SDL_IsTextInputActive'.'SDL2.dll'.'SDL_IsTextInputActive' -++'_SDL_StopTextInput'.'SDL2.dll'.'SDL_StopTextInput' -++'_SDL_SetTextInputRect'.'SDL2.dll'.'SDL_SetTextInputRect' -++'_SDL_HasScreenKeyboardSupport'.'SDL2.dll'.'SDL_HasScreenKeyboardSupport' -++'_SDL_IsScreenKeyboardShown'.'SDL2.dll'.'SDL_IsScreenKeyboardShown' -++'_SDL_LoadObject'.'SDL2.dll'.'SDL_LoadObject' -++'_SDL_LoadFunction'.'SDL2.dll'.'SDL_LoadFunction' -++'_SDL_UnloadObject'.'SDL2.dll'.'SDL_UnloadObject' -++'_SDL_LogSetAllPriority'.'SDL2.dll'.'SDL_LogSetAllPriority' -++'_SDL_LogSetPriority'.'SDL2.dll'.'SDL_LogSetPriority' -++'_SDL_LogGetPriority'.'SDL2.dll'.'SDL_LogGetPriority' -++'_SDL_LogResetPriorities'.'SDL2.dll'.'SDL_LogResetPriorities' -++'_SDL_LogMessageV'.'SDL2.dll'.'SDL_LogMessageV' -++'_SDL_LogGetOutputFunction'.'SDL2.dll'.'SDL_LogGetOutputFunction' -++'_SDL_LogSetOutputFunction'.'SDL2.dll'.'SDL_LogSetOutputFunction' -++'_SDL_SetMainReady'.'SDL2.dll'.'SDL_SetMainReady' -++'_SDL_ShowMessageBox'.'SDL2.dll'.'SDL_ShowMessageBox' -++'_SDL_ShowSimpleMessageBox'.'SDL2.dll'.'SDL_ShowSimpleMessageBox' -++'_SDL_GetMouseFocus'.'SDL2.dll'.'SDL_GetMouseFocus' -++'_SDL_GetMouseState'.'SDL2.dll'.'SDL_GetMouseState' -++'_SDL_GetRelativeMouseState'.'SDL2.dll'.'SDL_GetRelativeMouseState' -++'_SDL_WarpMouseInWindow'.'SDL2.dll'.'SDL_WarpMouseInWindow' -++'_SDL_SetRelativeMouseMode'.'SDL2.dll'.'SDL_SetRelativeMouseMode' -++'_SDL_GetRelativeMouseMode'.'SDL2.dll'.'SDL_GetRelativeMouseMode' -++'_SDL_CreateCursor'.'SDL2.dll'.'SDL_CreateCursor' -++'_SDL_CreateColorCursor'.'SDL2.dll'.'SDL_CreateColorCursor' -++'_SDL_CreateSystemCursor'.'SDL2.dll'.'SDL_CreateSystemCursor' -++'_SDL_SetCursor'.'SDL2.dll'.'SDL_SetCursor' -++'_SDL_GetCursor'.'SDL2.dll'.'SDL_GetCursor' -++'_SDL_GetDefaultCursor'.'SDL2.dll'.'SDL_GetDefaultCursor' -++'_SDL_FreeCursor'.'SDL2.dll'.'SDL_FreeCursor' -++'_SDL_ShowCursor'.'SDL2.dll'.'SDL_ShowCursor' -++'_SDL_CreateMutex'.'SDL2.dll'.'SDL_CreateMutex' -++'_SDL_LockMutex'.'SDL2.dll'.'SDL_LockMutex' -++'_SDL_TryLockMutex'.'SDL2.dll'.'SDL_TryLockMutex' -++'_SDL_UnlockMutex'.'SDL2.dll'.'SDL_UnlockMutex' -++'_SDL_DestroyMutex'.'SDL2.dll'.'SDL_DestroyMutex' -++'_SDL_CreateSemaphore'.'SDL2.dll'.'SDL_CreateSemaphore' -++'_SDL_DestroySemaphore'.'SDL2.dll'.'SDL_DestroySemaphore' -++'_SDL_SemWait'.'SDL2.dll'.'SDL_SemWait' -++'_SDL_SemTryWait'.'SDL2.dll'.'SDL_SemTryWait' -++'_SDL_SemWaitTimeout'.'SDL2.dll'.'SDL_SemWaitTimeout' -++'_SDL_SemPost'.'SDL2.dll'.'SDL_SemPost' -++'_SDL_SemValue'.'SDL2.dll'.'SDL_SemValue' -++'_SDL_CreateCond'.'SDL2.dll'.'SDL_CreateCond' -++'_SDL_DestroyCond'.'SDL2.dll'.'SDL_DestroyCond' -++'_SDL_CondSignal'.'SDL2.dll'.'SDL_CondSignal' -++'_SDL_CondBroadcast'.'SDL2.dll'.'SDL_CondBroadcast' -++'_SDL_CondWait'.'SDL2.dll'.'SDL_CondWait' -++'_SDL_CondWaitTimeout'.'SDL2.dll'.'SDL_CondWaitTimeout' -++'_SDL_GetPixelFormatName'.'SDL2.dll'.'SDL_GetPixelFormatName' -++'_SDL_PixelFormatEnumToMasks'.'SDL2.dll'.'SDL_PixelFormatEnumToMasks' -++'_SDL_MasksToPixelFormatEnum'.'SDL2.dll'.'SDL_MasksToPixelFormatEnum' -++'_SDL_AllocFormat'.'SDL2.dll'.'SDL_AllocFormat' -++'_SDL_FreeFormat'.'SDL2.dll'.'SDL_FreeFormat' -++'_SDL_AllocPalette'.'SDL2.dll'.'SDL_AllocPalette' -++'_SDL_SetPixelFormatPalette'.'SDL2.dll'.'SDL_SetPixelFormatPalette' -++'_SDL_SetPaletteColors'.'SDL2.dll'.'SDL_SetPaletteColors' -++'_SDL_FreePalette'.'SDL2.dll'.'SDL_FreePalette' -++'_SDL_MapRGB'.'SDL2.dll'.'SDL_MapRGB' -++'_SDL_MapRGBA'.'SDL2.dll'.'SDL_MapRGBA' -++'_SDL_GetRGB'.'SDL2.dll'.'SDL_GetRGB' -++'_SDL_GetRGBA'.'SDL2.dll'.'SDL_GetRGBA' -++'_SDL_CalculateGammaRamp'.'SDL2.dll'.'SDL_CalculateGammaRamp' -++'_SDL_GetPlatform'.'SDL2.dll'.'SDL_GetPlatform' -++'_SDL_GetPowerInfo'.'SDL2.dll'.'SDL_GetPowerInfo' -++'_SDL_HasIntersection'.'SDL2.dll'.'SDL_HasIntersection' -++'_SDL_IntersectRect'.'SDL2.dll'.'SDL_IntersectRect' -++'_SDL_UnionRect'.'SDL2.dll'.'SDL_UnionRect' -++'_SDL_EnclosePoints'.'SDL2.dll'.'SDL_EnclosePoints' -++'_SDL_IntersectRectAndLine'.'SDL2.dll'.'SDL_IntersectRectAndLine' -++'_SDL_GetNumRenderDrivers'.'SDL2.dll'.'SDL_GetNumRenderDrivers' -++'_SDL_GetRenderDriverInfo'.'SDL2.dll'.'SDL_GetRenderDriverInfo' -++'_SDL_CreateWindowAndRenderer'.'SDL2.dll'.'SDL_CreateWindowAndRenderer' -++'_SDL_CreateRenderer'.'SDL2.dll'.'SDL_CreateRenderer' -++'_SDL_CreateSoftwareRenderer'.'SDL2.dll'.'SDL_CreateSoftwareRenderer' -++'_SDL_GetRenderer'.'SDL2.dll'.'SDL_GetRenderer' -++'_SDL_GetRendererInfo'.'SDL2.dll'.'SDL_GetRendererInfo' -++'_SDL_GetRendererOutputSize'.'SDL2.dll'.'SDL_GetRendererOutputSize' -++'_SDL_CreateTexture'.'SDL2.dll'.'SDL_CreateTexture' -++'_SDL_CreateTextureFromSurface'.'SDL2.dll'.'SDL_CreateTextureFromSurface' -++'_SDL_QueryTexture'.'SDL2.dll'.'SDL_QueryTexture' -++'_SDL_SetTextureColorMod'.'SDL2.dll'.'SDL_SetTextureColorMod' -++'_SDL_GetTextureColorMod'.'SDL2.dll'.'SDL_GetTextureColorMod' -++'_SDL_SetTextureAlphaMod'.'SDL2.dll'.'SDL_SetTextureAlphaMod' -++'_SDL_GetTextureAlphaMod'.'SDL2.dll'.'SDL_GetTextureAlphaMod' -++'_SDL_SetTextureBlendMode'.'SDL2.dll'.'SDL_SetTextureBlendMode' -++'_SDL_GetTextureBlendMode'.'SDL2.dll'.'SDL_GetTextureBlendMode' -++'_SDL_UpdateTexture'.'SDL2.dll'.'SDL_UpdateTexture' -++'_SDL_UpdateYUVTexture'.'SDL2.dll'.'SDL_UpdateYUVTexture' -++'_SDL_LockTexture'.'SDL2.dll'.'SDL_LockTexture' -++'_SDL_UnlockTexture'.'SDL2.dll'.'SDL_UnlockTexture' -++'_SDL_RenderTargetSupported'.'SDL2.dll'.'SDL_RenderTargetSupported' -++'_SDL_SetRenderTarget'.'SDL2.dll'.'SDL_SetRenderTarget' -++'_SDL_GetRenderTarget'.'SDL2.dll'.'SDL_GetRenderTarget' -++'_SDL_RenderSetLogicalSize'.'SDL2.dll'.'SDL_RenderSetLogicalSize' -++'_SDL_RenderGetLogicalSize'.'SDL2.dll'.'SDL_RenderGetLogicalSize' -++'_SDL_RenderSetViewport'.'SDL2.dll'.'SDL_RenderSetViewport' -++'_SDL_RenderGetViewport'.'SDL2.dll'.'SDL_RenderGetViewport' -++'_SDL_RenderSetClipRect'.'SDL2.dll'.'SDL_RenderSetClipRect' -++'_SDL_RenderGetClipRect'.'SDL2.dll'.'SDL_RenderGetClipRect' -++'_SDL_RenderSetScale'.'SDL2.dll'.'SDL_RenderSetScale' -++'_SDL_RenderGetScale'.'SDL2.dll'.'SDL_RenderGetScale' -++'_SDL_SetRenderDrawColor'.'SDL2.dll'.'SDL_SetRenderDrawColor' -++'_SDL_GetRenderDrawColor'.'SDL2.dll'.'SDL_GetRenderDrawColor' -++'_SDL_SetRenderDrawBlendMode'.'SDL2.dll'.'SDL_SetRenderDrawBlendMode' -++'_SDL_GetRenderDrawBlendMode'.'SDL2.dll'.'SDL_GetRenderDrawBlendMode' -++'_SDL_RenderClear'.'SDL2.dll'.'SDL_RenderClear' -++'_SDL_RenderDrawPoint'.'SDL2.dll'.'SDL_RenderDrawPoint' -++'_SDL_RenderDrawPoints'.'SDL2.dll'.'SDL_RenderDrawPoints' -++'_SDL_RenderDrawLine'.'SDL2.dll'.'SDL_RenderDrawLine' -++'_SDL_RenderDrawLines'.'SDL2.dll'.'SDL_RenderDrawLines' -++'_SDL_RenderDrawRect'.'SDL2.dll'.'SDL_RenderDrawRect' -++'_SDL_RenderDrawRects'.'SDL2.dll'.'SDL_RenderDrawRects' -++'_SDL_RenderFillRect'.'SDL2.dll'.'SDL_RenderFillRect' -++'_SDL_RenderFillRects'.'SDL2.dll'.'SDL_RenderFillRects' -++'_SDL_RenderCopy'.'SDL2.dll'.'SDL_RenderCopy' -++'_SDL_RenderCopyEx'.'SDL2.dll'.'SDL_RenderCopyEx' -++'_SDL_RenderReadPixels'.'SDL2.dll'.'SDL_RenderReadPixels' -++'_SDL_RenderPresent'.'SDL2.dll'.'SDL_RenderPresent' -++'_SDL_DestroyTexture'.'SDL2.dll'.'SDL_DestroyTexture' -++'_SDL_DestroyRenderer'.'SDL2.dll'.'SDL_DestroyRenderer' -++'_SDL_GL_BindTexture'.'SDL2.dll'.'SDL_GL_BindTexture' -++'_SDL_GL_UnbindTexture'.'SDL2.dll'.'SDL_GL_UnbindTexture' -++'_SDL_RWFromFile'.'SDL2.dll'.'SDL_RWFromFile' -++'_SDL_RWFromMem'.'SDL2.dll'.'SDL_RWFromMem' -++'_SDL_RWFromConstMem'.'SDL2.dll'.'SDL_RWFromConstMem' -++'_SDL_AllocRW'.'SDL2.dll'.'SDL_AllocRW' -++'_SDL_FreeRW'.'SDL2.dll'.'SDL_FreeRW' -++'_SDL_ReadU8'.'SDL2.dll'.'SDL_ReadU8' -++'_SDL_ReadLE16'.'SDL2.dll'.'SDL_ReadLE16' -++'_SDL_ReadBE16'.'SDL2.dll'.'SDL_ReadBE16' -++'_SDL_ReadLE32'.'SDL2.dll'.'SDL_ReadLE32' -++'_SDL_ReadBE32'.'SDL2.dll'.'SDL_ReadBE32' -++'_SDL_ReadLE64'.'SDL2.dll'.'SDL_ReadLE64' -++'_SDL_ReadBE64'.'SDL2.dll'.'SDL_ReadBE64' -++'_SDL_WriteU8'.'SDL2.dll'.'SDL_WriteU8' -++'_SDL_WriteLE16'.'SDL2.dll'.'SDL_WriteLE16' -++'_SDL_WriteBE16'.'SDL2.dll'.'SDL_WriteBE16' -++'_SDL_WriteLE32'.'SDL2.dll'.'SDL_WriteLE32' -++'_SDL_WriteBE32'.'SDL2.dll'.'SDL_WriteBE32' -++'_SDL_WriteLE64'.'SDL2.dll'.'SDL_WriteLE64' -++'_SDL_WriteBE64'.'SDL2.dll'.'SDL_WriteBE64' -++'_SDL_CreateShapedWindow'.'SDL2.dll'.'SDL_CreateShapedWindow' -++'_SDL_IsShapedWindow'.'SDL2.dll'.'SDL_IsShapedWindow' -++'_SDL_SetWindowShape'.'SDL2.dll'.'SDL_SetWindowShape' -++'_SDL_GetShapedWindowMode'.'SDL2.dll'.'SDL_GetShapedWindowMode' -++'_SDL_malloc'.'SDL2.dll'.'SDL_malloc' -++'_SDL_calloc'.'SDL2.dll'.'SDL_calloc' -++'_SDL_realloc'.'SDL2.dll'.'SDL_realloc' -++'_SDL_free'.'SDL2.dll'.'SDL_free' -++'_SDL_getenv'.'SDL2.dll'.'SDL_getenv' -++'_SDL_setenv'.'SDL2.dll'.'SDL_setenv' -++'_SDL_qsort'.'SDL2.dll'.'SDL_qsort' -++'_SDL_abs'.'SDL2.dll'.'SDL_abs' -++'_SDL_isdigit'.'SDL2.dll'.'SDL_isdigit' -++'_SDL_isspace'.'SDL2.dll'.'SDL_isspace' -++'_SDL_toupper'.'SDL2.dll'.'SDL_toupper' -++'_SDL_tolower'.'SDL2.dll'.'SDL_tolower' -++'_SDL_memset'.'SDL2.dll'.'SDL_memset' -++'_SDL_memcpy'.'SDL2.dll'.'SDL_memcpy' -++'_SDL_memmove'.'SDL2.dll'.'SDL_memmove' -++'_SDL_memcmp'.'SDL2.dll'.'SDL_memcmp' -++'_SDL_wcslen'.'SDL2.dll'.'SDL_wcslen' -++'_SDL_wcslcpy'.'SDL2.dll'.'SDL_wcslcpy' -++'_SDL_wcslcat'.'SDL2.dll'.'SDL_wcslcat' -++'_SDL_strlen'.'SDL2.dll'.'SDL_strlen' -++'_SDL_strlcpy'.'SDL2.dll'.'SDL_strlcpy' -++'_SDL_utf8strlcpy'.'SDL2.dll'.'SDL_utf8strlcpy' -++'_SDL_strlcat'.'SDL2.dll'.'SDL_strlcat' -++'_SDL_strdup'.'SDL2.dll'.'SDL_strdup' -++'_SDL_strrev'.'SDL2.dll'.'SDL_strrev' -++'_SDL_strupr'.'SDL2.dll'.'SDL_strupr' -++'_SDL_strlwr'.'SDL2.dll'.'SDL_strlwr' -++'_SDL_strchr'.'SDL2.dll'.'SDL_strchr' -++'_SDL_strrchr'.'SDL2.dll'.'SDL_strrchr' -++'_SDL_strstr'.'SDL2.dll'.'SDL_strstr' -++'_SDL_itoa'.'SDL2.dll'.'SDL_itoa' -++'_SDL_uitoa'.'SDL2.dll'.'SDL_uitoa' -++'_SDL_ltoa'.'SDL2.dll'.'SDL_ltoa' -++'_SDL_ultoa'.'SDL2.dll'.'SDL_ultoa' -++'_SDL_lltoa'.'SDL2.dll'.'SDL_lltoa' -++'_SDL_ulltoa'.'SDL2.dll'.'SDL_ulltoa' -++'_SDL_atoi'.'SDL2.dll'.'SDL_atoi' -++'_SDL_atof'.'SDL2.dll'.'SDL_atof' -++'_SDL_strtol'.'SDL2.dll'.'SDL_strtol' -++'_SDL_strtoul'.'SDL2.dll'.'SDL_strtoul' -++'_SDL_strtoll'.'SDL2.dll'.'SDL_strtoll' -++'_SDL_strtoull'.'SDL2.dll'.'SDL_strtoull' -++'_SDL_strtod'.'SDL2.dll'.'SDL_strtod' -++'_SDL_strcmp'.'SDL2.dll'.'SDL_strcmp' -++'_SDL_strncmp'.'SDL2.dll'.'SDL_strncmp' -++'_SDL_strcasecmp'.'SDL2.dll'.'SDL_strcasecmp' -++'_SDL_strncasecmp'.'SDL2.dll'.'SDL_strncasecmp' -++'_SDL_vsnprintf'.'SDL2.dll'.'SDL_vsnprintf' -++'_SDL_acos'.'SDL2.dll'.'SDL_acos' -++'_SDL_asin'.'SDL2.dll'.'SDL_asin' -++'_SDL_atan'.'SDL2.dll'.'SDL_atan' -++'_SDL_atan2'.'SDL2.dll'.'SDL_atan2' -++'_SDL_ceil'.'SDL2.dll'.'SDL_ceil' -++'_SDL_copysign'.'SDL2.dll'.'SDL_copysign' -++'_SDL_cos'.'SDL2.dll'.'SDL_cos' -++'_SDL_cosf'.'SDL2.dll'.'SDL_cosf' -++'_SDL_fabs'.'SDL2.dll'.'SDL_fabs' -++'_SDL_floor'.'SDL2.dll'.'SDL_floor' -++'_SDL_log'.'SDL2.dll'.'SDL_log' -++'_SDL_pow'.'SDL2.dll'.'SDL_pow' -++'_SDL_scalbn'.'SDL2.dll'.'SDL_scalbn' -++'_SDL_sin'.'SDL2.dll'.'SDL_sin' -++'_SDL_sinf'.'SDL2.dll'.'SDL_sinf' -++'_SDL_sqrt'.'SDL2.dll'.'SDL_sqrt' -++'_SDL_iconv_open'.'SDL2.dll'.'SDL_iconv_open' -++'_SDL_iconv_close'.'SDL2.dll'.'SDL_iconv_close' -++'_SDL_iconv'.'SDL2.dll'.'SDL_iconv' -++'_SDL_iconv_string'.'SDL2.dll'.'SDL_iconv_string' -++'_SDL_CreateRGBSurface'.'SDL2.dll'.'SDL_CreateRGBSurface' -++'_SDL_CreateRGBSurfaceFrom'.'SDL2.dll'.'SDL_CreateRGBSurfaceFrom' -++'_SDL_FreeSurface'.'SDL2.dll'.'SDL_FreeSurface' -++'_SDL_SetSurfacePalette'.'SDL2.dll'.'SDL_SetSurfacePalette' -++'_SDL_LockSurface'.'SDL2.dll'.'SDL_LockSurface' -++'_SDL_UnlockSurface'.'SDL2.dll'.'SDL_UnlockSurface' -++'_SDL_LoadBMP_RW'.'SDL2.dll'.'SDL_LoadBMP_RW' -++'_SDL_SaveBMP_RW'.'SDL2.dll'.'SDL_SaveBMP_RW' -++'_SDL_SetSurfaceRLE'.'SDL2.dll'.'SDL_SetSurfaceRLE' -++'_SDL_SetColorKey'.'SDL2.dll'.'SDL_SetColorKey' -++'_SDL_GetColorKey'.'SDL2.dll'.'SDL_GetColorKey' -++'_SDL_SetSurfaceColorMod'.'SDL2.dll'.'SDL_SetSurfaceColorMod' -++'_SDL_GetSurfaceColorMod'.'SDL2.dll'.'SDL_GetSurfaceColorMod' -++'_SDL_SetSurfaceAlphaMod'.'SDL2.dll'.'SDL_SetSurfaceAlphaMod' -++'_SDL_GetSurfaceAlphaMod'.'SDL2.dll'.'SDL_GetSurfaceAlphaMod' -++'_SDL_SetSurfaceBlendMode'.'SDL2.dll'.'SDL_SetSurfaceBlendMode' -++'_SDL_GetSurfaceBlendMode'.'SDL2.dll'.'SDL_GetSurfaceBlendMode' -++'_SDL_SetClipRect'.'SDL2.dll'.'SDL_SetClipRect' -++'_SDL_GetClipRect'.'SDL2.dll'.'SDL_GetClipRect' -++'_SDL_ConvertSurface'.'SDL2.dll'.'SDL_ConvertSurface' -++'_SDL_ConvertSurfaceFormat'.'SDL2.dll'.'SDL_ConvertSurfaceFormat' -++'_SDL_ConvertPixels'.'SDL2.dll'.'SDL_ConvertPixels' -++'_SDL_FillRect'.'SDL2.dll'.'SDL_FillRect' -++'_SDL_FillRects'.'SDL2.dll'.'SDL_FillRects' -++'_SDL_UpperBlit'.'SDL2.dll'.'SDL_UpperBlit' -++'_SDL_LowerBlit'.'SDL2.dll'.'SDL_LowerBlit' -++'_SDL_SoftStretch'.'SDL2.dll'.'SDL_SoftStretch' -++'_SDL_UpperBlitScaled'.'SDL2.dll'.'SDL_UpperBlitScaled' -++'_SDL_LowerBlitScaled'.'SDL2.dll'.'SDL_LowerBlitScaled' -++'_SDL_GetWindowWMInfo'.'SDL2.dll'.'SDL_GetWindowWMInfo' -++'_SDL_GetThreadName'.'SDL2.dll'.'SDL_GetThreadName' -++'_SDL_ThreadID'.'SDL2.dll'.'SDL_ThreadID' -++'_SDL_GetThreadID'.'SDL2.dll'.'SDL_GetThreadID' -++'_SDL_SetThreadPriority'.'SDL2.dll'.'SDL_SetThreadPriority' -++'_SDL_WaitThread'.'SDL2.dll'.'SDL_WaitThread' -++'_SDL_DetachThread'.'SDL2.dll'.'SDL_DetachThread' -++'_SDL_TLSCreate'.'SDL2.dll'.'SDL_TLSCreate' -++'_SDL_TLSGet'.'SDL2.dll'.'SDL_TLSGet' -++'_SDL_TLSSet'.'SDL2.dll'.'SDL_TLSSet' -++'_SDL_GetTicks'.'SDL2.dll'.'SDL_GetTicks' -++'_SDL_GetPerformanceCounter'.'SDL2.dll'.'SDL_GetPerformanceCounter' -++'_SDL_GetPerformanceFrequency'.'SDL2.dll'.'SDL_GetPerformanceFrequency' -++'_SDL_Delay'.'SDL2.dll'.'SDL_Delay' -++'_SDL_AddTimer'.'SDL2.dll'.'SDL_AddTimer' -++'_SDL_RemoveTimer'.'SDL2.dll'.'SDL_RemoveTimer' -++'_SDL_GetNumTouchDevices'.'SDL2.dll'.'SDL_GetNumTouchDevices' -++'_SDL_GetTouchDevice'.'SDL2.dll'.'SDL_GetTouchDevice' -++'_SDL_GetNumTouchFingers'.'SDL2.dll'.'SDL_GetNumTouchFingers' -++'_SDL_GetTouchFinger'.'SDL2.dll'.'SDL_GetTouchFinger' -++'_SDL_GetVersion'.'SDL2.dll'.'SDL_GetVersion' -++'_SDL_GetRevision'.'SDL2.dll'.'SDL_GetRevision' -++'_SDL_GetRevisionNumber'.'SDL2.dll'.'SDL_GetRevisionNumber' -++'_SDL_GetNumVideoDrivers'.'SDL2.dll'.'SDL_GetNumVideoDrivers' -++'_SDL_GetVideoDriver'.'SDL2.dll'.'SDL_GetVideoDriver' -++'_SDL_VideoInit'.'SDL2.dll'.'SDL_VideoInit' -++'_SDL_VideoQuit'.'SDL2.dll'.'SDL_VideoQuit' -++'_SDL_GetCurrentVideoDriver'.'SDL2.dll'.'SDL_GetCurrentVideoDriver' -++'_SDL_GetNumVideoDisplays'.'SDL2.dll'.'SDL_GetNumVideoDisplays' -++'_SDL_GetDisplayName'.'SDL2.dll'.'SDL_GetDisplayName' -++'_SDL_GetDisplayBounds'.'SDL2.dll'.'SDL_GetDisplayBounds' -++'_SDL_GetDisplayDPI'.'SDL2.dll'.'SDL_GetDisplayDPI' -++'_SDL_GetNumDisplayModes'.'SDL2.dll'.'SDL_GetNumDisplayModes' -++'_SDL_GetDisplayMode'.'SDL2.dll'.'SDL_GetDisplayMode' -++'_SDL_GetDesktopDisplayMode'.'SDL2.dll'.'SDL_GetDesktopDisplayMode' -++'_SDL_GetCurrentDisplayMode'.'SDL2.dll'.'SDL_GetCurrentDisplayMode' -++'_SDL_GetClosestDisplayMode'.'SDL2.dll'.'SDL_GetClosestDisplayMode' -++'_SDL_GetWindowDisplayIndex'.'SDL2.dll'.'SDL_GetWindowDisplayIndex' -++'_SDL_SetWindowDisplayMode'.'SDL2.dll'.'SDL_SetWindowDisplayMode' -++'_SDL_GetWindowDisplayMode'.'SDL2.dll'.'SDL_GetWindowDisplayMode' -++'_SDL_GetWindowPixelFormat'.'SDL2.dll'.'SDL_GetWindowPixelFormat' -++'_SDL_CreateWindow'.'SDL2.dll'.'SDL_CreateWindow' -++'_SDL_CreateWindowFrom'.'SDL2.dll'.'SDL_CreateWindowFrom' -++'_SDL_GetWindowID'.'SDL2.dll'.'SDL_GetWindowID' -++'_SDL_GetWindowFromID'.'SDL2.dll'.'SDL_GetWindowFromID' -++'_SDL_GetWindowFlags'.'SDL2.dll'.'SDL_GetWindowFlags' -++'_SDL_SetWindowTitle'.'SDL2.dll'.'SDL_SetWindowTitle' -++'_SDL_GetWindowTitle'.'SDL2.dll'.'SDL_GetWindowTitle' -++'_SDL_SetWindowIcon'.'SDL2.dll'.'SDL_SetWindowIcon' -++'_SDL_SetWindowData'.'SDL2.dll'.'SDL_SetWindowData' -++'_SDL_GetWindowData'.'SDL2.dll'.'SDL_GetWindowData' -++'_SDL_SetWindowPosition'.'SDL2.dll'.'SDL_SetWindowPosition' -++'_SDL_GetWindowPosition'.'SDL2.dll'.'SDL_GetWindowPosition' -++'_SDL_SetWindowSize'.'SDL2.dll'.'SDL_SetWindowSize' -++'_SDL_GetWindowSize'.'SDL2.dll'.'SDL_GetWindowSize' -++'_SDL_SetWindowMinimumSize'.'SDL2.dll'.'SDL_SetWindowMinimumSize' -++'_SDL_GetWindowMinimumSize'.'SDL2.dll'.'SDL_GetWindowMinimumSize' -++'_SDL_SetWindowMaximumSize'.'SDL2.dll'.'SDL_SetWindowMaximumSize' -++'_SDL_GetWindowMaximumSize'.'SDL2.dll'.'SDL_GetWindowMaximumSize' -++'_SDL_SetWindowBordered'.'SDL2.dll'.'SDL_SetWindowBordered' -++'_SDL_ShowWindow'.'SDL2.dll'.'SDL_ShowWindow' -++'_SDL_HideWindow'.'SDL2.dll'.'SDL_HideWindow' -++'_SDL_RaiseWindow'.'SDL2.dll'.'SDL_RaiseWindow' -++'_SDL_MaximizeWindow'.'SDL2.dll'.'SDL_MaximizeWindow' -++'_SDL_MinimizeWindow'.'SDL2.dll'.'SDL_MinimizeWindow' -++'_SDL_RestoreWindow'.'SDL2.dll'.'SDL_RestoreWindow' -++'_SDL_SetWindowFullscreen'.'SDL2.dll'.'SDL_SetWindowFullscreen' -++'_SDL_GetWindowSurface'.'SDL2.dll'.'SDL_GetWindowSurface' -++'_SDL_UpdateWindowSurface'.'SDL2.dll'.'SDL_UpdateWindowSurface' -++'_SDL_UpdateWindowSurfaceRects'.'SDL2.dll'.'SDL_UpdateWindowSurfaceRects' -++'_SDL_SetWindowGrab'.'SDL2.dll'.'SDL_SetWindowGrab' -++'_SDL_GetWindowGrab'.'SDL2.dll'.'SDL_GetWindowGrab' -++'_SDL_SetWindowBrightness'.'SDL2.dll'.'SDL_SetWindowBrightness' -++'_SDL_GetWindowBrightness'.'SDL2.dll'.'SDL_GetWindowBrightness' -++'_SDL_SetWindowGammaRamp'.'SDL2.dll'.'SDL_SetWindowGammaRamp' -++'_SDL_GetWindowGammaRamp'.'SDL2.dll'.'SDL_GetWindowGammaRamp' -++'_SDL_DestroyWindow'.'SDL2.dll'.'SDL_DestroyWindow' -++'_SDL_IsScreenSaverEnabled'.'SDL2.dll'.'SDL_IsScreenSaverEnabled' -++'_SDL_EnableScreenSaver'.'SDL2.dll'.'SDL_EnableScreenSaver' -++'_SDL_DisableScreenSaver'.'SDL2.dll'.'SDL_DisableScreenSaver' -++'_SDL_GL_LoadLibrary'.'SDL2.dll'.'SDL_GL_LoadLibrary' -++'_SDL_GL_GetProcAddress'.'SDL2.dll'.'SDL_GL_GetProcAddress' -++'_SDL_GL_UnloadLibrary'.'SDL2.dll'.'SDL_GL_UnloadLibrary' -++'_SDL_GL_ExtensionSupported'.'SDL2.dll'.'SDL_GL_ExtensionSupported' -++'_SDL_GL_SetAttribute'.'SDL2.dll'.'SDL_GL_SetAttribute' -++'_SDL_GL_GetAttribute'.'SDL2.dll'.'SDL_GL_GetAttribute' -++'_SDL_GL_CreateContext'.'SDL2.dll'.'SDL_GL_CreateContext' -++'_SDL_GL_MakeCurrent'.'SDL2.dll'.'SDL_GL_MakeCurrent' -++'_SDL_GL_GetCurrentWindow'.'SDL2.dll'.'SDL_GL_GetCurrentWindow' -++'_SDL_GL_GetCurrentContext'.'SDL2.dll'.'SDL_GL_GetCurrentContext' -++'_SDL_GL_GetDrawableSize'.'SDL2.dll'.'SDL_GL_GetDrawableSize' -++'_SDL_GL_SetSwapInterval'.'SDL2.dll'.'SDL_GL_SetSwapInterval' -++'_SDL_GL_GetSwapInterval'.'SDL2.dll'.'SDL_GL_GetSwapInterval' -++'_SDL_GL_SwapWindow'.'SDL2.dll'.'SDL_GL_SwapWindow' -++'_SDL_GL_DeleteContext'.'SDL2.dll'.'SDL_GL_DeleteContext' -++'_SDL_vsscanf'.'SDL2.dll'.'SDL_vsscanf' -++'_SDL_GameControllerAddMappingsFromRW'.'SDL2.dll'.'SDL_GameControllerAddMappingsFromRW' -++'_SDL_GL_ResetAttributes'.'SDL2.dll'.'SDL_GL_ResetAttributes' -++'_SDL_HasAVX'.'SDL2.dll'.'SDL_HasAVX' -++'_SDL_GetDefaultAssertionHandler'.'SDL2.dll'.'SDL_GetDefaultAssertionHandler' -++'_SDL_GetAssertionHandler'.'SDL2.dll'.'SDL_GetAssertionHandler' -++'_SDL_DXGIGetOutputInfo'.'SDL2.dll'.'SDL_DXGIGetOutputInfo' -++'_SDL_RenderIsClipEnabled'.'SDL2.dll'.'SDL_RenderIsClipEnabled' -# ++'_SDL_WinRTRunApp'.'SDL2.dll'.'SDL_WinRTRunApp' -++'_SDL_WarpMouseGlobal'.'SDL2.dll'.'SDL_WarpMouseGlobal' -# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL2.dll'.'SDL_WinRTGetFSPathUNICODE' -# ++'_SDL_WinRTGetFSPathUTF8'.'SDL2.dll'.'SDL_WinRTGetFSPathUTF8' -++'_SDL_sqrtf'.'SDL2.dll'.'SDL_sqrtf' -++'_SDL_tan'.'SDL2.dll'.'SDL_tan' -++'_SDL_tanf'.'SDL2.dll'.'SDL_tanf' -++'_SDL_CaptureMouse'.'SDL2.dll'.'SDL_CaptureMouse' -++'_SDL_SetWindowHitTest'.'SDL2.dll'.'SDL_SetWindowHitTest' -++'_SDL_GetGlobalMouseState'.'SDL2.dll'.'SDL_GetGlobalMouseState' -++'_SDL_HasAVX2'.'SDL2.dll'.'SDL_HasAVX2' -++'_SDL_QueueAudio'.'SDL2.dll'.'SDL_QueueAudio' -++'_SDL_GetQueuedAudioSize'.'SDL2.dll'.'SDL_GetQueuedAudioSize' -++'_SDL_ClearQueuedAudio'.'SDL2.dll'.'SDL_ClearQueuedAudio' -++'_SDL_GetGrabbedWindow'.'SDL2.dll'.'SDL_GetGrabbedWindow' -++'_SDL_SetWindowsMessageHook'.'SDL2.dll'.'SDL_SetWindowsMessageHook' -++'_SDL_JoystickCurrentPowerLevel'.'SDL2.dll'.'SDL_JoystickCurrentPowerLevel' -++'_SDL_GameControllerFromInstanceID'.'SDL2.dll'.'SDL_GameControllerFromInstanceID' -++'_SDL_JoystickFromInstanceID'.'SDL2.dll'.'SDL_JoystickFromInstanceID' -++'_SDL_GetDisplayUsableBounds'.'SDL2.dll'.'SDL_GetDisplayUsableBounds' -++'_SDL_GetWindowBordersSize'.'SDL2.dll'.'SDL_GetWindowBordersSize' -++'_SDL_SetWindowOpacity'.'SDL2.dll'.'SDL_SetWindowOpacity' -++'_SDL_GetWindowOpacity'.'SDL2.dll'.'SDL_GetWindowOpacity' -++'_SDL_SetWindowInputFocus'.'SDL2.dll'.'SDL_SetWindowInputFocus' -++'_SDL_SetWindowModalFor'.'SDL2.dll'.'SDL_SetWindowModalFor' -++'_SDL_RenderSetIntegerScale'.'SDL2.dll'.'SDL_RenderSetIntegerScale' -++'_SDL_RenderGetIntegerScale'.'SDL2.dll'.'SDL_RenderGetIntegerScale' -++'_SDL_DequeueAudio'.'SDL2.dll'.'SDL_DequeueAudio' -++'_SDL_SetWindowResizable'.'SDL2.dll'.'SDL_SetWindowResizable' -++'_SDL_CreateRGBSurfaceWithFormat'.'SDL2.dll'.'SDL_CreateRGBSurfaceWithFormat' -++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL2.dll'.'SDL_CreateRGBSurfaceWithFormatFrom' -++'_SDL_GetHintBoolean'.'SDL2.dll'.'SDL_GetHintBoolean' -++'_SDL_JoystickGetDeviceVendor'.'SDL2.dll'.'SDL_JoystickGetDeviceVendor' -++'_SDL_JoystickGetDeviceProduct'.'SDL2.dll'.'SDL_JoystickGetDeviceProduct' -++'_SDL_JoystickGetDeviceProductVersion'.'SDL2.dll'.'SDL_JoystickGetDeviceProductVersion' -++'_SDL_JoystickGetVendor'.'SDL2.dll'.'SDL_JoystickGetVendor' -++'_SDL_JoystickGetProduct'.'SDL2.dll'.'SDL_JoystickGetProduct' -++'_SDL_JoystickGetProductVersion'.'SDL2.dll'.'SDL_JoystickGetProductVersion' -++'_SDL_GameControllerGetVendor'.'SDL2.dll'.'SDL_GameControllerGetVendor' -++'_SDL_GameControllerGetProduct'.'SDL2.dll'.'SDL_GameControllerGetProduct' -++'_SDL_GameControllerGetProductVersion'.'SDL2.dll'.'SDL_GameControllerGetProductVersion' -++'_SDL_HasNEON'.'SDL2.dll'.'SDL_HasNEON' -++'_SDL_GameControllerNumMappings'.'SDL2.dll'.'SDL_GameControllerNumMappings' -++'_SDL_GameControllerMappingForIndex'.'SDL2.dll'.'SDL_GameControllerMappingForIndex' -++'_SDL_JoystickGetAxisInitialState'.'SDL2.dll'.'SDL_JoystickGetAxisInitialState' -++'_SDL_JoystickGetDeviceType'.'SDL2.dll'.'SDL_JoystickGetDeviceType' -++'_SDL_JoystickGetType'.'SDL2.dll'.'SDL_JoystickGetType' -++'_SDL_MemoryBarrierReleaseFunction'.'SDL2.dll'.'SDL_MemoryBarrierReleaseFunction' -++'_SDL_MemoryBarrierAcquireFunction'.'SDL2.dll'.'SDL_MemoryBarrierAcquireFunction' -++'_SDL_JoystickGetDeviceInstanceID'.'SDL2.dll'.'SDL_JoystickGetDeviceInstanceID' -++'_SDL_utf8strlen'.'SDL2.dll'.'SDL_utf8strlen' -++'_SDL_LoadFile_RW'.'SDL2.dll'.'SDL_LoadFile_RW' -++'_SDL_wcscmp'.'SDL2.dll'.'SDL_wcscmp' -++'_SDL_ComposeCustomBlendMode'.'SDL2.dll'.'SDL_ComposeCustomBlendMode' -++'_SDL_DuplicateSurface'.'SDL2.dll'.'SDL_DuplicateSurface' -++'_SDL_Vulkan_LoadLibrary'.'SDL2.dll'.'SDL_Vulkan_LoadLibrary' -++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL2.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr' -++'_SDL_Vulkan_UnloadLibrary'.'SDL2.dll'.'SDL_Vulkan_UnloadLibrary' -++'_SDL_Vulkan_GetInstanceExtensions'.'SDL2.dll'.'SDL_Vulkan_GetInstanceExtensions' -++'_SDL_Vulkan_CreateSurface'.'SDL2.dll'.'SDL_Vulkan_CreateSurface' -++'_SDL_Vulkan_GetDrawableSize'.'SDL2.dll'.'SDL_Vulkan_GetDrawableSize' -++'_SDL_LockJoysticks'.'SDL2.dll'.'SDL_LockJoysticks' -++'_SDL_UnlockJoysticks'.'SDL2.dll'.'SDL_UnlockJoysticks' -++'_SDL_GetMemoryFunctions'.'SDL2.dll'.'SDL_GetMemoryFunctions' -++'_SDL_SetMemoryFunctions'.'SDL2.dll'.'SDL_SetMemoryFunctions' -++'_SDL_GetNumAllocations'.'SDL2.dll'.'SDL_GetNumAllocations' -++'_SDL_NewAudioStream'.'SDL2.dll'.'SDL_NewAudioStream' -++'_SDL_AudioStreamPut'.'SDL2.dll'.'SDL_AudioStreamPut' -++'_SDL_AudioStreamGet'.'SDL2.dll'.'SDL_AudioStreamGet' -++'_SDL_AudioStreamClear'.'SDL2.dll'.'SDL_AudioStreamClear' -++'_SDL_AudioStreamAvailable'.'SDL2.dll'.'SDL_AudioStreamAvailable' -++'_SDL_FreeAudioStream'.'SDL2.dll'.'SDL_FreeAudioStream' -++'_SDL_AudioStreamFlush'.'SDL2.dll'.'SDL_AudioStreamFlush' -++'_SDL_acosf'.'SDL2.dll'.'SDL_acosf' -++'_SDL_asinf'.'SDL2.dll'.'SDL_asinf' -++'_SDL_atanf'.'SDL2.dll'.'SDL_atanf' -++'_SDL_atan2f'.'SDL2.dll'.'SDL_atan2f' -++'_SDL_ceilf'.'SDL2.dll'.'SDL_ceilf' -++'_SDL_copysignf'.'SDL2.dll'.'SDL_copysignf' -++'_SDL_fabsf'.'SDL2.dll'.'SDL_fabsf' -++'_SDL_floorf'.'SDL2.dll'.'SDL_floorf' -++'_SDL_logf'.'SDL2.dll'.'SDL_logf' -++'_SDL_powf'.'SDL2.dll'.'SDL_powf' -++'_SDL_scalbnf'.'SDL2.dll'.'SDL_scalbnf' -++'_SDL_fmod'.'SDL2.dll'.'SDL_fmod' -++'_SDL_fmodf'.'SDL2.dll'.'SDL_fmodf' -++'_SDL_SetYUVConversionMode'.'SDL2.dll'.'SDL_SetYUVConversionMode' -++'_SDL_GetYUVConversionMode'.'SDL2.dll'.'SDL_GetYUVConversionMode' -++'_SDL_GetYUVConversionModeForResolution'.'SDL2.dll'.'SDL_GetYUVConversionModeForResolution' -++'_SDL_RenderGetMetalLayer'.'SDL2.dll'.'SDL_RenderGetMetalLayer' -++'_SDL_RenderGetMetalCommandEncoder'.'SDL2.dll'.'SDL_RenderGetMetalCommandEncoder' -# ++'_SDL_IsAndroidTV'.'SDL2.dll'.'SDL_IsAndroidTV' -# ++'_SDL_WinRTGetDeviceFamily'.'SDL2.dll'.'SDL_WinRTGetDeviceFamily' -++'_SDL_log10'.'SDL2.dll'.'SDL_log10' -++'_SDL_log10f'.'SDL2.dll'.'SDL_log10f' -++'_SDL_GameControllerMappingForDeviceIndex'.'SDL2.dll'.'SDL_GameControllerMappingForDeviceIndex' -# ++'_SDL_LinuxSetThreadPriority'.'SDL2.dll'.'SDL_LinuxSetThreadPriority' -++'_SDL_HasAVX512F'.'SDL2.dll'.'SDL_HasAVX512F' -# ++'_SDL_IsChromebook'.'SDL2.dll'.'SDL_IsChromebook' -# ++'_SDL_IsDeXMode'.'SDL2.dll'.'SDL_IsDeXMode' -# ++'_SDL_AndroidBackButton'.'SDL2.dll'.'SDL_AndroidBackButton' -++'_SDL_exp'.'SDL2.dll'.'SDL_exp' -++'_SDL_expf'.'SDL2.dll'.'SDL_expf' -++'_SDL_wcsdup'.'SDL2.dll'.'SDL_wcsdup' -++'_SDL_GameControllerRumble'.'SDL2.dll'.'SDL_GameControllerRumble' -++'_SDL_JoystickRumble'.'SDL2.dll'.'SDL_JoystickRumble' -++'_SDL_NumSensors'.'SDL2.dll'.'SDL_NumSensors' -++'_SDL_SensorGetDeviceName'.'SDL2.dll'.'SDL_SensorGetDeviceName' -++'_SDL_SensorGetDeviceType'.'SDL2.dll'.'SDL_SensorGetDeviceType' -++'_SDL_SensorGetDeviceNonPortableType'.'SDL2.dll'.'SDL_SensorGetDeviceNonPortableType' -++'_SDL_SensorGetDeviceInstanceID'.'SDL2.dll'.'SDL_SensorGetDeviceInstanceID' -++'_SDL_SensorOpen'.'SDL2.dll'.'SDL_SensorOpen' -++'_SDL_SensorFromInstanceID'.'SDL2.dll'.'SDL_SensorFromInstanceID' -++'_SDL_SensorGetName'.'SDL2.dll'.'SDL_SensorGetName' -++'_SDL_SensorGetType'.'SDL2.dll'.'SDL_SensorGetType' -++'_SDL_SensorGetNonPortableType'.'SDL2.dll'.'SDL_SensorGetNonPortableType' -++'_SDL_SensorGetInstanceID'.'SDL2.dll'.'SDL_SensorGetInstanceID' -++'_SDL_SensorGetData'.'SDL2.dll'.'SDL_SensorGetData' -++'_SDL_SensorClose'.'SDL2.dll'.'SDL_SensorClose' -++'_SDL_SensorUpdate'.'SDL2.dll'.'SDL_SensorUpdate' -++'_SDL_IsTablet'.'SDL2.dll'.'SDL_IsTablet' -++'_SDL_GetDisplayOrientation'.'SDL2.dll'.'SDL_GetDisplayOrientation' -++'_SDL_HasColorKey'.'SDL2.dll'.'SDL_HasColorKey' -++'_SDL_CreateThreadWithStackSize'.'SDL2.dll'.'SDL_CreateThreadWithStackSize' -++'_SDL_JoystickGetDevicePlayerIndex'.'SDL2.dll'.'SDL_JoystickGetDevicePlayerIndex' -++'_SDL_JoystickGetPlayerIndex'.'SDL2.dll'.'SDL_JoystickGetPlayerIndex' -++'_SDL_GameControllerGetPlayerIndex'.'SDL2.dll'.'SDL_GameControllerGetPlayerIndex' -++'_SDL_RenderFlush'.'SDL2.dll'.'SDL_RenderFlush' -++'_SDL_RenderDrawPointF'.'SDL2.dll'.'SDL_RenderDrawPointF' -++'_SDL_RenderDrawPointsF'.'SDL2.dll'.'SDL_RenderDrawPointsF' -++'_SDL_RenderDrawLineF'.'SDL2.dll'.'SDL_RenderDrawLineF' -++'_SDL_RenderDrawLinesF'.'SDL2.dll'.'SDL_RenderDrawLinesF' -++'_SDL_RenderDrawRectF'.'SDL2.dll'.'SDL_RenderDrawRectF' -++'_SDL_RenderDrawRectsF'.'SDL2.dll'.'SDL_RenderDrawRectsF' -++'_SDL_RenderFillRectF'.'SDL2.dll'.'SDL_RenderFillRectF' -++'_SDL_RenderFillRectsF'.'SDL2.dll'.'SDL_RenderFillRectsF' -++'_SDL_RenderCopyF'.'SDL2.dll'.'SDL_RenderCopyF' -++'_SDL_RenderCopyExF'.'SDL2.dll'.'SDL_RenderCopyExF' -++'_SDL_GetTouchDeviceType'.'SDL2.dll'.'SDL_GetTouchDeviceType' -# ++'_SDL_UIKitRunApp'.'SDL2.dll'.'SDL_UIKitRunApp' -++'_SDL_SIMDGetAlignment'.'SDL2.dll'.'SDL_SIMDGetAlignment' -++'_SDL_SIMDAlloc'.'SDL2.dll'.'SDL_SIMDAlloc' -++'_SDL_SIMDFree'.'SDL2.dll'.'SDL_SIMDFree' -++'_SDL_RWsize'.'SDL2.dll'.'SDL_RWsize' -++'_SDL_RWseek'.'SDL2.dll'.'SDL_RWseek' -++'_SDL_RWtell'.'SDL2.dll'.'SDL_RWtell' -++'_SDL_RWread'.'SDL2.dll'.'SDL_RWread' -++'_SDL_RWwrite'.'SDL2.dll'.'SDL_RWwrite' -++'_SDL_RWclose'.'SDL2.dll'.'SDL_RWclose' -++'_SDL_LoadFile'.'SDL2.dll'.'SDL_LoadFile' -++'_SDL_Metal_CreateView'.'SDL2.dll'.'SDL_Metal_CreateView' -++'_SDL_Metal_DestroyView'.'SDL2.dll'.'SDL_Metal_DestroyView' -++'_SDL_LockTextureToSurface'.'SDL2.dll'.'SDL_LockTextureToSurface' -++'_SDL_HasARMSIMD'.'SDL2.dll'.'SDL_HasARMSIMD' -++'_SDL_strtokr'.'SDL2.dll'.'SDL_strtokr' -++'_SDL_wcsstr'.'SDL2.dll'.'SDL_wcsstr' -++'_SDL_wcsncmp'.'SDL2.dll'.'SDL_wcsncmp' -++'_SDL_GameControllerTypeForIndex'.'SDL2.dll'.'SDL_GameControllerTypeForIndex' -++'_SDL_GameControllerGetType'.'SDL2.dll'.'SDL_GameControllerGetType' -++'_SDL_GameControllerFromPlayerIndex'.'SDL2.dll'.'SDL_GameControllerFromPlayerIndex' -++'_SDL_GameControllerSetPlayerIndex'.'SDL2.dll'.'SDL_GameControllerSetPlayerIndex' -++'_SDL_JoystickFromPlayerIndex'.'SDL2.dll'.'SDL_JoystickFromPlayerIndex' -++'_SDL_JoystickSetPlayerIndex'.'SDL2.dll'.'SDL_JoystickSetPlayerIndex' -++'_SDL_SetTextureScaleMode'.'SDL2.dll'.'SDL_SetTextureScaleMode' -++'_SDL_GetTextureScaleMode'.'SDL2.dll'.'SDL_GetTextureScaleMode' -++'_SDL_OnApplicationWillTerminate'.'SDL2.dll'.'SDL_OnApplicationWillTerminate' -++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL2.dll'.'SDL_OnApplicationDidReceiveMemoryWarning' -++'_SDL_OnApplicationWillResignActive'.'SDL2.dll'.'SDL_OnApplicationWillResignActive' -++'_SDL_OnApplicationDidEnterBackground'.'SDL2.dll'.'SDL_OnApplicationDidEnterBackground' -++'_SDL_OnApplicationWillEnterForeground'.'SDL2.dll'.'SDL_OnApplicationWillEnterForeground' -++'_SDL_OnApplicationDidBecomeActive'.'SDL2.dll'.'SDL_OnApplicationDidBecomeActive' -# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL2.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation' -# ++'_SDL_GetAndroidSDKVersion'.'SDL2.dll'.'SDL_GetAndroidSDKVersion' -++'_SDL_isupper'.'SDL2.dll'.'SDL_isupper' -++'_SDL_islower'.'SDL2.dll'.'SDL_islower' -++'_SDL_JoystickAttachVirtual'.'SDL2.dll'.'SDL_JoystickAttachVirtual' -++'_SDL_JoystickDetachVirtual'.'SDL2.dll'.'SDL_JoystickDetachVirtual' -++'_SDL_JoystickIsVirtual'.'SDL2.dll'.'SDL_JoystickIsVirtual' -++'_SDL_JoystickSetVirtualAxis'.'SDL2.dll'.'SDL_JoystickSetVirtualAxis' -++'_SDL_JoystickSetVirtualButton'.'SDL2.dll'.'SDL_JoystickSetVirtualButton' -++'_SDL_JoystickSetVirtualHat'.'SDL2.dll'.'SDL_JoystickSetVirtualHat' -++'_SDL_GetErrorMsg'.'SDL2.dll'.'SDL_GetErrorMsg' -++'_SDL_LockSensors'.'SDL2.dll'.'SDL_LockSensors' -++'_SDL_UnlockSensors'.'SDL2.dll'.'SDL_UnlockSensors' -++'_SDL_Metal_GetLayer'.'SDL2.dll'.'SDL_Metal_GetLayer' -++'_SDL_Metal_GetDrawableSize'.'SDL2.dll'.'SDL_Metal_GetDrawableSize' -++'_SDL_trunc'.'SDL2.dll'.'SDL_trunc' -++'_SDL_truncf'.'SDL2.dll'.'SDL_truncf' -++'_SDL_GetPreferredLocales'.'SDL2.dll'.'SDL_GetPreferredLocales' -++'_SDL_SIMDRealloc'.'SDL2.dll'.'SDL_SIMDRealloc' -# ++'_SDL_AndroidRequestPermission'.'SDL2.dll'.'SDL_AndroidRequestPermission' -++'_SDL_OpenURL'.'SDL2.dll'.'SDL_OpenURL' -++'_SDL_HasSurfaceRLE'.'SDL2.dll'.'SDL_HasSurfaceRLE' -++'_SDL_GameControllerHasLED'.'SDL2.dll'.'SDL_GameControllerHasLED' -++'_SDL_GameControllerSetLED'.'SDL2.dll'.'SDL_GameControllerSetLED' -++'_SDL_JoystickHasLED'.'SDL2.dll'.'SDL_JoystickHasLED' -++'_SDL_JoystickSetLED'.'SDL2.dll'.'SDL_JoystickSetLED' -++'_SDL_GameControllerRumbleTriggers'.'SDL2.dll'.'SDL_GameControllerRumbleTriggers' -++'_SDL_JoystickRumbleTriggers'.'SDL2.dll'.'SDL_JoystickRumbleTriggers' -++'_SDL_GameControllerHasAxis'.'SDL2.dll'.'SDL_GameControllerHasAxis' -++'_SDL_GameControllerHasButton'.'SDL2.dll'.'SDL_GameControllerHasButton' -++'_SDL_GameControllerGetNumTouchpads'.'SDL2.dll'.'SDL_GameControllerGetNumTouchpads' -++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL2.dll'.'SDL_GameControllerGetNumTouchpadFingers' -++'_SDL_GameControllerGetTouchpadFinger'.'SDL2.dll'.'SDL_GameControllerGetTouchpadFinger' -++'_SDL_crc32'.'SDL2.dll'.'SDL_crc32' -++'_SDL_GameControllerGetSerial'.'SDL2.dll'.'SDL_GameControllerGetSerial' -++'_SDL_JoystickGetSerial'.'SDL2.dll'.'SDL_JoystickGetSerial' -++'_SDL_GameControllerHasSensor'.'SDL2.dll'.'SDL_GameControllerHasSensor' -++'_SDL_GameControllerSetSensorEnabled'.'SDL2.dll'.'SDL_GameControllerSetSensorEnabled' -++'_SDL_GameControllerIsSensorEnabled'.'SDL2.dll'.'SDL_GameControllerIsSensorEnabled' -++'_SDL_GameControllerGetSensorData'.'SDL2.dll'.'SDL_GameControllerGetSensorData' -++'_SDL_wcscasecmp'.'SDL2.dll'.'SDL_wcscasecmp' -++'_SDL_wcsncasecmp'.'SDL2.dll'.'SDL_wcsncasecmp' -++'_SDL_round'.'SDL2.dll'.'SDL_round' -++'_SDL_roundf'.'SDL2.dll'.'SDL_roundf' -++'_SDL_lround'.'SDL2.dll'.'SDL_lround' -++'_SDL_lroundf'.'SDL2.dll'.'SDL_lroundf' -++'_SDL_SoftStretchLinear'.'SDL2.dll'.'SDL_SoftStretchLinear' -++'_SDL_RenderGetD3D11Device'.'SDL2.dll'.'SDL_RenderGetD3D11Device' -++'_SDL_UpdateNVTexture'.'SDL2.dll'.'SDL_UpdateNVTexture' -++'_SDL_SetWindowKeyboardGrab'.'SDL2.dll'.'SDL_SetWindowKeyboardGrab' -++'_SDL_SetWindowMouseGrab'.'SDL2.dll'.'SDL_SetWindowMouseGrab' -++'_SDL_GetWindowKeyboardGrab'.'SDL2.dll'.'SDL_GetWindowKeyboardGrab' -++'_SDL_GetWindowMouseGrab'.'SDL2.dll'.'SDL_GetWindowMouseGrab' -++'_SDL_isalpha'.'SDL2.dll'.'SDL_isalpha' -++'_SDL_isalnum'.'SDL2.dll'.'SDL_isalnum' -++'_SDL_isblank'.'SDL2.dll'.'SDL_isblank' -++'_SDL_iscntrl'.'SDL2.dll'.'SDL_iscntrl' -++'_SDL_isxdigit'.'SDL2.dll'.'SDL_isxdigit' -++'_SDL_ispunct'.'SDL2.dll'.'SDL_ispunct' -++'_SDL_isprint'.'SDL2.dll'.'SDL_isprint' -++'_SDL_isgraph'.'SDL2.dll'.'SDL_isgraph' -# ++'_SDL_AndroidShowToast'.'SDL2.dll'.'SDL_AndroidShowToast' -++'_SDL_GetAudioDeviceSpec'.'SDL2.dll'.'SDL_GetAudioDeviceSpec' -++'_SDL_TLSCleanup'.'SDL2.dll'.'SDL_TLSCleanup' -++'_SDL_SetWindowAlwaysOnTop'.'SDL2.dll'.'SDL_SetWindowAlwaysOnTop' -++'_SDL_FlashWindow'.'SDL2.dll'.'SDL_FlashWindow' -++'_SDL_GameControllerSendEffect'.'SDL2.dll'.'SDL_GameControllerSendEffect' -++'_SDL_JoystickSendEffect'.'SDL2.dll'.'SDL_JoystickSendEffect' -++'_SDL_GameControllerGetSensorDataRate'.'SDL2.dll'.'SDL_GameControllerGetSensorDataRate' -++'_SDL_SetTextureUserData'.'SDL2.dll'.'SDL_SetTextureUserData' -++'_SDL_GetTextureUserData'.'SDL2.dll'.'SDL_GetTextureUserData' -++'_SDL_RenderGeometry'.'SDL2.dll'.'SDL_RenderGeometry' -++'_SDL_RenderGeometryRaw'.'SDL2.dll'.'SDL_RenderGeometryRaw' -++'_SDL_RenderSetVSync'.'SDL2.dll'.'SDL_RenderSetVSync' -++'_SDL_asprintf'.'SDL2.dll'.'SDL_asprintf' -++'_SDL_vasprintf'.'SDL2.dll'.'SDL_vasprintf' -++'_SDL_GetWindowICCProfile'.'SDL2.dll'.'SDL_GetWindowICCProfile' -++'_SDL_GetTicks64'.'SDL2.dll'.'SDL_GetTicks64' -# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL2.dll'.'SDL_LinuxSetThreadPriorityAndPolicy' -++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL2.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton' -++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL2.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis' -++'_SDL_hid_init'.'SDL2.dll'.'SDL_hid_init' -++'_SDL_hid_exit'.'SDL2.dll'.'SDL_hid_exit' -++'_SDL_hid_device_change_count'.'SDL2.dll'.'SDL_hid_device_change_count' -++'_SDL_hid_enumerate'.'SDL2.dll'.'SDL_hid_enumerate' -++'_SDL_hid_free_enumeration'.'SDL2.dll'.'SDL_hid_free_enumeration' -++'_SDL_hid_open'.'SDL2.dll'.'SDL_hid_open' -++'_SDL_hid_open_path'.'SDL2.dll'.'SDL_hid_open_path' -++'_SDL_hid_write'.'SDL2.dll'.'SDL_hid_write' -++'_SDL_hid_read_timeout'.'SDL2.dll'.'SDL_hid_read_timeout' -++'_SDL_hid_read'.'SDL2.dll'.'SDL_hid_read' -++'_SDL_hid_set_nonblocking'.'SDL2.dll'.'SDL_hid_set_nonblocking' -++'_SDL_hid_send_feature_report'.'SDL2.dll'.'SDL_hid_send_feature_report' -++'_SDL_hid_get_feature_report'.'SDL2.dll'.'SDL_hid_get_feature_report' -++'_SDL_hid_close'.'SDL2.dll'.'SDL_hid_close' -++'_SDL_hid_get_manufacturer_string'.'SDL2.dll'.'SDL_hid_get_manufacturer_string' -++'_SDL_hid_get_product_string'.'SDL2.dll'.'SDL_hid_get_product_string' -++'_SDL_hid_get_serial_number_string'.'SDL2.dll'.'SDL_hid_get_serial_number_string' -++'_SDL_hid_get_indexed_string'.'SDL2.dll'.'SDL_hid_get_indexed_string' -++'_SDL_SetWindowMouseRect'.'SDL2.dll'.'SDL_SetWindowMouseRect' -++'_SDL_GetWindowMouseRect'.'SDL2.dll'.'SDL_GetWindowMouseRect' -++'_SDL_RenderWindowToLogical'.'SDL2.dll'.'SDL_RenderWindowToLogical' -++'_SDL_RenderLogicalToWindow'.'SDL2.dll'.'SDL_RenderLogicalToWindow' -++'_SDL_JoystickHasRumble'.'SDL2.dll'.'SDL_JoystickHasRumble' -++'_SDL_JoystickHasRumbleTriggers'.'SDL2.dll'.'SDL_JoystickHasRumbleTriggers' -++'_SDL_GameControllerHasRumble'.'SDL2.dll'.'SDL_GameControllerHasRumble' -++'_SDL_GameControllerHasRumbleTriggers'.'SDL2.dll'.'SDL_GameControllerHasRumbleTriggers' -++'_SDL_hid_ble_scan'.'SDL2.dll'.'SDL_hid_ble_scan' -++'_SDL_PremultiplyAlpha'.'SDL2.dll'.'SDL_PremultiplyAlpha' -# ++'_SDL_AndroidSendMessage'.'SDL2.dll'.'SDL_AndroidSendMessage' -++'_SDL_GetTouchName'.'SDL2.dll'.'SDL_GetTouchName' -++'_SDL_ClearComposition'.'SDL2.dll'.'SDL_ClearComposition' -++'_SDL_IsTextInputShown'.'SDL2.dll'.'SDL_IsTextInputShown' -++'_SDL_HasIntersectionF'.'SDL2.dll'.'SDL_HasIntersectionF' -++'_SDL_IntersectFRect'.'SDL2.dll'.'SDL_IntersectFRect' -++'_SDL_UnionFRect'.'SDL2.dll'.'SDL_UnionFRect' -++'_SDL_EncloseFPoints'.'SDL2.dll'.'SDL_EncloseFPoints' -++'_SDL_IntersectFRectAndLine'.'SDL2.dll'.'SDL_IntersectFRectAndLine' -++'_SDL_RenderGetWindow'.'SDL2.dll'.'SDL_RenderGetWindow' -++'_SDL_bsearch'.'SDL2.dll'.'SDL_bsearch' -++'_SDL_GameControllerPathForIndex'.'SDL2.dll'.'SDL_GameControllerPathForIndex' -++'_SDL_GameControllerPath'.'SDL2.dll'.'SDL_GameControllerPath' -++'_SDL_JoystickPathForIndex'.'SDL2.dll'.'SDL_JoystickPathForIndex' -++'_SDL_JoystickPath'.'SDL2.dll'.'SDL_JoystickPath' -++'_SDL_JoystickAttachVirtualEx'.'SDL2.dll'.'SDL_JoystickAttachVirtualEx' -++'_SDL_GameControllerGetFirmwareVersion'.'SDL2.dll'.'SDL_GameControllerGetFirmwareVersion' -++'_SDL_JoystickGetFirmwareVersion'.'SDL2.dll'.'SDL_JoystickGetFirmwareVersion' -++'_SDL_GUIDToString'.'SDL2.dll'.'SDL_GUIDToString' -++'_SDL_GUIDFromString'.'SDL2.dll'.'SDL_GUIDFromString' -++'_SDL_HasLSX'.'SDL2.dll'.'SDL_HasLSX' -++'_SDL_HasLASX'.'SDL2.dll'.'SDL_HasLASX' -++'_SDL_RenderGetD3D12Device'.'SDL2.dll'.'SDL_RenderGetD3D12Device' -++'_SDL_utf8strnlen'.'SDL2.dll'.'SDL_utf8strnlen' -# ++'_SDL_GDKGetTaskQueue'.'SDL2.dll'.'SDL_GDKGetTaskQueue' -# ++'_SDL_GDKRunApp'.'SDL2.dll'.'SDL_GDKRunApp' -++'_SDL_GetOriginalMemoryFunctions'.'SDL2.dll'.'SDL_GetOriginalMemoryFunctions' -++'_SDL_ResetKeyboard'.'SDL2.dll'.'SDL_ResetKeyboard' -++'_SDL_GetDefaultAudioInfo'.'SDL2.dll'.'SDL_GetDefaultAudioInfo' -++'_SDL_GetPointDisplayIndex'.'SDL2.dll'.'SDL_GetPointDisplayIndex' -++'_SDL_GetRectDisplayIndex'.'SDL2.dll'.'SDL_GetRectDisplayIndex' -++'_SDL_ResetHint'.'SDL2.dll'.'SDL_ResetHint' -++'_SDL_crc16'.'SDL2.dll'.'SDL_crc16' -++'_SDL_GetWindowSizeInPixels'.'SDL2.dll'.'SDL_GetWindowSizeInPixels' -++'_SDL_GetJoystickGUIDInfo'.'SDL2.dll'.'SDL_GetJoystickGUIDInfo' -++'_SDL_SetPrimarySelectionText'.'SDL2.dll'.'SDL_SetPrimarySelectionText' -++'_SDL_GetPrimarySelectionText'.'SDL2.dll'.'SDL_GetPrimarySelectionText' -++'_SDL_HasPrimarySelectionText'.'SDL2.dll'.'SDL_HasPrimarySelectionText' -++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL2.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' -++'_SDL_SensorGetDataWithTimestamp'.'SDL2.dll'.'SDL_SensorGetDataWithTimestamp' -++'_SDL_ResetHints'.'SDL2.dll'.'SDL_ResetHints' -++'_SDL_strcasestr'.'SDL2.dll'.'SDL_strcasestr' diff --git a/src/dynapi/SDL3.exports b/src/dynapi/SDL3.exports new file mode 100644 index 000000000..7bc5863a3 --- /dev/null +++ b/src/dynapi/SDL3.exports @@ -0,0 +1,869 @@ +# Windows exports file for Watcom +# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. +++'_SDL_DYNAPI_entry'.'SDL3.dll'.'SDL_DYNAPI_entry' +++'_SDL_SetError'.'SDL3.dll'.'SDL_SetError' +++'_SDL_Log'.'SDL3.dll'.'SDL_Log' +++'_SDL_LogVerbose'.'SDL3.dll'.'SDL_LogVerbose' +++'_SDL_LogDebug'.'SDL3.dll'.'SDL_LogDebug' +++'_SDL_LogInfo'.'SDL3.dll'.'SDL_LogInfo' +++'_SDL_LogWarn'.'SDL3.dll'.'SDL_LogWarn' +++'_SDL_LogError'.'SDL3.dll'.'SDL_LogError' +++'_SDL_LogCritical'.'SDL3.dll'.'SDL_LogCritical' +++'_SDL_LogMessage'.'SDL3.dll'.'SDL_LogMessage' +++'_SDL_sscanf'.'SDL3.dll'.'SDL_sscanf' +++'_SDL_snprintf'.'SDL3.dll'.'SDL_snprintf' +++'_SDL_CreateThread'.'SDL3.dll'.'SDL_CreateThread' +++'_SDL_RWFromFP'.'SDL3.dll'.'SDL_RWFromFP' +++'_SDL_RegisterApp'.'SDL3.dll'.'SDL_RegisterApp' +++'_SDL_UnregisterApp'.'SDL3.dll'.'SDL_UnregisterApp' +++'_SDL_Direct3D9GetAdapterIndex'.'SDL3.dll'.'SDL_Direct3D9GetAdapterIndex' +++'_SDL_RenderGetD3D9Device'.'SDL3.dll'.'SDL_RenderGetD3D9Device' +# ++'_SDL_iPhoneSetAnimationCallback'.'SDL3.dll'.'SDL_iPhoneSetAnimationCallback' +# ++'_SDL_iPhoneSetEventPump'.'SDL3.dll'.'SDL_iPhoneSetEventPump' +# ++'_SDL_AndroidGetJNIEnv'.'SDL3.dll'.'SDL_AndroidGetJNIEnv' +# ++'_SDL_AndroidGetActivity'.'SDL3.dll'.'SDL_AndroidGetActivity' +# ++'_SDL_AndroidGetInternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetInternalStoragePath' +# ++'_SDL_AndroidGetExternalStorageState'.'SDL3.dll'.'SDL_AndroidGetExternalStorageState' +# ++'_SDL_AndroidGetExternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetExternalStoragePath' +++'_SDL_Init'.'SDL3.dll'.'SDL_Init' +++'_SDL_InitSubSystem'.'SDL3.dll'.'SDL_InitSubSystem' +++'_SDL_QuitSubSystem'.'SDL3.dll'.'SDL_QuitSubSystem' +++'_SDL_WasInit'.'SDL3.dll'.'SDL_WasInit' +++'_SDL_Quit'.'SDL3.dll'.'SDL_Quit' +++'_SDL_ReportAssertion'.'SDL3.dll'.'SDL_ReportAssertion' +++'_SDL_SetAssertionHandler'.'SDL3.dll'.'SDL_SetAssertionHandler' +++'_SDL_GetAssertionReport'.'SDL3.dll'.'SDL_GetAssertionReport' +++'_SDL_ResetAssertionReport'.'SDL3.dll'.'SDL_ResetAssertionReport' +++'_SDL_AtomicTryLock'.'SDL3.dll'.'SDL_AtomicTryLock' +++'_SDL_AtomicLock'.'SDL3.dll'.'SDL_AtomicLock' +++'_SDL_AtomicUnlock'.'SDL3.dll'.'SDL_AtomicUnlock' +++'_SDL_AtomicCAS'.'SDL3.dll'.'SDL_AtomicCAS' +++'_SDL_AtomicSet'.'SDL3.dll'.'SDL_AtomicSet' +++'_SDL_AtomicGet'.'SDL3.dll'.'SDL_AtomicGet' +++'_SDL_AtomicAdd'.'SDL3.dll'.'SDL_AtomicAdd' +++'_SDL_AtomicCASPtr'.'SDL3.dll'.'SDL_AtomicCASPtr' +++'_SDL_AtomicSetPtr'.'SDL3.dll'.'SDL_AtomicSetPtr' +++'_SDL_AtomicGetPtr'.'SDL3.dll'.'SDL_AtomicGetPtr' +++'_SDL_GetNumAudioDrivers'.'SDL3.dll'.'SDL_GetNumAudioDrivers' +++'_SDL_GetAudioDriver'.'SDL3.dll'.'SDL_GetAudioDriver' +++'_SDL_AudioInit'.'SDL3.dll'.'SDL_AudioInit' +++'_SDL_AudioQuit'.'SDL3.dll'.'SDL_AudioQuit' +++'_SDL_GetCurrentAudioDriver'.'SDL3.dll'.'SDL_GetCurrentAudioDriver' +++'_SDL_OpenAudio'.'SDL3.dll'.'SDL_OpenAudio' +++'_SDL_GetNumAudioDevices'.'SDL3.dll'.'SDL_GetNumAudioDevices' +++'_SDL_GetAudioDeviceName'.'SDL3.dll'.'SDL_GetAudioDeviceName' +++'_SDL_OpenAudioDevice'.'SDL3.dll'.'SDL_OpenAudioDevice' +++'_SDL_GetAudioStatus'.'SDL3.dll'.'SDL_GetAudioStatus' +++'_SDL_GetAudioDeviceStatus'.'SDL3.dll'.'SDL_GetAudioDeviceStatus' +++'_SDL_PauseAudio'.'SDL3.dll'.'SDL_PauseAudio' +++'_SDL_PauseAudioDevice'.'SDL3.dll'.'SDL_PauseAudioDevice' +++'_SDL_LoadWAV_RW'.'SDL3.dll'.'SDL_LoadWAV_RW' +++'_SDL_FreeWAV'.'SDL3.dll'.'SDL_FreeWAV' +++'_SDL_BuildAudioCVT'.'SDL3.dll'.'SDL_BuildAudioCVT' +++'_SDL_ConvertAudio'.'SDL3.dll'.'SDL_ConvertAudio' +++'_SDL_MixAudio'.'SDL3.dll'.'SDL_MixAudio' +++'_SDL_MixAudioFormat'.'SDL3.dll'.'SDL_MixAudioFormat' +++'_SDL_LockAudio'.'SDL3.dll'.'SDL_LockAudio' +++'_SDL_LockAudioDevice'.'SDL3.dll'.'SDL_LockAudioDevice' +++'_SDL_UnlockAudio'.'SDL3.dll'.'SDL_UnlockAudio' +++'_SDL_UnlockAudioDevice'.'SDL3.dll'.'SDL_UnlockAudioDevice' +++'_SDL_CloseAudio'.'SDL3.dll'.'SDL_CloseAudio' +++'_SDL_CloseAudioDevice'.'SDL3.dll'.'SDL_CloseAudioDevice' +++'_SDL_SetClipboardText'.'SDL3.dll'.'SDL_SetClipboardText' +++'_SDL_GetClipboardText'.'SDL3.dll'.'SDL_GetClipboardText' +++'_SDL_HasClipboardText'.'SDL3.dll'.'SDL_HasClipboardText' +++'_SDL_GetCPUCount'.'SDL3.dll'.'SDL_GetCPUCount' +++'_SDL_GetCPUCacheLineSize'.'SDL3.dll'.'SDL_GetCPUCacheLineSize' +++'_SDL_HasRDTSC'.'SDL3.dll'.'SDL_HasRDTSC' +++'_SDL_HasAltiVec'.'SDL3.dll'.'SDL_HasAltiVec' +++'_SDL_HasMMX'.'SDL3.dll'.'SDL_HasMMX' +++'_SDL_Has3DNow'.'SDL3.dll'.'SDL_Has3DNow' +++'_SDL_HasSSE'.'SDL3.dll'.'SDL_HasSSE' +++'_SDL_HasSSE2'.'SDL3.dll'.'SDL_HasSSE2' +++'_SDL_HasSSE3'.'SDL3.dll'.'SDL_HasSSE3' +++'_SDL_HasSSE41'.'SDL3.dll'.'SDL_HasSSE41' +++'_SDL_HasSSE42'.'SDL3.dll'.'SDL_HasSSE42' +++'_SDL_GetSystemRAM'.'SDL3.dll'.'SDL_GetSystemRAM' +++'_SDL_GetError'.'SDL3.dll'.'SDL_GetError' +++'_SDL_ClearError'.'SDL3.dll'.'SDL_ClearError' +++'_SDL_Error'.'SDL3.dll'.'SDL_Error' +++'_SDL_PumpEvents'.'SDL3.dll'.'SDL_PumpEvents' +++'_SDL_PeepEvents'.'SDL3.dll'.'SDL_PeepEvents' +++'_SDL_HasEvent'.'SDL3.dll'.'SDL_HasEvent' +++'_SDL_HasEvents'.'SDL3.dll'.'SDL_HasEvents' +++'_SDL_FlushEvent'.'SDL3.dll'.'SDL_FlushEvent' +++'_SDL_FlushEvents'.'SDL3.dll'.'SDL_FlushEvents' +++'_SDL_PollEvent'.'SDL3.dll'.'SDL_PollEvent' +++'_SDL_WaitEvent'.'SDL3.dll'.'SDL_WaitEvent' +++'_SDL_WaitEventTimeout'.'SDL3.dll'.'SDL_WaitEventTimeout' +++'_SDL_PushEvent'.'SDL3.dll'.'SDL_PushEvent' +++'_SDL_SetEventFilter'.'SDL3.dll'.'SDL_SetEventFilter' +++'_SDL_GetEventFilter'.'SDL3.dll'.'SDL_GetEventFilter' +++'_SDL_AddEventWatch'.'SDL3.dll'.'SDL_AddEventWatch' +++'_SDL_DelEventWatch'.'SDL3.dll'.'SDL_DelEventWatch' +++'_SDL_FilterEvents'.'SDL3.dll'.'SDL_FilterEvents' +++'_SDL_EventState'.'SDL3.dll'.'SDL_EventState' +++'_SDL_RegisterEvents'.'SDL3.dll'.'SDL_RegisterEvents' +++'_SDL_GetBasePath'.'SDL3.dll'.'SDL_GetBasePath' +++'_SDL_GetPrefPath'.'SDL3.dll'.'SDL_GetPrefPath' +++'_SDL_GameControllerAddMapping'.'SDL3.dll'.'SDL_GameControllerAddMapping' +++'_SDL_GameControllerMappingForGUID'.'SDL3.dll'.'SDL_GameControllerMappingForGUID' +++'_SDL_GameControllerMapping'.'SDL3.dll'.'SDL_GameControllerMapping' +++'_SDL_IsGameController'.'SDL3.dll'.'SDL_IsGameController' +++'_SDL_GameControllerNameForIndex'.'SDL3.dll'.'SDL_GameControllerNameForIndex' +++'_SDL_GameControllerOpen'.'SDL3.dll'.'SDL_GameControllerOpen' +++'_SDL_GameControllerName'.'SDL3.dll'.'SDL_GameControllerName' +++'_SDL_GameControllerGetAttached'.'SDL3.dll'.'SDL_GameControllerGetAttached' +++'_SDL_GameControllerGetJoystick'.'SDL3.dll'.'SDL_GameControllerGetJoystick' +++'_SDL_GameControllerEventState'.'SDL3.dll'.'SDL_GameControllerEventState' +++'_SDL_GameControllerUpdate'.'SDL3.dll'.'SDL_GameControllerUpdate' +++'_SDL_GameControllerGetAxisFromString'.'SDL3.dll'.'SDL_GameControllerGetAxisFromString' +++'_SDL_GameControllerGetStringForAxis'.'SDL3.dll'.'SDL_GameControllerGetStringForAxis' +++'_SDL_GameControllerGetBindForAxis'.'SDL3.dll'.'SDL_GameControllerGetBindForAxis' +++'_SDL_GameControllerGetAxis'.'SDL3.dll'.'SDL_GameControllerGetAxis' +++'_SDL_GameControllerGetButtonFromString'.'SDL3.dll'.'SDL_GameControllerGetButtonFromString' +++'_SDL_GameControllerGetStringForButton'.'SDL3.dll'.'SDL_GameControllerGetStringForButton' +++'_SDL_GameControllerGetBindForButton'.'SDL3.dll'.'SDL_GameControllerGetBindForButton' +++'_SDL_GameControllerGetButton'.'SDL3.dll'.'SDL_GameControllerGetButton' +++'_SDL_GameControllerClose'.'SDL3.dll'.'SDL_GameControllerClose' +++'_SDL_RecordGesture'.'SDL3.dll'.'SDL_RecordGesture' +++'_SDL_SaveAllDollarTemplates'.'SDL3.dll'.'SDL_SaveAllDollarTemplates' +++'_SDL_SaveDollarTemplate'.'SDL3.dll'.'SDL_SaveDollarTemplate' +++'_SDL_LoadDollarTemplates'.'SDL3.dll'.'SDL_LoadDollarTemplates' +++'_SDL_NumHaptics'.'SDL3.dll'.'SDL_NumHaptics' +++'_SDL_HapticName'.'SDL3.dll'.'SDL_HapticName' +++'_SDL_HapticOpen'.'SDL3.dll'.'SDL_HapticOpen' +++'_SDL_HapticOpened'.'SDL3.dll'.'SDL_HapticOpened' +++'_SDL_HapticIndex'.'SDL3.dll'.'SDL_HapticIndex' +++'_SDL_MouseIsHaptic'.'SDL3.dll'.'SDL_MouseIsHaptic' +++'_SDL_HapticOpenFromMouse'.'SDL3.dll'.'SDL_HapticOpenFromMouse' +++'_SDL_JoystickIsHaptic'.'SDL3.dll'.'SDL_JoystickIsHaptic' +++'_SDL_HapticOpenFromJoystick'.'SDL3.dll'.'SDL_HapticOpenFromJoystick' +++'_SDL_HapticClose'.'SDL3.dll'.'SDL_HapticClose' +++'_SDL_HapticNumEffects'.'SDL3.dll'.'SDL_HapticNumEffects' +++'_SDL_HapticNumEffectsPlaying'.'SDL3.dll'.'SDL_HapticNumEffectsPlaying' +++'_SDL_HapticQuery'.'SDL3.dll'.'SDL_HapticQuery' +++'_SDL_HapticNumAxes'.'SDL3.dll'.'SDL_HapticNumAxes' +++'_SDL_HapticEffectSupported'.'SDL3.dll'.'SDL_HapticEffectSupported' +++'_SDL_HapticNewEffect'.'SDL3.dll'.'SDL_HapticNewEffect' +++'_SDL_HapticUpdateEffect'.'SDL3.dll'.'SDL_HapticUpdateEffect' +++'_SDL_HapticRunEffect'.'SDL3.dll'.'SDL_HapticRunEffect' +++'_SDL_HapticStopEffect'.'SDL3.dll'.'SDL_HapticStopEffect' +++'_SDL_HapticDestroyEffect'.'SDL3.dll'.'SDL_HapticDestroyEffect' +++'_SDL_HapticGetEffectStatus'.'SDL3.dll'.'SDL_HapticGetEffectStatus' +++'_SDL_HapticSetGain'.'SDL3.dll'.'SDL_HapticSetGain' +++'_SDL_HapticSetAutocenter'.'SDL3.dll'.'SDL_HapticSetAutocenter' +++'_SDL_HapticPause'.'SDL3.dll'.'SDL_HapticPause' +++'_SDL_HapticUnpause'.'SDL3.dll'.'SDL_HapticUnpause' +++'_SDL_HapticStopAll'.'SDL3.dll'.'SDL_HapticStopAll' +++'_SDL_HapticRumbleSupported'.'SDL3.dll'.'SDL_HapticRumbleSupported' +++'_SDL_HapticRumbleInit'.'SDL3.dll'.'SDL_HapticRumbleInit' +++'_SDL_HapticRumblePlay'.'SDL3.dll'.'SDL_HapticRumblePlay' +++'_SDL_HapticRumbleStop'.'SDL3.dll'.'SDL_HapticRumbleStop' +++'_SDL_SetHintWithPriority'.'SDL3.dll'.'SDL_SetHintWithPriority' +++'_SDL_SetHint'.'SDL3.dll'.'SDL_SetHint' +++'_SDL_GetHint'.'SDL3.dll'.'SDL_GetHint' +++'_SDL_AddHintCallback'.'SDL3.dll'.'SDL_AddHintCallback' +++'_SDL_DelHintCallback'.'SDL3.dll'.'SDL_DelHintCallback' +++'_SDL_ClearHints'.'SDL3.dll'.'SDL_ClearHints' +++'_SDL_NumJoysticks'.'SDL3.dll'.'SDL_NumJoysticks' +++'_SDL_JoystickNameForIndex'.'SDL3.dll'.'SDL_JoystickNameForIndex' +++'_SDL_JoystickOpen'.'SDL3.dll'.'SDL_JoystickOpen' +++'_SDL_JoystickName'.'SDL3.dll'.'SDL_JoystickName' +++'_SDL_JoystickGetDeviceGUID'.'SDL3.dll'.'SDL_JoystickGetDeviceGUID' +++'_SDL_JoystickGetGUID'.'SDL3.dll'.'SDL_JoystickGetGUID' +++'_SDL_JoystickGetGUIDString'.'SDL3.dll'.'SDL_JoystickGetGUIDString' +++'_SDL_JoystickGetGUIDFromString'.'SDL3.dll'.'SDL_JoystickGetGUIDFromString' +++'_SDL_JoystickGetAttached'.'SDL3.dll'.'SDL_JoystickGetAttached' +++'_SDL_JoystickInstanceID'.'SDL3.dll'.'SDL_JoystickInstanceID' +++'_SDL_JoystickNumAxes'.'SDL3.dll'.'SDL_JoystickNumAxes' +++'_SDL_JoystickNumBalls'.'SDL3.dll'.'SDL_JoystickNumBalls' +++'_SDL_JoystickNumHats'.'SDL3.dll'.'SDL_JoystickNumHats' +++'_SDL_JoystickNumButtons'.'SDL3.dll'.'SDL_JoystickNumButtons' +++'_SDL_JoystickUpdate'.'SDL3.dll'.'SDL_JoystickUpdate' +++'_SDL_JoystickEventState'.'SDL3.dll'.'SDL_JoystickEventState' +++'_SDL_JoystickGetAxis'.'SDL3.dll'.'SDL_JoystickGetAxis' +++'_SDL_JoystickGetHat'.'SDL3.dll'.'SDL_JoystickGetHat' +++'_SDL_JoystickGetBall'.'SDL3.dll'.'SDL_JoystickGetBall' +++'_SDL_JoystickGetButton'.'SDL3.dll'.'SDL_JoystickGetButton' +++'_SDL_JoystickClose'.'SDL3.dll'.'SDL_JoystickClose' +++'_SDL_GetKeyboardFocus'.'SDL3.dll'.'SDL_GetKeyboardFocus' +++'_SDL_GetKeyboardState'.'SDL3.dll'.'SDL_GetKeyboardState' +++'_SDL_GetModState'.'SDL3.dll'.'SDL_GetModState' +++'_SDL_SetModState'.'SDL3.dll'.'SDL_SetModState' +++'_SDL_GetKeyFromScancode'.'SDL3.dll'.'SDL_GetKeyFromScancode' +++'_SDL_GetScancodeFromKey'.'SDL3.dll'.'SDL_GetScancodeFromKey' +++'_SDL_GetScancodeName'.'SDL3.dll'.'SDL_GetScancodeName' +++'_SDL_GetScancodeFromName'.'SDL3.dll'.'SDL_GetScancodeFromName' +++'_SDL_GetKeyName'.'SDL3.dll'.'SDL_GetKeyName' +++'_SDL_GetKeyFromName'.'SDL3.dll'.'SDL_GetKeyFromName' +++'_SDL_StartTextInput'.'SDL3.dll'.'SDL_StartTextInput' +++'_SDL_IsTextInputActive'.'SDL3.dll'.'SDL_IsTextInputActive' +++'_SDL_StopTextInput'.'SDL3.dll'.'SDL_StopTextInput' +++'_SDL_SetTextInputRect'.'SDL3.dll'.'SDL_SetTextInputRect' +++'_SDL_HasScreenKeyboardSupport'.'SDL3.dll'.'SDL_HasScreenKeyboardSupport' +++'_SDL_IsScreenKeyboardShown'.'SDL3.dll'.'SDL_IsScreenKeyboardShown' +++'_SDL_LoadObject'.'SDL3.dll'.'SDL_LoadObject' +++'_SDL_LoadFunction'.'SDL3.dll'.'SDL_LoadFunction' +++'_SDL_UnloadObject'.'SDL3.dll'.'SDL_UnloadObject' +++'_SDL_LogSetAllPriority'.'SDL3.dll'.'SDL_LogSetAllPriority' +++'_SDL_LogSetPriority'.'SDL3.dll'.'SDL_LogSetPriority' +++'_SDL_LogGetPriority'.'SDL3.dll'.'SDL_LogGetPriority' +++'_SDL_LogResetPriorities'.'SDL3.dll'.'SDL_LogResetPriorities' +++'_SDL_LogMessageV'.'SDL3.dll'.'SDL_LogMessageV' +++'_SDL_LogGetOutputFunction'.'SDL3.dll'.'SDL_LogGetOutputFunction' +++'_SDL_LogSetOutputFunction'.'SDL3.dll'.'SDL_LogSetOutputFunction' +++'_SDL_SetMainReady'.'SDL3.dll'.'SDL_SetMainReady' +++'_SDL_ShowMessageBox'.'SDL3.dll'.'SDL_ShowMessageBox' +++'_SDL_ShowSimpleMessageBox'.'SDL3.dll'.'SDL_ShowSimpleMessageBox' +++'_SDL_GetMouseFocus'.'SDL3.dll'.'SDL_GetMouseFocus' +++'_SDL_GetMouseState'.'SDL3.dll'.'SDL_GetMouseState' +++'_SDL_GetRelativeMouseState'.'SDL3.dll'.'SDL_GetRelativeMouseState' +++'_SDL_WarpMouseInWindow'.'SDL3.dll'.'SDL_WarpMouseInWindow' +++'_SDL_SetRelativeMouseMode'.'SDL3.dll'.'SDL_SetRelativeMouseMode' +++'_SDL_GetRelativeMouseMode'.'SDL3.dll'.'SDL_GetRelativeMouseMode' +++'_SDL_CreateCursor'.'SDL3.dll'.'SDL_CreateCursor' +++'_SDL_CreateColorCursor'.'SDL3.dll'.'SDL_CreateColorCursor' +++'_SDL_CreateSystemCursor'.'SDL3.dll'.'SDL_CreateSystemCursor' +++'_SDL_SetCursor'.'SDL3.dll'.'SDL_SetCursor' +++'_SDL_GetCursor'.'SDL3.dll'.'SDL_GetCursor' +++'_SDL_GetDefaultCursor'.'SDL3.dll'.'SDL_GetDefaultCursor' +++'_SDL_FreeCursor'.'SDL3.dll'.'SDL_FreeCursor' +++'_SDL_ShowCursor'.'SDL3.dll'.'SDL_ShowCursor' +++'_SDL_CreateMutex'.'SDL3.dll'.'SDL_CreateMutex' +++'_SDL_LockMutex'.'SDL3.dll'.'SDL_LockMutex' +++'_SDL_TryLockMutex'.'SDL3.dll'.'SDL_TryLockMutex' +++'_SDL_UnlockMutex'.'SDL3.dll'.'SDL_UnlockMutex' +++'_SDL_DestroyMutex'.'SDL3.dll'.'SDL_DestroyMutex' +++'_SDL_CreateSemaphore'.'SDL3.dll'.'SDL_CreateSemaphore' +++'_SDL_DestroySemaphore'.'SDL3.dll'.'SDL_DestroySemaphore' +++'_SDL_SemWait'.'SDL3.dll'.'SDL_SemWait' +++'_SDL_SemTryWait'.'SDL3.dll'.'SDL_SemTryWait' +++'_SDL_SemWaitTimeout'.'SDL3.dll'.'SDL_SemWaitTimeout' +++'_SDL_SemPost'.'SDL3.dll'.'SDL_SemPost' +++'_SDL_SemValue'.'SDL3.dll'.'SDL_SemValue' +++'_SDL_CreateCond'.'SDL3.dll'.'SDL_CreateCond' +++'_SDL_DestroyCond'.'SDL3.dll'.'SDL_DestroyCond' +++'_SDL_CondSignal'.'SDL3.dll'.'SDL_CondSignal' +++'_SDL_CondBroadcast'.'SDL3.dll'.'SDL_CondBroadcast' +++'_SDL_CondWait'.'SDL3.dll'.'SDL_CondWait' +++'_SDL_CondWaitTimeout'.'SDL3.dll'.'SDL_CondWaitTimeout' +++'_SDL_GetPixelFormatName'.'SDL3.dll'.'SDL_GetPixelFormatName' +++'_SDL_PixelFormatEnumToMasks'.'SDL3.dll'.'SDL_PixelFormatEnumToMasks' +++'_SDL_MasksToPixelFormatEnum'.'SDL3.dll'.'SDL_MasksToPixelFormatEnum' +++'_SDL_AllocFormat'.'SDL3.dll'.'SDL_AllocFormat' +++'_SDL_FreeFormat'.'SDL3.dll'.'SDL_FreeFormat' +++'_SDL_AllocPalette'.'SDL3.dll'.'SDL_AllocPalette' +++'_SDL_SetPixelFormatPalette'.'SDL3.dll'.'SDL_SetPixelFormatPalette' +++'_SDL_SetPaletteColors'.'SDL3.dll'.'SDL_SetPaletteColors' +++'_SDL_FreePalette'.'SDL3.dll'.'SDL_FreePalette' +++'_SDL_MapRGB'.'SDL3.dll'.'SDL_MapRGB' +++'_SDL_MapRGBA'.'SDL3.dll'.'SDL_MapRGBA' +++'_SDL_GetRGB'.'SDL3.dll'.'SDL_GetRGB' +++'_SDL_GetRGBA'.'SDL3.dll'.'SDL_GetRGBA' +++'_SDL_CalculateGammaRamp'.'SDL3.dll'.'SDL_CalculateGammaRamp' +++'_SDL_GetPlatform'.'SDL3.dll'.'SDL_GetPlatform' +++'_SDL_GetPowerInfo'.'SDL3.dll'.'SDL_GetPowerInfo' +++'_SDL_HasIntersection'.'SDL3.dll'.'SDL_HasIntersection' +++'_SDL_IntersectRect'.'SDL3.dll'.'SDL_IntersectRect' +++'_SDL_UnionRect'.'SDL3.dll'.'SDL_UnionRect' +++'_SDL_EnclosePoints'.'SDL3.dll'.'SDL_EnclosePoints' +++'_SDL_IntersectRectAndLine'.'SDL3.dll'.'SDL_IntersectRectAndLine' +++'_SDL_GetNumRenderDrivers'.'SDL3.dll'.'SDL_GetNumRenderDrivers' +++'_SDL_GetRenderDriverInfo'.'SDL3.dll'.'SDL_GetRenderDriverInfo' +++'_SDL_CreateWindowAndRenderer'.'SDL3.dll'.'SDL_CreateWindowAndRenderer' +++'_SDL_CreateRenderer'.'SDL3.dll'.'SDL_CreateRenderer' +++'_SDL_CreateSoftwareRenderer'.'SDL3.dll'.'SDL_CreateSoftwareRenderer' +++'_SDL_GetRenderer'.'SDL3.dll'.'SDL_GetRenderer' +++'_SDL_GetRendererInfo'.'SDL3.dll'.'SDL_GetRendererInfo' +++'_SDL_GetRendererOutputSize'.'SDL3.dll'.'SDL_GetRendererOutputSize' +++'_SDL_CreateTexture'.'SDL3.dll'.'SDL_CreateTexture' +++'_SDL_CreateTextureFromSurface'.'SDL3.dll'.'SDL_CreateTextureFromSurface' +++'_SDL_QueryTexture'.'SDL3.dll'.'SDL_QueryTexture' +++'_SDL_SetTextureColorMod'.'SDL3.dll'.'SDL_SetTextureColorMod' +++'_SDL_GetTextureColorMod'.'SDL3.dll'.'SDL_GetTextureColorMod' +++'_SDL_SetTextureAlphaMod'.'SDL3.dll'.'SDL_SetTextureAlphaMod' +++'_SDL_GetTextureAlphaMod'.'SDL3.dll'.'SDL_GetTextureAlphaMod' +++'_SDL_SetTextureBlendMode'.'SDL3.dll'.'SDL_SetTextureBlendMode' +++'_SDL_GetTextureBlendMode'.'SDL3.dll'.'SDL_GetTextureBlendMode' +++'_SDL_UpdateTexture'.'SDL3.dll'.'SDL_UpdateTexture' +++'_SDL_UpdateYUVTexture'.'SDL3.dll'.'SDL_UpdateYUVTexture' +++'_SDL_LockTexture'.'SDL3.dll'.'SDL_LockTexture' +++'_SDL_UnlockTexture'.'SDL3.dll'.'SDL_UnlockTexture' +++'_SDL_RenderTargetSupported'.'SDL3.dll'.'SDL_RenderTargetSupported' +++'_SDL_SetRenderTarget'.'SDL3.dll'.'SDL_SetRenderTarget' +++'_SDL_GetRenderTarget'.'SDL3.dll'.'SDL_GetRenderTarget' +++'_SDL_RenderSetLogicalSize'.'SDL3.dll'.'SDL_RenderSetLogicalSize' +++'_SDL_RenderGetLogicalSize'.'SDL3.dll'.'SDL_RenderGetLogicalSize' +++'_SDL_RenderSetViewport'.'SDL3.dll'.'SDL_RenderSetViewport' +++'_SDL_RenderGetViewport'.'SDL3.dll'.'SDL_RenderGetViewport' +++'_SDL_RenderSetClipRect'.'SDL3.dll'.'SDL_RenderSetClipRect' +++'_SDL_RenderGetClipRect'.'SDL3.dll'.'SDL_RenderGetClipRect' +++'_SDL_RenderSetScale'.'SDL3.dll'.'SDL_RenderSetScale' +++'_SDL_RenderGetScale'.'SDL3.dll'.'SDL_RenderGetScale' +++'_SDL_SetRenderDrawColor'.'SDL3.dll'.'SDL_SetRenderDrawColor' +++'_SDL_GetRenderDrawColor'.'SDL3.dll'.'SDL_GetRenderDrawColor' +++'_SDL_SetRenderDrawBlendMode'.'SDL3.dll'.'SDL_SetRenderDrawBlendMode' +++'_SDL_GetRenderDrawBlendMode'.'SDL3.dll'.'SDL_GetRenderDrawBlendMode' +++'_SDL_RenderClear'.'SDL3.dll'.'SDL_RenderClear' +++'_SDL_RenderDrawPoint'.'SDL3.dll'.'SDL_RenderDrawPoint' +++'_SDL_RenderDrawPoints'.'SDL3.dll'.'SDL_RenderDrawPoints' +++'_SDL_RenderDrawLine'.'SDL3.dll'.'SDL_RenderDrawLine' +++'_SDL_RenderDrawLines'.'SDL3.dll'.'SDL_RenderDrawLines' +++'_SDL_RenderDrawRect'.'SDL3.dll'.'SDL_RenderDrawRect' +++'_SDL_RenderDrawRects'.'SDL3.dll'.'SDL_RenderDrawRects' +++'_SDL_RenderFillRect'.'SDL3.dll'.'SDL_RenderFillRect' +++'_SDL_RenderFillRects'.'SDL3.dll'.'SDL_RenderFillRects' +++'_SDL_RenderCopy'.'SDL3.dll'.'SDL_RenderCopy' +++'_SDL_RenderCopyEx'.'SDL3.dll'.'SDL_RenderCopyEx' +++'_SDL_RenderReadPixels'.'SDL3.dll'.'SDL_RenderReadPixels' +++'_SDL_RenderPresent'.'SDL3.dll'.'SDL_RenderPresent' +++'_SDL_DestroyTexture'.'SDL3.dll'.'SDL_DestroyTexture' +++'_SDL_DestroyRenderer'.'SDL3.dll'.'SDL_DestroyRenderer' +++'_SDL_GL_BindTexture'.'SDL3.dll'.'SDL_GL_BindTexture' +++'_SDL_GL_UnbindTexture'.'SDL3.dll'.'SDL_GL_UnbindTexture' +++'_SDL_RWFromFile'.'SDL3.dll'.'SDL_RWFromFile' +++'_SDL_RWFromMem'.'SDL3.dll'.'SDL_RWFromMem' +++'_SDL_RWFromConstMem'.'SDL3.dll'.'SDL_RWFromConstMem' +++'_SDL_AllocRW'.'SDL3.dll'.'SDL_AllocRW' +++'_SDL_FreeRW'.'SDL3.dll'.'SDL_FreeRW' +++'_SDL_ReadU8'.'SDL3.dll'.'SDL_ReadU8' +++'_SDL_ReadLE16'.'SDL3.dll'.'SDL_ReadLE16' +++'_SDL_ReadBE16'.'SDL3.dll'.'SDL_ReadBE16' +++'_SDL_ReadLE32'.'SDL3.dll'.'SDL_ReadLE32' +++'_SDL_ReadBE32'.'SDL3.dll'.'SDL_ReadBE32' +++'_SDL_ReadLE64'.'SDL3.dll'.'SDL_ReadLE64' +++'_SDL_ReadBE64'.'SDL3.dll'.'SDL_ReadBE64' +++'_SDL_WriteU8'.'SDL3.dll'.'SDL_WriteU8' +++'_SDL_WriteLE16'.'SDL3.dll'.'SDL_WriteLE16' +++'_SDL_WriteBE16'.'SDL3.dll'.'SDL_WriteBE16' +++'_SDL_WriteLE32'.'SDL3.dll'.'SDL_WriteLE32' +++'_SDL_WriteBE32'.'SDL3.dll'.'SDL_WriteBE32' +++'_SDL_WriteLE64'.'SDL3.dll'.'SDL_WriteLE64' +++'_SDL_WriteBE64'.'SDL3.dll'.'SDL_WriteBE64' +++'_SDL_CreateShapedWindow'.'SDL3.dll'.'SDL_CreateShapedWindow' +++'_SDL_IsShapedWindow'.'SDL3.dll'.'SDL_IsShapedWindow' +++'_SDL_SetWindowShape'.'SDL3.dll'.'SDL_SetWindowShape' +++'_SDL_GetShapedWindowMode'.'SDL3.dll'.'SDL_GetShapedWindowMode' +++'_SDL_malloc'.'SDL3.dll'.'SDL_malloc' +++'_SDL_calloc'.'SDL3.dll'.'SDL_calloc' +++'_SDL_realloc'.'SDL3.dll'.'SDL_realloc' +++'_SDL_free'.'SDL3.dll'.'SDL_free' +++'_SDL_getenv'.'SDL3.dll'.'SDL_getenv' +++'_SDL_setenv'.'SDL3.dll'.'SDL_setenv' +++'_SDL_qsort'.'SDL3.dll'.'SDL_qsort' +++'_SDL_abs'.'SDL3.dll'.'SDL_abs' +++'_SDL_isdigit'.'SDL3.dll'.'SDL_isdigit' +++'_SDL_isspace'.'SDL3.dll'.'SDL_isspace' +++'_SDL_toupper'.'SDL3.dll'.'SDL_toupper' +++'_SDL_tolower'.'SDL3.dll'.'SDL_tolower' +++'_SDL_memset'.'SDL3.dll'.'SDL_memset' +++'_SDL_memcpy'.'SDL3.dll'.'SDL_memcpy' +++'_SDL_memmove'.'SDL3.dll'.'SDL_memmove' +++'_SDL_memcmp'.'SDL3.dll'.'SDL_memcmp' +++'_SDL_wcslen'.'SDL3.dll'.'SDL_wcslen' +++'_SDL_wcslcpy'.'SDL3.dll'.'SDL_wcslcpy' +++'_SDL_wcslcat'.'SDL3.dll'.'SDL_wcslcat' +++'_SDL_strlen'.'SDL3.dll'.'SDL_strlen' +++'_SDL_strlcpy'.'SDL3.dll'.'SDL_strlcpy' +++'_SDL_utf8strlcpy'.'SDL3.dll'.'SDL_utf8strlcpy' +++'_SDL_strlcat'.'SDL3.dll'.'SDL_strlcat' +++'_SDL_strdup'.'SDL3.dll'.'SDL_strdup' +++'_SDL_strrev'.'SDL3.dll'.'SDL_strrev' +++'_SDL_strupr'.'SDL3.dll'.'SDL_strupr' +++'_SDL_strlwr'.'SDL3.dll'.'SDL_strlwr' +++'_SDL_strchr'.'SDL3.dll'.'SDL_strchr' +++'_SDL_strrchr'.'SDL3.dll'.'SDL_strrchr' +++'_SDL_strstr'.'SDL3.dll'.'SDL_strstr' +++'_SDL_itoa'.'SDL3.dll'.'SDL_itoa' +++'_SDL_uitoa'.'SDL3.dll'.'SDL_uitoa' +++'_SDL_ltoa'.'SDL3.dll'.'SDL_ltoa' +++'_SDL_ultoa'.'SDL3.dll'.'SDL_ultoa' +++'_SDL_lltoa'.'SDL3.dll'.'SDL_lltoa' +++'_SDL_ulltoa'.'SDL3.dll'.'SDL_ulltoa' +++'_SDL_atoi'.'SDL3.dll'.'SDL_atoi' +++'_SDL_atof'.'SDL3.dll'.'SDL_atof' +++'_SDL_strtol'.'SDL3.dll'.'SDL_strtol' +++'_SDL_strtoul'.'SDL3.dll'.'SDL_strtoul' +++'_SDL_strtoll'.'SDL3.dll'.'SDL_strtoll' +++'_SDL_strtoull'.'SDL3.dll'.'SDL_strtoull' +++'_SDL_strtod'.'SDL3.dll'.'SDL_strtod' +++'_SDL_strcmp'.'SDL3.dll'.'SDL_strcmp' +++'_SDL_strncmp'.'SDL3.dll'.'SDL_strncmp' +++'_SDL_strcasecmp'.'SDL3.dll'.'SDL_strcasecmp' +++'_SDL_strncasecmp'.'SDL3.dll'.'SDL_strncasecmp' +++'_SDL_vsnprintf'.'SDL3.dll'.'SDL_vsnprintf' +++'_SDL_acos'.'SDL3.dll'.'SDL_acos' +++'_SDL_asin'.'SDL3.dll'.'SDL_asin' +++'_SDL_atan'.'SDL3.dll'.'SDL_atan' +++'_SDL_atan2'.'SDL3.dll'.'SDL_atan2' +++'_SDL_ceil'.'SDL3.dll'.'SDL_ceil' +++'_SDL_copysign'.'SDL3.dll'.'SDL_copysign' +++'_SDL_cos'.'SDL3.dll'.'SDL_cos' +++'_SDL_cosf'.'SDL3.dll'.'SDL_cosf' +++'_SDL_fabs'.'SDL3.dll'.'SDL_fabs' +++'_SDL_floor'.'SDL3.dll'.'SDL_floor' +++'_SDL_log'.'SDL3.dll'.'SDL_log' +++'_SDL_pow'.'SDL3.dll'.'SDL_pow' +++'_SDL_scalbn'.'SDL3.dll'.'SDL_scalbn' +++'_SDL_sin'.'SDL3.dll'.'SDL_sin' +++'_SDL_sinf'.'SDL3.dll'.'SDL_sinf' +++'_SDL_sqrt'.'SDL3.dll'.'SDL_sqrt' +++'_SDL_iconv_open'.'SDL3.dll'.'SDL_iconv_open' +++'_SDL_iconv_close'.'SDL3.dll'.'SDL_iconv_close' +++'_SDL_iconv'.'SDL3.dll'.'SDL_iconv' +++'_SDL_iconv_string'.'SDL3.dll'.'SDL_iconv_string' +++'_SDL_CreateRGBSurface'.'SDL3.dll'.'SDL_CreateRGBSurface' +++'_SDL_CreateRGBSurfaceFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceFrom' +++'_SDL_FreeSurface'.'SDL3.dll'.'SDL_FreeSurface' +++'_SDL_SetSurfacePalette'.'SDL3.dll'.'SDL_SetSurfacePalette' +++'_SDL_LockSurface'.'SDL3.dll'.'SDL_LockSurface' +++'_SDL_UnlockSurface'.'SDL3.dll'.'SDL_UnlockSurface' +++'_SDL_LoadBMP_RW'.'SDL3.dll'.'SDL_LoadBMP_RW' +++'_SDL_SaveBMP_RW'.'SDL3.dll'.'SDL_SaveBMP_RW' +++'_SDL_SetSurfaceRLE'.'SDL3.dll'.'SDL_SetSurfaceRLE' +++'_SDL_SetColorKey'.'SDL3.dll'.'SDL_SetColorKey' +++'_SDL_GetColorKey'.'SDL3.dll'.'SDL_GetColorKey' +++'_SDL_SetSurfaceColorMod'.'SDL3.dll'.'SDL_SetSurfaceColorMod' +++'_SDL_GetSurfaceColorMod'.'SDL3.dll'.'SDL_GetSurfaceColorMod' +++'_SDL_SetSurfaceAlphaMod'.'SDL3.dll'.'SDL_SetSurfaceAlphaMod' +++'_SDL_GetSurfaceAlphaMod'.'SDL3.dll'.'SDL_GetSurfaceAlphaMod' +++'_SDL_SetSurfaceBlendMode'.'SDL3.dll'.'SDL_SetSurfaceBlendMode' +++'_SDL_GetSurfaceBlendMode'.'SDL3.dll'.'SDL_GetSurfaceBlendMode' +++'_SDL_SetClipRect'.'SDL3.dll'.'SDL_SetClipRect' +++'_SDL_GetClipRect'.'SDL3.dll'.'SDL_GetClipRect' +++'_SDL_ConvertSurface'.'SDL3.dll'.'SDL_ConvertSurface' +++'_SDL_ConvertSurfaceFormat'.'SDL3.dll'.'SDL_ConvertSurfaceFormat' +++'_SDL_ConvertPixels'.'SDL3.dll'.'SDL_ConvertPixels' +++'_SDL_FillRect'.'SDL3.dll'.'SDL_FillRect' +++'_SDL_FillRects'.'SDL3.dll'.'SDL_FillRects' +++'_SDL_UpperBlit'.'SDL3.dll'.'SDL_UpperBlit' +++'_SDL_LowerBlit'.'SDL3.dll'.'SDL_LowerBlit' +++'_SDL_SoftStretch'.'SDL3.dll'.'SDL_SoftStretch' +++'_SDL_UpperBlitScaled'.'SDL3.dll'.'SDL_UpperBlitScaled' +++'_SDL_LowerBlitScaled'.'SDL3.dll'.'SDL_LowerBlitScaled' +++'_SDL_GetWindowWMInfo'.'SDL3.dll'.'SDL_GetWindowWMInfo' +++'_SDL_GetThreadName'.'SDL3.dll'.'SDL_GetThreadName' +++'_SDL_ThreadID'.'SDL3.dll'.'SDL_ThreadID' +++'_SDL_GetThreadID'.'SDL3.dll'.'SDL_GetThreadID' +++'_SDL_SetThreadPriority'.'SDL3.dll'.'SDL_SetThreadPriority' +++'_SDL_WaitThread'.'SDL3.dll'.'SDL_WaitThread' +++'_SDL_DetachThread'.'SDL3.dll'.'SDL_DetachThread' +++'_SDL_TLSCreate'.'SDL3.dll'.'SDL_TLSCreate' +++'_SDL_TLSGet'.'SDL3.dll'.'SDL_TLSGet' +++'_SDL_TLSSet'.'SDL3.dll'.'SDL_TLSSet' +++'_SDL_GetTicks'.'SDL3.dll'.'SDL_GetTicks' +++'_SDL_GetPerformanceCounter'.'SDL3.dll'.'SDL_GetPerformanceCounter' +++'_SDL_GetPerformanceFrequency'.'SDL3.dll'.'SDL_GetPerformanceFrequency' +++'_SDL_Delay'.'SDL3.dll'.'SDL_Delay' +++'_SDL_AddTimer'.'SDL3.dll'.'SDL_AddTimer' +++'_SDL_RemoveTimer'.'SDL3.dll'.'SDL_RemoveTimer' +++'_SDL_GetNumTouchDevices'.'SDL3.dll'.'SDL_GetNumTouchDevices' +++'_SDL_GetTouchDevice'.'SDL3.dll'.'SDL_GetTouchDevice' +++'_SDL_GetNumTouchFingers'.'SDL3.dll'.'SDL_GetNumTouchFingers' +++'_SDL_GetTouchFinger'.'SDL3.dll'.'SDL_GetTouchFinger' +++'_SDL_GetVersion'.'SDL3.dll'.'SDL_GetVersion' +++'_SDL_GetRevision'.'SDL3.dll'.'SDL_GetRevision' +++'_SDL_GetRevisionNumber'.'SDL3.dll'.'SDL_GetRevisionNumber' +++'_SDL_GetNumVideoDrivers'.'SDL3.dll'.'SDL_GetNumVideoDrivers' +++'_SDL_GetVideoDriver'.'SDL3.dll'.'SDL_GetVideoDriver' +++'_SDL_VideoInit'.'SDL3.dll'.'SDL_VideoInit' +++'_SDL_VideoQuit'.'SDL3.dll'.'SDL_VideoQuit' +++'_SDL_GetCurrentVideoDriver'.'SDL3.dll'.'SDL_GetCurrentVideoDriver' +++'_SDL_GetNumVideoDisplays'.'SDL3.dll'.'SDL_GetNumVideoDisplays' +++'_SDL_GetDisplayName'.'SDL3.dll'.'SDL_GetDisplayName' +++'_SDL_GetDisplayBounds'.'SDL3.dll'.'SDL_GetDisplayBounds' +++'_SDL_GetDisplayDPI'.'SDL3.dll'.'SDL_GetDisplayDPI' +++'_SDL_GetNumDisplayModes'.'SDL3.dll'.'SDL_GetNumDisplayModes' +++'_SDL_GetDisplayMode'.'SDL3.dll'.'SDL_GetDisplayMode' +++'_SDL_GetDesktopDisplayMode'.'SDL3.dll'.'SDL_GetDesktopDisplayMode' +++'_SDL_GetCurrentDisplayMode'.'SDL3.dll'.'SDL_GetCurrentDisplayMode' +++'_SDL_GetClosestDisplayMode'.'SDL3.dll'.'SDL_GetClosestDisplayMode' +++'_SDL_GetWindowDisplayIndex'.'SDL3.dll'.'SDL_GetWindowDisplayIndex' +++'_SDL_SetWindowDisplayMode'.'SDL3.dll'.'SDL_SetWindowDisplayMode' +++'_SDL_GetWindowDisplayMode'.'SDL3.dll'.'SDL_GetWindowDisplayMode' +++'_SDL_GetWindowPixelFormat'.'SDL3.dll'.'SDL_GetWindowPixelFormat' +++'_SDL_CreateWindow'.'SDL3.dll'.'SDL_CreateWindow' +++'_SDL_CreateWindowFrom'.'SDL3.dll'.'SDL_CreateWindowFrom' +++'_SDL_GetWindowID'.'SDL3.dll'.'SDL_GetWindowID' +++'_SDL_GetWindowFromID'.'SDL3.dll'.'SDL_GetWindowFromID' +++'_SDL_GetWindowFlags'.'SDL3.dll'.'SDL_GetWindowFlags' +++'_SDL_SetWindowTitle'.'SDL3.dll'.'SDL_SetWindowTitle' +++'_SDL_GetWindowTitle'.'SDL3.dll'.'SDL_GetWindowTitle' +++'_SDL_SetWindowIcon'.'SDL3.dll'.'SDL_SetWindowIcon' +++'_SDL_SetWindowData'.'SDL3.dll'.'SDL_SetWindowData' +++'_SDL_GetWindowData'.'SDL3.dll'.'SDL_GetWindowData' +++'_SDL_SetWindowPosition'.'SDL3.dll'.'SDL_SetWindowPosition' +++'_SDL_GetWindowPosition'.'SDL3.dll'.'SDL_GetWindowPosition' +++'_SDL_SetWindowSize'.'SDL3.dll'.'SDL_SetWindowSize' +++'_SDL_GetWindowSize'.'SDL3.dll'.'SDL_GetWindowSize' +++'_SDL_SetWindowMinimumSize'.'SDL3.dll'.'SDL_SetWindowMinimumSize' +++'_SDL_GetWindowMinimumSize'.'SDL3.dll'.'SDL_GetWindowMinimumSize' +++'_SDL_SetWindowMaximumSize'.'SDL3.dll'.'SDL_SetWindowMaximumSize' +++'_SDL_GetWindowMaximumSize'.'SDL3.dll'.'SDL_GetWindowMaximumSize' +++'_SDL_SetWindowBordered'.'SDL3.dll'.'SDL_SetWindowBordered' +++'_SDL_ShowWindow'.'SDL3.dll'.'SDL_ShowWindow' +++'_SDL_HideWindow'.'SDL3.dll'.'SDL_HideWindow' +++'_SDL_RaiseWindow'.'SDL3.dll'.'SDL_RaiseWindow' +++'_SDL_MaximizeWindow'.'SDL3.dll'.'SDL_MaximizeWindow' +++'_SDL_MinimizeWindow'.'SDL3.dll'.'SDL_MinimizeWindow' +++'_SDL_RestoreWindow'.'SDL3.dll'.'SDL_RestoreWindow' +++'_SDL_SetWindowFullscreen'.'SDL3.dll'.'SDL_SetWindowFullscreen' +++'_SDL_GetWindowSurface'.'SDL3.dll'.'SDL_GetWindowSurface' +++'_SDL_UpdateWindowSurface'.'SDL3.dll'.'SDL_UpdateWindowSurface' +++'_SDL_UpdateWindowSurfaceRects'.'SDL3.dll'.'SDL_UpdateWindowSurfaceRects' +++'_SDL_SetWindowGrab'.'SDL3.dll'.'SDL_SetWindowGrab' +++'_SDL_GetWindowGrab'.'SDL3.dll'.'SDL_GetWindowGrab' +++'_SDL_SetWindowBrightness'.'SDL3.dll'.'SDL_SetWindowBrightness' +++'_SDL_GetWindowBrightness'.'SDL3.dll'.'SDL_GetWindowBrightness' +++'_SDL_SetWindowGammaRamp'.'SDL3.dll'.'SDL_SetWindowGammaRamp' +++'_SDL_GetWindowGammaRamp'.'SDL3.dll'.'SDL_GetWindowGammaRamp' +++'_SDL_DestroyWindow'.'SDL3.dll'.'SDL_DestroyWindow' +++'_SDL_IsScreenSaverEnabled'.'SDL3.dll'.'SDL_IsScreenSaverEnabled' +++'_SDL_EnableScreenSaver'.'SDL3.dll'.'SDL_EnableScreenSaver' +++'_SDL_DisableScreenSaver'.'SDL3.dll'.'SDL_DisableScreenSaver' +++'_SDL_GL_LoadLibrary'.'SDL3.dll'.'SDL_GL_LoadLibrary' +++'_SDL_GL_GetProcAddress'.'SDL3.dll'.'SDL_GL_GetProcAddress' +++'_SDL_GL_UnloadLibrary'.'SDL3.dll'.'SDL_GL_UnloadLibrary' +++'_SDL_GL_ExtensionSupported'.'SDL3.dll'.'SDL_GL_ExtensionSupported' +++'_SDL_GL_SetAttribute'.'SDL3.dll'.'SDL_GL_SetAttribute' +++'_SDL_GL_GetAttribute'.'SDL3.dll'.'SDL_GL_GetAttribute' +++'_SDL_GL_CreateContext'.'SDL3.dll'.'SDL_GL_CreateContext' +++'_SDL_GL_MakeCurrent'.'SDL3.dll'.'SDL_GL_MakeCurrent' +++'_SDL_GL_GetCurrentWindow'.'SDL3.dll'.'SDL_GL_GetCurrentWindow' +++'_SDL_GL_GetCurrentContext'.'SDL3.dll'.'SDL_GL_GetCurrentContext' +++'_SDL_GL_GetDrawableSize'.'SDL3.dll'.'SDL_GL_GetDrawableSize' +++'_SDL_GL_SetSwapInterval'.'SDL3.dll'.'SDL_GL_SetSwapInterval' +++'_SDL_GL_GetSwapInterval'.'SDL3.dll'.'SDL_GL_GetSwapInterval' +++'_SDL_GL_SwapWindow'.'SDL3.dll'.'SDL_GL_SwapWindow' +++'_SDL_GL_DeleteContext'.'SDL3.dll'.'SDL_GL_DeleteContext' +++'_SDL_vsscanf'.'SDL3.dll'.'SDL_vsscanf' +++'_SDL_GameControllerAddMappingsFromRW'.'SDL3.dll'.'SDL_GameControllerAddMappingsFromRW' +++'_SDL_GL_ResetAttributes'.'SDL3.dll'.'SDL_GL_ResetAttributes' +++'_SDL_HasAVX'.'SDL3.dll'.'SDL_HasAVX' +++'_SDL_GetDefaultAssertionHandler'.'SDL3.dll'.'SDL_GetDefaultAssertionHandler' +++'_SDL_GetAssertionHandler'.'SDL3.dll'.'SDL_GetAssertionHandler' +++'_SDL_DXGIGetOutputInfo'.'SDL3.dll'.'SDL_DXGIGetOutputInfo' +++'_SDL_RenderIsClipEnabled'.'SDL3.dll'.'SDL_RenderIsClipEnabled' +# ++'_SDL_WinRTRunApp'.'SDL3.dll'.'SDL_WinRTRunApp' +++'_SDL_WarpMouseGlobal'.'SDL3.dll'.'SDL_WarpMouseGlobal' +# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL3.dll'.'SDL_WinRTGetFSPathUNICODE' +# ++'_SDL_WinRTGetFSPathUTF8'.'SDL3.dll'.'SDL_WinRTGetFSPathUTF8' +++'_SDL_sqrtf'.'SDL3.dll'.'SDL_sqrtf' +++'_SDL_tan'.'SDL3.dll'.'SDL_tan' +++'_SDL_tanf'.'SDL3.dll'.'SDL_tanf' +++'_SDL_CaptureMouse'.'SDL3.dll'.'SDL_CaptureMouse' +++'_SDL_SetWindowHitTest'.'SDL3.dll'.'SDL_SetWindowHitTest' +++'_SDL_GetGlobalMouseState'.'SDL3.dll'.'SDL_GetGlobalMouseState' +++'_SDL_HasAVX2'.'SDL3.dll'.'SDL_HasAVX2' +++'_SDL_QueueAudio'.'SDL3.dll'.'SDL_QueueAudio' +++'_SDL_GetQueuedAudioSize'.'SDL3.dll'.'SDL_GetQueuedAudioSize' +++'_SDL_ClearQueuedAudio'.'SDL3.dll'.'SDL_ClearQueuedAudio' +++'_SDL_GetGrabbedWindow'.'SDL3.dll'.'SDL_GetGrabbedWindow' +++'_SDL_SetWindowsMessageHook'.'SDL3.dll'.'SDL_SetWindowsMessageHook' +++'_SDL_JoystickCurrentPowerLevel'.'SDL3.dll'.'SDL_JoystickCurrentPowerLevel' +++'_SDL_GameControllerFromInstanceID'.'SDL3.dll'.'SDL_GameControllerFromInstanceID' +++'_SDL_JoystickFromInstanceID'.'SDL3.dll'.'SDL_JoystickFromInstanceID' +++'_SDL_GetDisplayUsableBounds'.'SDL3.dll'.'SDL_GetDisplayUsableBounds' +++'_SDL_GetWindowBordersSize'.'SDL3.dll'.'SDL_GetWindowBordersSize' +++'_SDL_SetWindowOpacity'.'SDL3.dll'.'SDL_SetWindowOpacity' +++'_SDL_GetWindowOpacity'.'SDL3.dll'.'SDL_GetWindowOpacity' +++'_SDL_SetWindowInputFocus'.'SDL3.dll'.'SDL_SetWindowInputFocus' +++'_SDL_SetWindowModalFor'.'SDL3.dll'.'SDL_SetWindowModalFor' +++'_SDL_RenderSetIntegerScale'.'SDL3.dll'.'SDL_RenderSetIntegerScale' +++'_SDL_RenderGetIntegerScale'.'SDL3.dll'.'SDL_RenderGetIntegerScale' +++'_SDL_DequeueAudio'.'SDL3.dll'.'SDL_DequeueAudio' +++'_SDL_SetWindowResizable'.'SDL3.dll'.'SDL_SetWindowResizable' +++'_SDL_CreateRGBSurfaceWithFormat'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormat' +++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormatFrom' +++'_SDL_GetHintBoolean'.'SDL3.dll'.'SDL_GetHintBoolean' +++'_SDL_JoystickGetDeviceVendor'.'SDL3.dll'.'SDL_JoystickGetDeviceVendor' +++'_SDL_JoystickGetDeviceProduct'.'SDL3.dll'.'SDL_JoystickGetDeviceProduct' +++'_SDL_JoystickGetDeviceProductVersion'.'SDL3.dll'.'SDL_JoystickGetDeviceProductVersion' +++'_SDL_JoystickGetVendor'.'SDL3.dll'.'SDL_JoystickGetVendor' +++'_SDL_JoystickGetProduct'.'SDL3.dll'.'SDL_JoystickGetProduct' +++'_SDL_JoystickGetProductVersion'.'SDL3.dll'.'SDL_JoystickGetProductVersion' +++'_SDL_GameControllerGetVendor'.'SDL3.dll'.'SDL_GameControllerGetVendor' +++'_SDL_GameControllerGetProduct'.'SDL3.dll'.'SDL_GameControllerGetProduct' +++'_SDL_GameControllerGetProductVersion'.'SDL3.dll'.'SDL_GameControllerGetProductVersion' +++'_SDL_HasNEON'.'SDL3.dll'.'SDL_HasNEON' +++'_SDL_GameControllerNumMappings'.'SDL3.dll'.'SDL_GameControllerNumMappings' +++'_SDL_GameControllerMappingForIndex'.'SDL3.dll'.'SDL_GameControllerMappingForIndex' +++'_SDL_JoystickGetAxisInitialState'.'SDL3.dll'.'SDL_JoystickGetAxisInitialState' +++'_SDL_JoystickGetDeviceType'.'SDL3.dll'.'SDL_JoystickGetDeviceType' +++'_SDL_JoystickGetType'.'SDL3.dll'.'SDL_JoystickGetType' +++'_SDL_MemoryBarrierReleaseFunction'.'SDL3.dll'.'SDL_MemoryBarrierReleaseFunction' +++'_SDL_MemoryBarrierAcquireFunction'.'SDL3.dll'.'SDL_MemoryBarrierAcquireFunction' +++'_SDL_JoystickGetDeviceInstanceID'.'SDL3.dll'.'SDL_JoystickGetDeviceInstanceID' +++'_SDL_utf8strlen'.'SDL3.dll'.'SDL_utf8strlen' +++'_SDL_LoadFile_RW'.'SDL3.dll'.'SDL_LoadFile_RW' +++'_SDL_wcscmp'.'SDL3.dll'.'SDL_wcscmp' +++'_SDL_ComposeCustomBlendMode'.'SDL3.dll'.'SDL_ComposeCustomBlendMode' +++'_SDL_DuplicateSurface'.'SDL3.dll'.'SDL_DuplicateSurface' +++'_SDL_Vulkan_LoadLibrary'.'SDL3.dll'.'SDL_Vulkan_LoadLibrary' +++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL3.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr' +++'_SDL_Vulkan_UnloadLibrary'.'SDL3.dll'.'SDL_Vulkan_UnloadLibrary' +++'_SDL_Vulkan_GetInstanceExtensions'.'SDL3.dll'.'SDL_Vulkan_GetInstanceExtensions' +++'_SDL_Vulkan_CreateSurface'.'SDL3.dll'.'SDL_Vulkan_CreateSurface' +++'_SDL_Vulkan_GetDrawableSize'.'SDL3.dll'.'SDL_Vulkan_GetDrawableSize' +++'_SDL_LockJoysticks'.'SDL3.dll'.'SDL_LockJoysticks' +++'_SDL_UnlockJoysticks'.'SDL3.dll'.'SDL_UnlockJoysticks' +++'_SDL_GetMemoryFunctions'.'SDL3.dll'.'SDL_GetMemoryFunctions' +++'_SDL_SetMemoryFunctions'.'SDL3.dll'.'SDL_SetMemoryFunctions' +++'_SDL_GetNumAllocations'.'SDL3.dll'.'SDL_GetNumAllocations' +++'_SDL_NewAudioStream'.'SDL3.dll'.'SDL_NewAudioStream' +++'_SDL_AudioStreamPut'.'SDL3.dll'.'SDL_AudioStreamPut' +++'_SDL_AudioStreamGet'.'SDL3.dll'.'SDL_AudioStreamGet' +++'_SDL_AudioStreamClear'.'SDL3.dll'.'SDL_AudioStreamClear' +++'_SDL_AudioStreamAvailable'.'SDL3.dll'.'SDL_AudioStreamAvailable' +++'_SDL_FreeAudioStream'.'SDL3.dll'.'SDL_FreeAudioStream' +++'_SDL_AudioStreamFlush'.'SDL3.dll'.'SDL_AudioStreamFlush' +++'_SDL_acosf'.'SDL3.dll'.'SDL_acosf' +++'_SDL_asinf'.'SDL3.dll'.'SDL_asinf' +++'_SDL_atanf'.'SDL3.dll'.'SDL_atanf' +++'_SDL_atan2f'.'SDL3.dll'.'SDL_atan2f' +++'_SDL_ceilf'.'SDL3.dll'.'SDL_ceilf' +++'_SDL_copysignf'.'SDL3.dll'.'SDL_copysignf' +++'_SDL_fabsf'.'SDL3.dll'.'SDL_fabsf' +++'_SDL_floorf'.'SDL3.dll'.'SDL_floorf' +++'_SDL_logf'.'SDL3.dll'.'SDL_logf' +++'_SDL_powf'.'SDL3.dll'.'SDL_powf' +++'_SDL_scalbnf'.'SDL3.dll'.'SDL_scalbnf' +++'_SDL_fmod'.'SDL3.dll'.'SDL_fmod' +++'_SDL_fmodf'.'SDL3.dll'.'SDL_fmodf' +++'_SDL_SetYUVConversionMode'.'SDL3.dll'.'SDL_SetYUVConversionMode' +++'_SDL_GetYUVConversionMode'.'SDL3.dll'.'SDL_GetYUVConversionMode' +++'_SDL_GetYUVConversionModeForResolution'.'SDL3.dll'.'SDL_GetYUVConversionModeForResolution' +++'_SDL_RenderGetMetalLayer'.'SDL3.dll'.'SDL_RenderGetMetalLayer' +++'_SDL_RenderGetMetalCommandEncoder'.'SDL3.dll'.'SDL_RenderGetMetalCommandEncoder' +# ++'_SDL_IsAndroidTV'.'SDL3.dll'.'SDL_IsAndroidTV' +# ++'_SDL_WinRTGetDeviceFamily'.'SDL3.dll'.'SDL_WinRTGetDeviceFamily' +++'_SDL_log10'.'SDL3.dll'.'SDL_log10' +++'_SDL_log10f'.'SDL3.dll'.'SDL_log10f' +++'_SDL_GameControllerMappingForDeviceIndex'.'SDL3.dll'.'SDL_GameControllerMappingForDeviceIndex' +# ++'_SDL_LinuxSetThreadPriority'.'SDL3.dll'.'SDL_LinuxSetThreadPriority' +++'_SDL_HasAVX512F'.'SDL3.dll'.'SDL_HasAVX512F' +# ++'_SDL_IsChromebook'.'SDL3.dll'.'SDL_IsChromebook' +# ++'_SDL_IsDeXMode'.'SDL3.dll'.'SDL_IsDeXMode' +# ++'_SDL_AndroidBackButton'.'SDL3.dll'.'SDL_AndroidBackButton' +++'_SDL_exp'.'SDL3.dll'.'SDL_exp' +++'_SDL_expf'.'SDL3.dll'.'SDL_expf' +++'_SDL_wcsdup'.'SDL3.dll'.'SDL_wcsdup' +++'_SDL_GameControllerRumble'.'SDL3.dll'.'SDL_GameControllerRumble' +++'_SDL_JoystickRumble'.'SDL3.dll'.'SDL_JoystickRumble' +++'_SDL_NumSensors'.'SDL3.dll'.'SDL_NumSensors' +++'_SDL_SensorGetDeviceName'.'SDL3.dll'.'SDL_SensorGetDeviceName' +++'_SDL_SensorGetDeviceType'.'SDL3.dll'.'SDL_SensorGetDeviceType' +++'_SDL_SensorGetDeviceNonPortableType'.'SDL3.dll'.'SDL_SensorGetDeviceNonPortableType' +++'_SDL_SensorGetDeviceInstanceID'.'SDL3.dll'.'SDL_SensorGetDeviceInstanceID' +++'_SDL_SensorOpen'.'SDL3.dll'.'SDL_SensorOpen' +++'_SDL_SensorFromInstanceID'.'SDL3.dll'.'SDL_SensorFromInstanceID' +++'_SDL_SensorGetName'.'SDL3.dll'.'SDL_SensorGetName' +++'_SDL_SensorGetType'.'SDL3.dll'.'SDL_SensorGetType' +++'_SDL_SensorGetNonPortableType'.'SDL3.dll'.'SDL_SensorGetNonPortableType' +++'_SDL_SensorGetInstanceID'.'SDL3.dll'.'SDL_SensorGetInstanceID' +++'_SDL_SensorGetData'.'SDL3.dll'.'SDL_SensorGetData' +++'_SDL_SensorClose'.'SDL3.dll'.'SDL_SensorClose' +++'_SDL_SensorUpdate'.'SDL3.dll'.'SDL_SensorUpdate' +++'_SDL_IsTablet'.'SDL3.dll'.'SDL_IsTablet' +++'_SDL_GetDisplayOrientation'.'SDL3.dll'.'SDL_GetDisplayOrientation' +++'_SDL_HasColorKey'.'SDL3.dll'.'SDL_HasColorKey' +++'_SDL_CreateThreadWithStackSize'.'SDL3.dll'.'SDL_CreateThreadWithStackSize' +++'_SDL_JoystickGetDevicePlayerIndex'.'SDL3.dll'.'SDL_JoystickGetDevicePlayerIndex' +++'_SDL_JoystickGetPlayerIndex'.'SDL3.dll'.'SDL_JoystickGetPlayerIndex' +++'_SDL_GameControllerGetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerGetPlayerIndex' +++'_SDL_RenderFlush'.'SDL3.dll'.'SDL_RenderFlush' +++'_SDL_RenderDrawPointF'.'SDL3.dll'.'SDL_RenderDrawPointF' +++'_SDL_RenderDrawPointsF'.'SDL3.dll'.'SDL_RenderDrawPointsF' +++'_SDL_RenderDrawLineF'.'SDL3.dll'.'SDL_RenderDrawLineF' +++'_SDL_RenderDrawLinesF'.'SDL3.dll'.'SDL_RenderDrawLinesF' +++'_SDL_RenderDrawRectF'.'SDL3.dll'.'SDL_RenderDrawRectF' +++'_SDL_RenderDrawRectsF'.'SDL3.dll'.'SDL_RenderDrawRectsF' +++'_SDL_RenderFillRectF'.'SDL3.dll'.'SDL_RenderFillRectF' +++'_SDL_RenderFillRectsF'.'SDL3.dll'.'SDL_RenderFillRectsF' +++'_SDL_RenderCopyF'.'SDL3.dll'.'SDL_RenderCopyF' +++'_SDL_RenderCopyExF'.'SDL3.dll'.'SDL_RenderCopyExF' +++'_SDL_GetTouchDeviceType'.'SDL3.dll'.'SDL_GetTouchDeviceType' +# ++'_SDL_UIKitRunApp'.'SDL3.dll'.'SDL_UIKitRunApp' +++'_SDL_SIMDGetAlignment'.'SDL3.dll'.'SDL_SIMDGetAlignment' +++'_SDL_SIMDAlloc'.'SDL3.dll'.'SDL_SIMDAlloc' +++'_SDL_SIMDFree'.'SDL3.dll'.'SDL_SIMDFree' +++'_SDL_RWsize'.'SDL3.dll'.'SDL_RWsize' +++'_SDL_RWseek'.'SDL3.dll'.'SDL_RWseek' +++'_SDL_RWtell'.'SDL3.dll'.'SDL_RWtell' +++'_SDL_RWread'.'SDL3.dll'.'SDL_RWread' +++'_SDL_RWwrite'.'SDL3.dll'.'SDL_RWwrite' +++'_SDL_RWclose'.'SDL3.dll'.'SDL_RWclose' +++'_SDL_LoadFile'.'SDL3.dll'.'SDL_LoadFile' +++'_SDL_Metal_CreateView'.'SDL3.dll'.'SDL_Metal_CreateView' +++'_SDL_Metal_DestroyView'.'SDL3.dll'.'SDL_Metal_DestroyView' +++'_SDL_LockTextureToSurface'.'SDL3.dll'.'SDL_LockTextureToSurface' +++'_SDL_HasARMSIMD'.'SDL3.dll'.'SDL_HasARMSIMD' +++'_SDL_strtokr'.'SDL3.dll'.'SDL_strtokr' +++'_SDL_wcsstr'.'SDL3.dll'.'SDL_wcsstr' +++'_SDL_wcsncmp'.'SDL3.dll'.'SDL_wcsncmp' +++'_SDL_GameControllerTypeForIndex'.'SDL3.dll'.'SDL_GameControllerTypeForIndex' +++'_SDL_GameControllerGetType'.'SDL3.dll'.'SDL_GameControllerGetType' +++'_SDL_GameControllerFromPlayerIndex'.'SDL3.dll'.'SDL_GameControllerFromPlayerIndex' +++'_SDL_GameControllerSetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerSetPlayerIndex' +++'_SDL_JoystickFromPlayerIndex'.'SDL3.dll'.'SDL_JoystickFromPlayerIndex' +++'_SDL_JoystickSetPlayerIndex'.'SDL3.dll'.'SDL_JoystickSetPlayerIndex' +++'_SDL_SetTextureScaleMode'.'SDL3.dll'.'SDL_SetTextureScaleMode' +++'_SDL_GetTextureScaleMode'.'SDL3.dll'.'SDL_GetTextureScaleMode' +++'_SDL_OnApplicationWillTerminate'.'SDL3.dll'.'SDL_OnApplicationWillTerminate' +++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL3.dll'.'SDL_OnApplicationDidReceiveMemoryWarning' +++'_SDL_OnApplicationWillResignActive'.'SDL3.dll'.'SDL_OnApplicationWillResignActive' +++'_SDL_OnApplicationDidEnterBackground'.'SDL3.dll'.'SDL_OnApplicationDidEnterBackground' +++'_SDL_OnApplicationWillEnterForeground'.'SDL3.dll'.'SDL_OnApplicationWillEnterForeground' +++'_SDL_OnApplicationDidBecomeActive'.'SDL3.dll'.'SDL_OnApplicationDidBecomeActive' +# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL3.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation' +# ++'_SDL_GetAndroidSDKVersion'.'SDL3.dll'.'SDL_GetAndroidSDKVersion' +++'_SDL_isupper'.'SDL3.dll'.'SDL_isupper' +++'_SDL_islower'.'SDL3.dll'.'SDL_islower' +++'_SDL_JoystickAttachVirtual'.'SDL3.dll'.'SDL_JoystickAttachVirtual' +++'_SDL_JoystickDetachVirtual'.'SDL3.dll'.'SDL_JoystickDetachVirtual' +++'_SDL_JoystickIsVirtual'.'SDL3.dll'.'SDL_JoystickIsVirtual' +++'_SDL_JoystickSetVirtualAxis'.'SDL3.dll'.'SDL_JoystickSetVirtualAxis' +++'_SDL_JoystickSetVirtualButton'.'SDL3.dll'.'SDL_JoystickSetVirtualButton' +++'_SDL_JoystickSetVirtualHat'.'SDL3.dll'.'SDL_JoystickSetVirtualHat' +++'_SDL_GetErrorMsg'.'SDL3.dll'.'SDL_GetErrorMsg' +++'_SDL_LockSensors'.'SDL3.dll'.'SDL_LockSensors' +++'_SDL_UnlockSensors'.'SDL3.dll'.'SDL_UnlockSensors' +++'_SDL_Metal_GetLayer'.'SDL3.dll'.'SDL_Metal_GetLayer' +++'_SDL_Metal_GetDrawableSize'.'SDL3.dll'.'SDL_Metal_GetDrawableSize' +++'_SDL_trunc'.'SDL3.dll'.'SDL_trunc' +++'_SDL_truncf'.'SDL3.dll'.'SDL_truncf' +++'_SDL_GetPreferredLocales'.'SDL3.dll'.'SDL_GetPreferredLocales' +++'_SDL_SIMDRealloc'.'SDL3.dll'.'SDL_SIMDRealloc' +# ++'_SDL_AndroidRequestPermission'.'SDL3.dll'.'SDL_AndroidRequestPermission' +++'_SDL_OpenURL'.'SDL3.dll'.'SDL_OpenURL' +++'_SDL_HasSurfaceRLE'.'SDL3.dll'.'SDL_HasSurfaceRLE' +++'_SDL_GameControllerHasLED'.'SDL3.dll'.'SDL_GameControllerHasLED' +++'_SDL_GameControllerSetLED'.'SDL3.dll'.'SDL_GameControllerSetLED' +++'_SDL_JoystickHasLED'.'SDL3.dll'.'SDL_JoystickHasLED' +++'_SDL_JoystickSetLED'.'SDL3.dll'.'SDL_JoystickSetLED' +++'_SDL_GameControllerRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerRumbleTriggers' +++'_SDL_JoystickRumbleTriggers'.'SDL3.dll'.'SDL_JoystickRumbleTriggers' +++'_SDL_GameControllerHasAxis'.'SDL3.dll'.'SDL_GameControllerHasAxis' +++'_SDL_GameControllerHasButton'.'SDL3.dll'.'SDL_GameControllerHasButton' +++'_SDL_GameControllerGetNumTouchpads'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpads' +++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpadFingers' +++'_SDL_GameControllerGetTouchpadFinger'.'SDL3.dll'.'SDL_GameControllerGetTouchpadFinger' +++'_SDL_crc32'.'SDL3.dll'.'SDL_crc32' +++'_SDL_GameControllerGetSerial'.'SDL3.dll'.'SDL_GameControllerGetSerial' +++'_SDL_JoystickGetSerial'.'SDL3.dll'.'SDL_JoystickGetSerial' +++'_SDL_GameControllerHasSensor'.'SDL3.dll'.'SDL_GameControllerHasSensor' +++'_SDL_GameControllerSetSensorEnabled'.'SDL3.dll'.'SDL_GameControllerSetSensorEnabled' +++'_SDL_GameControllerIsSensorEnabled'.'SDL3.dll'.'SDL_GameControllerIsSensorEnabled' +++'_SDL_GameControllerGetSensorData'.'SDL3.dll'.'SDL_GameControllerGetSensorData' +++'_SDL_wcscasecmp'.'SDL3.dll'.'SDL_wcscasecmp' +++'_SDL_wcsncasecmp'.'SDL3.dll'.'SDL_wcsncasecmp' +++'_SDL_round'.'SDL3.dll'.'SDL_round' +++'_SDL_roundf'.'SDL3.dll'.'SDL_roundf' +++'_SDL_lround'.'SDL3.dll'.'SDL_lround' +++'_SDL_lroundf'.'SDL3.dll'.'SDL_lroundf' +++'_SDL_SoftStretchLinear'.'SDL3.dll'.'SDL_SoftStretchLinear' +++'_SDL_RenderGetD3D11Device'.'SDL3.dll'.'SDL_RenderGetD3D11Device' +++'_SDL_UpdateNVTexture'.'SDL3.dll'.'SDL_UpdateNVTexture' +++'_SDL_SetWindowKeyboardGrab'.'SDL3.dll'.'SDL_SetWindowKeyboardGrab' +++'_SDL_SetWindowMouseGrab'.'SDL3.dll'.'SDL_SetWindowMouseGrab' +++'_SDL_GetWindowKeyboardGrab'.'SDL3.dll'.'SDL_GetWindowKeyboardGrab' +++'_SDL_GetWindowMouseGrab'.'SDL3.dll'.'SDL_GetWindowMouseGrab' +++'_SDL_isalpha'.'SDL3.dll'.'SDL_isalpha' +++'_SDL_isalnum'.'SDL3.dll'.'SDL_isalnum' +++'_SDL_isblank'.'SDL3.dll'.'SDL_isblank' +++'_SDL_iscntrl'.'SDL3.dll'.'SDL_iscntrl' +++'_SDL_isxdigit'.'SDL3.dll'.'SDL_isxdigit' +++'_SDL_ispunct'.'SDL3.dll'.'SDL_ispunct' +++'_SDL_isprint'.'SDL3.dll'.'SDL_isprint' +++'_SDL_isgraph'.'SDL3.dll'.'SDL_isgraph' +# ++'_SDL_AndroidShowToast'.'SDL3.dll'.'SDL_AndroidShowToast' +++'_SDL_GetAudioDeviceSpec'.'SDL3.dll'.'SDL_GetAudioDeviceSpec' +++'_SDL_TLSCleanup'.'SDL3.dll'.'SDL_TLSCleanup' +++'_SDL_SetWindowAlwaysOnTop'.'SDL3.dll'.'SDL_SetWindowAlwaysOnTop' +++'_SDL_FlashWindow'.'SDL3.dll'.'SDL_FlashWindow' +++'_SDL_GameControllerSendEffect'.'SDL3.dll'.'SDL_GameControllerSendEffect' +++'_SDL_JoystickSendEffect'.'SDL3.dll'.'SDL_JoystickSendEffect' +++'_SDL_GameControllerGetSensorDataRate'.'SDL3.dll'.'SDL_GameControllerGetSensorDataRate' +++'_SDL_SetTextureUserData'.'SDL3.dll'.'SDL_SetTextureUserData' +++'_SDL_GetTextureUserData'.'SDL3.dll'.'SDL_GetTextureUserData' +++'_SDL_RenderGeometry'.'SDL3.dll'.'SDL_RenderGeometry' +++'_SDL_RenderGeometryRaw'.'SDL3.dll'.'SDL_RenderGeometryRaw' +++'_SDL_RenderSetVSync'.'SDL3.dll'.'SDL_RenderSetVSync' +++'_SDL_asprintf'.'SDL3.dll'.'SDL_asprintf' +++'_SDL_vasprintf'.'SDL3.dll'.'SDL_vasprintf' +++'_SDL_GetWindowICCProfile'.'SDL3.dll'.'SDL_GetWindowICCProfile' +++'_SDL_GetTicks64'.'SDL3.dll'.'SDL_GetTicks64' +# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL3.dll'.'SDL_LinuxSetThreadPriorityAndPolicy' +++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton' +++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis' +++'_SDL_hid_init'.'SDL3.dll'.'SDL_hid_init' +++'_SDL_hid_exit'.'SDL3.dll'.'SDL_hid_exit' +++'_SDL_hid_device_change_count'.'SDL3.dll'.'SDL_hid_device_change_count' +++'_SDL_hid_enumerate'.'SDL3.dll'.'SDL_hid_enumerate' +++'_SDL_hid_free_enumeration'.'SDL3.dll'.'SDL_hid_free_enumeration' +++'_SDL_hid_open'.'SDL3.dll'.'SDL_hid_open' +++'_SDL_hid_open_path'.'SDL3.dll'.'SDL_hid_open_path' +++'_SDL_hid_write'.'SDL3.dll'.'SDL_hid_write' +++'_SDL_hid_read_timeout'.'SDL3.dll'.'SDL_hid_read_timeout' +++'_SDL_hid_read'.'SDL3.dll'.'SDL_hid_read' +++'_SDL_hid_set_nonblocking'.'SDL3.dll'.'SDL_hid_set_nonblocking' +++'_SDL_hid_send_feature_report'.'SDL3.dll'.'SDL_hid_send_feature_report' +++'_SDL_hid_get_feature_report'.'SDL3.dll'.'SDL_hid_get_feature_report' +++'_SDL_hid_close'.'SDL3.dll'.'SDL_hid_close' +++'_SDL_hid_get_manufacturer_string'.'SDL3.dll'.'SDL_hid_get_manufacturer_string' +++'_SDL_hid_get_product_string'.'SDL3.dll'.'SDL_hid_get_product_string' +++'_SDL_hid_get_serial_number_string'.'SDL3.dll'.'SDL_hid_get_serial_number_string' +++'_SDL_hid_get_indexed_string'.'SDL3.dll'.'SDL_hid_get_indexed_string' +++'_SDL_SetWindowMouseRect'.'SDL3.dll'.'SDL_SetWindowMouseRect' +++'_SDL_GetWindowMouseRect'.'SDL3.dll'.'SDL_GetWindowMouseRect' +++'_SDL_RenderWindowToLogical'.'SDL3.dll'.'SDL_RenderWindowToLogical' +++'_SDL_RenderLogicalToWindow'.'SDL3.dll'.'SDL_RenderLogicalToWindow' +++'_SDL_JoystickHasRumble'.'SDL3.dll'.'SDL_JoystickHasRumble' +++'_SDL_JoystickHasRumbleTriggers'.'SDL3.dll'.'SDL_JoystickHasRumbleTriggers' +++'_SDL_GameControllerHasRumble'.'SDL3.dll'.'SDL_GameControllerHasRumble' +++'_SDL_GameControllerHasRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerHasRumbleTriggers' +++'_SDL_hid_ble_scan'.'SDL3.dll'.'SDL_hid_ble_scan' +++'_SDL_PremultiplyAlpha'.'SDL3.dll'.'SDL_PremultiplyAlpha' +# ++'_SDL_AndroidSendMessage'.'SDL3.dll'.'SDL_AndroidSendMessage' +++'_SDL_GetTouchName'.'SDL3.dll'.'SDL_GetTouchName' +++'_SDL_ClearComposition'.'SDL3.dll'.'SDL_ClearComposition' +++'_SDL_IsTextInputShown'.'SDL3.dll'.'SDL_IsTextInputShown' +++'_SDL_HasIntersectionF'.'SDL3.dll'.'SDL_HasIntersectionF' +++'_SDL_IntersectFRect'.'SDL3.dll'.'SDL_IntersectFRect' +++'_SDL_UnionFRect'.'SDL3.dll'.'SDL_UnionFRect' +++'_SDL_EncloseFPoints'.'SDL3.dll'.'SDL_EncloseFPoints' +++'_SDL_IntersectFRectAndLine'.'SDL3.dll'.'SDL_IntersectFRectAndLine' +++'_SDL_RenderGetWindow'.'SDL3.dll'.'SDL_RenderGetWindow' +++'_SDL_bsearch'.'SDL3.dll'.'SDL_bsearch' +++'_SDL_GameControllerPathForIndex'.'SDL3.dll'.'SDL_GameControllerPathForIndex' +++'_SDL_GameControllerPath'.'SDL3.dll'.'SDL_GameControllerPath' +++'_SDL_JoystickPathForIndex'.'SDL3.dll'.'SDL_JoystickPathForIndex' +++'_SDL_JoystickPath'.'SDL3.dll'.'SDL_JoystickPath' +++'_SDL_JoystickAttachVirtualEx'.'SDL3.dll'.'SDL_JoystickAttachVirtualEx' +++'_SDL_GameControllerGetFirmwareVersion'.'SDL3.dll'.'SDL_GameControllerGetFirmwareVersion' +++'_SDL_JoystickGetFirmwareVersion'.'SDL3.dll'.'SDL_JoystickGetFirmwareVersion' +++'_SDL_GUIDToString'.'SDL3.dll'.'SDL_GUIDToString' +++'_SDL_GUIDFromString'.'SDL3.dll'.'SDL_GUIDFromString' +++'_SDL_HasLSX'.'SDL3.dll'.'SDL_HasLSX' +++'_SDL_HasLASX'.'SDL3.dll'.'SDL_HasLASX' +++'_SDL_RenderGetD3D12Device'.'SDL3.dll'.'SDL_RenderGetD3D12Device' +++'_SDL_utf8strnlen'.'SDL3.dll'.'SDL_utf8strnlen' +# ++'_SDL_GDKGetTaskQueue'.'SDL3.dll'.'SDL_GDKGetTaskQueue' +# ++'_SDL_GDKRunApp'.'SDL3.dll'.'SDL_GDKRunApp' +++'_SDL_GetOriginalMemoryFunctions'.'SDL3.dll'.'SDL_GetOriginalMemoryFunctions' +++'_SDL_ResetKeyboard'.'SDL3.dll'.'SDL_ResetKeyboard' +++'_SDL_GetDefaultAudioInfo'.'SDL3.dll'.'SDL_GetDefaultAudioInfo' +++'_SDL_GetPointDisplayIndex'.'SDL3.dll'.'SDL_GetPointDisplayIndex' +++'_SDL_GetRectDisplayIndex'.'SDL3.dll'.'SDL_GetRectDisplayIndex' +++'_SDL_ResetHint'.'SDL3.dll'.'SDL_ResetHint' +++'_SDL_crc16'.'SDL3.dll'.'SDL_crc16' +++'_SDL_GetWindowSizeInPixels'.'SDL3.dll'.'SDL_GetWindowSizeInPixels' +++'_SDL_GetJoystickGUIDInfo'.'SDL3.dll'.'SDL_GetJoystickGUIDInfo' +++'_SDL_SetPrimarySelectionText'.'SDL3.dll'.'SDL_SetPrimarySelectionText' +++'_SDL_GetPrimarySelectionText'.'SDL3.dll'.'SDL_GetPrimarySelectionText' +++'_SDL_HasPrimarySelectionText'.'SDL3.dll'.'SDL_HasPrimarySelectionText' +++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL3.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' +++'_SDL_SensorGetDataWithTimestamp'.'SDL3.dll'.'SDL_SensorGetDataWithTimestamp' +++'_SDL_ResetHints'.'SDL3.dll'.'SDL_ResetHints' +++'_SDL_strcasestr'.'SDL3.dll'.'SDL_strcasestr' diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 9a7e4c994..033c4a75d 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -195,7 +195,7 @@ SDL_DYNAPI_VARARGS(,,) static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { char buf[512]; /* !!! FIXME: dynamic allocation */ \ va_list ap; - SDL_Log_REAL("SDL2CALL SDL_SetError"); + SDL_Log_REAL("SDL3CALL SDL_SetError"); va_start(ap, fmt); SDL_vsnprintf_REAL(buf, sizeof (buf), fmt, ap); va_end(ap); @@ -204,7 +204,7 @@ static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char static int SDLCALL SDL_sscanf_LOGSDLCALLS(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { int retval; va_list ap; - SDL_Log_REAL("SDL2CALL SDL_sscanf"); + SDL_Log_REAL("SDL3CALL SDL_sscanf"); va_start(ap, fmt); retval = SDL_vsscanf_REAL(buf, fmt, ap); va_end(ap); @@ -213,7 +213,7 @@ static int SDLCALL SDL_sscanf_LOGSDLCALLS(const char *buf, SDL_SCANF_FORMAT_STRI static int SDLCALL SDL_snprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { int retval; va_list ap; - SDL_Log_REAL("SDL2CALL SDL_snprintf"); + SDL_Log_REAL("SDL3CALL SDL_snprintf"); va_start(ap, fmt); retval = SDL_vsnprintf_REAL(buf, maxlen, fmt, ap); va_end(ap); @@ -222,7 +222,7 @@ static int SDLCALL SDL_snprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) char *buf, siz static int SDLCALL SDL_asprintf_LOGSDLCALLS(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { int retval; va_list ap; - SDL_Log_REAL("SDL2CALL SDL_asprintf"); + SDL_Log_REAL("SDL3CALL SDL_asprintf"); va_start(ap, fmt); retval = SDL_vasprintf_REAL(strp, fmt, ap); va_end(ap); @@ -230,14 +230,14 @@ static int SDLCALL SDL_asprintf_LOGSDLCALLS(char **strp, SDL_PRINTF_FORMAT_STRIN } static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list ap; - SDL_Log_REAL("SDL2CALL SDL_Log"); + SDL_Log_REAL("SDL3CALL SDL_Log"); va_start(ap, fmt); SDL_LogMessageV_REAL(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ va_end(ap); } static void SDLCALL SDL_LogMessage_LOGSDLCALLS(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list ap; - SDL_Log_REAL("SDL2CALL SDL_LogMessage"); + SDL_Log_REAL("SDL3CALL SDL_LogMessage"); va_start(ap, fmt); SDL_LogMessageV_REAL(category, priority, fmt, ap); va_end(ap); @@ -245,7 +245,7 @@ static void SDLCALL SDL_LogMessage_LOGSDLCALLS(int category, SDL_LogPriority pri #define SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(logname, prio) \ static void SDLCALL SDL_Log##logname##_LOGSDLCALLS(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; va_start(ap, fmt); \ - SDL_Log_REAL("SDL2CALL SDL_Log%s", #logname); \ + SDL_Log_REAL("SDL3CALL SDL_Log%s", #logname); \ SDL_LogMessageV_REAL(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } @@ -256,7 +256,7 @@ SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Warn, WARN) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL) #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; } + rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL3CALL %s", #fn); ret fn##_REAL args; } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl index a9ff9723b..6c19a8f7d 100755 --- a/src/dynapi/gendynapi.pl +++ b/src/dynapi/gendynapi.pl @@ -33,7 +33,7 @@ use File::Basename; chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; -my $sdl2_exports = "src/dynapi/SDL2.exports"; +my $sdl3_exports = "src/dynapi/SDL3.exports"; my %existing = (); if (-f $sdl_dynapi_procs_h) { @@ -48,7 +48,7 @@ if (-f $sdl_dynapi_procs_h) { open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); -open(SDL2_EXPORTS, '>>', $sdl2_exports) or die("Can't open $sdl2_exports: $!\n"); +open(SDL3_EXPORTS, '>>', $sdl3_exports) or die("Can't open $sdl3_exports: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { @@ -135,7 +135,7 @@ while (my $d = readdir(HEADERS)) { print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; - print SDL2_EXPORTS "++'_${fn}'.'SDL2.dll'.'${fn}'\n"; + print SDL3_EXPORTS "++'_${fn}'.'SDL3.dll'.'${fn}'\n"; } else { print("Failed to parse decl [$decl]!\n"); } @@ -146,6 +146,6 @@ closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); -close(SDL2_EXPORTS); +close(SDL3_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index fb2c26890..4a3b139b3 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,26,0,0 - PRODUCTVERSION 2,26,0,0 + FILEVERSION 3,0,0,0 + PRODUCTVERSION 3,0,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 26, 0, 0\0" + VALUE "FileVersion", "3, 0, 0, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" - VALUE "OriginalFilename", "SDL2.dll\0" + VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 26, 0, 0\0" + VALUE "ProductVersion", "3, 0, 0, 0\0" END END BLOCK "VarFileInfo" diff --git a/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur b/src/main/winrt/SDL3-WinRTResource_BlankCursor.cur similarity index 100% rename from src/main/winrt/SDL2-WinRTResource_BlankCursor.cur rename to src/main/winrt/SDL3-WinRTResource_BlankCursor.cur diff --git a/src/main/winrt/SDL2-WinRTResources.rc b/src/main/winrt/SDL3-WinRTResources.rc similarity index 54% rename from src/main/winrt/SDL2-WinRTResources.rc rename to src/main/winrt/SDL3-WinRTResources.rc index ce8549f2d..457fd093b 100644 --- a/src/main/winrt/SDL2-WinRTResources.rc +++ b/src/main/winrt/SDL3-WinRTResources.rc @@ -1,3 +1,3 @@ #include "winres.h" LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -5000 CURSOR "SDL2-WinRTResource_BlankCursor.cur" +5000 CURSOR "SDL3-WinRTResource_BlankCursor.cur" diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c index 8f92463b1..00418e332 100644 --- a/src/stdlib/SDL_mslibc.c +++ b/src/stdlib/SDL_mslibc.c @@ -39,7 +39,7 @@ __declspec(selectany) int _fltused = 1; #endif /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. - Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */ + Always provide it for the SDL3 DLL, but skip it when building static lib w/ static runtime. */ #if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) extern void *memcpy(void* dst, const void* src, size_t len); #pragma intrinsic(memcpy) diff --git a/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/video/emscripten/SDL_emscriptenframebuffer.c index 03fea04ef..edc523a46 100644 --- a/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -76,19 +76,19 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec var h = $1; var pixels = $2; - if (!Module['SDL2']) Module['SDL2'] = {}; - var SDL2 = Module['SDL2']; - if (SDL2.ctxCanvas !== Module['canvas']) { - SDL2.ctx = Module['createContext'](Module['canvas'], false, true); - SDL2.ctxCanvas = Module['canvas']; + if (!Module['SDL3']) Module['SDL3'] = {}; + var SDL3 = Module['SDL3']; + if (SDL3.ctxCanvas !== Module['canvas']) { + SDL3.ctx = Module['createContext'](Module['canvas'], false, true); + SDL3.ctxCanvas = Module['canvas']; } - if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) { - SDL2.image = SDL2.ctx.createImageData(w, h); - SDL2.w = w; - SDL2.h = h; - SDL2.imageCtx = SDL2.ctx; + if (SDL3.w !== w || SDL3.h !== h || SDL3.imageCtx !== SDL3.ctx) { + SDL3.image = SDL3.ctx.createImageData(w, h); + SDL3.w = w; + SDL3.h = h; + SDL3.imageCtx = SDL3.ctx; } - var data = SDL2.image.data; + var data = SDL3.image.data; var src = pixels >> 2; var dst = 0; var num; @@ -108,12 +108,12 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec dst += 4; } } else { - if (SDL2.data32Data !== data) { - SDL2.data32 = new Int32Array(data.buffer); - SDL2.data8 = new Uint8Array(data.buffer); - SDL2.data32Data = data; + if (SDL3.data32Data !== data) { + SDL3.data32 = new Int32Array(data.buffer); + SDL3.data8 = new Uint8Array(data.buffer); + SDL3.data32Data = data; } - var data32 = SDL2.data32; + var data32 = SDL3.data32; num = data32.length; // logically we need to do // while (dst < num) { @@ -124,7 +124,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec // native SDL_memcpy efficiencies, and the remaining loop // just stores, not load + store, so it is faster data32.set(HEAP32.subarray(src, src + num)); - var data8 = SDL2.data8; + var data8 = SDL3.data8; var i = 3; var j = i + 4*num; if (num % 8 == 0) { @@ -155,7 +155,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec } } - SDL2.ctx.putImageData(SDL2.image, 0, 0); + SDL3.ctx.putImageData(SDL3.image, 0, 0); }, surface->w, surface->h, surface->pixels); if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { diff --git a/src/video/haiku/SDL_bmessagebox.cc b/src/video/haiku/SDL_bmessagebox.cc index d777ed834..22b453cbb 100644 --- a/src/video/haiku/SDL_bmessagebox.cc +++ b/src/video/haiku/SDL_bmessagebox.cc @@ -309,7 +309,7 @@ public: fComputedMessageBoxWidth(0.0f), fCloseButton(G_CLOSE_BUTTON_ID), fDefaultButton(G_DEFAULT_BUTTON_ID), fCustomColorScheme(false), fThereIsLongLine(false), - HAIKU_SDL_DefTitle("SDL2 MessageBox"), + HAIKU_SDL_DefTitle("SDL MessageBox"), HAIKU_SDL_DefMessage("Some information has been lost."), HAIKU_SDL_DefButton("OK") { diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c index 253e34ecd..0580e0ec5 100644 --- a/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -186,7 +186,7 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) { we have waited here, there won't be a pending pageflip so the WaitPageflip at the beginning of this function will be a no-op. Just leave it here and don't worry. - Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " + Run your SDL program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " to enable this. */ if (windata->double_buffer) { if (!KMSDRM_WaitPageflip(_this, windata)) { diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 6c05bbd9b..e76c67efc 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1435,7 +1435,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window) if (!(viddata->gbm_init)) { - /* After SDL_CreateWindow, most SDL2 programs will do SDL_CreateRenderer(), + /* After SDL_CreateWindow, most SDL programs will do SDL_CreateRenderer(), which will in turn call GL_CreateRenderer() or GLES2_CreateRenderer(). In order for the GL_CreateRenderer() or GLES2_CreateRenderer() call to succeed without an unnecessary window re-creation, we must: diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c index 599384edf..f0147dc08 100644 --- a/src/video/os2/SDL_os2video.c +++ b/src/video/os2/SDL_os2video.c @@ -40,7 +40,7 @@ #define FOURCC_R666 mmioFOURCC('R','6','6','6') #endif -#define WIN_CLIENT_CLASS "SDL2" +#define WIN_CLIENT_CLASS "SDL3" #define OS2DRIVER_NAME_DIVE "DIVE" #define OS2DRIVER_NAME_VMAN "VMAN" @@ -760,7 +760,7 @@ static int OS2_CreateWindow(_THIS, SDL_Window *window) ulSWPFlags |= SWP_MINIMIZE; hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags, - WIN_CLIENT_CLASS, "SDL2", 0, 0, 0, &hwnd); + WIN_CLIENT_CLASS, "SDL3", 0, 0, 0, &hwnd); if (hwndFrame == NULLHANDLE) return SDL_SetError("Couldn't create window"); diff --git a/src/video/raspberry/SDL_rpiopengles.c b/src/video/raspberry/SDL_rpiopengles.c index 7b62b3e43..fe7d52175 100644 --- a/src/video/raspberry/SDL_rpiopengles.c +++ b/src/video/raspberry/SDL_rpiopengles.c @@ -52,7 +52,7 @@ RPI_GLES_SwapWindow(_THIS, SDL_Window * window) { } /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. - * Run your SDL2 program with "SDL_RPI_DOUBLE_BUFFER=1 " to enable this. */ + * Run your SDL program with "SDL_RPI_DOUBLE_BUFFER=1 " to enable this. */ if (wdata->double_buffer) { SDL_LockMutex(wdata->vsync_cond_mutex); SDL_CondWait(wdata->vsync_cond, wdata->vsync_cond_mutex); diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index d260f15c6..600f92af2 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -37,6 +37,7 @@ #include "SDL_windowsshape.h" #include "SDL_hints.h" #include "SDL_timer.h" +#include "SDL_version.h" /* Dropfile support */ #include @@ -773,7 +774,7 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size. * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0}, - * so switch them around because SDL2 wants them in positive. */ + * so switch them around because SDL3 wants them in positive. */ *top = rcClient.top - rcWindow.top; *left = rcClient.left - rcWindow.left; *bottom = rcWindow.bottom - rcClient.bottom; diff --git a/src/video/winrt/SDL_winrtmouse.cpp b/src/video/winrt/SDL_winrtmouse.cpp index 8c32e5fcf..24e44682e 100644 --- a/src/video/winrt/SDL_winrtmouse.cpp +++ b/src/video/winrt/SDL_winrtmouse.cpp @@ -160,8 +160,8 @@ WINRT_ShowCursor(SDL_Cursor * cursor) // Tech notes: // - SDL's blank cursor resource uses a resource ID of 5000. // - SDL's cursor resources consist of the following two files: - // - src/main/winrt/SDL2-WinRTResource_BlankCursor.cur -- cursor pixel data - // - src/main/winrt/SDL2-WinRTResources.rc -- declares the cursor resource, and its ID (of 5000) + // - src/main/winrt/SDL3-WinRTResource_BlankCursor.cur -- cursor pixel data + // - src/main/winrt/SDL3-WinRTResources.rc -- declares the cursor resource, and its ID (of 5000) // const unsigned int win32CursorResourceID = 5000; diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 49f5c5b9b..59f2cf545 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -473,7 +473,7 @@ X11_VideoInit(_THIS) #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ #ifndef X_HAVE_UTF8_STRING -#warning X server does not support UTF8_STRING, a feature introduced in 2000! This is likely to become a hard error in a future libSDL2. +#warning X server does not support UTF8_STRING, a feature introduced in 2000! This is likely to become a hard error in a future libSDL3. #endif if (X11_InitKeyboard(_this) != 0) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 676a8e791..8afa14f47 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(SDL2_test) +project(SDL3_test) include(CheckCCompilerFlag) include(CMakeParseArguments) @@ -22,8 +22,8 @@ macro(add_sdl_test_executable TARGET) endif() endmacro() -if(NOT TARGET SDL2::SDL2-static) - find_package(SDL2 2.0.23 REQUIRED COMPONENTS SDL2-static SDL2test) +if(NOT TARGET SDL3::SDL3-static) + find_package(SDL3 3.0.0 REQUIRED COMPONENTS SDL3-static SDL3test) endif() enable_testing() @@ -33,14 +33,14 @@ if(SDL_INSTALL_TESTS) endif() if(N3DS) - link_libraries(SDL2::SDL2main) + link_libraries(SDL3::SDL3main) endif() if(PSP) link_libraries( - SDL2::SDL2main - SDL2::SDL2test - SDL2::SDL2-static + SDL3::SDL3main + SDL3::SDL3test + SDL3::SDL3-static GL pspvram pspvfpu @@ -54,20 +54,20 @@ if(PSP) ) elseif(PS2) link_libraries( - SDL2main - SDL2_test - SDL2-static + SDL3main + SDL3_test + SDL3-static patches gskit dmakit ps2_drivers ) else() - link_libraries(SDL2::SDL2test SDL2::SDL2-static) + link_libraries(SDL3::SDL3test SDL3::SDL3-static) endif() if(WINDOWS) - # mingw32 must come before SDL2main to link successfully + # mingw32 must come before SDL3main to link successfully if(MINGW OR CYGWIN) link_libraries(mingw32) endif() @@ -79,7 +79,7 @@ if(WINDOWS) # FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, # but we need them for VS as well. - link_libraries(SDL2main) + link_libraries(SDL3main) add_definitions(-Dmain=SDL_main) endif() @@ -331,8 +331,8 @@ if(N3DS) set(SMDH_FILE "${TARGET_BINARY_DIR}/${APP}.smdh") ctr_generate_smdh("${SMDH_FILE}" NAME "SDL-${APP}" - DESCRIPTION "SDL2 Test suite" - AUTHOR "SDL2 Contributors" + DESCRIPTION "SDL3 Test suite" + AUTHOR "SDL3 Contributors" ICON "${CMAKE_CURRENT_SOURCE_DIR}/n3ds/logo48x48.png" ) ctr_create_3dsx( @@ -412,11 +412,11 @@ foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE}) ) if(SDL_INSTALL_TESTS) set(exe ${TESTCASE}) - set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL2") + set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL3") configure_file(template.test.in "${exe}.test" @ONLY) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test" - DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL2 + DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL3 ) endif() endforeach() @@ -428,16 +428,16 @@ if(SDL_INSTALL_TESTS) if(RISCOS) install( FILES ${SDL_TEST_EXECUTABLES_AIF} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL3 ) else() install( TARGETS ${SDL_TEST_EXECUTABLES} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL3 ) endif() install( FILES ${RESOURCE_FILES} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL3 ) endif() diff --git a/test/Makefile.in b/test/Makefile.in index 93df6360e..0927871e7 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -90,8 +90,8 @@ TARGETS = \ all: Makefile $(TARGETS) copydatafiles generatetestmeta -installedtestsdir = $(libexecdir)/installed-tests/SDL2 -installedtestsmetadir = $(datadir)/installed-tests/SDL2 +installedtestsdir = $(libexecdir)/installed-tests/SDL3 +installedtestsmetadir = $(datadir)/installed-tests/SDL3 generatetestmeta: rm -f *.test diff --git a/test/Makefile.os2 b/test/Makefile.os2 index ee66409b0..3f6daf859 100644 --- a/test/Makefile.os2 +++ b/test/Makefile.os2 @@ -1,4 +1,4 @@ -# Open Watcom makefile to build SDL2 tests for OS/2 +# Open Watcom makefile to build SDL3 tests for OS/2 # wmake -f Makefile.os2 # # To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 diff --git a/test/Makefile.w32 b/test/Makefile.w32 index 02e68e865..55ad493f4 100644 --- a/test/Makefile.w32 +++ b/test/Makefile.w32 @@ -1,4 +1,4 @@ -# Open Watcom makefile to build SDL2 tests for Win32 +# Open Watcom makefile to build SDL3 tests for Win32 # wmake -f Makefile.w32 # # To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 diff --git a/test/acinclude.m4 b/test/acinclude.m4 index 0fdf353ea..3dd4058ea 100644 --- a/test/acinclude.m4 +++ b/test/acinclude.m4 @@ -7,12 +7,12 @@ # serial 2 -dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl AM_PATH_SDL3([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl -AC_DEFUN([AM_PATH_SDL2], +AC_DEFUN([AM_PATH_SDL3], [dnl -dnl Get the cflags and libraries from the sdl2-config script +dnl Get the cflags and libraries from the sdl3-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") @@ -21,52 +21,52 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) - min_sdl_version=ifelse([$1], ,2.0.0,$1) + min_sdl_version=ifelse([$1], ,3.0.0,$1) if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + PKG_CHECK_MODULES([SDL], [sdl3 >= $min_sdl_version], [sdl_pc=yes], [sdl_pc=no]) else sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + AC_PATH_PROG(SDL3_CONFIG, sdl3-config, no, [$PATH]) PATH="$as_save_PATH" AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then + if test "$SDL3_CONFIG" = "no" ; then no_sdl=yes else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -77,7 +77,7 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl2-config to some extent +dnl checks the results of sdl3-config to some extent dnl rm -f conf.sdltest AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -105,11 +105,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -130,11 +130,11 @@ int main (int argc, char *argv[]) if test "x$no_sdl" = x ; then ifelse([$2], , :, [$2]) else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" diff --git a/test/configure b/test/configure index c71abe489..f524bd4d3 100755 --- a/test/configure +++ b/test/configure @@ -627,7 +627,7 @@ OPENGLES2_TARGETS OPENGLES1_TARGETS CPP XMKMF -SDL2_CONFIG +SDL3_CONFIG SDL_LIBS SDL_CFLAGS PKG_CONFIG_LIBDIR @@ -3719,7 +3719,7 @@ esac -SDL_VERSION=2.0.18 +SDL_VERSION=3.0.0 @@ -3881,19 +3881,19 @@ fi if test "x$sdl_prefix$sdl_exec_prefix" = x ; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 -printf %s "checking for sdl2 >= $min_sdl_version... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl3 >= $min_sdl_version" >&5 +printf %s "checking for sdl3 >= $min_sdl_version... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl3 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -3904,12 +3904,12 @@ if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl3 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -3929,9 +3929,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl3 >= $min_sdl_version" 2>&1` else - SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl3 >= $min_sdl_version" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SDL_PKG_ERRORS" >&5 @@ -3952,37 +3952,37 @@ fi sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - # Extract the first word of "sdl2-config", so it can be a program name with args. -set dummy sdl2-config; ac_word=$2 + # Extract the first word of "sdl3-config", so it can be a program name with args. +set dummy sdl3-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_SDL2_CONFIG+y} +if test ${ac_cv_path_SDL3_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop - case $SDL2_CONFIG in + case $SDL3_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. + ac_cv_path_SDL3_CONFIG="$SDL3_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3996,7 +3996,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext" + ac_cv_path_SDL3_CONFIG="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4004,14 +4004,14 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no" + test -z "$ac_cv_path_SDL3_CONFIG" && ac_cv_path_SDL3_CONFIG="no" ;; esac fi -SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG -if test -n "$SDL2_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 -printf "%s\n" "$SDL2_CONFIG" >&6; } +SDL3_CONFIG=$ac_cv_path_SDL3_CONFIG +if test -n "$SDL3_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL3_CONFIG" >&5 +printf "%s\n" "$SDL3_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } @@ -4023,17 +4023,17 @@ fi printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then + if test "$SDL3_CONFIG" = "no" ; then no_sdl=yes else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -4074,11 +4074,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -4112,11 +4112,11 @@ printf "%s\n" "no" >&6; } if test "x$no_sdl" = x ; then : else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -4159,7 +4159,7 @@ else $as_nop echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext @@ -4178,7 +4178,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f conf.sdltest CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL2_test $SDL_LIBS" +LIBS="$LIBS -lSDL3_test $SDL_LIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4832,14 +4832,14 @@ esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 -printf %s "checking for TTF_Init in -lSDL2_ttf... " >&6; } -if test ${ac_cv_lib_SDL2_ttf_TTF_Init+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL3_ttf" >&5 +printf %s "checking for TTF_Init in -lSDL3_ttf... " >&6; } +if test ${ac_cv_lib_SDL3_ttf_TTF_Init+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS -LIBS="-lSDL2_ttf $LIBS" +LIBS="-lSDL3_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4857,24 +4857,24 @@ return TTF_Init (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_SDL2_ttf_TTF_Init=yes + ac_cv_lib_SDL3_ttf_TTF_Init=yes else $as_nop - ac_cv_lib_SDL2_ttf_TTF_Init=no + ac_cv_lib_SDL3_ttf_TTF_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5 -printf "%s\n" "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; } -if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL3_ttf_TTF_Init" >&5 +printf "%s\n" "$ac_cv_lib_SDL3_ttf_TTF_Init" >&6; } +if test "x$ac_cv_lib_SDL3_ttf_TTF_Init" = xyes then : have_SDL_ttf=yes fi if test x$have_SDL_ttf = xyes; then CFLAGS="$CFLAGS -DHAVE_SDL_TTF" - SDL_TTF_LIB="-lSDL2_ttf" + SDL_TTF_LIB="-lSDL3_ttf" fi diff --git a/test/configure.ac b/test/configure.ac index e9890163e..60b60ada1 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -100,13 +100,13 @@ AC_SUBST(ISUNIX) AC_SUBST(ISOS2) dnl Check for SDL -SDL_VERSION=2.0.18 -AM_PATH_SDL2($SDL_VERSION, +SDL_VERSION=3.0.0 +AM_PATH_SDL3($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL2_test $SDL_LIBS" +LIBS="$LIBS -lSDL3_test $SDL_LIBS" dnl Check for X11 path, needed for OpenGL on some systems AC_PATH_X @@ -267,18 +267,18 @@ AC_SUBST(GLES2LIB) AC_SUBST(XLIB) dnl Check for SDL_ttf -AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) +AC_CHECK_LIB(SDL3_ttf, TTF_Init, have_SDL_ttf=yes) if test x$have_SDL_ttf = xyes; then CFLAGS="$CFLAGS -DHAVE_SDL_TTF" - SDL_TTF_LIB="-lSDL2_ttf" + SDL_TTF_LIB="-lSDL3_ttf" fi AC_SUBST(SDL_TTF_LIB) -dnl Really, SDL2_test should be linking against libunwind (if it found -dnl libunwind.h when configured), but SDL2_test is a static library, so -dnl there's no way for it to link against it. We could make SDL2 depend on -dnl it, but we don't want all SDL2 build to suddenly gain an extra dependency, -dnl so just assume that if it's here now, SDL2_test was probably built with it. +dnl Really, SDL3_test should be linking against libunwind (if it found +dnl libunwind.h when configured), but SDL3_test is a static library, so +dnl there's no way for it to link against it. We could make SDL3 depend on +dnl it, but we don't want all SDL3 build to suddenly gain an extra dependency, +dnl so just assume that if it's here now, SDL3_test was probably built with it. PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no) if test x$have_libunwind = xyes ; then LIBS="$LIBS $LIBUNWIND_LIBS" diff --git a/test/nacl/Makefile b/test/nacl/Makefile index 9ca166c12..ca7a03047 100644 --- a/test/nacl/Makefile +++ b/test/nacl/Makefile @@ -13,8 +13,8 @@ include $(NACL_SDK_ROOT)/tools/common.mk TARGET = sdl_app DEPS = ppapi_simple nacl_io -# ppapi_simple and SDL2 end up being listed twice due to dependency solving issues -- Gabriel -LIBS = SDL2_test SDL2 ppapi_simple SDL2main SDL2 $(DEPS) ppapi_gles2 ppapi_cpp ppapi pthread +# ppapi_simple and SDL3 end up being listed twice due to dependency solving issues -- Gabriel +LIBS = SDL3_test SDL3 ppapi_simple SDL3main SDL3 $(DEPS) ppapi_gles2 ppapi_cpp ppapi pthread CFLAGS := -Wall SOURCES ?= testgles2.c diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index e6127b573..3ba3094ea 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -948,7 +948,7 @@ int audio_openCloseAudioDeviceConnected() SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %" SDL_PRIu32, id); if (id > 1) { -/* TODO: enable test code when function is available in SDL2 */ +/* TODO: enable test code when function is available in SDL3 */ #ifdef AUDIODEVICECONNECTED_DEFINED /* Get connected status */ diff --git a/test/testver.c b/test/testver.c index cbbba7ec6..bf6983480 100644 --- a/test/testver.c +++ b/test/testver.c @@ -29,10 +29,10 @@ main(int argc, char *argv[]) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -#if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Log("Compiled with SDL 2.0 or newer\n"); +#if SDL_VERSION_ATLEAST(3, 0, 0) + SDL_Log("Compiled with SDL 3.0 or newer\n"); #else - SDL_Log("Compiled with SDL older than 2.0\n"); + SDL_Log("Compiled with SDL older than 3.0\n"); #endif SDL_VERSION(&compiled); SDL_Log("Compiled version: %d.%d.%d (%s)\n", diff --git a/test/watcom.mif b/test/watcom.mif index 2189fd49c..6d0d9d405 100644 --- a/test/watcom.mif +++ b/test/watcom.mif @@ -1,9 +1,9 @@ INCPATH+= -I"../include" LIBPATH = .. -LIBS = SDL2.lib SDL2test.lib testutils.lib +LIBS = SDL3.lib SDL3test.lib testutils.lib #CFLAGS+= -DHAVE_SDL_TTF -#TTFLIBS = SDL2ttf.lib +#TTFLIBS = SDL3ttf.lib CFLAGS+= $(INCPATH) @@ -106,14 +106,14 @@ testutils.lib: testutils.obj check: .SYMBOLIC $(TESTS) @set SDL_AUDIODRIVER=dummy @set SDL_VIDEODRIVER=dummy - @copy "../SDL2.dll" . + @copy "../SDL3.dll" . @for %exe in ($(TESTS)) do %exe check-quick: .SYMBOLIC $(TESTS) @set SDL_TESTS_QUICK=1 @set SDL_AUDIODRIVER=dummy @set SDL_VIDEODRIVER=dummy - @copy "../SDL2.dll" . + @copy "../SDL3.dll" . @for %exe in ($(TESTS)) do %exe clean: .SYMBOLIC diff --git a/visualtest/COPYING.txt b/visualtest/COPYING.txt index 6a3adc901..a92fe14bc 100644 --- a/visualtest/COPYING.txt +++ b/visualtest/COPYING.txt @@ -1,4 +1,4 @@ -Visual and Interactive Test Automation for SDL 2.0 +Visual and Interactive Test Automation for SDL 3.0 Copyright (C) 2013 Apoorv Upreti This software is provided 'as-is', without any express or implied diff --git a/visualtest/acinclude.m4 b/visualtest/acinclude.m4 index 0fdf353ea..3dd4058ea 100644 --- a/visualtest/acinclude.m4 +++ b/visualtest/acinclude.m4 @@ -7,12 +7,12 @@ # serial 2 -dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl AM_PATH_SDL3([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl -AC_DEFUN([AM_PATH_SDL2], +AC_DEFUN([AM_PATH_SDL3], [dnl -dnl Get the cflags and libraries from the sdl2-config script +dnl Get the cflags and libraries from the sdl3-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") @@ -21,52 +21,52 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) - min_sdl_version=ifelse([$1], ,2.0.0,$1) + min_sdl_version=ifelse([$1], ,3.0.0,$1) if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + PKG_CHECK_MODULES([SDL], [sdl3 >= $min_sdl_version], [sdl_pc=yes], [sdl_pc=no]) else sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + AC_PATH_PROG(SDL3_CONFIG, sdl3-config, no, [$PATH]) PATH="$as_save_PATH" AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then + if test "$SDL3_CONFIG" = "no" ; then no_sdl=yes else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -77,7 +77,7 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl2-config to some extent +dnl checks the results of sdl3-config to some extent dnl rm -f conf.sdltest AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -105,11 +105,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -130,11 +130,11 @@ int main (int argc, char *argv[]) if test "x$no_sdl" = x ; then ifelse([$2], , :, [$2]) else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" diff --git a/visualtest/configure b/visualtest/configure index ca7c71eb0..b9576830a 100755 --- a/visualtest/configure +++ b/visualtest/configure @@ -586,7 +586,7 @@ ac_subst_vars='LTLIBOBJS LIBOBJS LIBUNWIND_LIBS LIBUNWIND_CFLAGS -SDL2_CONFIG +SDL3_CONFIG SDL_LIBS SDL_CFLAGS PKG_CONFIG_LIBDIR @@ -2919,19 +2919,19 @@ fi if test "x$sdl_prefix$sdl_exec_prefix" = x ; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 -$as_echo_n "checking for sdl2 >= $min_sdl_version... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl3 >= $min_sdl_version" >&5 +$as_echo_n "checking for sdl3 >= $min_sdl_version... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl3 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -2942,12 +2942,12 @@ if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl3 >= $min_sdl_version" 2>/dev/null` else pkg_failed=yes fi @@ -2967,9 +2967,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl3 >= $min_sdl_version" 2>&1` else - SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $min_sdl_version" 2>&1` + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl3 >= $min_sdl_version" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SDL_PKG_ERRORS" >&5 @@ -2990,36 +2990,36 @@ fi sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - # Extract the first word of "sdl2-config", so it can be a program name with args. -set dummy sdl2-config; ac_word=$2 + # Extract the first word of "sdl3-config", so it can be a program name with args. +set dummy sdl3-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SDL2_CONFIG+:} false; then : +if ${ac_cv_path_SDL3_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else - case $SDL2_CONFIG in + case $SDL3_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. + ac_cv_path_SDL3_CONFIG="$SDL3_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3029,7 +3029,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_SDL3_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3037,14 +3037,14 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no" + test -z "$ac_cv_path_SDL3_CONFIG" && ac_cv_path_SDL3_CONFIG="no" ;; esac fi -SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG -if test -n "$SDL2_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 -$as_echo "$SDL2_CONFIG" >&6; } +SDL3_CONFIG=$ac_cv_path_SDL3_CONFIG +if test -n "$SDL3_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL3_CONFIG" >&5 +$as_echo "$SDL3_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -3056,17 +3056,17 @@ fi $as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then + if test "$SDL3_CONFIG" = "no" ; then no_sdl=yes else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -3106,11 +3106,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -3143,11 +3143,11 @@ $as_echo "no" >&6; } if test "x$no_sdl" = x ; then : else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -3189,7 +3189,7 @@ else echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -3208,7 +3208,7 @@ rm -f core conftest.err conftest.$ac_objext \ rm -f conf.sdltest CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL2_test $SDL_LIBS $EXTRALIB" +LIBS="$LIBS -lSDL3_test $SDL_LIBS $EXTRALIB" pkg_failed=no diff --git a/visualtest/configure.ac b/visualtest/configure.ac index 3566bf0d8..d36d89103 100644 --- a/visualtest/configure.ac +++ b/visualtest/configure.ac @@ -23,13 +23,13 @@ esac AC_SUBST(EXE) dnl Check for SDL -SDL_VERSION=2.0.0 -AM_PATH_SDL2($SDL_VERSION, +SDL_VERSION=3.0.0 +AM_PATH_SDL3($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL2_test $SDL_LIBS $EXTRALIB" +LIBS="$LIBS -lSDL3_test $SDL_LIBS $EXTRALIB" PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no) if test x$have_libunwind = xyes ; then From 1b9c4c5ca1d166a88fed14d5026574f072c03571 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 22 Nov 2022 04:30:16 +0000 Subject: [PATCH 409/459] Sync SDL wiki -> header --- include/SDL_audio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/SDL_audio.h b/include/SDL_audio.h index ee6c5e092..3ad8e6c9d 100644 --- a/include/SDL_audio.h +++ b/include/SDL_audio.h @@ -1211,9 +1211,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * You should not call SDL_LockAudio() on the device before queueing; SDL * handles locking internally for this function. * - * Note that SDL does not support planar audio. You will need to resample - * from planar audio formats into a non-planar one (see SDL_AudioFormat) - * before queuing audio. + * Note that SDL does not support planar audio. You will need to resample from + * planar audio formats into a non-planar one (see SDL_AudioFormat) before + * queuing audio. * * \param dev the device ID to which we will queue audio * \param data the data to queue to the device for later playback From ea21628045860c6f4b39b411d0a43ae32f51ccc7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 22 Nov 2022 06:36:19 +0100 Subject: [PATCH 410/459] ci: replace references to SDL2 with SDL3 --- .github/workflows/android.yml | 14 +++++++------- .github/workflows/emscripten.yml | 4 ++-- .github/workflows/main.yml | 30 +++++++++++++++--------------- .github/workflows/msvc.yml | 6 +++--- .github/workflows/n3ds.yml | 4 ++-- .github/workflows/ps2.yaml | 12 ++++++------ .github/workflows/psp.yaml | 12 ++++++------ .github/workflows/riscos.yml | 6 +++--- .github/workflows/vita.yaml | 12 ++++++------ .github/workflows/watcom.yml | 2 +- 10 files changed, 51 insertions(+), 51 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index ccc02666f..0cfda01d1 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -50,7 +50,7 @@ jobs: if: ${{ matrix.platform.name == 'CMake' }} run: | cmake --install build --config Release - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files if: ${{ matrix.platform.name == 'CMake' }} @@ -60,22 +60,22 @@ jobs: -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ -DANDROID_ABI=${{ matrix.platform.android_abi }} \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config if: ${{ matrix.platform.name == 'CMake' }} run: | export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc if: ${{ matrix.platform.name == 'CMake' }} run: | export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Verify Android.mk if: ${{ matrix.platform.name == 'CMake' }} run: | - export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules + export NDK_MODULE_PATH=${{ env.SDL3_DIR }}/share/ndk-modules ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1 diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 56f77b6ce..0a5cd7bc1 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -33,7 +33,7 @@ jobs: # ctest -VV --test-dir build/ - name: Install run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build/ - name: Verify CMake configuration files run: | @@ -41,5 +41,5 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DSDL_VENDOR_INFO="Github Workflow" \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b09ae9447..250f8905c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -88,14 +88,14 @@ jobs: ctest -VV --test-dir build/ if test "${{ runner.os }}" = "Linux"; then # This should show us the SDL_REVISION - strings build/libSDL2-2.0.so.0 | grep SDL- + strings build/libSDL3-3.0.so.0 | grep SDL- fi - name: Install (CMake) if: "! matrix.platform.autotools" run: | set -eu cmake --install build/ --config Release - echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV ( cd cmake_prefix; find ) | LC_ALL=C sort -u - name: Configure (Autotools) if: matrix.platform.autotools @@ -123,8 +123,8 @@ jobs: --x-libraries="/usr/lib/${multiarch}" \ --prefix=${{ github.workspace }}/autotools_prefix \ SDL_CFLAGS="-I${curdir}/include" \ - SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \ - ac_cv_lib_SDL2_ttf_TTF_Init=no \ + SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL3" \ + ac_cv_lib_SDL3_ttf_TTF_Init=no \ ${NULL+} ) fi @@ -147,7 +147,7 @@ jobs: make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" if test "${{ runner.os }}" = "Linux"; then # This should show us the SDL_REVISION - strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL- + strings "${curdir}/build-autotools/build/.libs/libSDL3-3.0.so.0" | grep SDL- fi - name: Install (Autotools) if: matrix.platform.autotools @@ -160,20 +160,20 @@ jobs: make -j"${parallel}" -C build-autotools/test install V=1 fi ( cd autotools_prefix; find . ) | LC_ALL=C sort -u - echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Distcheck (Autotools) if: matrix.platform.autotools @@ -184,9 +184,9 @@ jobs: # Similar to Automake `make distcheck`: check that the tarball # release is sufficient to do a new build mkdir distcheck - tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz - ( cd distcheck/SDL2-* && ./configure ) - make -j"${parallel}" -C distcheck/SDL2-* + tar -C distcheck -zxf build-autotools/SDL3-*.tar.gz + ( cd distcheck/SDL3-* && ./configure ) + make -j"${parallel}" -C distcheck/SDL3-* - name: Run installed-tests (Autotools) if: "runner.os == 'Linux' && matrix.platform.autotools" run: | @@ -203,4 +203,4 @@ jobs: LD_LIBRARY_PATH=/usr/local/lib \ SDL_AUDIODRIVER=dummy \ SDL_VIDEODRIVER=dummy \ - ginsttest-runner --tap SDL2 + ginsttest-runner --tap SDL3 diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 78fb73a7c..01d95485d 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -44,7 +44,7 @@ jobs: -DSDL_TESTS=ON ` -DSDL_INSTALL_TESTS=ON ` -DSDL_VENDOR_INFO="Github Workflow" ` - -DSDL2_DISABLE_INSTALL=OFF ` + -DSDL3_DISABLE_INSTALL=OFF ` ${{ matrix.platform.flags }} ` -DCMAKE_INSTALL_PREFIX=prefix - name: Build (CMake) @@ -56,13 +56,13 @@ jobs: ctest -VV --test-dir build/ -C Release - name: Install (CMake) run: | - echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV + echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV cmake --install build/ - name: Verify CMake configuration files if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP run: | cmake -S cmake/test -B cmake_config_build ` - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} ` + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} ` ${{ matrix.platform.flags }} cmake --build cmake_config_build --config Release diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml index f35577e66..b7d7d9d11 100644 --- a/.github/workflows/n3ds.yml +++ b/.github/workflows/n3ds.yml @@ -27,7 +27,7 @@ jobs: run: cmake --build build --verbose - name: Install CMake run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build/ ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files @@ -35,7 +35,7 @@ jobs: cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose # Not running test_pkgconfig.sh and test_sdlconfig.sh diff --git a/.github/workflows/ps2.yaml b/.github/workflows/ps2.yaml index bfb0b1ceb..e36905aa8 100644 --- a/.github/workflows/ps2.yaml +++ b/.github/workflows/ps2.yaml @@ -36,7 +36,7 @@ jobs: run: | set -eu cmake --install build/ --config Release - echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV ( cd cmake_prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files @@ -44,20 +44,20 @@ jobs: cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=mips64r5900el-ps2-elf-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib" cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=mips64r5900el-ps2-elf-gcc export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib" - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Get short SHA diff --git a/.github/workflows/psp.yaml b/.github/workflows/psp.yaml index addc7b11f..80c42c92a 100644 --- a/.github/workflows/psp.yaml +++ b/.github/workflows/psp.yaml @@ -25,26 +25,26 @@ jobs: run: cmake --build build --config Release - name: Install run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build --config Release ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build \ -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DTEST_SHARED=FALSE \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=psp-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=psp-gcc - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" cmake/test/test_pkgconfig.sh diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml index 1fec84066..2f4aca27d 100644 --- a/.github/workflows/riscos.yml +++ b/.github/workflows/riscos.yml @@ -34,7 +34,7 @@ jobs: - name: Install (autotools) if: ${{ contains(matrix.platform.name, 'autotools') }} run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV + echo "SDL3_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV make -C build_autotools install ( cd ${{ github.workspace }}/prefix_autotools; find ) | LC_ALL=C sort -u - name: Configure (CMake) @@ -55,14 +55,14 @@ jobs: - name: Install (CMake) if: ${{ contains(matrix.platform.name, 'CMake') }} run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV + echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV cmake --install build/ ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release \ ${{ matrix.platform.test_args }} cmake --build cmake_config_build --verbose diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index ac3b17c43..a73114d04 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -30,7 +30,7 @@ jobs: run: cmake --build build --verbose - name: Install CMake run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build/ ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files @@ -38,16 +38,16 @@ jobs: cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=arm-vita-eabi-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=arm-vita-eabi-gcc - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml index bef3cf957..13f1505ff 100644 --- a/.github/workflows/watcom.yml +++ b/.github/workflows/watcom.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: open-watcom/setup-watcom@v0 - - name: Build SDL2 + - name: Build run: | wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - name: Build tests From d8864ea11de4804b49b5a7bbb573c0aa919dc0d8 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 22 Nov 2022 18:47:03 +0300 Subject: [PATCH 411/459] removed visualtest --- .gitignore | 9 - .../unittest/testquit/testquit_VS2012.vcxproj | 217 - VisualC/visualtest/visualtest_VS2012.vcxproj | 308 -- visualtest/COPYING.txt | 18 - visualtest/Makefile.in | 44 - visualtest/README.txt | 214 - visualtest/acinclude.m4 | 337 -- visualtest/autogen.sh | 11 - .../testsprite2_blendmodes.actions | 3 - .../testsprite2_blendmodes.config | 5 - .../testsprite2_blendmodes.parameters | 5 - .../testsprite2_crashtest.actions | 1 - .../testsprite2_crashtest.config | 5 - .../testsprite2_crashtest.parameters | 24 - .../testsprite2_fullscreen.actions | 3 - .../testsprite2_fullscreen.config | 5 - .../testsprite2_fullscreen.parameters | 5 - .../testsprite2_geometry.actions | 3 - .../testsprite2_geometry.config | 5 - .../testsprite2_geometry.parameters | 5 - visualtest/configure | 4442 ----------------- visualtest/configure.ac | 41 - visualtest/docs/Doxyfile | 1936 ------- .../SDL_visualtest_action_configparser.h | 149 - .../SDL_visualtest_exhaustive_variator.h | 64 - .../SDL_visualtest_harness_argparser.h | 75 - .../include/SDL_visualtest_mischelper.h | 28 - .../include/SDL_visualtest_parsehelper.h | 46 - visualtest/include/SDL_visualtest_process.h | 112 - .../include/SDL_visualtest_random_variator.h | 61 - visualtest/include/SDL_visualtest_rwhelper.h | 87 - .../include/SDL_visualtest_screenshot.h | 52 - .../include/SDL_visualtest_sut_configparser.h | 105 - .../include/SDL_visualtest_variator_common.h | 122 - visualtest/include/SDL_visualtest_variators.h | 66 - visualtest/launch_harness.cmd | 2 - visualtest/launch_harness.sh | 6 - visualtest/src/action_configparser.c | 399 -- visualtest/src/harness_argparser.c | 358 -- visualtest/src/linux/linux_process.c | 208 - visualtest/src/mischelper.c | 28 - visualtest/src/parsehelper.c | 231 - visualtest/src/rwhelper.c | 131 - visualtest/src/screenshot.c | 136 - visualtest/src/sut_configparser.c | 232 - visualtest/src/testharness.c | 532 -- visualtest/src/variator_common.c | 225 - visualtest/src/variator_exhaustive.c | 133 - visualtest/src/variator_random.c | 113 - visualtest/src/variators.c | 95 - visualtest/src/windows/windows_process.c | 283 -- visualtest/src/windows/windows_screenshot.c | 349 -- visualtest/testsprite2_sample.actions | 3 - visualtest/testsprite2_sample.config | 6 - visualtest/testsprite2_sample.parameters | 29 - visualtest/unittest/testquit.actions | 1 - visualtest/unittest/testquit.c | 102 - visualtest/unittest/testquit.config | 5 - visualtest/unittest/testquit.parameters | 3 - 59 files changed, 12223 deletions(-) delete mode 100644 VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj delete mode 100644 VisualC/visualtest/visualtest_VS2012.vcxproj delete mode 100644 visualtest/COPYING.txt delete mode 100644 visualtest/Makefile.in delete mode 100644 visualtest/README.txt delete mode 100644 visualtest/acinclude.m4 delete mode 100755 visualtest/autogen.sh delete mode 100644 visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.actions delete mode 100644 visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.config delete mode 100644 visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.parameters delete mode 100644 visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.actions delete mode 100644 visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.config delete mode 100644 visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.parameters delete mode 100644 visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.actions delete mode 100644 visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.config delete mode 100644 visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.parameters delete mode 100644 visualtest/configs/testsprite2_geometry/testsprite2_geometry.actions delete mode 100644 visualtest/configs/testsprite2_geometry/testsprite2_geometry.config delete mode 100644 visualtest/configs/testsprite2_geometry/testsprite2_geometry.parameters delete mode 100755 visualtest/configure delete mode 100644 visualtest/configure.ac delete mode 100644 visualtest/docs/Doxyfile delete mode 100644 visualtest/include/SDL_visualtest_action_configparser.h delete mode 100644 visualtest/include/SDL_visualtest_exhaustive_variator.h delete mode 100644 visualtest/include/SDL_visualtest_harness_argparser.h delete mode 100644 visualtest/include/SDL_visualtest_mischelper.h delete mode 100644 visualtest/include/SDL_visualtest_parsehelper.h delete mode 100644 visualtest/include/SDL_visualtest_process.h delete mode 100644 visualtest/include/SDL_visualtest_random_variator.h delete mode 100644 visualtest/include/SDL_visualtest_rwhelper.h delete mode 100644 visualtest/include/SDL_visualtest_screenshot.h delete mode 100644 visualtest/include/SDL_visualtest_sut_configparser.h delete mode 100644 visualtest/include/SDL_visualtest_variator_common.h delete mode 100644 visualtest/include/SDL_visualtest_variators.h delete mode 100644 visualtest/launch_harness.cmd delete mode 100755 visualtest/launch_harness.sh delete mode 100644 visualtest/src/action_configparser.c delete mode 100644 visualtest/src/harness_argparser.c delete mode 100644 visualtest/src/linux/linux_process.c delete mode 100644 visualtest/src/mischelper.c delete mode 100644 visualtest/src/parsehelper.c delete mode 100644 visualtest/src/rwhelper.c delete mode 100644 visualtest/src/screenshot.c delete mode 100644 visualtest/src/sut_configparser.c delete mode 100644 visualtest/src/testharness.c delete mode 100644 visualtest/src/variator_common.c delete mode 100644 visualtest/src/variator_exhaustive.c delete mode 100644 visualtest/src/variator_random.c delete mode 100644 visualtest/src/variators.c delete mode 100644 visualtest/src/windows/windows_process.c delete mode 100644 visualtest/src/windows/windows_screenshot.c delete mode 100644 visualtest/testsprite2_sample.actions delete mode 100644 visualtest/testsprite2_sample.config delete mode 100644 visualtest/testsprite2_sample.parameters delete mode 100644 visualtest/unittest/testquit.actions delete mode 100644 visualtest/unittest/testquit.c delete mode 100644 visualtest/unittest/testquit.config delete mode 100644 visualtest/unittest/testquit.parameters diff --git a/.gitignore b/.gitignore index a746abbc1..099b15322 100644 --- a/.gitignore +++ b/.gitignore @@ -88,15 +88,6 @@ VisualC/tests/testscale/icon.bmp VisualC/tests/testscale/sample.bmp VisualC/tests/testsprite2/icon.bmp VisualC/tests/testyuv/testyuv.bmp -VisualC/visualtest/icon.bmp -VisualC/visualtest/testquit.actions -VisualC/visualtest/testquit.config -VisualC/visualtest/testquit.exe -VisualC/visualtest/testquit.parameters -VisualC/visualtest/testsprite2.exe -VisualC/visualtest/testsprite2_sample.actions -VisualC/visualtest/testsprite2_sample.config -VisualC/visualtest/testsprite2_sample.parameters VisualC-GDK/**/Layout # for Android diff --git a/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj b/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj deleted file mode 100644 index 37fa03927..000000000 --- a/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj +++ /dev/null @@ -1,217 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - testquit - testquit - {1D12C737-7C71-45CE-AE2C-AAB47B690BC8} - 10.0 - - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - MultiByte - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - false - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - true - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - OnlyExplicitInline - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - - - OnlyExplicitInline - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - - - - - - - - {da956fd3-e142-46f2-9dd5-c78bebb56b7a} - - - {da956fd3-e143-46f2-9fe5-c77bebc56b1a} - - - {81ce8daf-ebb2-4761-8e45-b71abcca8c68} - - - - - - \ No newline at end of file diff --git a/VisualC/visualtest/visualtest_VS2012.vcxproj b/VisualC/visualtest/visualtest_VS2012.vcxproj deleted file mode 100644 index 6ad5b619d..000000000 --- a/VisualC/visualtest/visualtest_VS2012.vcxproj +++ /dev/null @@ -1,308 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - visualtest - visualtest - {13DDF23A-4A8F-4AF9-9734-CC09D9157924} - 10.0 - - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - MultiByte - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - false - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - true - - - testharness - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - OnlyExplicitInline - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - - - OnlyExplicitInline - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - Disabled - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - EditAndContinue - Default - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - - - Disabled - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {da956fd3-e142-46f2-9dd5-c78bebb56b7a} - - - {da956fd3-e143-46f2-9fe5-c77bebc56b1a} - - - {81ce8daf-ebb2-4761-8e45-b71abcca8c68} - - - - - - \ No newline at end of file diff --git a/visualtest/COPYING.txt b/visualtest/COPYING.txt deleted file mode 100644 index a92fe14bc..000000000 --- a/visualtest/COPYING.txt +++ /dev/null @@ -1,18 +0,0 @@ -Visual and Interactive Test Automation for SDL 3.0 -Copyright (C) 2013 Apoorv Upreti - -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. diff --git a/visualtest/Makefile.in b/visualtest/Makefile.in deleted file mode 100644 index 3cf2f6df4..000000000 --- a/visualtest/Makefile.in +++ /dev/null @@ -1,44 +0,0 @@ -# Makefile to build the SDL tests - -srcdir = @srcdir@ -CC = @CC@ -EXE = @EXE@ -CFLAGS = @CFLAGS@ -I../include -I./include -LIBS = @LIBS@ - -TARGETS = \ - testharness$(EXE) \ - testquit$(EXE) - -all: Makefile $(TARGETS) - -Makefile: $(srcdir)/Makefile.in - $(SHELL) config.status $@ - -testharness$(EXE): $(srcdir)/src/action_configparser.c \ - $(srcdir)/src/harness_argparser.c \ - $(srcdir)/src/rwhelper.c \ - $(srcdir)/src/testharness.c \ - $(srcdir)/src/variator_exhaustive.c \ - $(srcdir)/src/variators.c \ - $(srcdir)/src/screenshot.c \ - $(srcdir)/src/harness_argparser.c \ - $(srcdir)/src/sut_configparser.c \ - $(srcdir)/src/variator_common.c \ - $(srcdir)/src/variator_random.c \ - $(srcdir)/src/parsehelper.c \ - $(srcdir)/src/mischelper.c \ - $(srcdir)/src/linux/linux_process.c \ - $(srcdir)/src/windows/windows_process.c \ - $(srcdir)/src/windows/windows_screenshot.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - -testquit$(EXE): $(srcdir)/unittest/testquit.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - -clean: - rm -f $(TARGETS) -distclean: clean - rm -f Makefile - rm -f config.status config.cache config.log - rm -rf $(srcdir)/autom4te* diff --git a/visualtest/README.txt b/visualtest/README.txt deleted file mode 100644 index 0d9a905f6..000000000 --- a/visualtest/README.txt +++ /dev/null @@ -1,214 +0,0 @@ -/*! - -\mainpage Visual and Interactive Test Automation for SDL 2.0 - -\section license_sec License -Check the file \c LICENSE.txt for licensing information. - -\section intro_sec Introduction -The goal of this GSoC project is to automate the testing of testsprite2. -testsprite2 takes 26 parameters which have thousands of valid combinations and is -used to validate SDL's window, mouse and rendering behaviour. By having a test -harness that runs testsprite2 with various command line argument strings and -validates the output for each run, we can make testing an easier task for -maintainers, contributors and testers. The test harness can be used by a continuous -integration system (like buildbot or jenkins) to validate SDL after checkins. - -SDL Homepage: http://libsdl.org/ - -\section build_sec Building - -\subsection build_linux Building on Linux/Cygwin -./autogen.sh; ./configure; make; - -\subsection build_windows Building on Windows -Use the Visual Studio solution under \c SDL/VisualC/visualtest. - -\section docs_sec Documentation -Documentation is available via Doxygen. To build the documentation, cd to the -SDL/visualtest/docs directory and run \c doxygen. A good starting point for -exploring the documentation is \c SDL/visualtest/docs/html/index.html - -\section usage_sec Usage -To see all the options supported by the test harness, just run \c testharness -with no arguments. - -At the moment the following options are supported: -\li \c sutapp - Path to the system under test (SUT) application -\li \c sutargs - Launch the SUT with the specified arguments string -\li \c timeout - The maximum time after which the SUT process will be killed; - passed as hh:mm:ss; default 00:01:00 -\li \c variator - Which variator to use; see \ref variators_sec -\li \c num-variations - The number of variations to run for; taken to be - 1 for the random variator and ALL for the exhaustive variator by default -\li \c no-launch - Just print the arguments string for each variation without - launching the SUT or performing any actions -\li \c parameter-config - A config file that describes the command line parameters - supported by the SUT; see \ref paramconfig_sec or the sample *.parameters files - for more details -\li \c action-config - A config file with a list of actions to be performed while - the SUT is running; see \ref actionconfig_sec or the sample *.actions files -\li \c output-dir - Path to the directory where screenshots should be saved; is - created if it doesn't exist; taken to be "./output" by default -\li \c verify-dir - Path to the directory with the verification images; taken to - be "./verify" by default - -Paths can be relative or absolute. - -Alternatively, the options can be passed as a config file for convenience: - -testharness \-\-config testsprite2_sample.config - -For a sample, take a look at the *.config files in this repository. - -We can also pass a config file and override certain options as necessary: -testharness \-\-config testsprite2_sample.config \-\-num-variations 10 - -Note: You may find it convenient to copy the SUT executable along with any -resources to the test harness directory. Also note that testsprite2 and its -resources (icon.bmp) are automatically copied when using the Visual Studio -solution. - -\subsection usageexamples_subsec Usage examples: - -Passing a custom arguments string: -testharness \-\-sutapp testsprite2 \-\-sutargs "\-\-cyclecolor \-\-blend mod -\-\-iterations 2" \-\-action-config xyz.actions - -Using the random variator: -testharness \-\-sutapp testsprite2 \-\-variator random \-\-num-variations 5 -\-\-parameter-config xyz.parameters \-\-action-config xyz.actions - -\subsection config_subsec Config Files -Config files are an alternate way to pass parameters to the test harness. We -describe the paramters in a config file and pass that to the test harness using -the \-\-config option. The config file consists of lines of the form "x=y" where -x is an option and y is it's value. For boolean options, we simply give the name -of the option to indicate that it is to be passed to the testharness. - -The hash '#' character can be used to start a comment from that point to the end -of the line. - -\section paramconfig_sec The SUT Parameters File -To generate variations we need to describe the parameters the will be passed to -the SUT. This description is given in a parameters file. Each line of the parameters -file (except the blank lines) represents one command line option with five -comma separated fields: -name, type, values, required, categories - -\li \c name is the name of the option, e.g., \c \-\-cyclecolor. -\li \c type can have one of three values - integer, boolean and enum. -\li \c values - for integer options this is the valid range of values the option - can take, i.e., [min max]. For enum options this is a list of strings that - the option can take, e.g., [val1 val2 val3]. For boolean options this field - is ignored. -\li \c required - true if the option is required, false otherwise. -\li \c categories - a list of categories that the option belongs to. For example, - [video mouse audio] - -Just like with config files, hash characters can be used to start comments. - -\subsection additionalnotes_subsec Additional Notes - -\li If you want to have an option that always takes a certain value, use an enum - with only one value. -\li Currently there isn't any way to turn an option off, i.e., all options will - be included in the command line options string that is generated using the - config. If you don't want an option to be passed to the SUT, remove it from - the config file or comment it out. - -\section variators_sec Variators -Variators are the mechanism by which we generate strings of command line arguments -to test the SUT with. A variator is quite simply an iterator that iterates through -different variations of command line options. There are two variators supported at -the moment: -\li \b Exhaustive - Generate all possible combinations of command line arguments - that are valid. -\li \b Random - Generate a random variation each time the variator is called. - -As an example, let's try a simple .parameters file:\n - -\-\-blend, enum, [add mod], false, [] \n -\-\-fullscreen, boolean, [], false, [] - - -The exhaustive variator would generate the following four variations:\n - -\-\-blend add \n -\-\-blend mod \n -\-\-blend add \-\-fullscreen \n -\-\-blend mod \-\-fullscreen \n - - -The random variator would simply generate a random variation like the following:\n -\-\-blend mod - -\section actionconfig_sec The Actions File -Once the SUT process has been launched, automated testing happens using a mechanism -called actions. A list of actions is read from a file and each action is performed -on the SUT process sequentially. Each line in the actions file describes an action. -The format for an action is hh:mm:ss ACTION_NAME additional parameters. -There are five actions supported at the moment: -\li \b SCREENSHOT - Takes a screenshot of each window owned by the SUT process. The - images are saved as \c [hash]_[i].bmp where \c [hash] is the 32 character long - hexadecimal MD5 hash of the arguments string that was passed to the SUT while - launching it and \c i is the window number. i = 1 is an exceptional case - where the \c _[i] is dropped and the filename is simply \c [hash].bmp\n - Note: The screenshots are only of the window's client area. -\li \b VERIFY - Verifies the screenshots taken by the last SCREENSHOT action by - comparing them against a verification image. Each \c [hash]_i.bmp image output - by the SCREENSHOT action is compared against a \c [hash].bmp image in the - verify-dir. -\li \b QUIT - Gracefully quits the SUT process. On Windows this means sending a - WM_CLOSE message to each window owned by the SUT process. On Linux it means - sending a SIGQUIT signal to the SUT process. -\li \b KILL - Forcefully kills the SUT process. This is useful when the SUT process - doesn't respond to the QUIT action. -\li LAUNCH [/path/to/executable] [args] - Runs an executable with \c [args] - as the arguments string. - -Just like with config files, hash characters can be used to start comments. - -\section contint_sec Continuous Integration (CI) -One of the goals of the project was to create a test harness that integrates -with CI systems to provide automated visual and interactive testing to SDL. - -At the moment the test harness can be run in two modes that are useful for CI: -\li Crash testing mode - launch the SUT with every variation and all parameters, - report to the CI if there's a crash -\li Visual testing mode - launch and visually verify the SUT for a smaller subset - of the parameters - -Look at the launch_harness.sh/launch_harness.cmd for an example scripts that run the -test harness for all variations with all parameters and report an error on a crash. -The script uses the testsprite2_crashtest config, so remember to copy those files -over to the test harness executable directory along with the script. - -\section todo_sec TODOs -\li Allow specifying a clipping box along with the VERIFY action, i.e., hh:mm:ss - VERIFY x, y, w, h -\li Add support for spaces between the equals sign in test harness config files -\li Implement the SCREENSHOT action on Linux -\li Add a pairwise variator -\li Add actions to inject keyboard/mouse events -\li Add actions to manipulate the SUT window, e.g., minimize, restore, resize -\li Add support to load and save screenshots as .pngs instead of .bmps - -\section issues_sec Known Issues -\li The QUIT action does not work on a testsprite2 process with multiple windows. - This appears to be an issue with testsprite2. -\li The SCREENSHOT action doesn't capture the testsprite2 window correctly if the - --fullscreen option is supplied. It works with --fullscreen-desktop, however. - -\section moreinfo_sec More Information - -Author Contact Info:\n -Apoorv Upreti \c \ - -Other useful links: -- Project Repository: https://bitbucket.org/nerdap/sdlvisualtest -- Project Wiki: https://github.com/nerdap/autotestsprite2/wiki -- Project Blog: http://nerdap.github.io -- Verification images for testsprite2_blendmodes: https://www.dropbox.com/s/nm02aem76m812ng/testsprite2_blendmodes.zip -- Verification images for testsprite2_geometry: https://www.dropbox.com/s/csypwryopaslpaf/testsprite2_geometry.zip -*/ diff --git a/visualtest/acinclude.m4 b/visualtest/acinclude.m4 deleted file mode 100644 index 3dd4058ea..000000000 --- a/visualtest/acinclude.m4 +++ /dev/null @@ -1,337 +0,0 @@ -# Configure paths for SDL -# Sam Lantinga 9/21/99 -# stolen from Manish Singh -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -# serial 2 - -dnl AM_PATH_SDL3([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS -dnl -AC_DEFUN([AM_PATH_SDL3], -[dnl -dnl Get the cflags and libraries from the sdl3-config script -dnl -AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], - sdl_prefix="$withval", sdl_prefix="") -AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], - sdl_exec_prefix="$withval", sdl_exec_prefix="") -AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], - , enable_sdltest=yes) - - min_sdl_version=ifelse([$1], ,3.0.0,$1) - - if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl3 >= $min_sdl_version], - [sdl_pc=yes], - [sdl_pc=no]) - else - sdl_pc=no - if test x$sdl_exec_prefix != x ; then - sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL3_CONFIG+set} != xset ; then - SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL3_CONFIG+set} != xset ; then - SDL3_CONFIG=$sdl_prefix/bin/sdl3-config - fi - fi - fi - - if test "x$sdl_pc" = xyes ; then - no_sdl="" - SDL3_CONFIG="pkg-config sdl3" - else - as_save_PATH="$PATH" - if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - fi - AC_PATH_PROG(SDL3_CONFIG, sdl3-config, no, [$PATH]) - PATH="$as_save_PATH" - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - no_sdl="" - - if test "$SDL3_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - - sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" -dnl -dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl3-config to some extent -dnl - rm -f conf.sdltest - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include "SDL.h" - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - FILE *fp = fopen("conf.sdltest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); - printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -]])], [], [no_sdl=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - fi - if test "x$no_sdl" = x ; then - ifelse([$2], , :, [$2]) - else - if test "$SDL3_CONFIG" = "no" ; then - echo "*** The sdl3-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL3_CONFIG environment variable to the" - echo "*** full path to sdl3-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main -]], [[ return 0; ]])], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - rm -f conf.sdltest -]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH|_LIBDIR)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $2]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])# PKG_CHECK_MODULES diff --git a/visualtest/autogen.sh b/visualtest/autogen.sh deleted file mode 100755 index 988d41760..000000000 --- a/visualtest/autogen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -cp acinclude.m4 aclocal.m4 - -if test "$AUTOCONF"x = x; then - AUTOCONF=autoconf -fi - -$AUTOCONF || exit 1 -rm aclocal.m4 -rm -rf autom4te.cache diff --git a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.actions b/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.actions deleted file mode 100644 index ef54e86b4..000000000 --- a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.actions +++ /dev/null @@ -1,3 +0,0 @@ -00:00:03 SCREENSHOT -00:00:06 VERIFY -00:00:09 QUIT \ No newline at end of file diff --git a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.config b/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.config deleted file mode 100644 index 0d707bcbc..000000000 --- a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.config +++ /dev/null @@ -1,5 +0,0 @@ -parameter-config=testsprite2_blendmodes.parameters -variator=exhaustive -sutapp=testsprite2 -timeout=00:00:15 -action-config=testsprite2_blendmodes.actions \ No newline at end of file diff --git a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.parameters b/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.parameters deleted file mode 100644 index a5df29c8c..000000000 --- a/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.parameters +++ /dev/null @@ -1,5 +0,0 @@ -# parameter name, type, value range, required, categories ---blend, enum, [none blend add mod], false, [] ---cyclecolor, boolean, [], false, [] ---cyclealpha, boolean, [], false, [] ---iterations, integer, [1000 1000], true, [] \ No newline at end of file diff --git a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.actions b/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.actions deleted file mode 100644 index 75af9d75d..000000000 --- a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.actions +++ /dev/null @@ -1 +0,0 @@ -00:00:02 QUIT \ No newline at end of file diff --git a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.config b/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.config deleted file mode 100644 index c8f07ca9f..000000000 --- a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.config +++ /dev/null @@ -1,5 +0,0 @@ -parameter-config=testsprite2_crashtest.parameters -variator=exhaustive -sutapp=testsprite2 -timeout=00:00:10 -action-config=testsprite2_crashtest.actions \ No newline at end of file diff --git a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.parameters b/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.parameters deleted file mode 100644 index e89ce60ab..000000000 --- a/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.parameters +++ /dev/null @@ -1,24 +0,0 @@ -# parameter name, type, value range, required, categories ---display, integer, [1 5], false, [] ---fullscreen, boolean, [], false, [] ---fullscreen-desktop, boolean, [], false, [] ---title, enum, [vartest bartest footest], false, [] ---icon, enum, [icon.bmp], false, [] ---center, boolean, [], false, [] ---position, enum, [300,300], false, [] ---geometry, enum, [500x500], false, [] ---min-geometry, enum, [100x100 200x200], false, [] ---max-geometry, enum, [600x600 700x700], false, [] ---logical, enum, [500x500 550x450], false, [] ---scale, integer, [1 5], false, [] ---depth, integer, [1 5], false, [] ---refresh, integer, [1 5], false, [] ---vsync, boolean, [], false, [] ---noframe, boolean, [], false, [] ---resize, boolean, [], false, [] ---minimize, boolean, [], false, [] ---maximize, boolean, [], false, [] ---grab, boolean, [], false, [mouse] ---blend, enum, [none blend add mod], false, [] ---cyclecolor, boolean, [], false, [] ---cyclealpha, boolean, [], false, [] \ No newline at end of file diff --git a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.actions b/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.actions deleted file mode 100644 index ef54e86b4..000000000 --- a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.actions +++ /dev/null @@ -1,3 +0,0 @@ -00:00:03 SCREENSHOT -00:00:06 VERIFY -00:00:09 QUIT \ No newline at end of file diff --git a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.config b/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.config deleted file mode 100644 index 361020ac0..000000000 --- a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.config +++ /dev/null @@ -1,5 +0,0 @@ -parameter-config=testsprite2_fullscreen.parameters -variator=exhaustive -sutapp=testsprite2 -timeout=00:00:15 -action-config=testsprite2_fullscreen.actions \ No newline at end of file diff --git a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.parameters b/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.parameters deleted file mode 100644 index 8da19673e..000000000 --- a/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.parameters +++ /dev/null @@ -1,5 +0,0 @@ -# parameter name, type, value range, required, categories ---blend, enum, [none blend add mod], false, [] ---fullscreen, boolean, [], false, [] ---fullscreen-desktop, boolean, [], false, [] ---iterations, integer, [1000 1000], true, [] \ No newline at end of file diff --git a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.actions b/visualtest/configs/testsprite2_geometry/testsprite2_geometry.actions deleted file mode 100644 index ef54e86b4..000000000 --- a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.actions +++ /dev/null @@ -1,3 +0,0 @@ -00:00:03 SCREENSHOT -00:00:06 VERIFY -00:00:09 QUIT \ No newline at end of file diff --git a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.config b/visualtest/configs/testsprite2_geometry/testsprite2_geometry.config deleted file mode 100644 index f3cda9ac1..000000000 --- a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.config +++ /dev/null @@ -1,5 +0,0 @@ -parameter-config=testsprite2_geometry.parameters -variator=exhaustive -sutapp=testsprite2 -timeout=00:00:15 -action-config=testsprite2_geometry.actions \ No newline at end of file diff --git a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.parameters b/visualtest/configs/testsprite2_geometry/testsprite2_geometry.parameters deleted file mode 100644 index c1ac8ef37..000000000 --- a/visualtest/configs/testsprite2_geometry/testsprite2_geometry.parameters +++ /dev/null @@ -1,5 +0,0 @@ -# parameter name, type, value range, required, categories ---geometry, enum, [500x500 600x600], false, [] ---logical, enum, [300x500 550x450], false, [] ---scale, integer, [1 5], false, [] ---iterations, integer, [1000 1000], true, [] \ No newline at end of file diff --git a/visualtest/configure b/visualtest/configure deleted file mode 100755 index b9576830a..000000000 --- a/visualtest/configure +++ /dev/null @@ -1,4442 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="unittest/testquit.c" -ac_subst_vars='LTLIBOBJS -LIBOBJS -LIBUNWIND_LIBS -LIBUNWIND_CFLAGS -SDL3_CONFIG -SDL_LIBS -SDL_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -EXE -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_sdl_prefix -with_sdl_exec_prefix -enable_sdltest -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -SDL_CFLAGS -SDL_LIBS -LIBUNWIND_CFLAGS -LIBUNWIND_LIBS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-sdltest Do not try to compile and run a test SDL program - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-sdl-prefix=PFX Prefix where SDL is installed (optional) - --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - SDL_CFLAGS C compiler flags for SDL, overriding pkg-config - SDL_LIBS linker flags for SDL, overriding pkg-config - LIBUNWIND_CFLAGS - C compiler flags for LIBUNWIND, overriding pkg-config - LIBUNWIND_LIBS - linker flags for LIBUNWIND, overriding pkg-config - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -ac_aux_dir= -for ac_dir in ../build-scripts "$srcdir"/../build-scripts; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in ../build-scripts \"$srcdir\"/../build-scripts" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -case "$host" in - *-*-cygwin* | *-*-mingw*) - EXE=".exe" - EXTRALIB="-lshlwapi" - ;; - *) - EXE="" - EXTRALIB="" - ;; -esac - - -SDL_VERSION=2.0.0 - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi - - -# Check whether --with-sdl-prefix was given. -if test "${with_sdl_prefix+set}" = set; then : - withval=$with_sdl_prefix; sdl_prefix="$withval" -else - sdl_prefix="" -fi - - -# Check whether --with-sdl-exec-prefix was given. -if test "${with_sdl_exec_prefix+set}" = set; then : - withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" -else - sdl_exec_prefix="" -fi - -# Check whether --enable-sdltest was given. -if test "${enable_sdltest+set}" = set; then : - enableval=$enable_sdltest; -else - enable_sdltest=yes -fi - - - min_sdl_version=$SDL_VERSION - - if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl3 >= $min_sdl_version" >&5 -$as_echo_n "checking for sdl3 >= $min_sdl_version... " >&6; } - -if test -n "$SDL_CFLAGS"; then - pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl3 >= $min_sdl_version" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$SDL_LIBS"; then - pkg_cv_SDL_LIBS="$SDL_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl3 >= \$min_sdl_version\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sdl3 >= $min_sdl_version") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl3 >= $min_sdl_version" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl3 >= $min_sdl_version" 2>&1` - else - SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl3 >= $min_sdl_version" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$SDL_PKG_ERRORS" >&5 - - sdl_pc=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - sdl_pc=no -else - SDL_CFLAGS=$pkg_cv_SDL_CFLAGS - SDL_LIBS=$pkg_cv_SDL_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - sdl_pc=yes -fi - else - sdl_pc=no - if test x$sdl_exec_prefix != x ; then - sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL3_CONFIG+set} != xset ; then - SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL3_CONFIG+set} != xset ; then - SDL3_CONFIG=$sdl_prefix/bin/sdl3-config - fi - fi - fi - - if test "x$sdl_pc" = xyes ; then - no_sdl="" - SDL3_CONFIG="pkg-config sdl3" - else - as_save_PATH="$PATH" - if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - fi - # Extract the first word of "sdl3-config", so it can be a program name with args. -set dummy sdl3-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SDL3_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $SDL3_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SDL3_CONFIG="$SDL3_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SDL3_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_SDL3_CONFIG" && ac_cv_path_SDL3_CONFIG="no" - ;; -esac -fi -SDL3_CONFIG=$ac_cv_path_SDL3_CONFIG -if test -n "$SDL3_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL3_CONFIG" >&5 -$as_echo "$SDL3_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - PATH="$as_save_PATH" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 -$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } - no_sdl="" - - if test "$SDL3_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` - - sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - rm -f conf.sdltest - if test "$cross_compiling" = yes; then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include "SDL.h" - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - FILE *fp = fopen("conf.sdltest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); - printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - no_sdl=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - if test "x$no_sdl" = x ; then - : - else - if test "$SDL3_CONFIG" = "no" ; then - echo "*** The sdl3-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL3_CONFIG environment variable to the" - echo "*** full path to sdl3-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main - -int -main () -{ - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 - - fi - - - rm -f conf.sdltest - -CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL3_test $SDL_LIBS $EXTRALIB" - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 -$as_echo_n "checking for libunwind... " >&6; } - -if test -n "$LIBUNWIND_CFLAGS"; then - pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$LIBUNWIND_LIBS"; then - pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libunwind" 2>&1` - else - LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --print-errors "libunwind" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBUNWIND_PKG_ERRORS" >&5 - - have_libunwind=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - have_libunwind=no -else - LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS - LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_libunwind=yes -fi -if test x$have_libunwind = xyes ; then - LIBS="$LIBS $LIBUNWIND_LIBS" -fi - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/visualtest/configure.ac b/visualtest/configure.ac deleted file mode 100644 index d36d89103..000000000 --- a/visualtest/configure.ac +++ /dev/null @@ -1,41 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT -AC_CONFIG_SRCDIR([unittest/testquit.c]) - -dnl Detect the canonical build and host environments -AC_CONFIG_AUX_DIR([../build-scripts]) -AC_CANONICAL_HOST - -dnl Check for tools -AC_PROG_CC - -dnl Figure out which math or extra library to use -case "$host" in - *-*-cygwin* | *-*-mingw*) - EXE=".exe" - EXTRALIB="-lshlwapi" - ;; - *) - EXE="" - EXTRALIB="" - ;; -esac -AC_SUBST(EXE) - -dnl Check for SDL -SDL_VERSION=3.0.0 -AM_PATH_SDL3($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) -) -CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS -lSDL3_test $SDL_LIBS $EXTRALIB" - -PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no) -if test x$have_libunwind = xyes ; then - LIBS="$LIBS $LIBUNWIND_LIBS" -fi - -dnl Finally create all the generated files -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/visualtest/docs/Doxyfile b/visualtest/docs/Doxyfile deleted file mode 100644 index 08caeb491..000000000 --- a/visualtest/docs/Doxyfile +++ /dev/null @@ -1,1936 +0,0 @@ -# Doxyfile 1.8.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = "SDL Visual Test" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian, -# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, -# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields or simple typedef fields will be shown -# inline in the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO (the default), structs, classes, and unions are shown on a separate -# page (for HTML and Man pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can -# be an expensive process and often the same symbol appear multiple times in -# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too -# small doxygen will become slower. If the cache is too large, memory is wasted. -# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid -# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536 -# symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../ - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.for \ - *.vhd \ - *.vhdl \ - README.txt - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be ignored. -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -# If CLANG_ASSISTED_PARSING is set to YES, then doxygen will use the clang parser -# for more acurate parsing at the cost of reduced performance. This can be -# particularly helpful with template rich C++ code for which doxygen's built-in -# parser lacks the necessairy type information. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified at INPUT and INCLUDE_PATH. - -CLANG_OPTIONS = - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript -# pieces of code that will be used on startup of the MathJax code. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search -# engine library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4 will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images -# or other source files which should be copied to the LaTeX output directory. -# Note that the files will be copied as-is; there are no commands or markers -# available. - -LATEX_EXTRA_FILES = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- - -# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files -# that can be used to generate PDF. - -GENERATE_DOCBOOK = NO - -# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in -# front of it. If left blank docbook will be used as the default path. - -DOCBOOK_OUTPUT = docbook - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed -# in the related pages index. If set to NO, only the current project's -# pages will be listed. - -EXTERNAL_PAGES = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# manageable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/visualtest/include/SDL_visualtest_action_configparser.h b/visualtest/include/SDL_visualtest_action_configparser.h deleted file mode 100644 index 40481f379..000000000 --- a/visualtest/include/SDL_visualtest_action_configparser.h +++ /dev/null @@ -1,149 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_action_configparser.h - * - * Header file for the parser for action config files. - */ - -#ifndef SDL_visualtest_action_configparser_h_ -#define SDL_visualtest_action_configparser_h_ - -/** The maximum length of one line in the actions file */ -#define MAX_ACTION_LINE_LENGTH 300 - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Type of the action. - */ -typedef enum -{ - /*! Launch an application with some given arguments */ - SDL_ACTION_LAUNCH = 0, - /*! Kill the SUT process */ - SDL_ACTION_KILL, - /*! Quit (Gracefully exit) the SUT process */ - SDL_ACTION_QUIT, - /*! Take a screenshot of the SUT window */ - SDL_ACTION_SCREENSHOT, - /*! Verify a previously taken screenshot */ - SDL_ACTION_VERIFY -} SDLVisualTest_ActionType; - -/** - * Struct that defines an action that will be performed on the SUT process at - * a specific time. - */ -typedef struct SDLVisualTest_Action -{ - /*! The type of action to be performed */ - SDLVisualTest_ActionType type; - /*! The time, in milliseconds from the launch of the SUT, when the action - will be performed */ - int time; - /*! Any additional information needed to perform the action. */ - union - { - /*! The path and arguments to the process to be launched */ - struct - { - char* path; - char* args; - } process; - } extra; -} SDLVisualTest_Action; - -/** - * Struct for a node in the action queue. - */ -typedef struct SDLVisualTest_ActionNode -{ - /*! The action in this node */ - SDLVisualTest_Action action; - /*! Pointer to the next element in the queue */ - struct SDLVisualTest_ActionNode* next; -} SDLVisualTest_ActionNode; - -/** - * Queue structure for actions loaded from the actions config file. - */ -typedef struct SDLVisualTest_ActionQueue -{ - /*! Pointer to the front of the queue */ - SDLVisualTest_ActionNode* front; - /*! Pointer to the rear of the queue */ - SDLVisualTest_ActionNode* rear; - /*! Number of nodes in the queue */ - int size; -} SDLVisualTest_ActionQueue; - -/** - * Add an action pointed to by \c action to the rear of the action queue pointed - * to by \c queue. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_EnqueueAction(SDLVisualTest_ActionQueue* queue, - SDLVisualTest_Action action); - -/** - * Remove an action from the front of the action queue pointed to by \c queue. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_DequeueAction(SDLVisualTest_ActionQueue* queue); - -/** - * Initialize the action queue pointed to by \c queue. - */ -void SDLVisualTest_InitActionQueue(SDLVisualTest_ActionQueue* queue); - -/** - * Get the action at the front of the action queue pointed to by \c queue. - * The returned action pointer may become invalid after subsequent dequeues. - * - * \return pointer to the action on success, NULL on failure. - */ -SDLVisualTest_Action* SDLVisualTest_GetQueueFront(SDLVisualTest_ActionQueue* queue); - -/** - * Check if the queue pointed to by \c queue is empty or not. - * - * \return 1 if the queue is empty, 0 otherwise. - */ -int SDLVisualTest_IsActionQueueEmpty(SDLVisualTest_ActionQueue* queue); - -/** - * Dequeues all the elements in the queque pointed to by \c queue. - */ -void SDLVisualTest_EmptyActionQueue(SDLVisualTest_ActionQueue* queue); - -/** - * Inserts an action \c action into the queue pointed to by \c queue such that - * the times of actions in the queue increase as we move from the front to the - * rear. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue, - SDLVisualTest_Action action); - -/** - * Parses an action config file with path \c file and populates an action queue - * pointed to by \c queue with actions. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_ParseActionConfig(const char* file, SDLVisualTest_ActionQueue* queue); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_action_configparser_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_exhaustive_variator.h b/visualtest/include/SDL_visualtest_exhaustive_variator.h deleted file mode 100644 index 4637ce29e..000000000 --- a/visualtest/include/SDL_visualtest_exhaustive_variator.h +++ /dev/null @@ -1,64 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_exhaustive_variator.h - * - * Header for the exhaustive variator. - */ - -#include "SDL_visualtest_harness_argparser.h" -#include "SDL_visualtest_variator_common.h" - -#ifndef SDL_visualtest_exhaustive_variator_h_ -#define SDL_visualtest_exhaustive_variator_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Struct for the variator that exhaustively iterates through all variations of - * command line arguments to the SUT. - */ -typedef struct SDLVisualTest_ExhaustiveVariator -{ - /*! The current variation. */ - SDLVisualTest_Variation variation; - /*! Configuration object for the SUT that the variator is running for. */ - SDLVisualTest_SUTConfig config; - /*! Buffer to store the arguments string built from the variation */ - char buffer[MAX_SUT_ARGS_LEN]; -} SDLVisualTest_ExhaustiveVariator; - -/** - * Initializes the variator. - * - * \return 1 on success, 0 on failure - */ -int SDLVisualTest_InitExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator, - SDLVisualTest_SUTConfig* config); - -/** - * Gets the arguments string for the next variation using the variator and updates - * the variator's current variation object to the next variation. - * - * \return The arguments string representing the next variation on success, and - * NULL on failure or if we have iterated through all possible variations. - * In the latter case subsequent calls will start the variations again from - * the very beginning. The pointer returned should not be freed. - */ -char* SDLVisualTest_GetNextExhaustiveVariation(SDLVisualTest_ExhaustiveVariator* variator); - -/** - * Frees any resources associated with the variator. - */ -void SDLVisualTest_FreeExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_exhaustive_variator_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_harness_argparser.h b/visualtest/include/SDL_visualtest_harness_argparser.h deleted file mode 100644 index 75420fe2e..000000000 --- a/visualtest/include/SDL_visualtest_harness_argparser.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * \file SDL_visualtest_harness_argparser.h - * - * Provides functionality to parse command line arguments to the test harness. - */ - -#include -#include "SDL_visualtest_sut_configparser.h" -#include "SDL_visualtest_variator_common.h" -#include "SDL_visualtest_action_configparser.h" - -#ifndef SDL_visualtest_harness_argparser_h_ -#define SDL_visualtest_harness_argparser_h_ - -/** Maximum length of a path string */ -#define MAX_PATH_LEN 300 -/** Maximum length of a string of SUT arguments */ -#define MAX_SUT_ARGS_LEN 600 - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Stores the state of the test harness. - */ -typedef struct SDLVisualTest_HarnessState -{ - /*! Path to the System Under Test (SUT) executable */ - char sutapp[MAX_PATH_LEN]; - /*! Command line arguments to be passed to the SUT */ - char sutargs[MAX_SUT_ARGS_LEN]; - /*! Time in milliseconds after which to kill the SUT */ - int timeout; - /*! Configuration object for the SUT */ - SDLVisualTest_SUTConfig sut_config; - /*! What type of variator to use to generate argument strings */ - SDLVisualTest_VariatorType variator_type; - /*! The number of variations to generate */ - int num_variations; - /*! If true, the test harness will just print the different variations - without launching the SUT for each one */ - SDL_bool no_launch; - /*! A queue with actions to be performed while the SUT is running */ - SDLVisualTest_ActionQueue action_queue; - /*! Output directory to save the screenshots */ - char output_dir[MAX_PATH_LEN]; - /*! Path to directory with the verification images */ - char verify_dir[MAX_PATH_LEN]; -} SDLVisualTest_HarnessState; - -/** - * Parse command line paramters to the test harness and populate a state object. - * - * \param argv The array of command line parameters. - * \param state Pointer to the state object to be populated. - * - * \return Non-zero on success, zero on failure. - */ -int SDLVisualTest_ParseHarnessArgs(char** argv, SDLVisualTest_HarnessState* state); - -/** - * Frees any resources associated with the state object pointed to by \c state. - */ -void SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_harness_argparser_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_mischelper.h b/visualtest/include/SDL_visualtest_mischelper.h deleted file mode 100644 index 5faffa567..000000000 --- a/visualtest/include/SDL_visualtest_mischelper.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * \file mischelper.c - * - * Header with miscellaneous helper functions. - */ - -#ifndef SDL_visualtest_mischelper_h_ -#define SDL_visualtest_mischelper_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Stores a 32 digit hexadecimal string representing the MD5 hash of the - * string \c str in \c hash. - */ -void SDLVisualTest_HashString(char* str, char hash[33]); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_mischelper_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_parsehelper.h b/visualtest/include/SDL_visualtest_parsehelper.h deleted file mode 100644 index 4558552c1..000000000 --- a/visualtest/include/SDL_visualtest_parsehelper.h +++ /dev/null @@ -1,46 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_parsehelper.h - * - * Header with some helper functions for parsing strings. - */ - -#ifndef SDL_visualtest_parsehelper_h_ -#define SDL_visualtest_parsehelper_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Takes an string of command line arguments and breaks them up into an array - * based on whitespace. - * - * \param args The string of arguments. - * - * \return NULL on failure, an array of strings on success. The last element - * of the array is NULL. The first element of the array is NULL and should - * be set to the path of the executable by the caller. - */ -char** SDLVisualTest_ParseArgsToArgv(char* args); - -/** - * Takes a string and breaks it into tokens by splitting on whitespace. - * - * \param str The string to be split. - * \param max_token_len Length of each element in the array to be returned. - * - * \return NULL on failure; an array of strings with the tokens on success. The - * last element of the array is NULL. - */ -char** SDLVisualTest_Tokenize(char* str, int max_token_len); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_parsehelper_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_process.h b/visualtest/include/SDL_visualtest_process.h deleted file mode 100644 index 26ce5a098..000000000 --- a/visualtest/include/SDL_visualtest_process.h +++ /dev/null @@ -1,112 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_process.h - * - * Provides cross-platfrom process launching and termination functionality. - */ - -#include - -#if defined(__WIN32__) -#include -#include -#elif defined(__LINUX__) -#include -#else -#error "Unsupported platform." -#endif - -#ifndef SDL_visualtest_process_h_ -#define SDL_visualtest_process_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Struct to store a platform specific handle to a process. - */ -typedef struct SDL_ProcessInfo -{ -//#if defined(_WIN32) || defined(__WIN32__) -#if defined(__WIN32__) - PROCESS_INFORMATION pi; -//#elif defined(__linux__) -#elif defined(__LINUX__) - int pid; -#endif -} SDL_ProcessInfo; - -/** - * This structure stores the exit status (value returned by main()) and - * whether the process exited sucessfully or not. - */ -typedef struct SDL_ProcessExitStatus -{ - int exit_success; /*!< Zero if the process exited successfully */ - int exit_status; /*!< The exit status of the process. 8-bit value. */ -} SDL_ProcessExitStatus; - -/** - * Launches a process with the given commandline arguments. - * - * \param file The path to the executable to be launched. - * \param args The command line arguments to be passed to the process. - * \param pinfo Pointer to an SDL_ProcessInfo object to be populated with - * platform specific information about the launched process. - * - * \return Non-zero on success, zero on failure. - */ -int SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo); - -/** - * Checks if a process is running or not. - * - * \param pinfo Pointer to SDL_ProcessInfo object of the process that needs to be - * checked. - * - * \return 1 if the process is still running; zero if it is not and -1 if the - * status could not be retrieved. - */ -int SDL_IsProcessRunning(SDL_ProcessInfo* pinfo); - -/** - * Kills a currently running process. - * - * \param pinfo Pointer to a SDL_ProcessInfo object of the process to be terminated. - * \param ps Pointer to a SDL_ProcessExitStatus object which will be populated - * with the exit status. - * - * \return 1 on success, 0 on failure. - */ -int SDL_KillProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps); - -/** - * Cleanly exits the process represented by \c pinfo and stores the exit status - * in the exit status object pointed to by \c ps. - * - * \return 1 on success, 0 on failure. - */ -int SDL_QuitProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps); - -/** - * Gets the exit status of a process. If the exit status is -1, the process is - * still running. - * - * \param pinfo Pointer to a SDL_ProcessInfo object of the process to be checked. - * \param ps Pointer to a SDL_ProcessExitStatus object which will be populated - * with the exit status. - * - * \return 1 on success, 0 on failure. - */ -int SDL_GetProcessExitStatus(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_process_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_random_variator.h b/visualtest/include/SDL_visualtest_random_variator.h deleted file mode 100644 index 0514ce631..000000000 --- a/visualtest/include/SDL_visualtest_random_variator.h +++ /dev/null @@ -1,61 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_random_variator.h - * - * Header for the random variator. - */ - -#include "SDL_visualtest_harness_argparser.h" -#include "SDL_visualtest_variator_common.h" - -#ifndef SDL_visualtest_random_variator_h_ -#define SDL_visualtest_random_variator_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Struct for the variator that randomly generates variations of command line - * arguments to the SUT. - */ -typedef struct SDLVisualTest_RandomVariator -{ - /*! The current variation. */ - SDLVisualTest_Variation variation; - /*! Configuration object for the SUT that the variator is running for. */ - SDLVisualTest_SUTConfig config; - /*! Buffer to store the arguments string built from the variation */ - char buffer[MAX_SUT_ARGS_LEN]; -} SDLVisualTest_RandomVariator; - -/** - * Initializes the variator. - * - * \return 1 on success, 0 on failure - */ -int SDLVisualTest_InitRandomVariator(SDLVisualTest_RandomVariator* variator, - SDLVisualTest_SUTConfig* config, Uint64 seed); - -/** - * Generates a new random variation. - * - * \return The arguments string representing the random variation on success, and - * NULL on failure. The pointer returned should not be freed. - */ -char* SDLVisualTest_GetNextRandomVariation(SDLVisualTest_RandomVariator* variator); - -/** - * Frees any resources associated with the variator. - */ -void SDLVisualTest_FreeRandomVariator(SDLVisualTest_RandomVariator* variator); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_random_variator_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_rwhelper.h b/visualtest/include/SDL_visualtest_rwhelper.h deleted file mode 100644 index bc3942594..000000000 --- a/visualtest/include/SDL_visualtest_rwhelper.h +++ /dev/null @@ -1,87 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file rwhelper.c - * - * Header file with some helper functions for working with SDL_RWops. - */ - -#include - -#ifndef SDL_visualtest_rwhelper_h_ -#define SDL_visualtest_rwhelper_h_ - -/** Length of the buffer in SDLVisualTest_RWHelperBuffer */ -#define RWOPS_BUFFER_LEN 256 - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Struct that is used as a buffer by the RW helper functions. Should be initialized by calling - * SDLVisualTest_RWHelperResetBuffer() before being used. - */ -typedef struct SDLVisualTest_RWHelperBuffer -{ - /*! Character buffer that data is read into */ - char buffer[RWOPS_BUFFER_LEN]; - /*! buffer[buffer_pos] is the next character to be read from the buffer */ - int buffer_pos; - /*! Number of character read into the buffer */ - int buffer_width; -} SDLVisualTest_RWHelperBuffer; - -/** - * Resets the buffer pointed to by \c buffer used by some of the helper functions. - * This function should be called when you're using one of the helper functions - * with a new SDL_RWops object. - */ -void SDLVisualTest_RWHelperResetBuffer(SDLVisualTest_RWHelperBuffer* buffer); - -/** - * Reads a single character using the SDL_RWops object pointed to by \c rw. - * This function reads data in blocks and stores them in the buffer pointed to by - * \c buffer, so other SDL_RWops functions should not be used in conjunction - * with this function. - * - * \return The character that was read. - */ -char SDLVisualTest_RWHelperReadChar(SDL_RWops* rw, - SDLVisualTest_RWHelperBuffer* buffer); - -/** - * Reads characters using the SDL_RWops object pointed to by \c rw into the - * character array pointed to by \c str (of size \c size) until either the - * array is full or a new line is encountered. If \c comment_char is encountered, - * all characters from that position till the end of the line are ignored. The new line - * is not included as part of the buffer. Lines with only whitespace and comments - * are ignored. This function reads data in blocks and stores them in the buffer - * pointed to by \c buffer, so other SDL_RWops functions should not be used in - * conjunction with this function. - * - * \return pointer to the string on success, NULL on failure or EOF. - */ -char* SDLVisualTest_RWHelperReadLine(SDL_RWops* rw, char* str, int size, - SDLVisualTest_RWHelperBuffer* buffer, - char comment_char); - -/** - * Counts the number of lines that are not all whitespace and comments using the - * SDL_RWops object pointed to by \c rw. \c comment_char indicates the character - * used for comments. Uses the buffer pointed to by \c buffer to read data in blocks. - * - * \return Number of lines on success, -1 on failure. - */ -int SDLVisualTest_RWHelperCountNonEmptyLines(SDL_RWops* rw, - SDLVisualTest_RWHelperBuffer* buffer, - char comment_char); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_rwhelper_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_screenshot.h b/visualtest/include/SDL_visualtest_screenshot.h deleted file mode 100644 index 69411e99d..000000000 --- a/visualtest/include/SDL_visualtest_screenshot.h +++ /dev/null @@ -1,52 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_screenshot.h - * - * Header for the screenshot API. - */ - -#include "SDL_visualtest_process.h" - -#ifndef SDL_visualtest_screenshot_h_ -#define SDL_visualtest_screenshot_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Takes a screenshot of each window owned by the process \c pinfo and saves - * it in a file \c prefix-i.png where \c prefix is the full path to the file - * along with a prefix given to each screenshot. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_ScreenshotProcess(SDL_ProcessInfo* pinfo, char* prefix); - -/** - * Takes a screenshot of the desktop and saves it into the file with path - * \c filename. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_ScreenshotDesktop(char* filename); - -/** - * Compare a screenshot taken previously with SUT arguments \c args that is - * located in \c test_dir with a verification image that is located in - * \c verify_dir. - * - * \return -1 on failure, 0 if the images were not equal, 1 if the images are equal - * and 2 if the verification image is not present. - */ -int SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_screenshot_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_sut_configparser.h b/visualtest/include/SDL_visualtest_sut_configparser.h deleted file mode 100644 index 63506f5a0..000000000 --- a/visualtest/include/SDL_visualtest_sut_configparser.h +++ /dev/null @@ -1,105 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_sut_configparser.h - * - * Header for the parser for SUT config files. - */ - -#ifndef SDL_visualtest_sut_configparser_h_ -#define SDL_visualtest_sut_configparser_h_ - -/** Maximum length of the name of an SUT option */ -#define MAX_SUTOPTION_NAME_LEN 100 -/** Maximum length of the name of a category of an SUT option */ -#define MAX_SUTOPTION_CATEGORY_LEN 40 -/** Maximum length of one enum value of an SUT option */ -#define MAX_SUTOPTION_ENUMVAL_LEN 40 -/** Maximum length of a line in the paramters file */ -#define MAX_SUTOPTION_LINE_LENGTH 256 - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Describes the different kinds of options to the SUT. - */ -typedef enum { - SDL_SUT_OPTIONTYPE_STRING = 0, - SDL_SUT_OPTIONTYPE_INT, - SDL_SUT_OPTIONTYPE_ENUM, - SDL_SUT_OPTIONTYPE_BOOL -} SDLVisualTest_SUTOptionType; - -/** - * Represents the range of values an integer option can take. - */ -typedef struct SDLVisualTest_SUTIntRange { - /*! Minimum value of the integer option */ - int min; - /*! Maximum value of the integer option */ - int max; -} SDLVisualTest_SUTIntRange; - -/** - * Struct that defines an option to be passed to the SUT. - */ -typedef struct SDLVisualTest_SUTOption { - /*! The name of the option. This is what you would pass in the command line - along with two leading hyphens. */ - char name[MAX_SUTOPTION_NAME_LEN]; - /*! An array of categories that the option belongs to. The last element is - NULL. */ - char** categories; - /*! Type of the option - integer, boolean, etc. */ - SDLVisualTest_SUTOptionType type; - /*! Whether the option is required or not */ - SDL_bool required; - /*! extra data that is required for certain types */ - union { - /*! This field is valid only for integer type options; it defines the - valid range for such an option */ - SDLVisualTest_SUTIntRange range; - /*! This field is valid only for enum type options; it holds the list of values - that the option can take. The last element is NULL */ - char** enum_values; - } data; -} SDLVisualTest_SUTOption; - -/** - * Struct to hold all the options to an SUT application. - */ -typedef struct SDLVisualTest_SUTConfig -{ - /*! Pointer to an array of options */ - SDLVisualTest_SUTOption* options; - /*! Number of options in \c options */ - int num_options; -} SDLVisualTest_SUTConfig; - -/** - * Parses a configuration file that describes the command line options an SUT - * application will take and populates a SUT config object. All lines in the - * config file must be smaller than - * - * \param file Path to the configuration file. - * \param config Pointer to an object that represents an SUT configuration. - * - * \return zero on failure, non-zero on success - */ -int SDLVisualTest_ParseSUTConfig(char* file, SDLVisualTest_SUTConfig* config); - -/** - * Free any resources associated with the config object pointed to by \c config. - */ -void SDLVisualTest_FreeSUTConfig(SDLVisualTest_SUTConfig* config); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_sut_configparser_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_variator_common.h b/visualtest/include/SDL_visualtest_variator_common.h deleted file mode 100644 index 19a5b3782..000000000 --- a/visualtest/include/SDL_visualtest_variator_common.h +++ /dev/null @@ -1,122 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_variator_common.h - * - * Header for common functionality used by variators. - */ - -#include -#include "SDL_visualtest_sut_configparser.h" - -#ifndef SDL_visualtest_variator_common_h_ -#define SDL_visualtest_variator_common_h_ - -/** The number of variations one integer option would generate */ -#define SDL_SUT_INTEGER_OPTION_TEST_STEPS 3 - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** enum for indicating the type of variator being used */ -typedef enum SDLVisualTest_VariatorType -{ - SDL_VARIATOR_NONE = 0, - SDL_VARIATOR_EXHAUSTIVE, - SDL_VARIATOR_RANDOM -} SDLVisualTest_VariatorType; - -/** - * One possible value for a command line option to the SUT. - */ -typedef union SDLVisualTest_SUTOptionValue -{ - /*! Value if the option is of type boolean */ - SDL_bool bool_value; - /*! Value if the option is of type integer. If on is true then the option - will be passed to the SUT, otherwise it will be ignored. */ - struct { - int value; - SDL_bool on; - } integer; - /*! Index of the string in the enum_values field of the corresponding - SDLVisualTest_SUTOption object. If on is true the option will passed - to the SUT, otherwise it will be ignored. */ - struct { - int index; - SDL_bool on; - } enumerated; - /*! Value if the option is of type string. If on is true the option will - be passed to the SUT, otherwise it will be ignored. */ - struct { - char* value; - SDL_bool on; - } string; -} SDLVisualTest_SUTOptionValue; - -/** - * Represents a valid combination of parameters that can be passed to the SUT. - * The ordering of the values here is the same as the ordering of the options in - * the SDLVisualTest_SUTConfig object for this variation. - */ -typedef struct SDLVisualTest_Variation -{ - /*! Pointer to array of option values */ - SDLVisualTest_SUTOptionValue* vars; - /*! Number of option values in \c vars */ - int num_vars; -} SDLVisualTest_Variation; - -/** - * "Increments" the value of the option by one and returns the carry. We wrap - * around to the initial value on overflow which makes the carry one. - * For example: "incrementing" an SDL_FALSE option makes it SDL_TRUE with no - * carry, and "incrementing" an SDL_TRUE option makes it SDL_FALSE with carry - * one. For integers, a random value in the valid range for the option is used. - * - * \param var Value of the option - * \param opt Object with metadata about the option - * - * \return 1 if there is a carry for enum and bool type options, 0 otherwise. - * 1 is always returned for integer and string type options. -1 is - * returned on error. - */ -int SDLVisualTest_NextValue(SDLVisualTest_SUTOptionValue* var, - SDLVisualTest_SUTOption* opt); - -/** - * Converts a variation object into a string of command line arguments. - * - * \param variation Variation object to be converted. - * \param config Config object for the SUT. - * \param buffer Pointer to the buffer the arguments string will be copied into. - * \param size Size of the buffer. - * - * \return 1 on success, 0 on failure - */ -int SDLVisualTest_MakeStrFromVariation(SDLVisualTest_Variation* variation, - SDLVisualTest_SUTConfig* config, - char* buffer, int size); - -/** - * Initializes the variation using the following rules: - * - Boolean options are initialized to SDL_FALSE. - * - Integer options are initialized to the minimum valid value they can hold. - * - Enum options are initialized to the first element in the list of values they - * can take. - * - String options are initialized to the name of the option. - * - * \return 1 on success, 0 on failure. - */ -int SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation, - SDLVisualTest_SUTConfig* config); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_variator_common_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/include/SDL_visualtest_variators.h b/visualtest/include/SDL_visualtest_variators.h deleted file mode 100644 index e14f67d2a..000000000 --- a/visualtest/include/SDL_visualtest_variators.h +++ /dev/null @@ -1,66 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file SDL_visualtest_variators.h - * - * Header for all the variators that vary input parameters to a SUT application. - */ - -#include "SDL_visualtest_exhaustive_variator.h" -#include "SDL_visualtest_random_variator.h" - -#ifndef SDL_visualtest_variators_h_ -#define SDL_visualtest_variators_h_ - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Struct that acts like a wrapper around the different types of variators - * available. - */ -typedef struct SDLVisualTest_Variator -{ - /*! Type of the variator */ - SDLVisualTest_VariatorType type; - /*! union object that stores the variator */ - union - { - SDLVisualTest_ExhaustiveVariator exhaustive; - SDLVisualTest_RandomVariator random; - } data; -} SDLVisualTest_Variator; - -/** - * Initializes the variator object pointed to by \c variator of type \c type - * with information from the config object pointed to by \c config. - * - * \return 1 on success, 0 on failure - */ -int SDLVisualTest_InitVariator(SDLVisualTest_Variator* variator, - SDLVisualTest_SUTConfig* config, - SDLVisualTest_VariatorType type, - Uint64 seed); - -/** - * Gets the next variation using the variator. - * - * \return The arguments string representing the variation on success, and - * NULL on failure. The pointer returned should not be freed. - */ -char* SDLVisualTest_GetNextVariation(SDLVisualTest_Variator* variator); - -/** - * Frees any resources associated with the variator. - */ -void SDLVisualTest_FreeVariator(SDLVisualTest_Variator* variator); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* SDL_visualtest_variators_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/visualtest/launch_harness.cmd b/visualtest/launch_harness.cmd deleted file mode 100644 index 93462a9d2..000000000 --- a/visualtest/launch_harness.cmd +++ /dev/null @@ -1,2 +0,0 @@ -start /wait testharness.exe --config testsprite2_crashtest.config > testrun.log 2>&1 -if %ERRORLEVEL% NEQ 0 echo TEST RUN FAILED (see testrun.log) \ No newline at end of file diff --git a/visualtest/launch_harness.sh b/visualtest/launch_harness.sh deleted file mode 100755 index a2d1471c8..000000000 --- a/visualtest/launch_harness.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -./testharness.exe --config testsprite2_crashtest.config > testrun.log 2>&1 -if [ "$?" != "0" ]; then - echo TEST RUN FAILED (see testrun.log) - # report error code to CI -fi \ No newline at end of file diff --git a/visualtest/src/action_configparser.c b/visualtest/src/action_configparser.c deleted file mode 100644 index f3b1afd73..000000000 --- a/visualtest/src/action_configparser.c +++ /dev/null @@ -1,399 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file action_configparser.c - * - * Source file for the parser for action config files. - */ - -#include -#include -#include -#include "SDL_visualtest_action_configparser.h" -#include "SDL_visualtest_rwhelper.h" -#include "SDL_visualtest_parsehelper.h" - -static void -FreeAction(SDLVisualTest_Action* action) -{ - if(!action) - return; - switch(action->type) - { - case SDL_ACTION_LAUNCH: - { - char* path; - char* args; - - path = action->extra.process.path; - args = action->extra.process.args; - - if(path) - SDL_free(path); - if(args) - SDL_free(args); - - action->extra.process.path = NULL; - action->extra.process.args = NULL; - } - break; - - default: - break; - } -} - -int -SDLVisualTest_EnqueueAction(SDLVisualTest_ActionQueue* queue, - SDLVisualTest_Action action) -{ - SDLVisualTest_ActionNode* node; - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return 0; - } - - node = (SDLVisualTest_ActionNode*)SDL_malloc( - sizeof(SDLVisualTest_ActionNode)); - if(!node) - { - SDLTest_LogError("SDL_malloc() failed"); - return 0; - } - node->action = action; - node->next = NULL; - queue->size++; - if(!queue->rear) - queue->rear = queue->front = node; - else - { - queue->rear->next = node; - queue->rear = node; - } - return 1; -} - -int -SDLVisualTest_DequeueAction(SDLVisualTest_ActionQueue* queue) -{ - SDLVisualTest_ActionNode* node; - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return 0; - } - if(SDLVisualTest_IsActionQueueEmpty(queue)) - { - SDLTest_LogError("cannot dequeue from empty queue"); - return 0; - } - if(queue->front == queue->rear) - { - FreeAction(&queue->front->action); - SDL_free(queue->front); - queue->front = queue->rear = NULL; - } - else - { - node = queue->front; - queue->front = queue->front->next; - FreeAction(&node->action); - SDL_free(node); - } - queue->size--; - return 1; -} - -void -SDLVisualTest_InitActionQueue(SDLVisualTest_ActionQueue* queue) -{ - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return; - } - queue->front = NULL; - queue->rear = NULL; - queue->size = 0; -} - -SDLVisualTest_Action* -SDLVisualTest_GetQueueFront(SDLVisualTest_ActionQueue* queue) -{ - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return NULL; - } - if(!queue->front) - { - SDLTest_LogError("cannot get front of empty queue"); - return NULL; - } - - return &queue->front->action; -} - -int -SDLVisualTest_IsActionQueueEmpty(SDLVisualTest_ActionQueue* queue) -{ - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return 1; - } - - if(queue->size > 0) - return 0; - return 1; -} - -void -SDLVisualTest_EmptyActionQueue(SDLVisualTest_ActionQueue* queue) -{ - if(queue) - { - while(!SDLVisualTest_IsActionQueueEmpty(queue)) - SDLVisualTest_DequeueAction(queue); - } -} - -/* Since the size of the queue is not likely to be larger than 100 elements - we can get away with using insertion sort. */ -static void -SortQueue(SDLVisualTest_ActionQueue* queue) -{ - SDLVisualTest_ActionNode* head; - SDLVisualTest_ActionNode* tail; - - if(!queue || SDLVisualTest_IsActionQueueEmpty(queue)) - return; - - head = queue->front; - for(tail = head; tail && tail->next;) - { - SDLVisualTest_ActionNode* pos; - SDLVisualTest_ActionNode* element = tail->next; - - if(element->action.time < head->action.time) - { - tail->next = tail->next->next; - element->next = head; - head = element; - } - else if(element->action.time >= tail->action.time) - { - tail = tail->next; - } - else - { - for(pos = head; - (pos->next->action.time < element->action.time); - pos = pos->next); - tail->next = tail->next->next; - element->next = pos->next; - pos->next = element; - } - } - - queue->front = head; - queue->rear = tail; -} - -int -SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue, - SDLVisualTest_Action action) -{ - SDLVisualTest_ActionNode* n; - SDLVisualTest_ActionNode* prev; - SDLVisualTest_ActionNode* newnode; - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return 0; - } - - if(SDLVisualTest_IsActionQueueEmpty(queue)) - { - if(!SDLVisualTest_EnqueueAction(queue, action)) - { - SDLTest_LogError("SDLVisualTest_EnqueueAction() failed"); - return 0; - } - return 1; - } - - newnode = (SDLVisualTest_ActionNode*)SDL_malloc(sizeof(SDLVisualTest_ActionNode)); - if(!newnode) - { - SDLTest_LogError("SDL_malloc() failed"); - return 0; - } - newnode->action = action; - - queue->size++; - for(n = queue->front, prev = NULL; n; n = n->next) - { - if(action.time < n->action.time) - { - if(prev) - { - prev->next = newnode; - newnode->next = n; - } - else - { - newnode->next = queue->front; - queue->front = newnode; - } - return 1; - } - prev = n; - } - - queue->rear->next = newnode; - newnode->next = NULL; - queue->rear = newnode; - - return 1; -} - -int -SDLVisualTest_ParseActionConfig(const char* file, SDLVisualTest_ActionQueue* queue) -{ - char line[MAX_ACTION_LINE_LENGTH]; - SDLVisualTest_RWHelperBuffer buffer; - char* token_ptr; - int linenum; - SDL_RWops* rw; - - if(!file) - { - SDLTest_LogError("file argument cannot be NULL"); - return 0; - } - if(!queue) - { - SDLTest_LogError("queue argument cannot be NULL"); - return 0; - } - - rw = SDL_RWFromFile(file, "r"); - if(!rw) - { - SDLTest_LogError("SDL_RWFromFile() failed"); - return 0; - } - - SDLVisualTest_RWHelperResetBuffer(&buffer); - SDLVisualTest_InitActionQueue(queue); - linenum = 0; - while(SDLVisualTest_RWHelperReadLine(rw, line, MAX_ACTION_LINE_LENGTH, - &buffer, '#')) - { - SDLVisualTest_Action action; - int hr, min, sec; - - /* parse time */ - token_ptr = strtok(line, " "); - if(!token_ptr || - (SDL_sscanf(token_ptr, "%d:%d:%d", &hr, &min, &sec) != 3)) - { - SDLTest_LogError("Could not parse time token at line: %d", - linenum); - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - action.time = (((hr * 60 + min) * 60) + sec) * 1000; - - /* parse type */ - token_ptr = strtok(NULL, " "); - if(SDL_strcasecmp(token_ptr, "launch") == 0) - action.type = SDL_ACTION_LAUNCH; - else if(SDL_strcasecmp(token_ptr, "kill") == 0) - action.type = SDL_ACTION_KILL; - else if(SDL_strcasecmp(token_ptr, "quit") == 0) - action.type = SDL_ACTION_QUIT; - else if(SDL_strcasecmp(token_ptr, "screenshot") == 0) - action.type = SDL_ACTION_SCREENSHOT; - else if(SDL_strcasecmp(token_ptr, "verify") == 0) - action.type = SDL_ACTION_VERIFY; - else - { - SDLTest_LogError("Could not parse type token at line: %d", - linenum); - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - - /* parse the extra field */ - if(action.type == SDL_ACTION_LAUNCH) - { - int len; - char* args; - char* path; - token_ptr = strtok(NULL, " "); - len = token_ptr ? SDL_strlen(token_ptr) : 0; - if(len <= 0) - { - SDLTest_LogError("Please specify the process to launch at line: %d", - linenum); - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - path = (char*)SDL_malloc(sizeof(char) * (len + 1)); - if(!path) - { - SDLTest_LogError("SDL_malloc() failed"); - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - SDL_strlcpy(path, token_ptr, len + 1); - - token_ptr = strtok(NULL, ""); - len = token_ptr ? SDL_strlen(token_ptr) : 0; - if(len > 0) - { - args = (char*)SDL_malloc(sizeof(char) * (len + 1)); - if(!args) - { - SDLTest_LogError("SDL_malloc() failed"); - SDL_free(path); - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - SDL_strlcpy(args, token_ptr, len + 1); - } - else - args = NULL; - - action.extra.process.path = path; - action.extra.process.args = args; - } - - /* add the action to the queue */ - if(!SDLVisualTest_EnqueueAction(queue, action)) - { - SDLTest_LogError("SDLVisualTest_EnqueueAction() failed"); - if(action.type == SDL_ACTION_LAUNCH) - { - SDL_free(action.extra.process.path); - if(action.extra.process.args) - SDL_free(action.extra.process.args); - } - SDLVisualTest_EmptyActionQueue(queue); - SDL_RWclose(rw); - return 0; - } - } - /* sort the queue of actions */ - SortQueue(queue); - - SDL_RWclose(rw); - return 1; -} diff --git a/visualtest/src/harness_argparser.c b/visualtest/src/harness_argparser.c deleted file mode 100644 index 8bc57064b..000000000 --- a/visualtest/src/harness_argparser.c +++ /dev/null @@ -1,358 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file harness_argparser.c - * - * Source file for functions to parse arguments to the test harness. - */ - -#include -#include -#include - -#include "SDL_visualtest_harness_argparser.h" -#include "SDL_visualtest_rwhelper.h" - -/** Maximum length of one line in the config file */ -#define MAX_CONFIG_LINE_LEN 400 -/** Default value for the timeout after which the SUT is forcefully killed */ -#define DEFAULT_SUT_TIMEOUT (60 * 1000) - -/* String compare s1 and s2 ignoring leading hyphens */ -static int -StrCaseCmpIgnoreHyphen(const char* s1, const char* s2) -{ - /* treat NULL pointer as empty strings */ - if(!s1) - s1 = ""; - if(!s2) - s2 = ""; - - while(*s1 == '-') - s1++; - while(*s2 == '-') - s2++; - - return SDL_strcasecmp(s1, s2); -} - -/* parser an argument, updates the state object and returns the number of - arguments processed; returns -1 on failure */ -static int -ParseArg(char** argv, int index, SDLVisualTest_HarnessState* state) -{ - if(!argv || !argv[index] || !state) - return 0; - - if(StrCaseCmpIgnoreHyphen("sutapp", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for sutapp."); - return -1; - } - SDL_strlcpy(state->sutapp, argv[index], MAX_PATH_LEN); - SDLTest_Log("SUT Application: %s", state->sutapp); - return 2; - } - else if(StrCaseCmpIgnoreHyphen("output-dir", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for output-dir."); - return -1; - } - SDL_strlcpy(state->output_dir, argv[index], MAX_PATH_LEN); - SDLTest_Log("Screenshot Output Directory: %s", state->output_dir); - return 2; - } - else if(StrCaseCmpIgnoreHyphen("verify-dir", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for verify-dir."); - return -1; - } - SDL_strlcpy(state->verify_dir, argv[index], MAX_PATH_LEN); - SDLTest_Log("Screenshot Verification Directory: %s", state->verify_dir); - return 2; - } - else if(StrCaseCmpIgnoreHyphen("sutargs", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for sutargs."); - return -1; - } - SDL_strlcpy(state->sutargs, argv[index], MAX_SUT_ARGS_LEN); - SDLTest_Log("SUT Arguments: %s", state->sutargs); - return 2; - } - else if(StrCaseCmpIgnoreHyphen("timeout", argv[index]) == 0) - { - int hr, min, sec; - index++; - if(!argv[index] || SDL_sscanf(argv[index], "%d:%d:%d", &hr, &min, &sec) != 3) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for timeout."); - return -1; - } - state->timeout = (((hr * 60) + min) * 60 + sec) * 1000; - SDLTest_Log("Maximum Timeout for each SUT run: %d milliseconds", - state->timeout); - return 2; - } - else if(StrCaseCmpIgnoreHyphen("parameter-config", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for parameter-config."); - return -1; - } - SDLTest_Log("SUT Parameters file: %s", argv[index]); - SDLVisualTest_FreeSUTConfig(&state->sut_config); - if(!SDLVisualTest_ParseSUTConfig(argv[index], &state->sut_config)) - { - SDLTest_LogError("Failed to parse SUT parameters file"); - return -1; - } - return 2; - } - else if(StrCaseCmpIgnoreHyphen("variator", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for variator."); - return -1; - } - SDLTest_Log("Variator: %s", argv[index]); - if(SDL_strcasecmp("exhaustive", argv[index]) == 0) - state->variator_type = SDL_VARIATOR_EXHAUSTIVE; - else if(SDL_strcasecmp("random", argv[index]) == 0) - state->variator_type = SDL_VARIATOR_RANDOM; - else - { - SDLTest_LogError("Arguments parsing error: Invalid variator name."); - return -1; - } - return 2; - } - else if(StrCaseCmpIgnoreHyphen("num-variations", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: Invalid argument for num-variations."); - return -1; - } - state->num_variations = SDL_atoi(argv[index]); - SDLTest_Log("Number of variations to run: %d", state->num_variations); - if(state->num_variations <= 0) - { - SDLTest_LogError("Arguments parsing error: num-variations must be positive."); - return -1; - } - return 2; - } - else if(StrCaseCmpIgnoreHyphen("no-launch", argv[index]) == 0) - { - state->no_launch = SDL_TRUE; - SDLTest_Log("SUT will not be launched."); - return 1; - } - else if(StrCaseCmpIgnoreHyphen("action-config", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: invalid argument for action-config"); - return -1; - } - SDLTest_Log("Action Config file: %s", argv[index]); - SDLVisualTest_EmptyActionQueue(&state->action_queue); - if(!SDLVisualTest_ParseActionConfig(argv[index], &state->action_queue)) - { - SDLTest_LogError("SDLVisualTest_ParseActionConfig() failed"); - return -1; - } - return 2; - } - else if(StrCaseCmpIgnoreHyphen("config", argv[index]) == 0) - { - index++; - if(!argv[index]) - { - SDLTest_LogError("Arguments parsing error: invalid argument for config"); - return -1; - } - - /* do nothing, this option has already been handled */ - return 2; - } - return 0; -} - -/* TODO: Trailing/leading spaces and spaces between equals sign not supported. */ -static int -ParseConfig(const char* file, SDLVisualTest_HarnessState* state) -{ - SDL_RWops* rw; - SDLVisualTest_RWHelperBuffer buffer; - char line[MAX_CONFIG_LINE_LEN]; - - rw = SDL_RWFromFile(file, "r"); - if(!rw) - { - SDLTest_LogError("SDL_RWFromFile() failed"); - return 0; - } - - SDLVisualTest_RWHelperResetBuffer(&buffer); - while(SDLVisualTest_RWHelperReadLine(rw, line, MAX_CONFIG_LINE_LEN, - &buffer, '#')) - { - char** argv; - int i, num_params; - - /* count number of parameters and replace the trailing newline with 0 */ - num_params = 1; - for(i = 0; line[i]; i++) - { - if(line[i] == '=') - { - num_params = 2; - break; - } - } - - /* populate argv */ - argv = (char**)SDL_malloc((num_params + 1) * sizeof(char*)); - if(!argv) - { - SDLTest_LogError("SDL_malloc() failed."); - SDL_RWclose(rw); - return 0; - } - - argv[num_params] = NULL; - for(i = 0; i < num_params; i++) - { - argv[i] = strtok(i == 0 ? line : NULL, "="); - } - - if(ParseArg(argv, 0, state) == -1) - { - SDLTest_LogError("ParseArg() failed"); - SDL_free(argv); - SDL_RWclose(rw); - return 0; - } - SDL_free(argv); - } - SDL_RWclose(rw); - - if(!state->sutapp[0]) - return 0; - return 1; -} - -int -SDLVisualTest_ParseHarnessArgs(char** argv, SDLVisualTest_HarnessState* state) -{ - int i; - - SDLTest_Log("Parsing commandline arguments.."); - - if(!argv) - { - SDLTest_LogError("argv is NULL"); - return 0; - } - if(!state) - { - SDLTest_LogError("state is NULL"); - return 0; - } - - /* initialize the state object */ - state->sutargs[0] = '\0'; - state->sutapp[0] = '\0'; - state->output_dir[0] = '\0'; - state->verify_dir[0] = '\0'; - state->timeout = DEFAULT_SUT_TIMEOUT; - SDL_memset(&state->sut_config, 0, sizeof(SDLVisualTest_SUTConfig)); - SDL_memset(&state->action_queue, 0, sizeof(SDLVisualTest_ActionQueue)); - state->variator_type = SDL_VARIATOR_RANDOM; - state->num_variations = -1; - state->no_launch = SDL_FALSE; - - /* parse config file if passed */ - for(i = 0; argv[i]; i++) - { - if(StrCaseCmpIgnoreHyphen("config", argv[i]) == 0) - { - if(!argv[i + 1]) - { - SDLTest_Log("Arguments parsing error: invalid argument for config."); - return 0; - } - if(!ParseConfig(argv[i + 1], state)) - { - SDLTest_LogError("ParseConfig() failed"); - return 0; - } - } - } - - /* parse the arguments */ - for(i = 0; argv[i];) - { - int consumed = ParseArg(argv, i, state); - if(consumed == -1 || consumed == 0) - { - SDLTest_LogError("ParseArg() failed"); - return 0; - } - i += consumed; - } - - if(state->variator_type == SDL_VARIATOR_RANDOM && state->num_variations == -1) - state->num_variations = 1; - - /* check to see if required options have been passed */ - if(!state->sutapp[0]) - { - SDLTest_LogError("sutapp must be passed."); - return 0; - } - if(!state->sutargs[0] && !state->sut_config.options) - { - SDLTest_LogError("Either sutargs or parameter-config must be passed."); - return 0; - } - if(!state->output_dir[0]) - { - SDL_strlcpy(state->output_dir, "./output", MAX_PATH_LEN); - } - if(!state->verify_dir[0]) - { - SDL_strlcpy(state->verify_dir, "./verify", MAX_PATH_LEN); - } - - return 1; -} - -void -SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state) -{ - if(state) - { - SDLVisualTest_EmptyActionQueue(&state->action_queue); - SDLVisualTest_FreeSUTConfig(&state->sut_config); - } -} diff --git a/visualtest/src/linux/linux_process.c b/visualtest/src/linux/linux_process.c deleted file mode 100644 index b93f3407e..000000000 --- a/visualtest/src/linux/linux_process.c +++ /dev/null @@ -1,208 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file linux_process.c - * - * Source file for the process API on linux. - */ - - -#include -#include - -#include "SDL_visualtest_process.h" -#include "SDL_visualtest_harness_argparser.h" -#include "SDL_visualtest_parsehelper.h" - -#if defined(__LINUX__) -#include -#include -#include -#include - -static void -LogLastError(const char* str) -{ - const char* error = strerror(errno); - if(!str || !error) - return; - SDLTest_LogError("%s: %s", str, error); -} - -int -SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo) -{ - pid_t pid; - char** argv; - - if(!file) - { - SDLTest_LogError("file argument cannot be NULL"); - return 0; - } - if(!pinfo) - { - SDLTest_LogError("pinfo cannot be NULL"); - return 0; - } - pid = fork(); - if(pid == -1) - { - LogLastError("fork() failed"); - return 0; - } - else if(pid == 0) - { - /* parse the arguments string */ - argv = SDLVisualTest_ParseArgsToArgv(args); - argv[0] = file; - execv(file, argv); - LogLastError("execv() failed"); - return 0; - } - else - { - pinfo->pid = pid; - return 1; - } - - /* never executed */ - return 0; -} - -int -SDL_GetProcessExitStatus(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - int success, status; - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps argument cannot be NULL"); - return 0; - } - success = waitpid(pinfo->pid, &status, WNOHANG); - if(success == -1) - { - LogLastError("waitpid() failed"); - return 0; - } - else if(success == 0) - { - ps->exit_status = -1; - ps->exit_success = 1; - } - else - { - ps->exit_success = WIFEXITED(status); - ps->exit_status = WEXITSTATUS(status); - } - return 1; -} - -int -SDL_IsProcessRunning(SDL_ProcessInfo* pinfo) -{ - int success; - - if(!pinfo) - { - SDLTest_LogError("pinfo cannot be NULL"); - return -1; - } - - success = kill(pinfo->pid, 0); - if(success == -1) - { - if(errno == ESRCH) /* process is not running */ - return 0; - else - { - LogLastError("kill() failed"); - return -1; - } - } - return 1; -} - -int -SDL_QuitProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - int success, status; - - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps argument cannot be NULL"); - return 0; - } - - success = kill(pinfo->pid, SIGQUIT); - if(success == -1) - { - LogLastError("kill() failed"); - return 0; - } - - success = waitpid(pinfo->pid, &status, 0); - if(success == -1) - { - LogLastError("waitpid() failed"); - return 0; - } - - ps->exit_success = WIFEXITED(status); - ps->exit_status = WEXITSTATUS(status); - return 1; -} - -int -SDL_KillProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - int success, status; - - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps argument cannot be NULL"); - return 0; - } - - success = kill(pinfo->pid, SIGKILL); - if(success == -1) - { - LogLastError("kill() failed"); - return 0; - } - success = waitpid(pinfo->pid, &status, 0); - if(success == -1) - { - LogLastError("waitpid() failed"); - return 0; - } - - ps->exit_success = WIFEXITED(status); - ps->exit_status = WEXITSTATUS(status); - return 1; -} - -/* each window of the process will have a screenshot taken. The file name will be - prefix-i.png for the i'th window. */ -int -SDLVisualTest_ScreenshotProcess(SDL_ProcessInfo* pinfo, char* prefix) -{ - SDLTest_LogError("Screenshot process not implemented"); - return 0; -} - -#endif diff --git a/visualtest/src/mischelper.c b/visualtest/src/mischelper.c deleted file mode 100644 index 9684af6f6..000000000 --- a/visualtest/src/mischelper.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - * \file mischelper.c - * - * Source file with miscellaneous helper functions. - */ - -#include - -void -SDLVisualTest_HashString(char* str, char hash[33]) -{ - SDLTest_Md5Context md5c; - int i; - - if(!str) - { - SDLTest_LogError("str argument cannot be NULL"); - return; - } - - SDLTest_Md5Init(&md5c); - SDLTest_Md5Update(&md5c, (unsigned char*)str, SDL_strlen(str)); - SDLTest_Md5Final(&md5c); - - /* convert the md5 hash to an array of hexadecimal digits */ - for(i = 0; i < 16; i++) - SDL_snprintf(hash + 2 * i, 33 - 2 * i, "%02x", (int)md5c.digest[i]); -} diff --git a/visualtest/src/parsehelper.c b/visualtest/src/parsehelper.c deleted file mode 100644 index 9d38cb2f2..000000000 --- a/visualtest/src/parsehelper.c +++ /dev/null @@ -1,231 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file parsehelper.c - * - * Source file with some helper functions for parsing strings. - */ - -#include -#include "SDL_visualtest_harness_argparser.h" - -/* this function uses a DFA to count the number of tokens in an agruments string. - state 0 is taken to be the start and end state. State 1 handles a double quoted - argument and state 2 handles unquoted arguments. */ -static int -CountTokens(char* args) -{ - int index, num_tokens; - int state; /* current state of the DFA */ - - if(!args) - return -1; - - index = 0; - state = 0; - num_tokens = 0; - while(args[index]) - { - char ch = args[index]; - switch(state) - { - case 0: - if(ch == '\"') - { - state = 1; - num_tokens++; - } - else if(!SDL_isspace(ch)) - { - state = 2; - num_tokens++; - } - break; - - case 1: - if(ch == '\"') - { - state = 0; - } - break; - - case 2: - if(SDL_isspace(ch)) - { - state = 0; - } - break; - } - index++; - } - return num_tokens; -} - -/* - size of tokens is num_tokens + 1 -- uses the same DFA used in CountTokens() to split args into an array of strings */ -static int -TokenizeHelper(char* str, char** tokens, int num_tokens, int max_token_len) -{ - int index, state, done, st_index, token_index; - - if(!str) - { - SDLTest_LogError("str argument cannot be NULL"); - return 0; - } - if(!tokens) - { - SDLTest_LogError("tokens argument cannot be NULL"); - return 0; - } - if(num_tokens <= 0) - { - SDLTest_LogError("num_tokens argument must be positive"); - return 0; - } - if(max_token_len <= 0) - { - SDLTest_LogError("max_token_len argument must be positive"); - return 0; - } - - /* allocate memory for the tokens */ - tokens[num_tokens] = NULL; - for(index = 0; index < num_tokens; index++) - { - tokens[index] = (char*)SDL_malloc(max_token_len); - if(!tokens[index]) - { - int i; - SDLTest_LogError("SDL_malloc() failed."); - for(i = 0; i < index; i++) - SDL_free(tokens[i]); - return 0; - } - tokens[index][0] = '\0'; - } - - /* copy the tokens into the array */ - st_index = 0; - index = 0; - token_index = 0; - state = 0; - done = 0; - while(!done) - { - char ch = str[index]; - switch(state) - { - case 0: - if(ch == '\"') - { - state = 1; - st_index = index + 1; - } - else if(!ch) - done = 1; - else if(ch && !SDL_isspace(ch)) - { - state = 2; - st_index = index; - } - break; - - case 1: - if(ch == '\"') - { - int i; - state = 0; - for(i = st_index; i < index; i++) - { - tokens[token_index][i - st_index] = str[i]; - } - tokens[token_index][i - st_index] = '\0'; - token_index++; - } - else if(!ch) - { - SDLTest_LogError("Parsing Error!"); - done = 1; - } - break; - - case 2: - if(!ch) - done = 1; - if(SDL_isspace(ch) || !ch) - { - int i; - state = 0; - for(i = st_index; i < index; i++) - { - tokens[token_index][i - st_index] = str[i]; - } - tokens[token_index][i - st_index] = '\0'; - token_index++; - } - break; - } - index++; - } - return 1; -} - -char** -SDLVisualTest_Tokenize(char* str, int max_token_len) -{ - int num_tokens; - char** tokens; - - if(!str) - { - SDLTest_LogError("str argument cannot be NULL"); - return NULL; - } - if(max_token_len <= 0) - { - SDLTest_LogError("max_token_len argument must be positive"); - return NULL; - } - - num_tokens = CountTokens(str); - if(num_tokens == 0) - return NULL; - - tokens = (char**)SDL_malloc(sizeof(char*) * (num_tokens + 1)); - if(!TokenizeHelper(str, tokens, num_tokens, max_token_len)) - { - SDLTest_LogError("TokenizeHelper() failed"); - SDL_free(tokens); - return NULL; - } - return tokens; -} - -char** -SDLVisualTest_ParseArgsToArgv(char* args) -{ - char** argv; - int num_tokens; - - num_tokens = CountTokens(args); - if(num_tokens == 0) - return NULL; - - /* allocate space for arguments */ - argv = (char**)SDL_malloc((num_tokens + 2) * sizeof(char*)); - if(!argv) - { - SDLTest_LogError("SDL_malloc() failed."); - return NULL; - } - - /* tokenize */ - if(!TokenizeHelper(args, argv + 1, num_tokens, MAX_SUT_ARGS_LEN)) - { - SDLTest_LogError("TokenizeHelper() failed"); - SDL_free(argv); - return NULL; - } - argv[0] = NULL; - return argv; -} diff --git a/visualtest/src/rwhelper.c b/visualtest/src/rwhelper.c deleted file mode 100644 index 1ff9190ff..000000000 --- a/visualtest/src/rwhelper.c +++ /dev/null @@ -1,131 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file rwhelper.c - * - * Source file with some helper functions for working with SDL_RWops. - */ - -#include -#include "SDL_visualtest_sut_configparser.h" -#include "SDL_visualtest_rwhelper.h" - -void -SDLVisualTest_RWHelperResetBuffer(SDLVisualTest_RWHelperBuffer* buffer) -{ - if(!buffer) - { - SDLTest_LogError("buffer argument cannot be NULL"); - return; - } - buffer->buffer_pos = 0; - buffer->buffer_width = 0; -} - -char -SDLVisualTest_RWHelperReadChar(SDL_RWops* rw, SDLVisualTest_RWHelperBuffer* buffer) -{ - if(!rw || !buffer) - return 0; - /* if the buffer has been consumed, we fill it up again */ - if(buffer->buffer_pos == buffer->buffer_width) - { - buffer->buffer_width = SDL_RWread(rw, buffer->buffer, 1, RWOPS_BUFFER_LEN); - buffer->buffer_pos = 0; - if(buffer->buffer_width == 0) - return 0; - } - buffer->buffer_pos++; - return buffer->buffer[buffer->buffer_pos - 1]; -} - -/* does not include new lines in the buffer and adds a trailing null character */ -char* -SDLVisualTest_RWHelperReadLine(SDL_RWops* rw, char* str, int size, - SDLVisualTest_RWHelperBuffer* buffer, - char comment_char) -{ - char ch; - int current_pos, done; - if(!rw) - { - SDLTest_LogError("rw argument cannot be NULL"); - return NULL; - } - if(!str) - { - SDLTest_LogError("str argument cannot be NULL"); - return NULL; - } - if(!buffer) - { - SDLTest_LogError("buffer argument cannot be NULL"); - return NULL; - } - if(size <= 0) - { - SDLTest_LogError("size argument should be positive"); - return NULL; - } - - done = 0; - while(!done) - { - /* ignore leading whitespace */ - for(ch = SDLVisualTest_RWHelperReadChar(rw, buffer); ch && SDL_isspace(ch); - ch = SDLVisualTest_RWHelperReadChar(rw, buffer)); - - for(current_pos = 0; - ch && ch != '\n' && ch != '\r' && ch != comment_char; - current_pos++) - { - str[current_pos] = ch; - if(current_pos >= size - 2) - { - current_pos++; - break; - } - ch = SDLVisualTest_RWHelperReadChar(rw, buffer); - } - - done = 1; - if(ch == comment_char) /* discard all characters until the next line */ - { - do - { - ch = SDLVisualTest_RWHelperReadChar(rw, buffer); - }while(ch && ch != '\n' && ch != '\r'); - - if(current_pos == 0) - done = 0; - } - } - if(current_pos == 0) - return NULL; - - str[current_pos] = '\0'; - return str; -} - -/* Lines with all whitespace are ignored */ -int -SDLVisualTest_RWHelperCountNonEmptyLines(SDL_RWops* rw, - SDLVisualTest_RWHelperBuffer* buffer, - char comment_char) -{ - int num_lines = 0; - char str[MAX_SUTOPTION_LINE_LENGTH]; - if(!rw) - { - SDLTest_LogError("rw argument cannot be NULL"); - return -1; - } - if(!buffer) - { - SDLTest_LogError("buffer argument cannot be NULL"); - return -1; - } - while(SDLVisualTest_RWHelperReadLine(rw, str, MAX_SUTOPTION_LINE_LENGTH, - buffer, comment_char)) - num_lines++; - return num_lines; -} diff --git a/visualtest/src/screenshot.c b/visualtest/src/screenshot.c deleted file mode 100644 index be5e4df85..000000000 --- a/visualtest/src/screenshot.c +++ /dev/null @@ -1,136 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file screenshot.c - * - * Source file for the screenshot API. - */ - -#include "SDL_visualtest_mischelper.h" -#include - -int -SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir) -{ - int i, verify_len, return_code, test_len; - char hash[33]; - char* verify_path; /* path to the bmp file used for verification */ - char* test_path; /* path to the bmp file to be verified */ - SDL_RWops* rw; - SDL_Surface* verifybmp; - - return_code = 1; - - if(!args) - { - SDLTest_LogError("args argument cannot be NULL"); - return_code = -1; - goto verifyscreenshots_cleanup_generic; - } - if(!test_dir) - { - SDLTest_LogError("test_dir argument cannot be NULL"); - return_code = -1; - goto verifyscreenshots_cleanup_generic; - } - if(!verify_dir) - { - SDLTest_LogError("verify_dir argument cannot be NULL"); - return_code = -1; - goto verifyscreenshots_cleanup_generic; - } - - /* generate the MD5 hash */ - SDLVisualTest_HashString(args, hash); - - /* find the verification image */ - /* path_len + hash_len + some number of extra characters */ - verify_len = SDL_strlen(verify_dir) + 32 + 10; - verify_path = (char*)SDL_malloc(verify_len * sizeof(char)); - if(!verify_path) - { - SDLTest_LogError("SDL_malloc() failed"); - return_code = -1; - goto verifyscreenshots_cleanup_generic; - } - SDL_snprintf(verify_path, verify_len - 1, - "%s/%s.bmp", verify_dir, hash); - rw = SDL_RWFromFile(verify_path, "rb"); - if(!rw) - { - SDLTest_Log("Verification image does not exist." - " Please manually verify that the SUT is working correctly."); - return_code = 2; - goto verifyscreenshots_cleanup_verifypath; - } - - /* load the verification image */ - verifybmp = SDL_LoadBMP_RW(rw, 1); - if(!verifybmp) - { - SDLTest_LogError("SDL_LoadBMP_RW() failed"); - return_code = -1; - goto verifyscreenshots_cleanup_verifypath; - } - - /* load the test images and compare with the verification image */ - /* path_len + hash_len + some number of extra characters */ - test_len = SDL_strlen(test_dir) + 32 + 10; - test_path = (char*)SDL_malloc(test_len * sizeof(char)); - if(!test_path) - { - SDLTest_LogError("SDL_malloc() failed"); - return_code = -1; - goto verifyscreenshots_cleanup_verifybmp; - } - - for(i = 1; ; i++) - { - SDL_RWops* testrw; - SDL_Surface* testbmp; - - if(i == 1) - SDL_snprintf(test_path, test_len - 1, "%s/%s.bmp", test_dir, hash); - else - SDL_snprintf(test_path, test_len - 1, "%s/%s_%d.bmp", test_dir, hash, i); - testrw = SDL_RWFromFile(test_path, "rb"); - - /* we keep going until we've iterated through the screenshots each - SUT window */ - if(!testrw) - break; - - /* load the test screenshot */ - testbmp = SDL_LoadBMP_RW(testrw, 1); - if(!testbmp) - { - SDLTest_LogError("SDL_LoadBMP_RW() failed"); - return_code = -1; - goto verifyscreenshots_cleanup_verifybmp; - } - - /* compare with the verification image */ - if(SDLTest_CompareSurfaces(testbmp, verifybmp, 0) != 0) - { - return_code = 0; - SDL_FreeSurface(testbmp); - goto verifyscreenshots_cleanup_verifybmp; - } - - SDL_FreeSurface(testbmp); - } - - if(i == 1) - { - SDLTest_LogError("No verification images found"); - return_code = -1; - } - -verifyscreenshots_cleanup_verifybmp: - SDL_FreeSurface(verifybmp); - -verifyscreenshots_cleanup_verifypath: - SDL_free(verify_path); - -verifyscreenshots_cleanup_generic: - return return_code; -} diff --git a/visualtest/src/sut_configparser.c b/visualtest/src/sut_configparser.c deleted file mode 100644 index fa8c2d4bb..000000000 --- a/visualtest/src/sut_configparser.c +++ /dev/null @@ -1,232 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file sut_configparser.c - * - * Source file for the parser for SUT config files. - */ - -#include -#include -#include -#include -#include "SDL_visualtest_sut_configparser.h" -#include "SDL_visualtest_parsehelper.h" -#include "SDL_visualtest_rwhelper.h" - -int -SDLVisualTest_ParseSUTConfig(char* file, SDLVisualTest_SUTConfig* config) -{ - char line[MAX_SUTOPTION_LINE_LENGTH]; - SDLVisualTest_RWHelperBuffer buffer; - char* token_ptr; - char* token_end; - int num_lines, i, token_len; - SDL_RWops* rw; - - if(!file) - { - SDLTest_LogError("file argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - - /* count the number of lines */ - rw = SDL_RWFromFile(file, "r"); - if(!rw) - { - SDLTest_LogError("SDL_RWFromFile() failed"); - return 0; - } - SDLVisualTest_RWHelperResetBuffer(&buffer); - num_lines = SDLVisualTest_RWHelperCountNonEmptyLines(rw, &buffer, '#'); - if(num_lines == -1) - return 0; - else if(num_lines == 0) - { - config->options = NULL; - config->num_options = 0; - SDL_RWclose(rw); - return 1; - } - - /* allocate memory */ - SDL_RWseek(rw, 0, RW_SEEK_SET); - SDLVisualTest_RWHelperResetBuffer(&buffer); - config->num_options = num_lines; - config->options = (SDLVisualTest_SUTOption*)SDL_malloc(num_lines * - sizeof(SDLVisualTest_SUTOption)); - if(!config->options) - { - SDLTest_LogError("SDL_malloc() failed"); - SDL_RWclose(rw); - return 0; - } - - /* actually parse the options */ - for(i = 0; i < num_lines; i++) - { - if(!SDLVisualTest_RWHelperReadLine(rw, line, MAX_SUTOPTION_LINE_LENGTH, - &buffer, '#')) - { - SDLTest_LogError("SDLVisualTest_RWHelperReadLine() failed"); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - - /* parse name */ - token_ptr = strtok(line, ", "); - if(!token_ptr) - { - SDLTest_LogError("Could not parse line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - token_len = SDL_strlen(token_ptr) + 1; - SDL_strlcpy(config->options[i].name, token_ptr, token_len); - - /* parse type */ - token_ptr = strtok(NULL, ", "); - if(!token_ptr) - { - SDLTest_LogError("Could not parse line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - if(SDL_strcmp(token_ptr, "string") == 0) - config->options[i].type = SDL_SUT_OPTIONTYPE_STRING; - else if(SDL_strcmp(token_ptr, "integer") == 0) - config->options[i].type = SDL_SUT_OPTIONTYPE_INT; - else if(SDL_strcmp(token_ptr, "enum") == 0) - config->options[i].type = SDL_SUT_OPTIONTYPE_ENUM; - else if(SDL_strcmp(token_ptr, "boolean") == 0) - config->options[i].type = SDL_SUT_OPTIONTYPE_BOOL; - else - { - SDLTest_LogError("Could not parse type token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - - /* parse values */ - token_ptr = strtok(NULL, "]"); - if(!token_ptr) - { - SDLTest_LogError("Could not parse line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - token_ptr = SDL_strchr(token_ptr, '['); - if(!token_ptr) - { - SDLTest_LogError("Could not parse enum token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - token_ptr++; - if(config->options[i].type == SDL_SUT_OPTIONTYPE_INT) - { - if(SDL_sscanf(token_ptr, "%d %d", &config->options[i].data.range.min, - &config->options[i].data.range.max) != 2) - { - config->options[i].data.range.min = INT_MIN; - config->options[i].data.range.max = INT_MAX; - } - } - else if(config->options[i].type == SDL_SUT_OPTIONTYPE_ENUM) - { - config->options[i].data.enum_values = SDLVisualTest_Tokenize(token_ptr, - MAX_SUTOPTION_ENUMVAL_LEN); - if(!config->options[i].data.enum_values) - { - SDLTest_LogError("Could not parse enum token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - } - - /* parse required */ - token_ptr = strtok(NULL, ", "); - if(!token_ptr) - { - SDLTest_LogError("Could not parse line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - - if(SDL_strcmp(token_ptr, "true") == 0) - config->options[i].required = SDL_TRUE; - else if(SDL_strcmp(token_ptr, "false") == 0) - config->options[i].required = SDL_FALSE; - else - { - SDLTest_LogError("Could not parse required token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - - /* parse categories */ - token_ptr = strtok(NULL, ","); - if(!token_ptr) - { - SDLTest_LogError("Could not parse line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - token_ptr = SDL_strchr(token_ptr, '['); - if(!token_ptr) - { - SDLTest_LogError("Could not parse enum token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - token_ptr++; - token_end = SDL_strchr(token_ptr, ']'); - *token_end = '\0'; - if(!token_end) - { - SDLTest_LogError("Could not parse enum token at line %d", i + 1); - SDL_free(config->options); - SDL_RWclose(rw); - return 0; - } - config->options[i].categories = SDLVisualTest_Tokenize(token_ptr, - MAX_SUTOPTION_CATEGORY_LEN); - } - SDL_RWclose(rw); - return 1; -} - -void -SDLVisualTest_FreeSUTConfig(SDLVisualTest_SUTConfig* config) -{ - if(config && config->options) - { - SDLVisualTest_SUTOption* option; - for(option = config->options; - option != config->options + config->num_options; option++) - { - if(option->categories) - SDL_free(option->categories); - if(option->type == SDL_SUT_OPTIONTYPE_ENUM && option->data.enum_values) - SDL_free(option->data.enum_values); - } - SDL_free(config->options); - config->options = NULL; - config->num_options = 0; - } -} diff --git a/visualtest/src/testharness.c b/visualtest/src/testharness.c deleted file mode 100644 index db3ca55b2..000000000 --- a/visualtest/src/testharness.c +++ /dev/null @@ -1,532 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file testharness.c - * - * Source file for the test harness. - */ - -#include -#include -#include -#include -#include "SDL_visualtest_harness_argparser.h" -#include "SDL_visualtest_process.h" -#include "SDL_visualtest_variators.h" -#include "SDL_visualtest_screenshot.h" -#include "SDL_visualtest_mischelper.h" - -#if defined(__WIN32__) && !defined(__CYGWIN__) -#include -#elif defined(__WIN32__) && defined(__CYGWIN__) -#include -#elif defined(__LINUX__) -#include -#include -#include -#else -#error "Unsupported platform" -#endif - -/** Code for the user event triggered when a new action is to be executed */ -#define ACTION_TIMER_EVENT 0 -/** Code for the user event triggered when the maximum timeout is reached */ -#define KILL_TIMER_EVENT 1 -/** FPS value used for delays in the action loop */ -#define ACTION_LOOP_FPS 10 - -/** Value returned by RunSUTAndTest() when the test has passed */ -#define TEST_PASSED 1 -/** Value returned by RunSUTAndTest() when the test has failed */ -#define TEST_FAILED 0 -/** Value returned by RunSUTAndTest() on a fatal error */ -#define TEST_ERROR -1 - -static SDL_ProcessInfo pinfo; -static SDL_ProcessExitStatus sut_exitstatus; -static SDLVisualTest_HarnessState state; -static SDLVisualTest_Variator variator; -static SDLVisualTest_ActionNode* current; /* the current action being performed */ -static SDL_TimerID action_timer, kill_timer; - -/* returns a char* to be passed as the format argument of a printf-style function. */ -static const char* -usage(void) -{ - return "Usage: \n%s --sutapp xyz" - " [--sutargs abc | --parameter-config xyz.parameters" - " [--variator exhaustive|random]" - " [--num-variations N] [--no-launch]] [--timeout hh:mm:ss]" - " [--action-config xyz.actions]" - " [--output-dir /path/to/output]" - " [--verify-dir /path/to/verify]" - " or --config app.config"; -} - -/* register Ctrl+C handlers */ -#if defined(__LINUX__) || defined(__CYGWIN__) -static void -CtrlCHandlerCallback(int signum) -{ - SDL_Event event; - SDLTest_Log("Ctrl+C received"); - event.type = SDL_QUIT; - SDL_PushEvent(&event); -} -#endif - -static Uint32 -ActionTimerCallback(Uint32 interval, void* param) -{ - SDL_Event event; - SDL_UserEvent userevent; - Uint32 next_action_time; - - /* push an event to handle the action */ - SDL_zero(userevent); - userevent.type = SDL_USEREVENT; - userevent.code = ACTION_TIMER_EVENT; - userevent.data1 = ¤t->action; - - event.type = SDL_USEREVENT; - event.user = userevent; - SDL_PushEvent(&event); - - /* calculate the new interval and return it */ - if(current->next) - next_action_time = current->next->action.time - current->action.time; - else - { - next_action_time = 0; - action_timer = 0; - } - - current = current->next; - return next_action_time; -} - -static Uint32 -KillTimerCallback(Uint32 interval, void* param) -{ - SDL_Event event; - SDL_UserEvent userevent; - - SDL_zero(userevent); - userevent.type = SDL_USEREVENT; - userevent.code = KILL_TIMER_EVENT; - - event.type = SDL_USEREVENT; - event.user = userevent; - SDL_PushEvent(&event); - - kill_timer = 0; - return 0; -} - -static int -ProcessAction(SDLVisualTest_Action* action, int* sut_running, char* args) -{ - if(!action || !sut_running) - return TEST_ERROR; - - switch(action->type) - { - case SDL_ACTION_KILL: - SDLTest_Log("Action: Kill SUT"); - if(SDL_IsProcessRunning(&pinfo) == 1 && - !SDL_KillProcess(&pinfo, &sut_exitstatus)) - { - SDLTest_LogError("SDL_KillProcess() failed"); - return TEST_ERROR; - } - *sut_running = 0; - break; - - case SDL_ACTION_QUIT: - SDLTest_Log("Action: Quit SUT"); - if(SDL_IsProcessRunning(&pinfo) == 1 && - !SDL_QuitProcess(&pinfo, &sut_exitstatus)) - { - SDLTest_LogError("SDL_QuitProcess() failed"); - return TEST_FAILED; - } - *sut_running = 0; - break; - - case SDL_ACTION_LAUNCH: - { - char* path; - char* args; - SDL_ProcessInfo action_process; - SDL_ProcessExitStatus ps; - - path = action->extra.process.path; - args = action->extra.process.args; - if(args) - { - SDLTest_Log("Action: Launch process: %s with arguments: %s", - path, args); - } - else - SDLTest_Log("Action: Launch process: %s", path); - if(!SDL_LaunchProcess(path, args, &action_process)) - { - SDLTest_LogError("SDL_LaunchProcess() failed"); - return TEST_ERROR; - } - - /* small delay so that the process can do its job */ - SDL_Delay(1000); - - if(SDL_IsProcessRunning(&action_process) > 0) - { - SDLTest_LogError("Process %s took too long too complete." - " Force killing...", action->extra.process.path); - if(!SDL_KillProcess(&action_process, &ps)) - { - SDLTest_LogError("SDL_KillProcess() failed"); - return TEST_ERROR; - } - } - } - break; - - case SDL_ACTION_SCREENSHOT: - { - char path[MAX_PATH_LEN], hash[33]; - - SDLTest_Log("Action: Take screenshot"); - /* can't take a screenshot if the SUT isn't running */ - if(SDL_IsProcessRunning(&pinfo) != 1) - { - SDLTest_LogError("SUT has quit."); - *sut_running = 0; - return TEST_FAILED; - } - - /* file name for the screenshot image */ - SDLVisualTest_HashString(args, hash); - SDL_snprintf(path, MAX_PATH_LEN, "%s/%s", state.output_dir, hash); - if(!SDLVisualTest_ScreenshotProcess(&pinfo, path)) - { - SDLTest_LogError("SDLVisualTest_ScreenshotProcess() failed"); - return TEST_ERROR; - } - } - break; - - case SDL_ACTION_VERIFY: - { - int ret; - - SDLTest_Log("Action: Verify screenshot"); - ret = SDLVisualTest_VerifyScreenshots(args, state.output_dir, - state.verify_dir); - - if(ret == -1) - { - SDLTest_LogError("SDLVisualTest_VerifyScreenshots() failed"); - return TEST_ERROR; - } - else if(ret == 0) - { - SDLTest_Log("Verification failed: Images were not equal."); - return TEST_FAILED; - } - else if(ret == 1) - SDLTest_Log("Verification successful."); - else - { - SDLTest_Log("Verfication skipped."); - return TEST_FAILED; - } - } - break; - - default: - SDLTest_LogError("Invalid action type"); - return TEST_ERROR; - break; - } - - return TEST_PASSED; -} - -static int -RunSUTAndTest(char* sutargs, int variation_num) -{ - int success, sut_running, return_code; - char hash[33]; - SDL_Event event; - - return_code = TEST_PASSED; - - if(!sutargs) - { - SDLTest_LogError("sutargs argument cannot be NULL"); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_generic; - } - - SDLVisualTest_HashString(sutargs, hash); - SDLTest_Log("Hash: %s", hash); - - success = SDL_LaunchProcess(state.sutapp, sutargs, &pinfo); - if(!success) - { - SDLTest_Log("Could not launch SUT."); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_generic; - } - SDLTest_Log("SUT launch successful."); - SDLTest_Log("Process will be killed in %d milliseconds", state.timeout); - sut_running = 1; - - /* launch the timers */ - SDLTest_Log("Performing actions.."); - current = state.action_queue.front; - action_timer = 0; - kill_timer = 0; - if(current) - { - action_timer = SDL_AddTimer(current->action.time, ActionTimerCallback, NULL); - if(!action_timer) - { - SDLTest_LogError("SDL_AddTimer() failed"); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_timer; - } - } - kill_timer = SDL_AddTimer(state.timeout, KillTimerCallback, NULL); - if(!kill_timer) - { - SDLTest_LogError("SDL_AddTimer() failed"); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_timer; - } - - /* the timer stops running if the actions queue is empty, and the - SUT stops running if it crashes or if we encounter a KILL/QUIT action */ - while(sut_running) - { - /* process the actions by using an event queue */ - while(SDL_PollEvent(&event)) - { - if(event.type == SDL_USEREVENT) - { - if(event.user.code == ACTION_TIMER_EVENT) - { - SDLVisualTest_Action* action; - - action = (SDLVisualTest_Action*)event.user.data1; - - switch(ProcessAction(action, &sut_running, sutargs)) - { - case TEST_PASSED: - break; - - case TEST_FAILED: - return_code = TEST_FAILED; - goto runsutandtest_cleanup_timer; - break; - - default: - SDLTest_LogError("ProcessAction() failed"); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_timer; - } - } - else if(event.user.code == KILL_TIMER_EVENT) - { - SDLTest_LogError("Maximum timeout reached. Force killing.."); - return_code = TEST_FAILED; - goto runsutandtest_cleanup_timer; - } - } - else if(event.type == SDL_QUIT) - { - SDLTest_LogError("Received QUIT event. Testharness is quitting.."); - return_code = TEST_ERROR; - goto runsutandtest_cleanup_timer; - } - } - SDL_Delay(1000/ACTION_LOOP_FPS); - } - - SDLTest_Log("SUT exit code was: %d", sut_exitstatus.exit_status); - if(sut_exitstatus.exit_status == 0) - { - return_code = TEST_PASSED; - goto runsutandtest_cleanup_timer; - } - else - { - return_code = TEST_FAILED; - goto runsutandtest_cleanup_timer; - } - - return_code = TEST_ERROR; - goto runsutandtest_cleanup_generic; - -runsutandtest_cleanup_timer: - if(action_timer && !SDL_RemoveTimer(action_timer)) - { - SDLTest_Log("SDL_RemoveTimer() failed"); - return_code = TEST_ERROR; - } - - if(kill_timer && !SDL_RemoveTimer(kill_timer)) - { - SDLTest_Log("SDL_RemoveTimer() failed"); - return_code = TEST_ERROR; - } -/* runsutandtest_cleanup_process: */ - if(SDL_IsProcessRunning(&pinfo) && !SDL_KillProcess(&pinfo, &sut_exitstatus)) - { - SDLTest_Log("SDL_KillProcess() failed"); - return_code = TEST_ERROR; - } -runsutandtest_cleanup_generic: - return return_code; -} - -/** Entry point for testharness */ -int -main(int argc, char* argv[]) -{ - int i, passed, return_code, failed; - - /* freeing resources, linux style! */ - return_code = 0; - - if(argc < 2) - { - SDLTest_Log(usage(), argv[0]); - goto cleanup_generic; - } - -#if defined(__LINUX__) || defined(__CYGWIN__) - signal(SIGINT, CtrlCHandlerCallback); -#endif - - /* parse arguments */ - if(!SDLVisualTest_ParseHarnessArgs(argv + 1, &state)) - { - SDLTest_Log(usage(), argv[0]); - return_code = 1; - goto cleanup_generic; - } - SDLTest_Log("Parsed harness arguments successfully."); - - /* initialize SDL */ - if(SDL_Init(SDL_INIT_TIMER) == -1) - { - SDLTest_LogError("SDL_Init() failed."); - SDLVisualTest_FreeHarnessState(&state); - return_code = 1; - goto cleanup_harness_state; - } - - /* create an output directory if none exists */ -#if defined(__LINUX__) || defined(__CYGWIN__) - mkdir(state.output_dir, 0777); -#elif defined(__WIN32__) - _mkdir(state.output_dir); -#else -#error "Unsupported platform" -#endif - - /* test with sutargs */ - if(SDL_strlen(state.sutargs)) - { - SDLTest_Log("Running: %s %s", state.sutapp, state.sutargs); - if(!state.no_launch) - { - switch(RunSUTAndTest(state.sutargs, 0)) - { - case TEST_PASSED: - SDLTest_Log("Status: PASSED"); - break; - - case TEST_FAILED: - SDLTest_Log("Status: FAILED"); - break; - - case TEST_ERROR: - SDLTest_LogError("Some error occurred while testing."); - return_code = 1; - goto cleanup_sdl; - break; - } - } - } - - if(state.sut_config.num_options > 0) - { - const char* variator_name = (state.variator_type == SDL_VARIATOR_RANDOM) ? - "RANDOM" : "EXHAUSTIVE"; - if(state.num_variations > 0) - SDLTest_Log("Testing SUT with variator: %s for %d variations", - variator_name, state.num_variations); - else - SDLTest_Log("Testing SUT with variator: %s and ALL variations", - variator_name); - /* initialize the variator */ - if(!SDLVisualTest_InitVariator(&variator, &state.sut_config, - state.variator_type, 0)) - { - SDLTest_LogError("Could not initialize variator"); - return_code = 1; - goto cleanup_sdl; - } - - /* iterate through all the variations */ - passed = 0; - failed = 0; - for(i = 0; state.num_variations > 0 ? (i < state.num_variations) : 1; i++) - { - char* args = SDLVisualTest_GetNextVariation(&variator); - if(!args) - break; - SDLTest_Log("\nVariation number: %d\nArguments: %s", i + 1, args); - - if(!state.no_launch) - { - switch(RunSUTAndTest(args, i + 1)) - { - case TEST_PASSED: - SDLTest_Log("Status: PASSED"); - passed++; - break; - - case TEST_FAILED: - SDLTest_Log("Status: FAILED"); - failed++; - break; - - case TEST_ERROR: - SDLTest_LogError("Some error occurred while testing."); - goto cleanup_variator; - break; - } - } - } - if(!state.no_launch) - { - /* report stats */ - SDLTest_Log("Testing complete."); - SDLTest_Log("%d/%d tests passed.", passed, passed + failed); - } - goto cleanup_variator; - } - - goto cleanup_sdl; - -cleanup_variator: - SDLVisualTest_FreeVariator(&variator); -cleanup_sdl: - SDL_Quit(); -cleanup_harness_state: - SDLVisualTest_FreeHarnessState(&state); -cleanup_generic: - return return_code; -} diff --git a/visualtest/src/variator_common.c b/visualtest/src/variator_common.c deleted file mode 100644 index e8444b317..000000000 --- a/visualtest/src/variator_common.c +++ /dev/null @@ -1,225 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file variator_common.c - * - * Source file for some common functionality used by variators. - */ - -#include -#include "SDL_visualtest_variator_common.h" - -int -SDLVisualTest_NextValue(SDLVisualTest_SUTOptionValue* var, - SDLVisualTest_SUTOption* opt) -{ - if(!var) - { - SDLTest_LogError("var argument cannot be NULL"); - return -1; - } - if(!opt) - { - SDLTest_LogError("opt argument cannot be NULL"); - return -1; - } - - switch(opt->type) - { - case SDL_SUT_OPTIONTYPE_BOOL: - if(var->bool_value) - { - var->bool_value = SDL_FALSE; - return 1; - } - else - { - var->bool_value = SDL_TRUE; - return 0; - } - break; - - case SDL_SUT_OPTIONTYPE_ENUM: - var->enumerated.index++; - if(!opt->data.enum_values[var->enumerated.index]) - { - var->enumerated.index = 0; - return 1; - } - return 0; - break; - - case SDL_SUT_OPTIONTYPE_INT: - { - int increment = (opt->data.range.max - opt->data.range.min) / - SDL_SUT_INTEGER_OPTION_TEST_STEPS; - /* prevents infinite loop when rounding */ - if(increment == 0) - increment = 1; - var->integer.value += increment; - if(var->integer.value > opt->data.range.max) - { - var->integer.value = opt->data.range.min; - return 1; - } - return 0; - } - break; - - case SDL_SUT_OPTIONTYPE_STRING: - return 1; - break; - } - return -1; -} - -int -SDLVisualTest_MakeStrFromVariation(SDLVisualTest_Variation* variation, - SDLVisualTest_SUTConfig* config, - char* buffer, int size) -{ - int i, index; - SDLVisualTest_SUTOptionValue* vars; - SDLVisualTest_SUTOption* options; - if(!variation) - { - SDLTest_LogError("variation argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - if(!buffer) - { - SDLTest_LogError("buffer argument cannot be NULL"); - return 0; - } - if(size <= 0) - { - SDLTest_LogError("size argument should be positive"); - return 0; - } - - index = 0; - buffer[0] = '\0'; - options = config->options; - vars = variation->vars; - for(i = 0; i < variation->num_vars; i++) - { - int n, enum_index; - if(index >= size - 1) - { - SDLTest_LogError("String did not fit in buffer size"); - return 0; - } - switch(options[i].type) - { - case SDL_SUT_OPTIONTYPE_BOOL: - if(vars[i].bool_value) - { - n = SDL_snprintf(buffer + index, size - index, "%s ", - options[i].name); - if(n <= 0) - { - SDLTest_LogError("SDL_snprintf() failed"); - return 0; - } - index += n; - } - break; - - case SDL_SUT_OPTIONTYPE_ENUM: - if(vars[i].enumerated.on) - { - enum_index = vars[i].enumerated.index; - n = SDL_snprintf(buffer + index, size - index, "%s %s ", - options[i].name, options[i].data.enum_values[enum_index]); - index += n; - } - break; - - case SDL_SUT_OPTIONTYPE_INT: - if(vars[i].integer.on) - { - n = SDL_snprintf(buffer + index, size - index, "%s %d ", - options[i].name, vars[i].integer.value); - index += n; - } - break; - - case SDL_SUT_OPTIONTYPE_STRING: - if(vars[i].string.on) - { - n = SDL_snprintf(buffer + index, size - index, "%s %s ", - options[i].name, vars[i].string.value); - index += n; - } - break; - } - } - return 1; -} - -int -SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation, - SDLVisualTest_SUTConfig* config) -{ - int i; - SDLVisualTest_SUTOptionValue* vars; - SDLVisualTest_SUTOption* options; - if(!variation) - { - SDLTest_LogError("variation argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - - /* initialize the first variation */ - if(config->num_options <= 0) - { - SDLTest_LogError("config->num_options must be positive"); - return 0; - } - variation->vars = (SDLVisualTest_SUTOptionValue*)SDL_malloc(config->num_options * - sizeof(SDLVisualTest_SUTOptionValue)); - if(!variation->vars) - { - SDLTest_LogError("SDL_malloc() failed"); - return 0; - } - variation->num_vars = config->num_options; - vars = variation->vars; - options = config->options; - for(i = 0; i < variation->num_vars; i++) - { - switch(options[i].type) - { - case SDL_SUT_OPTIONTYPE_BOOL: - vars[i].bool_value = SDL_FALSE; - break; - - case SDL_SUT_OPTIONTYPE_ENUM: - vars[i].enumerated.on = SDL_TRUE; - vars[i].enumerated.index = 0; - break; - - case SDL_SUT_OPTIONTYPE_INT: - { - vars[i].integer.on = SDL_TRUE; - vars[i].integer.value = options[i].data.range.min; - } - break; - - case SDL_SUT_OPTIONTYPE_STRING: - vars[i].string.on = SDL_TRUE; - vars[i].string.value = options[i].name; - break; - } - } - return 1; -} diff --git a/visualtest/src/variator_exhaustive.c b/visualtest/src/variator_exhaustive.c deleted file mode 100644 index 1e6a79e0a..000000000 --- a/visualtest/src/variator_exhaustive.c +++ /dev/null @@ -1,133 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file variator_exhaustive.c - * - * Source file for the variator that tests the SUT with all the different - * variations of input parameters that are valid. - */ - -#include -#include -#include "SDL_visualtest_sut_configparser.h" -#include "SDL_visualtest_exhaustive_variator.h" - -static int -NextVariation(SDLVisualTest_Variation* variation, - SDLVisualTest_SUTConfig* config) -{ - int i, carry; - if(!variation) - { - SDLTest_LogError("variation argument cannot be NULL"); - return -1; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return -1; - } - - carry = 1; - for(i = 0; i < variation->num_vars; i++) - { - carry = SDLVisualTest_NextValue(&variation->vars[i], &config->options[i]); - if(carry != 1) - break; - } - - if(carry == 1) /* we're done, we've tried all possible variations */ - return 0; - if(carry == 0) - return 1; - - SDLTest_LogError("NextVariation() failed"); - return -1; -} - -int -SDLVisualTest_InitExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator, - SDLVisualTest_SUTConfig* config) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - - SDLTest_FuzzerInit(time(NULL)); - - variator->config = *config; - variator->variation.num_vars = 0; - variator->variation.vars = NULL; - - return 1; -} - -/* TODO: Right now variations where an option is not specified at all are not - tested for. This can be implemented by switching the on attribute for integer, - enum and string options to true and false. */ -char* -SDLVisualTest_GetNextExhaustiveVariation(SDLVisualTest_ExhaustiveVariator* variator) -{ - int success; - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return NULL; - } - - if(!variator->variation.vars) /* the first time this function is called */ - { - success = SDLVisualTest_InitVariation(&variator->variation, - &variator->config); - if(!success) - { - SDLTest_LogError("SDLVisualTest_InitVariation() failed"); - return NULL; - } - success = SDLVisualTest_MakeStrFromVariation(&variator->variation, - &variator->config, variator->buffer, MAX_SUT_ARGS_LEN); - if(!success) - { - SDLTest_LogError("SDLVisualTest_MakeStrFromVariation() failed"); - return NULL; - } - return variator->buffer; - } - else - { - success = NextVariation(&variator->variation, &variator->config); - if(success == 1) - { - success = SDLVisualTest_MakeStrFromVariation(&variator->variation, - &variator->config, variator->buffer, MAX_SUT_ARGS_LEN); - if(!success) - { - SDLTest_LogError("SDLVisualTest_MakeStrFromVariation() failed"); - return NULL; - } - return variator->buffer; - } - else if(success == -1) - SDLTest_LogError("NextVariation() failed."); - return NULL; - } - return NULL; -} - -void -SDLVisualTest_FreeExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return; - } - SDL_free(variator->variation.vars); - variator->variation.vars = NULL; -} diff --git a/visualtest/src/variator_random.c b/visualtest/src/variator_random.c deleted file mode 100644 index 4da4161e1..000000000 --- a/visualtest/src/variator_random.c +++ /dev/null @@ -1,113 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file variator_random.c - * - * Source file for the variator that tests the SUT with random variations to the - * input parameters. - */ - -#include -#include -#include "SDL_visualtest_random_variator.h" - -int -SDLVisualTest_InitRandomVariator(SDLVisualTest_RandomVariator* variator, - SDLVisualTest_SUTConfig* config, Uint64 seed) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - - if(seed) - SDLTest_FuzzerInit(seed); - else - SDLTest_FuzzerInit(time(NULL)); - - variator->config = *config; - - if(!SDLVisualTest_InitVariation(&variator->variation, &variator->config)) - { - SDLTest_LogError("SDLVisualTest_InitVariation() failed"); - return 0; - } - - return 1; -} - -char* -SDLVisualTest_GetNextRandomVariation(SDLVisualTest_RandomVariator* variator) -{ - SDLVisualTest_SUTOptionValue* vars; - SDLVisualTest_SUTOption* options; - int i; - - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return NULL; - } - - /* to save typing */ - vars = variator->variation.vars; - options = variator->config.options; - - /* generate a random variation */ - for(i = 0; i < variator->variation.num_vars; i++) - { - switch(options[i].type) - { - case SDL_SUT_OPTIONTYPE_BOOL: - vars[i].bool_value = SDLTest_RandomIntegerInRange(0, 1) ? SDL_FALSE : - SDL_TRUE; - break; - - case SDL_SUT_OPTIONTYPE_ENUM: - { - int emx = 0; - while(options[i].data.enum_values[emx]) - emx++; - vars[i].enumerated.index = SDLTest_RandomIntegerInRange(0, emx - 1); - } - break; - - case SDL_SUT_OPTIONTYPE_INT: - vars[i].integer.value = SDLTest_RandomIntegerInRange( - options[i].data.range.min, - options[i].data.range.max); - break; - - case SDL_SUT_OPTIONTYPE_STRING: - // String values are left unchanged - break; - } - } - - /* convert variation to an arguments string */ - if(!SDLVisualTest_MakeStrFromVariation(&variator->variation, &variator->config, - variator->buffer, MAX_SUT_ARGS_LEN)) - { - SDLTest_LogError("SDLVisualTest_MakeStrFromVariation() failed"); - return NULL; - } - - return variator->buffer; -} - -void SDLVisualTest_FreeRandomVariator(SDLVisualTest_RandomVariator* variator) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return; - } - - SDL_free(variator->variation.vars); - variator->variation.vars = NULL; -} diff --git a/visualtest/src/variators.c b/visualtest/src/variators.c deleted file mode 100644 index e9485c6f6..000000000 --- a/visualtest/src/variators.c +++ /dev/null @@ -1,95 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file variators.c - * - * Source file for the operations that act on variators. - */ - -#include -#include "SDL_visualtest_variators.h" - -int -SDLVisualTest_InitVariator(SDLVisualTest_Variator* variator, - SDLVisualTest_SUTConfig* config, - SDLVisualTest_VariatorType type, - Uint64 seed) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return 0; - } - if(!config) - { - SDLTest_LogError("config argument cannot be NULL"); - return 0; - } - - variator->type = type; - switch(type) - { - case SDL_VARIATOR_EXHAUSTIVE: - return SDLVisualTest_InitExhaustiveVariator(&variator->data.exhaustive, - config); - break; - - case SDL_VARIATOR_RANDOM: - return SDLVisualTest_InitRandomVariator(&variator->data.random, - config, seed); - break; - - default: - SDLTest_LogError("Invalid value for variator type"); - return 0; - } - return 0; -} - -char* -SDLVisualTest_GetNextVariation(SDLVisualTest_Variator* variator) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return NULL; - } - - switch(variator->type) - { - case SDL_VARIATOR_EXHAUSTIVE: - return SDLVisualTest_GetNextExhaustiveVariation(&variator->data.exhaustive); - break; - - case SDL_VARIATOR_RANDOM: - return SDLVisualTest_GetNextRandomVariation(&variator->data.random); - break; - - default: - SDLTest_LogError("Invalid value for variator type"); - return NULL; - } - return NULL; -} - -void SDLVisualTest_FreeVariator(SDLVisualTest_Variator* variator) -{ - if(!variator) - { - SDLTest_LogError("variator argument cannot be NULL"); - return; - } - - switch(variator->type) - { - case SDL_VARIATOR_EXHAUSTIVE: - SDLVisualTest_FreeExhaustiveVariator(&variator->data.exhaustive); - break; - - case SDL_VARIATOR_RANDOM: - SDLVisualTest_FreeRandomVariator(&variator->data.random); - break; - - default: - SDLTest_LogError("Invalid value for variator type"); - } -} diff --git a/visualtest/src/windows/windows_process.c b/visualtest/src/windows/windows_process.c deleted file mode 100644 index e7e265c7c..000000000 --- a/visualtest/src/windows/windows_process.c +++ /dev/null @@ -1,283 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file windows_process.c - * - * Source file for the process API on windows. - */ - -#include -#include -#include -#include - -#include "SDL_visualtest_process.h" - -#if defined(__WIN32__) - -void -LogLastError(const char* str) -{ - LPVOID buffer; - DWORD dw = GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM| - FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, - 0, NULL); - SDLTest_LogError("%s: %s", str, (char*)buffer); - LocalFree(buffer); -} - -int -SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo) -{ - BOOL success; - char* working_directory; - char* command_line; - int path_length, args_length; - STARTUPINFO sui = {0}; - sui.cb = sizeof(sui); - - if(!file) - { - SDLTest_LogError("Path to executable to launched cannot be NULL."); - return 0; - } - if(!pinfo) - { - SDLTest_LogError("pinfo cannot be NULL."); - return 0; - } - - /* get the working directory of the process being launched, so that - the process can load any resources it has in it's working directory */ - path_length = SDL_strlen(file); - if(path_length == 0) - { - SDLTest_LogError("Length of the file parameter is zero."); - return 0; - } - - working_directory = (char*)SDL_malloc(path_length + 1); - if(!working_directory) - { - SDLTest_LogError("Could not allocate working_directory - SDL_malloc() failed."); - return 0; - } - - SDL_memcpy(working_directory, file, path_length + 1); - PathRemoveFileSpec(working_directory); - if(SDL_strlen(working_directory) == 0) - { - SDL_free(working_directory); - working_directory = NULL; - } - - /* join the file path and the args string together */ - if(!args) - args = ""; - args_length = SDL_strlen(args); - command_line = (char*)SDL_malloc(path_length + args_length + 2); - if(!command_line) - { - SDLTest_LogError("Could not allocate command_line - SDL_malloc() failed."); - return 0; - } - SDL_memcpy(command_line, file, path_length); - command_line[path_length] = ' '; - SDL_memcpy(command_line + path_length + 1, args, args_length + 1); - - /* create the process */ - success = CreateProcess(NULL, command_line, NULL, NULL, FALSE, - NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, - NULL, working_directory, &sui, &pinfo->pi); - if(working_directory) - { - SDL_free(working_directory); - working_directory = NULL; - } - SDL_free(command_line); - if(!success) - { - LogLastError("CreateProcess() failed"); - return 0; - } - - return 1; -} - -int -SDL_GetProcessExitStatus(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - DWORD exit_status; - BOOL success; - - if(!pinfo) - { - SDLTest_LogError("pinfo cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps cannot be NULL"); - return 0; - } - - /* get the exit code */ - success = GetExitCodeProcess(pinfo->pi.hProcess, &exit_status); - if(!success) - { - LogLastError("GetExitCodeProcess() failed"); - return 0; - } - - if(exit_status == STILL_ACTIVE) - ps->exit_status = -1; - else - ps->exit_status = exit_status; - ps->exit_success = 1; - return 1; -} - - -int -SDL_IsProcessRunning(SDL_ProcessInfo* pinfo) -{ - DWORD exit_status; - BOOL success; - - if(!pinfo) - { - SDLTest_LogError("pinfo cannot be NULL"); - return -1; - } - - success = GetExitCodeProcess(pinfo->pi.hProcess, &exit_status); - if(!success) - { - LogLastError("GetExitCodeProcess() failed"); - return -1; - } - - if(exit_status == STILL_ACTIVE) - return 1; - return 0; -} - -static BOOL CALLBACK -CloseWindowCallback(HWND hwnd, LPARAM lparam) -{ - DWORD pid; - SDL_ProcessInfo* pinfo; - - pinfo = (SDL_ProcessInfo*)lparam; - - GetWindowThreadProcessId(hwnd, &pid); - if(pid == pinfo->pi.dwProcessId) - { - DWORD_PTR result; - if(!SendMessageTimeout(hwnd, WM_CLOSE, 0, 0, SMTO_BLOCK, - 1000, &result)) - { - if(GetLastError() != ERROR_TIMEOUT) - { - LogLastError("SendMessageTimeout() failed"); - return FALSE; - } - } - } - return TRUE; -} - -int -SDL_QuitProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - DWORD wait_result; - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps argument cannot be NULL"); - return 0; - } - - /* enumerate through all the windows, trying to close each one */ - if(!EnumWindows(CloseWindowCallback, (LPARAM)pinfo)) - { - SDLTest_LogError("EnumWindows() failed"); - return 0; - } - - /* wait until the process terminates */ - wait_result = WaitForSingleObject(pinfo->pi.hProcess, 1000); - if(wait_result == WAIT_FAILED) - { - LogLastError("WaitForSingleObject() failed"); - return 0; - } - if(wait_result != WAIT_OBJECT_0) - { - SDLTest_LogError("Process did not quit."); - return 0; - } - - /* get the exit code */ - if(!SDL_GetProcessExitStatus(pinfo, ps)) - { - SDLTest_LogError("SDL_GetProcessExitStatus() failed"); - return 0; - } - - return 1; -} - -int -SDL_KillProcess(SDL_ProcessInfo* pinfo, SDL_ProcessExitStatus* ps) -{ - BOOL success; - DWORD exit_status, wait_result; - - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!ps) - { - SDLTest_LogError("ps argument cannot be NULL"); - return 0; - } - - /* initiate termination of the process */ - success = TerminateProcess(pinfo->pi.hProcess, 0); - if(!success) - { - LogLastError("TerminateProcess() failed"); - return 0; - } - - /* wait until the process terminates */ - wait_result = WaitForSingleObject(pinfo->pi.hProcess, INFINITE); - if(wait_result == WAIT_FAILED) - { - LogLastError("WaitForSingleObject() failed"); - return 0; - } - - /* get the exit code */ - success = GetExitCodeProcess(pinfo->pi.hProcess, &exit_status); - if(!success) - { - LogLastError("GetExitCodeProcess() failed"); - return 0; - } - - ps->exit_status = exit_status; - ps->exit_success = 1; - - return 1; -} - -#endif diff --git a/visualtest/src/windows/windows_screenshot.c b/visualtest/src/windows/windows_screenshot.c deleted file mode 100644 index d4ac7d3a1..000000000 --- a/visualtest/src/windows/windows_screenshot.c +++ /dev/null @@ -1,349 +0,0 @@ -/* See LICENSE.txt for the full license governing this code. */ -/** - * \file windows_screenshot.c - * - * Source file for the screenshot API on windows. - */ - -#include "SDL_visualtest_process.h" -#include -#include - -#if defined(__CYGWIN__) -#include -#endif - -#if defined(__WIN32__) -#include - -void LogLastError(const char* str); - -static int img_num; -static SDL_ProcessInfo screenshot_pinfo; - -/* Saves a bitmap to a file using hdc as a device context */ -static int -SaveBitmapToFile(HDC hdc, HBITMAP hbitmap, char* filename) -{ - BITMAP bitmap; - BITMAPFILEHEADER bfh; - BITMAPINFOHEADER bih; - DWORD bmpsize, bytes_written; - HANDLE hdib, hfile; - char* bmpdata; - int return_code = 1; - - if(!hdc) - { - SDLTest_LogError("hdc argument is NULL"); - return 0; - } - if(!hbitmap) - { - SDLTest_LogError("hbitmap argument is NULL"); - return 0; - } - if(!filename) - { - SDLTest_LogError("filename argument is NULL"); - return 0; - } - - if(!GetObject(hbitmap, sizeof(BITMAP), (void*)&bitmap)) - { - SDLTest_LogError("GetObject() failed"); - return_code = 0; - goto savebitmaptofile_cleanup_generic; - } - - bih.biSize = sizeof(BITMAPINFOHEADER); - bih.biWidth = bitmap.bmWidth; - bih.biHeight = bitmap.bmHeight; - bih.biPlanes = 1; - bih.biBitCount = 32; - bih.biCompression = BI_RGB; - bih.biSizeImage = 0; - bih.biXPelsPerMeter = 0; - bih.biYPelsPerMeter = 0; - bih.biClrUsed = 0; - bih.biClrImportant = 0; - - bmpsize = ((bitmap.bmWidth * bih.biBitCount + 31) / 32) * 4 * bitmap.bmHeight; - - hdib = GlobalAlloc(GHND, bmpsize); - if(!hdib) - { - LogLastError("GlobalAlloc() failed"); - return_code = 0; - goto savebitmaptofile_cleanup_generic; - } - bmpdata = (char*)GlobalLock(hdib); - if(!bmpdata) - { - LogLastError("GlobalLock() failed"); - return_code = 0; - goto savebitmaptofile_cleanup_hdib; - } - - if(!GetDIBits(hdc, hbitmap, 0, (UINT)bitmap.bmHeight, bmpdata, - (LPBITMAPINFO)&bih, DIB_RGB_COLORS)) - { - SDLTest_LogError("GetDIBits() failed"); - return_code = 0; - goto savebitmaptofile_cleanup_unlockhdib; - } - - hfile = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - if(hfile == INVALID_HANDLE_VALUE) - { - LogLastError("CreateFile()"); - return_code = 0; - goto savebitmaptofile_cleanup_unlockhdib; - } - bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); - bfh.bfSize = bmpsize + bfh.bfOffBits; - bfh.bfType = 0x4D42; - - bytes_written = 0; - if(!WriteFile(hfile, (void*)&bfh, sizeof(BITMAPFILEHEADER), &bytes_written, NULL) || - !WriteFile(hfile, (void*)&bih, sizeof(BITMAPINFOHEADER), &bytes_written, NULL) || - !WriteFile(hfile, (void*)bmpdata, bmpsize, &bytes_written, NULL)) - { - LogLastError("WriteFile() failed"); - return_code = 0; - goto savebitmaptofile_cleanup_hfile; - } - -savebitmaptofile_cleanup_hfile: - CloseHandle(hfile); - -/* make the screenshot file writable on cygwin, since it could be overwritten later */ -#if defined(__CYGWIN__) - if(chmod(filename, 0777) == -1) - { - SDLTest_LogError("chmod() failed"); - return_code = 0; - } -#endif - -savebitmaptofile_cleanup_unlockhdib: - GlobalUnlock(hdib); - -savebitmaptofile_cleanup_hdib: - GlobalFree(hdib); - -savebitmaptofile_cleanup_generic: - return return_code; -} - -/* Takes the screenshot of a window and saves it to a file. If only_client_area - is true, then only the client area of the window is considered */ -static int -ScreenshotWindow(HWND hwnd, char* filename, SDL_bool only_client_area) -{ - int width, height; - RECT dimensions; - HDC windowdc, capturedc; - HBITMAP capturebitmap; - HGDIOBJ select_success; - BOOL blt_success; - int return_code = 1; - - if(!filename) - { - SDLTest_LogError("filename argument cannot be NULL"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - if(!hwnd) - { - SDLTest_LogError("hwnd argument cannot be NULL"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - - if(!GetWindowRect(hwnd, &dimensions)) - { - LogLastError("GetWindowRect() failed"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - - if(only_client_area) - { - RECT crect; - if(!GetClientRect(hwnd, &crect)) - { - SDLTest_LogError("GetClientRect() failed"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - - width = crect.right; - height = crect.bottom; - windowdc = GetDC(hwnd); - if(!windowdc) - { - SDLTest_LogError("GetDC() failed"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - } - else - { - width = dimensions.right - dimensions.left; - height = dimensions.bottom - dimensions.top; - windowdc = GetWindowDC(hwnd); - if(!windowdc) - { - SDLTest_LogError("GetWindowDC() failed"); - return_code = 0; - goto screenshotwindow_cleanup_generic; - } - } - - capturedc = CreateCompatibleDC(windowdc); - if(!capturedc) - { - SDLTest_LogError("CreateCompatibleDC() failed"); - return_code = 0; - goto screenshotwindow_cleanup_windowdc; - } - capturebitmap = CreateCompatibleBitmap(windowdc, width, height); - if(!capturebitmap) - { - SDLTest_LogError("CreateCompatibleBitmap() failed"); - return_code = 0; - goto screenshotwindow_cleanup_capturedc; - } - select_success = SelectObject(capturedc, capturebitmap); - if(!select_success || select_success == HGDI_ERROR) - { - SDLTest_LogError("SelectObject() failed"); - return_code = 0; - goto screenshotwindow_cleanup_capturebitmap; - } - blt_success = BitBlt(capturedc, 0, 0, width, height, windowdc, - 0, 0, SRCCOPY|CAPTUREBLT); - if(!blt_success) - { - LogLastError("BitBlt() failed"); - return_code = 0; - goto screenshotwindow_cleanup_capturebitmap; - } - - /* save bitmap as file */ - if(!SaveBitmapToFile(windowdc, capturebitmap, filename)) - { - SDLTest_LogError("SaveBitmapToFile() failed"); - return_code = 0; - goto screenshotwindow_cleanup_capturebitmap; - } - - /* Free resources */ - -screenshotwindow_cleanup_capturebitmap: - if(!DeleteObject(capturebitmap)) - { - SDLTest_LogError("DeleteObjectFailed"); - return_code = 0; - } - -screenshotwindow_cleanup_capturedc: - if(!DeleteDC(capturedc)) - { - SDLTest_LogError("DeleteDC() failed"); - return_code = 0; - } - -screenshotwindow_cleanup_windowdc: - if(!ReleaseDC(hwnd, windowdc)) - { - SDLTest_LogError("ReleaseDC() failed"); - return_code = 0; - } - -screenshotwindow_cleanup_generic: - return return_code; -} - -/* Takes the screenshot of the entire desktop and saves it to a file */ -int SDLVisualTest_ScreenshotDesktop(char* filename) -{ - HWND hwnd; - hwnd = GetDesktopWindow(); - return ScreenshotWindow(hwnd, filename, SDL_FALSE); -} - -/* take screenshot of a window and save it to a file */ -static BOOL CALLBACK -ScreenshotHwnd(HWND hwnd, LPARAM lparam) -{ - int len; - DWORD pid; - char* prefix; - char* filename; - - GetWindowThreadProcessId(hwnd, &pid); - if(pid != screenshot_pinfo.pi.dwProcessId) - return TRUE; - - if(!IsWindowVisible(hwnd)) - return TRUE; - - prefix = (char*)lparam; - len = SDL_strlen(prefix) + 100; - filename = (char*)SDL_malloc(len * sizeof(char)); - if(!filename) - { - SDLTest_LogError("SDL_malloc() failed"); - return FALSE; - } - - /* restore the window and bring it to the top */ - ShowWindowAsync(hwnd, SW_RESTORE); - /* restore is not instantaneous */ - SDL_Delay(500); - - /* take a screenshot of the client area */ - if(img_num == 1) - SDL_snprintf(filename, len, "%s.bmp", prefix); - else - SDL_snprintf(filename, len, "%s_%d.bmp", prefix, img_num); - img_num++; - ScreenshotWindow(hwnd, filename, SDL_TRUE); - - SDL_free(filename); - return TRUE; -} - - -/* each window of the process will have a screenshot taken. The file name will be - prefix-i.png for the i'th window. */ -int -SDLVisualTest_ScreenshotProcess(SDL_ProcessInfo* pinfo, char* prefix) -{ - if(!pinfo) - { - SDLTest_LogError("pinfo argument cannot be NULL"); - return 0; - } - if(!prefix) - { - SDLTest_LogError("prefix argument cannot be NULL"); - return 0; - } - - img_num = 1; - screenshot_pinfo = *pinfo; - if(!EnumWindows(ScreenshotHwnd, (LPARAM)prefix)) - { - SDLTest_LogError("EnumWindows() failed"); - return 0; - } - - return 1; -} - -#endif diff --git a/visualtest/testsprite2_sample.actions b/visualtest/testsprite2_sample.actions deleted file mode 100644 index c0e9ab8b9..000000000 --- a/visualtest/testsprite2_sample.actions +++ /dev/null @@ -1,3 +0,0 @@ -00:00:02 SCREENSHOT # Take a screenshot of each window owned by the SUT process -00:00:05 VERIFY # Verify each screenshot taken with verification images -00:00:10 QUIT # Gracefully quit the SUT process \ No newline at end of file diff --git a/visualtest/testsprite2_sample.config b/visualtest/testsprite2_sample.config deleted file mode 100644 index 14eb4622c..000000000 --- a/visualtest/testsprite2_sample.config +++ /dev/null @@ -1,6 +0,0 @@ -parameter-config=testsprite2_sample.parameters -num-variations=10 -variator=random -sutapp=testsprite2 -timeout=00:00:20 -action-config=testsprite2_sample.actions \ No newline at end of file diff --git a/visualtest/testsprite2_sample.parameters b/visualtest/testsprite2_sample.parameters deleted file mode 100644 index 29e34cd28..000000000 --- a/visualtest/testsprite2_sample.parameters +++ /dev/null @@ -1,29 +0,0 @@ -# parameter name, type, value range, required, categories ---gldebug, boolean, [], false, [] ---info, enum, [all video modes render event], false, [] ---log, enum, [all error system audio video render input], false, [] ---display, integer, [1 5], false, [] ---fullscreen, boolean, [], false, [] ---fullscreen-desktop, boolean, [], false, [] -# --windows, integer, [1 5], false, [] # this option is not supported yet ---title, enum, [vartest bartest footest], false, [] ---icon, enum, [icon.bmp], false, [] ---center, boolean, [], false, [] ---position, enum, [300,300], false, [] ---geometry, enum, [500x500], false, [] ---min-geometry, enum, [100x100], false, [] ---max-geometry, enum, [600x600 700x700], false, [] ---logical, enum, [500x500 550x450], false, [] ---scale, integer, [1 5], false, [] ---depth, integer, [1 5], false, [] ---refresh, integer, [1 5], false, [] ---vsync, boolean, [], false, [] ---noframe, boolean, [], false, [] ---resize, boolean, [], false, [] ---minimize, boolean, [], false, [] ---maximize, boolean, [], false, [] ---grab, boolean, [], false, [mouse] ---blend, enum, [none blend add mod], false, [] ---cyclecolor, boolean, [], false, [] ---cyclealpha, boolean, [], false, [] ---iterations, integer, [10 100], false, [] \ No newline at end of file diff --git a/visualtest/unittest/testquit.actions b/visualtest/unittest/testquit.actions deleted file mode 100644 index fa6880520..000000000 --- a/visualtest/unittest/testquit.actions +++ /dev/null @@ -1 +0,0 @@ -00:00:05 QUIT \ No newline at end of file diff --git a/visualtest/unittest/testquit.c b/visualtest/unittest/testquit.c deleted file mode 100644 index 04e3c5c5a..000000000 --- a/visualtest/unittest/testquit.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2013 Apoorv Upreti - - 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. -*/ -/* Quits, hangs or crashes based on the command line options passed. */ - -#include -#include - -static SDLTest_CommonState *state; -static int exit_code; -static SDL_bool hang; -static SDL_bool crash; - -int -main(int argc, char** argv) -{ - int i, done; - SDL_Event event; - - state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if(!state) - return 1; - - state->window_flags |= SDL_WINDOW_RESIZABLE; - - exit_code = 0; - hang = SDL_FALSE; - crash = SDL_FALSE; - - for(i = 1; i < argc; ) - { - int consumed; - consumed = SDLTest_CommonArg(state, i); - if(consumed == 0) - { - consumed = -1; - if(SDL_strcasecmp(argv[i], "--exit-code") == 0) - { - if(argv[i + 1]) - { - exit_code = SDL_atoi(argv[i + 1]); - consumed = 2; - } - } - else if(SDL_strcasecmp(argv[i], "--hang") == 0) - { - hang = SDL_TRUE; - consumed = 1; - } - else if(SDL_strcasecmp(argv[i], "--crash") == 0) - { - crash = SDL_TRUE; - consumed = 1; - } - } - - if(consumed < 0) - { - static const char *options[] = { "[--exit-code N]", "[--crash]", "[--hang]", NULL }; - SDLTest_CommonLogUsage(state, argv[0], options); - SDLTest_CommonQuit(state); - return 1; - } - i += consumed; - } - - if(!SDLTest_CommonInit(state)) - { - SDLTest_CommonQuit(state); - return 1; - } - - /* infinite loop to hang the process */ - while(hang) - SDL_Delay(10); - - /* dereference NULL pointer to crash process */ - if(crash) - { - int* p = NULL; - *p = 5; - } - - /* event loop */ - done = 0; - while(!done) - { - while(SDL_PollEvent(&event)) - SDLTest_CommonEvent(state, &event, &done); - SDL_Delay(10); - } - - return exit_code; -} diff --git a/visualtest/unittest/testquit.config b/visualtest/unittest/testquit.config deleted file mode 100644 index 756dec8ac..000000000 --- a/visualtest/unittest/testquit.config +++ /dev/null @@ -1,5 +0,0 @@ -sutconfig=testquit.parameters -action-config=testquit.actions -variator=exhaustive -sutapp=testquit -timeout=00:00:10 \ No newline at end of file diff --git a/visualtest/unittest/testquit.parameters b/visualtest/unittest/testquit.parameters deleted file mode 100644 index 6e5887ce5..000000000 --- a/visualtest/unittest/testquit.parameters +++ /dev/null @@ -1,3 +0,0 @@ ---exit-code, integer, [-1 1], false, [] # The exit code returned by the executable ---crash, boolean, [], false, [] # Crashes the SUT executable ---hang, boolean, [], false, [] # Runs the SUT in the infinite loop and ignores all events \ No newline at end of file From 63243eb3a535bc8e943e4568faa63dd947f7aef4 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 22 Nov 2022 18:50:00 +0300 Subject: [PATCH 412/459] removed pandora support --- Makefile.pandora | 64 -- docs/README-pandora.md | 17 - docs/README.md | 1 - include/SDL_config_pandora.h | 141 ---- src/render/opengles/SDL_render_gles.c | 14 - src/render/opengles2/SDL_render_gles2.c | 2 - src/video/SDL_video.c | 3 - src/video/pandora/SDL_pandora.c | 833 ------------------------ src/video/pandora/SDL_pandora.h | 100 --- src/video/pandora/SDL_pandora_events.c | 38 -- src/video/pandora/SDL_pandora_events.h | 25 - test/testgl2.c | 2 - test/testgles2.c | 2 - test/testgles2_sdf.c | 2 - 14 files changed, 1244 deletions(-) delete mode 100644 Makefile.pandora delete mode 100644 docs/README-pandora.md delete mode 100644 include/SDL_config_pandora.h delete mode 100644 src/video/pandora/SDL_pandora.c delete mode 100644 src/video/pandora/SDL_pandora.h delete mode 100644 src/video/pandora/SDL_pandora_events.c delete mode 100644 src/video/pandora/SDL_pandora_events.h diff --git a/Makefile.pandora b/Makefile.pandora deleted file mode 100644 index 4e6465eb5..000000000 --- a/Makefile.pandora +++ /dev/null @@ -1,64 +0,0 @@ -# Makefile to build the pandora SDL library - -AR = arm-none-linux-gnueabi-ar -RANLIB = arm-none-linux-gnueabi-ranlib -CC = arm-none-linux-gnueabi-gcc -CXX = arm-none-linux-gnueabi-g++ -STRIP = arm-none-linux-gnueabi-strip - -CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ - -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ - -I./include -I$(PNDSDK)/usr/include - -TARGET = libSDL3.a - -SOURCES = - ./src/*.c \ - ./src/atomic/*.c \ - ./src/audio/*.c \ - ./src/audio/disk/*.c \ - ./src/audio/dsp/*.c \ - ./src/audio/dummy/*.c \ - ./src/cpuinfo/*.c \ - ./src/events/*.c \ - ./src/file/*.c \ - ./src/filesystem/unix/*.c \ - ./src/haptic/*.c \ - ./src/haptic/linux/*.c \ - ./src/hidapi/*.c \ - ./src/joystick/*.c \ - ./src/joystick/linux/*.c \ - ./src/loadso/dlopen/*.c \ - ./src/locale/*.c \ - ./src/locale/unix/*.c \ - ./src/misc/*.c \ - ./src/misc/unix/*.c \ - ./src/power/*.c \ - ./src/sensor/*.c \ - ./src/sensor/dummy/*.c \ - ./src/stdlib/*.c \ - ./src/thread/*.c \ - ./src/thread/pthread/SDL_syscond.c \ - ./src/thread/pthread/SDL_sysmutex.c \ - ./src/thread/pthread/SDL_syssem.c \ - ./src/thread/pthread/SDL_systhread.c \ - ./src/timer/*.c \ - ./src/timer/unix/*.c \ - ./src/video/*.c \ - ./src/video/yuv2rgb/*.c \ - ./src/video/dummy/*.c \ - ./src/video/x11/*.c \ - ./src/video/pandora/*.c - -OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') - -CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h) - -all: $(TARGET) - -$(TARGET): $(CONFIG_H) $(OBJECTS) - $(AR) crv $@ $^ - $(RANLIB) $@ - -clean: - rm -f $(TARGET) $(OBJECTS) diff --git a/docs/README-pandora.md b/docs/README-pandora.md deleted file mode 100644 index a0277634b..000000000 --- a/docs/README-pandora.md +++ /dev/null @@ -1,17 +0,0 @@ -Pandora -===================================================================== - -( http://openpandora.org/ ) -- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES -support to work on the pandora under the framebuffer. This driver do not have -input support for now, so if you use it you will have to add your own control code. -The video driver name is "pandora" so if you have problem running it from -the framebuffer, try to set the following variable before starting your application : -"export SDL_VIDEODRIVER=pandora" - -- OpenGL ES support was added to the x11 driver, so it's working like the normal -x11 driver one with OpenGLX support, with SDL input event's etc.. - - -David Carré (Cpasjuste) -cpasjuste@gmail.com diff --git a/docs/README.md b/docs/README.md index 6813f75fb..7666060c9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -36,7 +36,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [macOS](README-macos.md) - [OS/2](README-os2.md) - [Native Client](README-nacl.md) -- [Pandora](README-pandora.md) - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) - [PSP](README-psp.md) diff --git a/include/SDL_config_pandora.h b/include/SDL_config_pandora.h deleted file mode 100644 index 01bbf49b0..000000000 --- a/include/SDL_config_pandora.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_config_pandora_h_ -#define SDL_config_pandora_h_ -#define SDL_config_h_ - -/* This is a set of defines to configure the SDL features */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#define SDL_BYTEORDER 1234 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MATH_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 - -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_STRLEN 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_OSS 1 - -#define SDL_INPUT_LINUXEV 1 -#define SDL_JOYSTICK_LINUX 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_LINUX 1 - -#define SDL_SENSOR_DUMMY 1 - -#define SDL_LOADSO_DLOPEN 1 - -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 - -#define SDL_TIMER_UNIX 1 -#define SDL_FILESYSTEM_UNIX 1 - -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_X11 1 -#define SDL_VIDEO_DRIVER_PANDORA 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_OPENGL_ES 1 - -#endif /* SDL_config_pandora_h_ */ diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index ba08a46e2..8e918c665 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -35,18 +35,6 @@ #define RENDERER_CONTEXT_MAJOR 1 #define RENDERER_CONTEXT_MINOR 1 -#if defined(SDL_VIDEO_DRIVER_PANDORA) - -/* Empty function stub to get OpenGL ES 1.x support without */ -/* OpenGL ES extension GL_OES_draw_texture supported */ -GL_API void GL_APIENTRY -glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) -{ - return; -} - -#endif /* SDL_VIDEO_DRIVER_PANDORA */ - /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */ /* Used to re-create the window with OpenGL ES capability */ @@ -154,8 +142,6 @@ static int GLES_LoadFunctions(GLES_RenderData * data) #define __SDL_NOGETPROCADDR__ #elif SDL_VIDEO_DRIVER_ANDROID #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA -#define __SDL_NOGETPROCADDR__ #endif #ifdef __SDL_NOGETPROCADDR__ diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 41bf300f4..da48e4d6e 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -249,8 +249,6 @@ static int GLES2_LoadFunctions(GLES2_RenderData * data) #define __SDL_NOGETPROCADDR__ #elif SDL_VIDEO_DRIVER_ANDROID #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA -#define __SDL_NOGETPROCADDR__ #endif #if defined __SDL_NOGETPROCADDR__ diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0804c9cfb..064276cb1 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -89,9 +89,6 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_HAIKU &HAIKU_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PANDORA - &PND_bootstrap, -#endif #if SDL_VIDEO_DRIVER_UIKIT &UIKIT_bootstrap, #endif diff --git a/src/video/pandora/SDL_pandora.c b/src/video/pandora/SDL_pandora.c deleted file mode 100644 index 834083838..000000000 --- a/src/video/pandora/SDL_pandora.c +++ /dev/null @@ -1,833 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_PANDORA - -/* SDL internals */ -#include "../SDL_sysvideo.h" -#include "SDL_version.h" -#include "SDL_syswm.h" -#include "SDL_loadso.h" -#include "SDL_events.h" -#include "../../events/SDL_mouse_c.h" -#include "../../events/SDL_keyboard_c.h" - -/* PND declarations */ -#include "SDL_pandora.h" -#include "SDL_pandora_events.h" - -/* WIZ declarations */ -#include "GLES/gl.h" -#ifdef WIZ_GLES_LITE -static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */ -#endif - -static int -PND_available(void) -{ - return 1; -} - -static void -PND_destroy(SDL_VideoDevice * device) -{ - if (device->driverdata != NULL) { - SDL_free(device->driverdata); - device->driverdata = NULL; - } - SDL_free(device); -} - -static SDL_VideoDevice * -PND_create() -{ - SDL_VideoDevice *device; - SDL_VideoData *phdata; - int status; - - /* Check if pandora could be initialized */ - status = PND_available(); - if (status == 0) { - /* PND could not be used */ - return NULL; - } - - /* Initialize SDL_VideoDevice structure */ - device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - /* Initialize internal Pandora specific data */ - phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { - SDL_OutOfMemory(); - SDL_free(device); - return NULL; - } - - device->driverdata = phdata; - - phdata->egl_initialized = SDL_TRUE; - - - /* Setup amount of available displays */ - device->num_displays = 0; - - /* Set device free function */ - device->free = PND_destroy; - - /* Setup all functions which we can handle */ - device->VideoInit = PND_videoinit; - device->VideoQuit = PND_videoquit; - device->GetDisplayModes = PND_getdisplaymodes; - device->SetDisplayMode = PND_setdisplaymode; - device->CreateSDLWindow = PND_createwindow; - device->CreateSDLWindowFrom = PND_createwindowfrom; - device->SetWindowTitle = PND_setwindowtitle; - device->SetWindowIcon = PND_setwindowicon; - device->SetWindowPosition = PND_setwindowposition; - device->SetWindowSize = PND_setwindowsize; - device->ShowWindow = PND_showwindow; - device->HideWindow = PND_hidewindow; - device->RaiseWindow = PND_raisewindow; - device->MaximizeWindow = PND_maximizewindow; - device->MinimizeWindow = PND_minimizewindow; - device->RestoreWindow = PND_restorewindow; - device->DestroyWindow = PND_destroywindow; -#if 0 - device->GetWindowWMInfo = PND_getwindowwminfo; -#endif - device->GL_LoadLibrary = PND_gl_loadlibrary; - device->GL_GetProcAddress = PND_gl_getprocaddres; - device->GL_UnloadLibrary = PND_gl_unloadlibrary; - device->GL_CreateContext = PND_gl_createcontext; - device->GL_MakeCurrent = PND_gl_makecurrent; - device->GL_SetSwapInterval = PND_gl_setswapinterval; - device->GL_GetSwapInterval = PND_gl_getswapinterval; - device->GL_SwapWindow = PND_gl_swapwindow; - device->GL_DeleteContext = PND_gl_deletecontext; - device->PumpEvents = PND_PumpEvents; - - /* !!! FIXME: implement SetWindowBordered */ - - return device; -} - -VideoBootStrap PND_bootstrap = { -#ifdef WIZ_GLES_LITE - "wiz", - "SDL Wiz Video Driver", -#else - "pandora", - "SDL Pandora Video Driver", -#endif - PND_available, - PND_create -}; - -/*****************************************************************************/ -/* SDL Video and Display initialization/handling functions */ -/*****************************************************************************/ -int -PND_videoinit(_THIS) -{ - SDL_VideoDisplay display; - SDL_DisplayMode current_mode; - - SDL_zero(current_mode); -#ifdef WIZ_GLES_LITE - current_mode.w = 320; - current_mode.h = 240; -#else - current_mode.w = 800; - current_mode.h = 480; -#endif - current_mode.refresh_rate = 60; - current_mode.format = SDL_PIXELFORMAT_RGB565; - current_mode.driverdata = NULL; - - SDL_zero(display); - display.desktop_mode = current_mode; - display.current_mode = current_mode; - display.driverdata = NULL; - - SDL_AddVideoDisplay(&display, SDL_FALSE); - - return 1; -} - -void -PND_videoquit(_THIS) -{ - -} - -void -PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display) -{ - -} - -int -PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) -{ - return 0; -} - -int -PND_createwindow(_THIS, SDL_Window * window) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - - SDL_WindowData *wdata; - - /* Allocate window internal data */ - wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { - return SDL_OutOfMemory(); - } - - /* Setup driver data for this window */ - window->driverdata = wdata; - - /* Check if window must support OpenGL ES rendering */ - if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) { - - EGLBoolean initstatus; - - /* Mark this window as OpenGL ES compatible */ - wdata->uses_gles = SDL_TRUE; - - /* Create connection to OpenGL ES */ - if (phdata->egl_display == EGL_NO_DISPLAY) { - phdata->egl_display = eglGetDisplay((NativeDisplayType) 0); - if (phdata->egl_display == EGL_NO_DISPLAY) { - return SDL_SetError("PND: Can't get connection to OpenGL ES"); - } - - initstatus = eglInitialize(phdata->egl_display, NULL, NULL); - if (initstatus != EGL_TRUE) { - return SDL_SetError("PND: Can't init OpenGL ES library"); - } - } - - phdata->egl_refcount++; - } - - /* Window has been successfully created */ - return 0; -} - -int -PND_createwindowfrom(_THIS, SDL_Window * window, const void *data) -{ - return -1; -} - -void -PND_setwindowtitle(_THIS, SDL_Window * window) -{ -} -void -PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon) -{ -} -void -PND_setwindowposition(_THIS, SDL_Window * window) -{ -} -void -PND_setwindowsize(_THIS, SDL_Window * window) -{ -} -void -PND_showwindow(_THIS, SDL_Window * window) -{ -} -void -PND_hidewindow(_THIS, SDL_Window * window) -{ -} -void -PND_raisewindow(_THIS, SDL_Window * window) -{ -} -void -PND_maximizewindow(_THIS, SDL_Window * window) -{ -} -void -PND_minimizewindow(_THIS, SDL_Window * window) -{ -} -void -PND_restorewindow(_THIS, SDL_Window * window) -{ -} -void -PND_destroywindow(_THIS, SDL_Window * window) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - eglTerminate(phdata->egl_display); -} - -/*****************************************************************************/ -/* SDL Window Manager function */ -/*****************************************************************************/ -#if 0 -SDL_bool -PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) -{ - if (info->version.major <= SDL_MAJOR_VERSION) { - return SDL_TRUE; - } else { - SDL_SetError("application not compiled with SDL %d", - SDL_MAJOR_VERSION); - return SDL_FALSE; - } - - /* Failed to get window manager information */ - return SDL_FALSE; -} -#endif - -/*****************************************************************************/ -/* SDL OpenGL/OpenGL ES functions */ -/*****************************************************************************/ -int -PND_gl_loadlibrary(_THIS, const char *path) -{ - /* Check if OpenGL ES library is specified for GF driver */ - if (path == NULL) { - path = SDL_getenv("SDL_OPENGL_LIBRARY"); - if (path == NULL) { - path = SDL_getenv("SDL_OPENGLES_LIBRARY"); - } - } - - /* Check if default library loading requested */ - if (path == NULL) { - /* Already linked with GF library which provides egl* subset of */ - /* functions, use Common profile of OpenGL ES library by default */ -#ifdef WIZ_GLES_LITE - path = "/lib/libopengles_lite.so"; -#else - path = "/usr/lib/libGLES_CM.so"; -#endif - } - - /* Load dynamic library */ - _this->gl_config.dll_handle = SDL_LoadObject(path); - if (!_this->gl_config.dll_handle) { - /* Failed to load new GL ES library */ - return SDL_SetError("PND: Failed to locate OpenGL ES library"); - } - - /* Store OpenGL ES library path and name */ - SDL_strlcpy(_this->gl_config.driver_path, path, - SDL_arraysize(_this->gl_config.driver_path)); - - /* New OpenGL ES library is loaded */ - return 0; -} - -void * -PND_gl_getprocaddres(_THIS, const char *proc) -{ - void *function_address; - - /* Try to get function address through the egl interface */ - function_address = eglGetProcAddress(proc); - if (function_address != NULL) { - return function_address; - } - - /* Then try to get function in the OpenGL ES library */ - if (_this->gl_config.dll_handle) { - function_address = - SDL_LoadFunction(_this->gl_config.dll_handle, proc); - if (function_address != NULL) { - return function_address; - } - } - - /* Failed to get GL ES function address pointer */ - SDL_SetError("PND: Cannot locate OpenGL ES function name"); - return NULL; -} - -void -PND_gl_unloadlibrary(_THIS) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - - if (phdata->egl_initialized == SDL_TRUE) { - /* Unload OpenGL ES library */ - if (_this->gl_config.dll_handle) { - SDL_UnloadObject(_this->gl_config.dll_handle); - _this->gl_config.dll_handle = NULL; - } - } else { - SDL_SetError("PND: GF initialization failed, no OpenGL ES support"); - } -} - -SDL_GLContext -PND_gl_createcontext(_THIS, SDL_Window * window) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; - EGLBoolean status; - EGLint configs; - uint32_t attr_pos; - EGLint attr_value; - EGLint cit; - - /* Check if EGL was initialized */ - if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: EGL initialization failed, no OpenGL ES support"); - return NULL; - } - - /* Prepare attributes list to pass them to OpenGL ES */ - attr_pos = 0; - wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE; - wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT; - wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.red_size; - wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.green_size; - wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.blue_size; - wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; - - /* Setup alpha size in bits */ - if (_this->gl_config.alpha_size) { - wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size; - } else { - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - } - - /* Setup color buffer size */ - if (_this->gl_config.buffer_size) { - wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; - } else { - wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - } - - /* Setup depth buffer bits */ - wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size; - - /* Setup stencil bits */ - if (_this->gl_config.stencil_size) { - wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; - wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; - } else { - wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - } - - /* Set number of samples in multisampling */ - if (_this->gl_config.multisamplesamples) { - wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; - wdata->gles_attributes[attr_pos++] = - _this->gl_config.multisamplesamples; - } - - /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */ - if (_this->gl_config.multisamplebuffers) { - wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; - wdata->gles_attributes[attr_pos++] = - _this->gl_config.multisamplebuffers; - } - - /* Finish attributes list */ - wdata->gles_attributes[attr_pos] = EGL_NONE; - - /* Request first suitable framebuffer configuration */ - status = eglChooseConfig(phdata->egl_display, wdata->gles_attributes, - wdata->gles_configs, 1, &configs); - if (status != EGL_TRUE) { - SDL_SetError("PND: Can't find closest configuration for OpenGL ES"); - return NULL; - } - - /* Check if nothing has been found, try "don't care" settings */ - if (configs == 0) { - int32_t it; - int32_t jt; - GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE }; - - for (it = 0; it < 4; it++) { - for (jt = 16; jt >= 0; jt--) { - /* Don't care about color buffer bits, use what exist */ - /* Replace previous set data with EGL_DONT_CARE */ - attr_pos = 0; - wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE; - wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT; - wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - - /* Try to find requested or smallest depth */ - if (_this->gl_config.depth_size) { - wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; - wdata->gles_attributes[attr_pos++] = depthbits[it]; - } else { - wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - } - - if (_this->gl_config.stencil_size) { - wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; - wdata->gles_attributes[attr_pos++] = jt; - } else { - wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - } - - wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; - wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; - wdata->gles_attributes[attr_pos] = EGL_NONE; - - /* Request first suitable framebuffer configuration */ - status = - eglChooseConfig(phdata->egl_display, - wdata->gles_attributes, - wdata->gles_configs, 1, &configs); - - if (status != EGL_TRUE) { - SDL_SetError - ("PND: Can't find closest configuration for OpenGL ES"); - return NULL; - } - if (configs != 0) { - break; - } - } - if (configs != 0) { - break; - } - } - - /* No available configs */ - if (configs == 0) { - SDL_SetError("PND: Can't find any configuration for OpenGL ES"); - return NULL; - } - } - - /* Initialize config index */ - wdata->gles_config = 0; - - /* Now check each configuration to find out the best */ - for (cit = 0; cit < configs; cit++) { - uint32_t stencil_found; - uint32_t depth_found; - - stencil_found = 0; - depth_found = 0; - - if (_this->gl_config.stencil_size) { - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[cit], EGL_STENCIL_SIZE, - &attr_value); - if (status == EGL_TRUE) { - if (attr_value != 0) { - stencil_found = 1; - } - } - } else { - stencil_found = 1; - } - - if (_this->gl_config.depth_size) { - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[cit], EGL_DEPTH_SIZE, - &attr_value); - if (status == EGL_TRUE) { - if (attr_value != 0) { - depth_found = 1; - } - } - } else { - depth_found = 1; - } - - /* Exit from loop if found appropriate configuration */ - if ((depth_found != 0) && (stencil_found != 0)) { - break; - } - } - - /* If best could not be found, use first */ - if (cit == configs) { - cit = 0; - } - wdata->gles_config = cit; - - /* Create OpenGL ES context */ - wdata->gles_context = - eglCreateContext(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], NULL, NULL); - if (wdata->gles_context == EGL_NO_CONTEXT) { - SDL_SetError("PND: OpenGL ES context creation has been failed"); - return NULL; - } - -#ifdef WIZ_GLES_LITE - if( !hNativeWnd ) { - hNativeWnd = (NativeWindowType)SDL_malloc(16*1024); - - if(!hNativeWnd) - printf( "Error: Wiz framebuffer allocatation failed\n" ); - else - printf( "SDL: Wiz framebuffer allocated: %X\n", hNativeWnd ); - } - else { - printf( "SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd ); - } - - wdata->gles_surface = - eglCreateWindowSurface(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - hNativeWnd, NULL ); -#else - wdata->gles_surface = - eglCreateWindowSurface(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - (NativeWindowType) 0, NULL); -#endif - - - if (wdata->gles_surface == 0) { - SDL_SetError("Error : eglCreateWindowSurface failed;"); - return NULL; - } - - /* Make just created context current */ - status = - eglMakeCurrent(phdata->egl_display, wdata->gles_surface, - wdata->gles_surface, wdata->gles_context); - if (status != EGL_TRUE) { - /* Destroy OpenGL ES surface */ - eglDestroySurface(phdata->egl_display, wdata->gles_surface); - eglDestroyContext(phdata->egl_display, wdata->gles_context); - wdata->gles_context = EGL_NO_CONTEXT; - SDL_SetError("PND: Can't set OpenGL ES context on creation"); - return NULL; - } - - _this->gl_config.accelerated = 1; - - /* Always clear stereo enable, since OpenGL ES do not supports stereo */ - _this->gl_config.stereo = 0; - - /* Get back samples and samplebuffers configurations. Rest framebuffer */ - /* parameters could be obtained through the OpenGL ES API */ - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - EGL_SAMPLES, &attr_value); - if (status == EGL_TRUE) { - _this->gl_config.multisamplesamples = attr_value; - } - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - EGL_SAMPLE_BUFFERS, &attr_value); - if (status == EGL_TRUE) { - _this->gl_config.multisamplebuffers = attr_value; - } - - /* Get back stencil and depth buffer sizes */ - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - EGL_DEPTH_SIZE, &attr_value); - if (status == EGL_TRUE) { - _this->gl_config.depth_size = attr_value; - } - status = - eglGetConfigAttrib(phdata->egl_display, - wdata->gles_configs[wdata->gles_config], - EGL_STENCIL_SIZE, &attr_value); - if (status == EGL_TRUE) { - _this->gl_config.stencil_size = attr_value; - } - - /* Under PND OpenGL ES output can't be double buffered */ - _this->gl_config.double_buffer = 0; - - /* GL ES context was successfully created */ - return wdata->gles_context; -} - -int -PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - SDL_WindowData *wdata; - EGLBoolean status; - - if (phdata->egl_initialized != SDL_TRUE) { - return SDL_SetError("PND: GF initialization failed, no OpenGL ES support"); - } - - if ((window == NULL) && (context == NULL)) { - status = - eglMakeCurrent(phdata->egl_display, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (status != EGL_TRUE) { - /* Failed to set current GL ES context */ - return SDL_SetError("PND: Can't set OpenGL ES context"); - } - } else { - wdata = (SDL_WindowData *) window->driverdata; - if (wdata->gles_surface == EGL_NO_SURFACE) { - return SDL_SetError - ("PND: OpenGL ES surface is not initialized for this window"); - } - if (wdata->gles_context == EGL_NO_CONTEXT) { - return SDL_SetError - ("PND: OpenGL ES context is not initialized for this window"); - } - if (wdata->gles_context != context) { - return SDL_SetError - ("PND: OpenGL ES context is not belong to this window"); - } - status = - eglMakeCurrent(phdata->egl_display, wdata->gles_surface, - wdata->gles_surface, wdata->gles_context); - if (status != EGL_TRUE) { - /* Failed to set current GL ES context */ - return SDL_SetError("PND: Can't set OpenGL ES context"); - } - } - return 0; -} - -int -PND_gl_setswapinterval(_THIS, int interval) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - EGLBoolean status; - - if (phdata->egl_initialized != SDL_TRUE) { - return SDL_SetError("PND: EGL initialization failed, no OpenGL ES support"); - } - - /* Check if OpenGL ES connection has been initialized */ - if (phdata->egl_display != EGL_NO_DISPLAY) { - /* Set swap OpenGL ES interval */ - status = eglSwapInterval(phdata->egl_display, interval); - if (status == EGL_TRUE) { - /* Return success to upper level */ - phdata->swapinterval = interval; - return 0; - } - } - - /* Failed to set swap interval */ - return SDL_SetError("PND: Cannot set swap interval"); -} - -int -PND_gl_getswapinterval(_THIS) -{ - return ((SDL_VideoData *) _this->driverdata)->swapinterval; -} - -int -PND_gl_swapwindow(_THIS, SDL_Window * window) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; - - if (phdata->egl_initialized != SDL_TRUE) { - return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); - } - - /* Many applications do not uses glFinish(), so we call it for them */ - glFinish(); - - /* Wait until OpenGL ES rendering is completed */ - eglWaitGL(); - - eglSwapBuffers(phdata->egl_display, wdata->gles_surface); - return 0; -} - -void -PND_gl_deletecontext(_THIS, SDL_GLContext context) -{ - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - EGLBoolean status; - - if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); - return; - } - - /* Check if OpenGL ES connection has been initialized */ - if (phdata->egl_display != EGL_NO_DISPLAY) { - if (context != EGL_NO_CONTEXT) { - status = eglDestroyContext(phdata->egl_display, context); - if (status != EGL_TRUE) { - /* Error during OpenGL ES context destroying */ - SDL_SetError("PND: OpenGL ES context destroy error"); - return; - } - } - } - -#ifdef WIZ_GLES_LITE - if( hNativeWnd != 0 ) - { - SDL_free(hNativeWnd); - hNativeWnd = 0; - printf( "SDL: Wiz framebuffer released\n" ); - } -#endif - - return; -} - -#endif /* SDL_VIDEO_DRIVER_PANDORA */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/pandora/SDL_pandora.h b/src/video/pandora/SDL_pandora.h deleted file mode 100644 index 0954cd3af..000000000 --- a/src/video/pandora/SDL_pandora.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_PANDORA_H__ -#define __SDL_PANDORA_H__ - -#include - -#include "../../SDL_internal.h" -#include "../SDL_sysvideo.h" - -typedef struct SDL_VideoData -{ - SDL_bool egl_initialized; /* OpenGL ES device initialization status */ - EGLDisplay egl_display; /* OpenGL ES display connection */ - uint32_t egl_refcount; /* OpenGL ES reference count */ - uint32_t swapinterval; /* OpenGL ES default swap interval */ - -} SDL_VideoData; - - -typedef struct SDL_DisplayData -{ - -} SDL_DisplayData; - - -typedef struct SDL_WindowData -{ - SDL_bool uses_gles; /* if true window must support OpenGL ES */ - - EGLConfig gles_configs[32]; - EGLint gles_config; /* OpenGL ES configuration index */ - EGLContext gles_context; /* OpenGL ES context */ - EGLint gles_attributes[256]; /* OpenGL ES attributes for context */ - EGLSurface gles_surface; /* OpenGL ES target rendering surface */ - -} SDL_WindowData; - - -/****************************************************************************/ -/* SDL_VideoDevice functions declaration */ -/****************************************************************************/ - -/* Display and window functions */ -int PND_videoinit(_THIS); -void PND_videoquit(_THIS); -void PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display); -int PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); -int PND_createwindow(_THIS, SDL_Window * window); -int PND_createwindowfrom(_THIS, SDL_Window * window, const void *data); -void PND_setwindowtitle(_THIS, SDL_Window * window); -void PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon); -void PND_setwindowposition(_THIS, SDL_Window * window); -void PND_setwindowsize(_THIS, SDL_Window * window); -void PND_showwindow(_THIS, SDL_Window * window); -void PND_hidewindow(_THIS, SDL_Window * window); -void PND_raisewindow(_THIS, SDL_Window * window); -void PND_maximizewindow(_THIS, SDL_Window * window); -void PND_minimizewindow(_THIS, SDL_Window * window); -void PND_restorewindow(_THIS, SDL_Window * window); -void PND_destroywindow(_THIS, SDL_Window * window); - -/* Window manager function */ -SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window, - struct SDL_SysWMinfo *info); - -/* OpenGL/OpenGL ES functions */ -int PND_gl_loadlibrary(_THIS, const char *path); -void *PND_gl_getprocaddres(_THIS, const char *proc); -void PND_gl_unloadlibrary(_THIS); -SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window); -int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context); -int PND_gl_setswapinterval(_THIS, int interval); -int PND_gl_getswapinterval(_THIS); -int PND_gl_swapwindow(_THIS, SDL_Window * window); -void PND_gl_deletecontext(_THIS, SDL_GLContext context); - - -#endif /* __SDL_PANDORA_H__ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/pandora/SDL_pandora_events.c b/src/video/pandora/SDL_pandora_events.c deleted file mode 100644 index ab077d5dd..000000000 --- a/src/video/pandora/SDL_pandora_events.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_PANDORA - -/* Being a null driver, there's no event stream. We just define stubs for - most of the API. */ - -#include "../../events/SDL_events_c.h" - -void -PND_PumpEvents(_THIS) -{ - /* Not implemented. */ -} - -#endif /* SDL_VIDEO_DRIVER_PANDORA */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/pandora/SDL_pandora_events.h b/src/video/pandora/SDL_pandora_events.h deleted file mode 100644 index 8ad8e355d..000000000 --- a/src/video/pandora/SDL_pandora_events.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -extern void PND_PumpEvents(_THIS); - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/testgl2.c b/test/testgl2.c index f259ddc93..4f1f857ae 100644 --- a/test/testgl2.c +++ b/test/testgl2.c @@ -45,8 +45,6 @@ static int LoadContext(GL_Context * data) #define __SDL_NOGETPROCADDR__ #elif SDL_VIDEO_DRIVER_ANDROID #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA -#define __SDL_NOGETPROCADDR__ #endif #if defined __SDL_NOGETPROCADDR__ diff --git a/test/testgles2.c b/test/testgles2.c index 903f7a822..39a10869f 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -69,8 +69,6 @@ static int LoadContext(GLES2_Context * data) #define __SDL_NOGETPROCADDR__ #elif SDL_VIDEO_DRIVER_ANDROID #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA -#define __SDL_NOGETPROCADDR__ #endif #if defined __SDL_NOGETPROCADDR__ diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index e9e79d6e6..e66c188bc 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -72,8 +72,6 @@ static int LoadContext(GLES2_Context * data) #define __SDL_NOGETPROCADDR__ #elif SDL_VIDEO_DRIVER_ANDROID #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA -#define __SDL_NOGETPROCADDR__ #endif #if defined __SDL_NOGETPROCADDR__ From 01d137592cf47863176638ade668ef6a218c3053 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 22 Nov 2022 07:56:43 -0800 Subject: [PATCH 413/459] Updated SDL_VERSIONNUM macro for new SDL version convention Fixes https://github.com/libsdl-org/SDL/issues/6578 --- include/SDL_version.h | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/include/SDL_version.h b/include/SDL_version.h index 75cc89149..6b6c59ba2 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -83,44 +83,26 @@ typedef struct SDL_version (x)->patch = SDL_PATCHLEVEL; \ } -/* TODO: Remove this whole block in SDL 3 */ -#if SDL_MAJOR_VERSION <= 3 /** * This macro turns the version numbers into a numeric value: * \verbatim - (1,2,3) -> (1203) + (1,2,3) -> (0x1000203) \endverbatim - * - * This assumes that there will never be more than 100 patchlevels. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300, - * and 2.255.99 would be encoded as 25799. - * This macro will not be available in SDL 3.x. */ -#define SDL_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X) << 24 | (Y) << 8 | (Z) << 0) /** * This is the version number macro for the current SDL version. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300. - * This macro will not be available in SDL 3.x. - * - * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) -#endif /* SDL_MAJOR_VERSION < 3 */ /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - ((SDL_MAJOR_VERSION >= X) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONUM(X, Y, Z)) /** * Get the version of SDL that is linked against your program. From 8d6fda48103caf25288f0ba67364851c7472ef09 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 22 Nov 2022 19:18:47 +0300 Subject: [PATCH 414/459] removed os2 support & support for building SDL with watcom. --- .github/workflows/watcom.yml | 35 - CMakeLists.txt | 75 +- Makefile.os2 | 296 ----- Makefile.w32 | 280 ---- cmake/sdlchecks.cmake | 4 +- configure | 130 -- configure.ac | 101 -- docs/README-os2.md | 89 -- docs/README.md | 1 - include/SDL_config.h | 2 - include/SDL_config.h.cmake | 7 - include/SDL_config.h.in | 7 - include/SDL_config_os2.h | 207 --- include/SDL_config_windows.h | 15 - include/SDL_opengl.h | 7 - include/SDL_syswm.h | 23 - include/SDL_thread.h | 43 - include/begin_code.h | 11 - src/SDL.c | 19 - src/audio/SDL_audio.c | 3 - src/audio/SDL_sysaudio.h | 1 - src/audio/os2/SDL_os2audio.c | 450 ------- src/audio/os2/SDL_os2audio.h | 54 - src/core/os2/SDL_os2.c | 38 - src/core/os2/SDL_os2.h | 57 - src/core/os2/geniconv/geniconv.c | 161 --- src/core/os2/geniconv/geniconv.h | 85 -- src/core/os2/geniconv/iconv.h | 21 - src/core/os2/geniconv/makefile | 37 - src/core/os2/geniconv/os2cp.c | 416 ------ src/core/os2/geniconv/os2cp.h | 32 - src/core/os2/geniconv/os2iconv.c | 286 ---- src/core/os2/geniconv/sys2utf8.c | 119 -- src/core/os2/geniconv/test.c | 69 - src/core/os2/iconv2.lbc | 4 - src/cpuinfo/SDL_cpuinfo.c | 21 - src/dynapi/SDL3.exports | 869 ------------ src/dynapi/SDL_dynapi.c | 21 - src/dynapi/SDL_dynapi_procs.h | 4 - src/dynapi/gendynapi.pl | 4 - src/events/SDL_mouse.c | 6 - src/filesystem/os2/SDL_sysfilesystem.c | 131 -- src/hidapi/libusb/hid.c | 3 - src/joystick/SDL_joystick.c | 3 - src/joystick/SDL_sysjoystick.h | 1 - src/joystick/os2/SDL_os2joystick.c | 799 ----------- src/loadso/os2/SDL_sysloadso.c | 103 -- src/thread/SDL_thread_c.h | 2 - src/thread/os2/SDL_sysmutex.c | 129 -- src/thread/os2/SDL_syssem.c | 190 --- src/thread/os2/SDL_systhread.c | 133 -- src/thread/os2/SDL_systhread_c.h | 25 - src/thread/os2/SDL_systls.c | 89 -- src/thread/os2/SDL_systls_c.h | 38 - src/thread/windows/SDL_systhread.c | 17 - src/timer/os2/SDL_systimer.c | 186 --- src/video/SDL_sysvideo.h | 2 - src/video/SDL_video.c | 16 +- src/video/os2/SDL_gradd.h | 171 --- src/video/os2/SDL_os2dive.c | 331 ----- src/video/os2/SDL_os2messagebox.c | 561 -------- src/video/os2/SDL_os2messagebox.h | 29 - src/video/os2/SDL_os2mouse.c | 194 --- src/video/os2/SDL_os2mouse.h | 33 - src/video/os2/SDL_os2output.h | 59 - src/video/os2/SDL_os2util.c | 114 -- src/video/os2/SDL_os2util.h | 38 - src/video/os2/SDL_os2video.c | 1696 ------------------------ src/video/os2/SDL_os2video.h | 82 -- src/video/os2/SDL_os2vman.c | 483 ------- test/Makefile.in | 8 - test/Makefile.os2 | 18 - test/Makefile.w32 | 21 - test/configure | 9 - test/configure.ac | 8 - test/testnative.c | 3 - test/testnative.h | 6 - test/testnativeos2.c | 57 - test/watcom.mif | 122 -- 79 files changed, 3 insertions(+), 10017 deletions(-) delete mode 100644 .github/workflows/watcom.yml delete mode 100644 Makefile.os2 delete mode 100644 Makefile.w32 delete mode 100644 docs/README-os2.md delete mode 100644 include/SDL_config_os2.h delete mode 100644 src/audio/os2/SDL_os2audio.c delete mode 100644 src/audio/os2/SDL_os2audio.h delete mode 100644 src/core/os2/SDL_os2.c delete mode 100644 src/core/os2/SDL_os2.h delete mode 100644 src/core/os2/geniconv/geniconv.c delete mode 100644 src/core/os2/geniconv/geniconv.h delete mode 100644 src/core/os2/geniconv/iconv.h delete mode 100644 src/core/os2/geniconv/makefile delete mode 100644 src/core/os2/geniconv/os2cp.c delete mode 100644 src/core/os2/geniconv/os2cp.h delete mode 100644 src/core/os2/geniconv/os2iconv.c delete mode 100644 src/core/os2/geniconv/sys2utf8.c delete mode 100644 src/core/os2/geniconv/test.c delete mode 100644 src/core/os2/iconv2.lbc delete mode 100644 src/dynapi/SDL3.exports delete mode 100644 src/filesystem/os2/SDL_sysfilesystem.c delete mode 100644 src/joystick/os2/SDL_os2joystick.c delete mode 100644 src/loadso/os2/SDL_sysloadso.c delete mode 100644 src/thread/os2/SDL_sysmutex.c delete mode 100644 src/thread/os2/SDL_syssem.c delete mode 100644 src/thread/os2/SDL_systhread.c delete mode 100644 src/thread/os2/SDL_systhread_c.h delete mode 100644 src/thread/os2/SDL_systls.c delete mode 100644 src/thread/os2/SDL_systls_c.h delete mode 100644 src/timer/os2/SDL_systimer.c delete mode 100644 src/video/os2/SDL_gradd.h delete mode 100644 src/video/os2/SDL_os2dive.c delete mode 100644 src/video/os2/SDL_os2messagebox.c delete mode 100644 src/video/os2/SDL_os2messagebox.h delete mode 100644 src/video/os2/SDL_os2mouse.c delete mode 100644 src/video/os2/SDL_os2mouse.h delete mode 100644 src/video/os2/SDL_os2output.h delete mode 100644 src/video/os2/SDL_os2util.c delete mode 100644 src/video/os2/SDL_os2util.h delete mode 100644 src/video/os2/SDL_os2video.c delete mode 100644 src/video/os2/SDL_os2video.h delete mode 100644 src/video/os2/SDL_os2vman.c delete mode 100644 test/Makefile.os2 delete mode 100644 test/Makefile.w32 delete mode 100644 test/testnativeos2.c delete mode 100644 test/watcom.mif diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml deleted file mode 100644 index 13f1505ff..000000000 --- a/.github/workflows/watcom.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build (OpenWatcom) - -on: [push, pull_request] - -jobs: - os2: - name: ${{ matrix.platform.name }} - runs-on: windows-latest - - strategy: - matrix: - platform: - - { name: Windows, makefile: Makefile.w32 } - - { name: OS/2, makefile: Makefile.os2 } - - steps: - - uses: actions/checkout@v3 - - uses: open-watcom/setup-watcom@v0 - - name: Build - run: | - wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - - name: Build tests - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - cd .. - - name: Run tests - if: "matrix.platform.makefile == 'Makefile.w32'" - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} check-quick - cd .. - - name: distclean - run: | - wmake -f ${{ matrix.platform.makefile }} distclean - cd test && wmake -f ${{ matrix.platform.makefile }} distclean - cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 60a4782ae..702d0c433 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2696,76 +2696,6 @@ elseif(PS2) ps2_drivers ) -elseif(OS2) - list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") - - file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) - file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/geniconv/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - endif() - - if(SDL_THREADS) - set(SDL_THREAD_OS2 1) - file(GLOB OS2_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) - set(HAVE_SDL_THREADS TRUE) - endif() - - if(SDL_TIMERS) - set(SDL_TIMER_UNIX 1) - file(GLOB OS2_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) - set(HAVE_SDL_TIMERS TRUE) - endif() - - if(SDL_LOADSO) - set(SDL_LOADSO_OS2 1) - file(GLOB OS2_LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) - set(HAVE_SDL_LOADSO TRUE) - endif() - - if(SDL_FILESYSTEM) - set(SDL_FILESYSTEM_OS2 1) - file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/os2/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) - set(HAVE_SDL_FILESYSTEM TRUE) - endif() - - if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/unix/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) - set(HAVE_SDL_LOCALE TRUE) - endif() - - if(SDL_VIDEO) - set(SDL_VIDEO_DRIVER_OS2 1) - file(GLOB OS2_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) - set(HAVE_SDL_VIDEO TRUE) - endif() - - if(SDL_AUDIO) - set(SDL_AUDIO_DRIVER_OS2 1) - file(GLOB OS2_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - list(APPEND EXTRA_LIBS mmpm2) - endif() - - if(SDL_JOYSTICK) - set(SDL_JOYSTICK_OS2 1) - file(GLOB OS2_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) - set(HAVE_SDL_JOYSTICK TRUE) - endif() - - if(SDL_HIDAPI) - CheckHIDAPI() - endif() - elseif(N3DS) file(GLOB N3DS_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/n3ds/*.c) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${N3DS_MAIN_SOURCES}) @@ -3302,9 +3232,6 @@ if(SDL_SHARED) if(WINDOWS OR CYGWIN) set_target_properties(SDL3 PROPERTIES DEFINE_SYMBOL DLL_EXPORT) - elseif(OS2) - set_target_properties(SDL3 PROPERTIES - DEFINE_SYMBOL BUILD_SDL) endif() set_target_properties(SDL3 PROPERTIES VERSION ${SDL_VERSION} @@ -3522,7 +3449,7 @@ if(NOT SDL3_DISABLE_INSTALL) if(SDL_SHARED) set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. get_target_property(SONAME SDL3 OUTPUT_NAME) - if(NOT ANDROID AND NOT MINGW AND NOT OS2) + if(NOT ANDROID AND NOT MINGW) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL3${SOPOSTFIX}${SOEXT}\" diff --git a/Makefile.os2 b/Makefile.os2 deleted file mode 100644 index 0cefb4b3e..000000000 --- a/Makefile.os2 +++ /dev/null @@ -1,296 +0,0 @@ -# Open Watcom makefile to build SDL3.dll for OS/2 -# wmake -f Makefile.os2 -# -# If you have GNU libiconv installed (iconv2.dll), you -# can compile against it by specifying LIBICONV=1, e.g.: -# wmake -f Makefile.os2 LIBICONV=1 -# -# If you have libusb-1.0 installed (usb100.dll, libusb.h), you -# can compile hidapi joystick support against it (experimental) -# by specifying HIDAPI=1, e.g.: -# wmake -f Makefile.os2 HIDAPI=1 -# -# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 - -LIBNAME = SDL3 -MAJOR_VERSION = 3 -MINOR_VERSION = 0 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) -DESCRIPTION = Simple DirectMedia Layer 2 - -LIBICONV=0 -ICONVLIB=$(LIBICONV_LIB) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude - -LIBM = SDL3libm.lib -TLIB = SDL3test.lib -LIBS = mmpm2.lib $(LIBM) -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# Debug options: -# - debug messages from OS/2 related code to stdout: -#CFLAGS+= -DOS2DEBUG -# - debug messages from OS/2 code via SDL_LogDebug(): -#CFLAGS+= -DOS2DEBUG=2 - -# max warnings: -CFLAGS+= -wx -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# iconv: -LIBICONV_LIB=iconv2.lib -!ifeq LIBICONV 1 -CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -LIBS+= $(ICONVLIB) -!else -LIBS+= libuls.lib libconv.lib -!endif -# hidapi (libusb): -!ifeq HIDAPI 1 -CFLAGS_DLL+= -DHAVE_LIBUSB_H=1 -!endif -# building SDL itself (for DECLSPEC): -CFLAGS_DLL+= -DBUILD_SDL - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_os2.c -!ifeq LIBICONV 0 -SRCS+= geniconv.c os2cp.c os2iconv.c sys2utf8.c -!endif -SRCS+= SDL_os2audio.c -SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c & - SDL_os2mouse.c SDL_os2messagebox.c - -SRCS+= SDL_dynapi.c - -OBJS = $(SRCS:.c=.obj) - -.extensions: -.extensions: .lib .dll .obj .c .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/os2;./src/audio/os2;./src/loadso/os2;./src/filesystem/os2;./src/joystick/os2;./src/thread/os2;./src/timer/os2;./src/video/os2; -.c: ./src/core/os2/geniconv; -.c: ./src/locale/;./src/locale/unix;./src/misc;./src/misc/dummy;./src/joystick/hidapi;./src/hidapi - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(LIBICONV_LIB) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* $(DLLFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -!ifeq HIDAPI 1 -# c99 mode needed because of structs with flexible array members in libusb.h -SDL_hidapi.obj: SDL_hidapi.c - wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $< -!endif - -$(LIBICONV_LIB): "src/core/os2/iconv2.lbc" - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ @$< - -# SDL3libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL3test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(LIBHOME)/$^&.exp - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)' - @%append $@ OPTION ELIMINATE - @%append $@ OPTION MANYAUTODATA - @%append $@ OPTION OSNAME='OS/2 and eComStation' - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - @if exist $(LIBICONV_LIB) rm $(LIBICONV_LIB) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/Makefile.w32 b/Makefile.w32 deleted file mode 100644 index b89a44e57..000000000 --- a/Makefile.w32 +++ /dev/null @@ -1,280 +0,0 @@ -# Open Watcom makefile to build SDL3.dll for Win32 -# wmake -f Makefile.w32 -# -# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 - -LIBNAME = SDL3 -MAJOR_VERSION = 3 -MINOR_VERSION = 0 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -EXPFILE = $(LIBHOME)/$(LIBNAME).exp -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude -INCPATH+= -I"src/video/khronos" - -LIBM = SDL3libm.lib -TLIB = SDL3test.lib -# user32.lib, gdi32.lib, ole32.lib and oleaut32.lib are actually -# among the default libraries in wlink.lnk for nt_dll linkage... -LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) - -CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# max warnings: -CFLAGS+= -wx -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# new vulkan headers result in lots of W202 warnings -CFLAGS+= -wcd=202 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# we override the DECLSPEC define in begin_code.h, because we are using -# an exports file to remove the _cdecl '_' prefix from the symbol names -CFLAGS_DLL+= -DDECLSPEC= - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -RCFLAGS = -q -r -bt=nt $(INCPATH) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c -SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c -SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c -SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c -SRCS+= SDL_syspower.c -SRCS+= SDL_d3dmath.c -SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c -SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c -SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c -SRCS+= SDL_render_gl.c SDL_shaders_gl.c -SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c -SRCS+= SDL_windowssensor.c -SRCS+= SDL_syscond_cv.c -SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c - -SRCS+= SDL_dynapi.c - -RCSRCS = version.rc - -OBJS = $(SRCS:.c=.obj) -RCOBJS= $(RCSRCS:.rc=.res) - -.extensions: -.extensions: .lib .dll .obj .res .c .rc .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows; -.c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2 -.rc: ./src/main/windows - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -.rc.res: - wrc $(RCFLAGS) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -SDL_malloc.obj: SDL_malloc.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< - -# SDL3libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL3test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): Makefile.w32 - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION RESOURCE=$(RCOBJS) - @%append $@ EXPORT=src/dynapi/SDL3.exports - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(EXPFILE) - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION ELIMINATE - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.res rm *.res - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 462fdd4ba..b65d63aab 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -364,7 +364,7 @@ macro(CheckLibSampleRate) get_property(_samplerate_type TARGET SampleRate::samplerate PROPERTY TYPE) if(_samplerate_type STREQUAL "SHARED_LIBRARY") set(HAVE_LIBSAMPLERATE_SHARED TRUE) - if(WIN32 OR OS2) + if(WIN32) set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") else() set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") @@ -1172,8 +1172,6 @@ macro(CheckHIDAPI) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}") if(HIDAPI_ONLY_LIBUSB) list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES}) - elseif(OS2) - set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS FindLibraryAndSONAME("usb-1.0" LIBDIRS ${PKG_LIBUSB_LIBRARY_DIRS}) diff --git a/configure b/configure index 677132988..79763cbba 100755 --- a/configure +++ b/configure @@ -27236,36 +27236,6 @@ printf "%s\n" "#define HAVE_SHELLSCALINGAPI_H 1" >>confdefs.h fi } -CheckOS2() -{ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 -printf %s "checking OS/2 compiler... " >&6; } - have_os2_gcc=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_os2_gcc=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 -printf "%s\n" "$have_os2_gcc" >&6; } - if test x$have_os2_gcc != xyes; then - as_fn_error $? " -*** Your compiler ($CC) does not produce OS/2 executables! - " "$LINENO" 5 - fi -} - CheckDIRECTX() { # Check whether --enable-directx was given. @@ -28008,9 +27978,6 @@ fi enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -28123,9 +28090,6 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` @@ -29361,100 +29325,6 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckWerror - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_system_iconv = xyes; then - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - -printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - -printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - -printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - -printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - -printf "%s\n" "#define SDL_JOYSTICK_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) as_fn_error $? " *** Unsupported host: Please add to configure.ac diff --git a/configure.ac b/configure.ac index 9d2cc2934..d0bcbf16f 100644 --- a/configure.ac +++ b/configure.ac @@ -3294,21 +3294,6 @@ CheckWINDOWS() fi } -dnl Determine whether the compiler can produce OS/2 executables -CheckOS2() -{ - AC_MSG_CHECKING(OS/2 compiler) - have_os2_gcc=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [])],[have_os2_gcc=yes],[]) - AC_MSG_RESULT($have_os2_gcc) - if test x$have_os2_gcc != xyes; then - AC_MSG_ERROR([ -*** Your compiler ($CC) does not produce OS/2 executables! - ]) - fi -} - dnl Find the DirectX includes and libraries CheckDIRECTX() { @@ -3607,9 +3592,6 @@ CheckHIDAPI() enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -3643,9 +3625,6 @@ CheckHIDAPI() *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -4580,86 +4559,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckWerror - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_system_iconv = xyes; then - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - AC_DEFINE(SDL_THREAD_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - AC_DEFINE(SDL_JOYSTICK_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) AC_MSG_ERROR([ *** Unsupported host: Please add to configure.ac diff --git a/docs/README-os2.md b/docs/README-os2.md deleted file mode 100644 index 3024f1125..000000000 --- a/docs/README-os2.md +++ /dev/null @@ -1,89 +0,0 @@ -Simple DirectMedia Layer 2 for OS/2 & eComStation -================================================================================ -SDL port for OS/2, authored by Andrey Vasilkin , 2016 - - -OpenGL and audio capture not supported by this port. - -Additional optional environment variables: - -SDL_AUDIO_SHARE - Values: 0 or 1, default is 0 - Initializes the device as shareable or exclusively acquired. - -SDL_VIDEODRIVER - Values: DIVE or VMAN, default is DIVE - Use video subsystem: Direct interface video extensions (DIVE) or - Video Manager (VMAN). - -You may significantly increase video output speed with OS4 kernel and patched -files vman.dll and dive.dll or with latest versions of ACPI support and video -driver Panorama. - -Latest versions of OS/4 kernel: - http://gus.biysk.ru/os4/ - (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4) - -Patched files vman.dll and dive.dll: - http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR - - -Compiling: ----------- - -Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see: -https://github.com/open-watcom/ and https://open-watcom.github.io -WATCOM environment variable must to be set to the Open Watcom install -directory. To compile, run: wmake -f Makefile.os2 - - -Installing: ------------ - -- eComStation: - - If you have previously installed SDL3, make a Backup copy of SDL3.dll - located in D:\ecs\dll (where D: is disk on which installed eComStation). - Stop all programs running with SDL3. Copy SDL3.dll to D:\ecs\dll - -- OS/2: - - Copy SDL3.dll to any directory on your LIBPATH. If you have a previous - version installed, close all SDL3 applications before replacing the old - copy. Also make sure that any other older versions of DLLs are removed - from your system. - - -Joysticks: ------------------- - -The Joystick detection only works for standard joysticks (2 buttons, 2 axes -and the like). Therefore, if you use a non-standard joystick, you should -specify its features in the SDL_OS2_JOYSTICK environment variable in a batch -file or CONFIG.SYS, so SDL applications can provide full capability to your -device. The syntax is: - -SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] - -So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, -the line should be: - -SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 - -If you want to add spaces in your joystick name, just surround it with -quotes or double-quotes: - -SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 - -or - -SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 - - Note however that Balls and Hats are not supported under OS/2, and the -value will be ignored... but it is wise to define these correctly because -in the future those can be supported. - - Also the number of buttons is limited to 2 when using two joysticks, -4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes -and 8 when using a joystick with 2 axes. Notice however these are limitations -of the Joystick Port hardware, not OS/2. diff --git a/docs/README.md b/docs/README.md index 7666060c9..9af1ceb6b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,7 +34,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [iOS](README-ios.md) - [Linux](README-linux.md) - [macOS](README-macos.md) -- [OS/2](README-os2.md) - [Native Client](README-nacl.md) - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) diff --git a/include/SDL_config.h b/include/SDL_config.h index f91cb47ec..f59b6bbff 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -43,8 +43,6 @@ #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" -#elif defined(__OS2__) -#include "SDL_config_os2.h" #elif defined(__EMSCRIPTEN__) #include "SDL_config_emscripten.h" #elif defined(__NGAGE__) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 8fcb63d18..41acf1c71 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -322,7 +322,6 @@ #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ #cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ @@ -341,7 +340,6 @@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ #cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_OS2 @SDL_JOYSTICK_OS2@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ #cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ @@ -373,7 +371,6 @@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ #cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ -#cmakedefine SDL_LOADSO_OS2 @SDL_LOADSO_OS2@ /* Enable various threading systems */ #cmakedefine SDL_THREAD_GENERIC_COND_SUFFIX @SDL_THREAD_GENERIC_COND_SUFFIX@ @@ -381,7 +378,6 @@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ #cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ -#cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ #cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ @@ -392,7 +388,6 @@ #cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ #cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ #cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ -#cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ #cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ @@ -414,7 +409,6 @@ #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ -#cmakedefine SDL_VIDEO_DRIVER_OS2 @SDL_VIDEO_DRIVER_OS2@ #cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@ #cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@ #cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@ @@ -505,7 +499,6 @@ #cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ #cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ #cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ -#cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ #cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 7b8d848e0..a4756ee7b 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -310,7 +310,6 @@ #undef SDL_AUDIO_DRIVER_SUNAUDIO #undef SDL_AUDIO_DRIVER_WASAPI #undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_OS2 /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -326,7 +325,6 @@ #undef SDL_JOYSTICK_MFI #undef SDL_JOYSTICK_LINUX #undef SDL_JOYSTICK_ANDROID -#undef SDL_JOYSTICK_OS2 #undef SDL_JOYSTICK_USBHID #undef SDL_HAVE_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_HIDAPI @@ -351,7 +349,6 @@ #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG #undef SDL_LOADSO_WINDOWS -#undef SDL_LOADSO_OS2 /* Enable various threading systems */ #undef SDL_THREAD_GENERIC_COND_SUFFIX @@ -359,14 +356,12 @@ #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP #undef SDL_THREAD_WINDOWS -#undef SDL_THREAD_OS2 /* Enable various timer systems */ #undef SDL_TIMER_HAIKU #undef SDL_TIMER_DUMMY #undef SDL_TIMER_UNIX #undef SDL_TIMER_WINDOWS -#undef SDL_TIMER_OS2 /* Enable various video drivers */ #undef SDL_VIDEO_DRIVER_HAIKU @@ -410,7 +405,6 @@ #undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK -#undef SDL_VIDEO_DRIVER_OS2 #undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_DRIVER_RISCOS @@ -460,7 +454,6 @@ #undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_NACL #undef SDL_FILESYSTEM_EMSCRIPTEN -#undef SDL_FILESYSTEM_OS2 #undef SDL_FILESYSTEM_VITA #undef SDL_FILESYSTEM_PSP #undef SDL_FILESYSTEM_PS2 diff --git a/include/SDL_config_os2.h b/include/SDL_config_os2.h deleted file mode 100644 index c86769db4..000000000 --- a/include/SDL_config_os2.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_config_os2_h_ -#define SDL_config_os2_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#define SIZEOF_VOIDP 4 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_OS2 1 - -#define SDL_POWER_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 - -#define SDL_SENSOR_DUMMY 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_OS2 1 -#define SDL_JOYSTICK_OS2 1 -#ifndef HAVE_LIBUSB_H /* see Makefile */ -#define SDL_HIDAPI_DISABLED 1 -/*#undef SDL_JOYSTICK_HIDAPI */ -#else -#define SDL_JOYSTICK_HIDAPI 1 -#define HAVE_LIBUSB 1 -/* dynamically loaded libusb-1.0 dll: */ -#define SDL_LIBUSB_DYNAMIC "usb100.dll" -#endif -/*#undef SDL_JOYSTICK_VIRTUAL */ - -/* Enable OpenGL support */ -/* #undef SDL_VIDEO_OPENGL */ - -#define SDL_THREAD_OS2 1 -#define SDL_LOADSO_OS2 1 -#define SDL_TIMER_OS2 1 -#define SDL_FILESYSTEM_OS2 1 - -/* use libsamplerate for audio rate conversion. */ -/*#define HAVE_LIBSAMPLERATE_H 1 */ - -/* Enable dynamic libsamplerate support */ -#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL" - -#define HAVE_LIBC 1 - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 - -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_WCHAR_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_SIGNAL_H 1 - -#if 0 /* see Makefile */ -#define HAVE_ICONV 1 -#define HAVE_ICONV_H 1 -#endif - -/* #undef HAVE_DLOPEN */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#if defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE__FTELLI64 1 -#endif -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -#define HAVE_WCSCMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -/* #undef HAVE_WCSDUP */ -#define HAVE__WCSDUP 1 -#define HAVE_WCSSTR 1 -#define HAVE_WCSCMP 1 -#define HAVE_WCSNCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -#define HAVE_ITOA 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE__I64TOA 1 -#define HAVE__UI64TOA 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_VSSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_SETJMP 1 -#define HAVE_ACOS 1 -/* #undef HAVE_ACOSF */ -#define HAVE_ASIN 1 -/* #undef HAVE_ASINF */ -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -/* #undef HAVE_ATAN2F */ -#define HAVE_CEIL 1 -/* #undef HAVE_CEILF */ -/* #undef HAVE_COPYSIGN */ -/* #undef HAVE_COPYSIGNF */ -#define HAVE_COS 1 -/* #undef HAVE_COSF */ -#define HAVE_EXP 1 -/* #undef HAVE_EXPF */ -#define HAVE_FABS 1 -/* #undef HAVE_FABSF */ -#define HAVE_FLOOR 1 -/* #undef HAVE_FLOORF */ -#define HAVE_FMOD 1 -/* #undef HAVE_FMODF */ -#define HAVE_LOG 1 -/* #undef HAVE_LOGF */ -#define HAVE_LOG10 1 -/* #undef HAVE_LOG10F */ -#define HAVE_POW 1 -/* #undef HAVE_POWF */ -#define HAVE_SIN 1 -/* #undef HAVE_SINF */ -/* #undef HAVE_SCALBN */ -/* #undef HAVE_SCALBNF */ -#define HAVE_SQRT 1 -/* #undef HAVE_SQRTF */ -#define HAVE_TAN 1 -/* #undef HAVE_TANF */ -/* #undef HAVE_TRUNC */ -/* #undef HAVE_TRUNCF */ -/* #undef HAVE_LROUND */ -/* #undef HAVE_LROUNDF */ -/* #undef HAVE_ROUND */ -/* #undef HAVE_ROUNDF */ - -#endif /* SDL_config_os2_h_ */ diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h index 58e0b7ecb..1ae40aab3 100644 --- a/include/SDL_config_windows.h +++ b/include/SDL_config_windows.h @@ -89,7 +89,6 @@ typedef unsigned int uintptr_t; #define HAVE_DDRAW_H 1 #define HAVE_DINPUT_H 1 #define HAVE_DSOUND_H 1 -#ifndef __WATCOMC__ #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ @@ -101,7 +100,6 @@ typedef unsigned int uintptr_t; #endif #if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ #define HAVE_D3D12_H 1 -#endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ #define HAVE_SHELLSCALINGAPI_H 1 #endif @@ -136,11 +134,8 @@ typedef unsigned int uintptr_t; #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ #define HAVE_QSORT 1 #define HAVE_BSEARCH 1 -#endif #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -186,7 +181,6 @@ typedef unsigned int uintptr_t; #define HAVE_SIN 1 #define HAVE_SQRT 1 #define HAVE_TAN 1 -#ifndef __WATCOMC__ #define HAVE_ACOSF 1 #define HAVE_ASINF 1 #define HAVE_ATANF 1 @@ -204,7 +198,6 @@ typedef unsigned int uintptr_t; #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#endif #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 @@ -227,14 +220,6 @@ typedef unsigned int uintptr_t; #ifdef _USE_MATH_DEFINES #define HAVE_M_PI 1 #endif -#elif defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_ROUND 1 -#define HAVE_SCALBN 1 -#define HAVE_TRUNC 1 #else #define HAVE_M_PI 1 #endif diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 0f2b257ab..1816d4eb4 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -97,13 +97,6 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall -#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ -# define GLAPI extern -# define GLAPIENTRY _System -# define APIENTRY _System -# if defined(__GNUC__) && !defined(_System) -# define _System -# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 45f8e7540..f28b19d57 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -111,10 +111,6 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif -#if defined(SDL_VIDEO_DRIVER_OS2) -#define INCL_WIN -#include -#endif #endif /* SDL_PROTOTYPES_ONLY */ #if defined(SDL_VIDEO_DRIVER_KMSDRM) @@ -145,7 +141,6 @@ typedef enum SDL_SYSWM_WINRT, SDL_SYSWM_ANDROID, SDL_SYSWM_VIVANTE, - SDL_SYSWM_OS2, SDL_SYSWM_HAIKU, SDL_SYSWM_KMSDRM, SDL_SYSWM_RISCOS @@ -201,16 +196,6 @@ struct SDL_SysWMmsg int dummy; /* No Vivante window events yet */ } vivante; -#endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - BOOL fFrame; /**< TRUE if hwnd is a frame window */ - HWND hwnd; /**< The window receiving the message */ - ULONG msg; /**< The message identifier */ - MPARAM mp1; /**< The first first message parameter */ - MPARAM mp2; /**< The second first message parameter */ - } os2; #endif /* Can't have an empty union */ int dummy; @@ -318,14 +303,6 @@ struct SDL_SysWMinfo } android; #endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - HWND hwnd; /**< The window handle */ - HWND hwndFrame; /**< The frame window handle */ - } os2; -#endif - #if defined(SDL_VIDEO_DRIVER_VIVANTE) struct { diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 6bedcb555..ea8d36fb6 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -38,13 +38,6 @@ #if defined(__WIN32__) || defined(__GDK__) #include /* _beginthreadex() and _endthreadex() */ #endif -#if defined(__OS2__) /* for _beginthread() and _endthread() */ -#ifndef __EMX__ -#include -#else -#include -#endif -#endif #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -145,42 +138,6 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) #endif -#elif defined(__OS2__) -/* - * just like the windows case above: We compile SDL3 - * into a dll with Watcom's runtime statically linked. - */ -#define SDL_PASSED_BEGINTHREAD_ENDTHREAD - -typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); -typedef void (*pfnSDL_CurrentEndThread)(void); - -#ifndef SDL_beginthread -#define SDL_beginthread _beginthread -#endif -#ifndef SDL_endthread -#define SDL_endthread _endthread -#endif - -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); - -#if defined(SDL_CreateThread) && SDL_DYNAMIC_API -#undef SDL_CreateThread -#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#undef SDL_CreateThreadWithStackSize -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#else -#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#endif - #else /** diff --git a/include/begin_code.h b/include/begin_code.h index b3e69e85c..bc248b2e4 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -57,12 +57,6 @@ # else # define DECLSPEC # endif -# elif defined(__OS2__) -# ifdef BUILD_SDL -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -76,11 +70,6 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__) #define SDLCALL __cdecl -#elif defined(__OS2__) || defined(__EMX__) -#define SDLCALL _System -# if defined (__GNUC__) && !defined(_System) -# define _System /* for old EMX/GCC compat. */ -# endif #else #define SDLCALL #endif diff --git a/src/SDL.c b/src/SDL.c index 6297159e4..90bf7a2cb 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -22,17 +22,9 @@ #if defined(__WIN32__) || defined(__GDK__) #include "core/windows/SDL_windows.h" -#elif defined(__OS2__) -#include /* _exit() */ #elif !defined(__WINRT__) #include /* _exit(), etc. */ #endif -#if defined(__OS2__) -#include "core/os2/SDL_os2.h" -#if SDL_THREAD_OS2 -#include "thread/os2/SDL_systls_c.h" -#endif -#endif /* this checks for HAVE_DBUS_DBUS_H internally. */ #include "core/linux/SDL_dbus.h" @@ -198,10 +190,6 @@ SDL_InitSubSystem(Uint32 flags) flags |= SDL_INIT_EVENTS; } -#if SDL_THREAD_OS2 - SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ -#endif - #if SDL_VIDEO_DRIVER_WINDOWS if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { if (SDL_HelperWindowCreate() < 0) { @@ -359,13 +347,6 @@ SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { -#if defined(__OS2__) -#if SDL_THREAD_OS2 - SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ -#endif - SDL_OS2Quit(); -#endif - /* Shut down requested initialized subsystems */ #if !SDL_SENSOR_DISABLED if ((flags & SDL_INIT_SENSOR)) { diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 088887822..76395f54f 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -120,9 +120,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OS2 - &OS2AUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_DISK &DISKAUDIO_bootstrap, #endif diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index a911de041..a76c5c21b 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -211,7 +211,6 @@ extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; extern AudioBootStrap N3DSAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; -extern AudioBootStrap OS2AUDIO_bootstrap; #endif /* SDL_sysaudio_h_ */ diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c deleted file mode 100644 index 9ddfb7607..000000000 --- a/src/audio/os2/SDL_os2audio.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_OS2 - -/* Allow access to a raw mixing buffer */ - -#include "../../core/os2/SDL_os2.h" - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_os2audio.h" - -/* -void lockIncr(volatile int *piVal); -#pragma aux lockIncr = \ - "lock add [eax], 1 "\ - parm [eax]; - -void lockDecr(volatile int *piVal); -#pragma aux lockDecr = \ - "lock sub [eax], 1 "\ - parm [eax]; -*/ - -static ULONG _getEnvULong(const char *name, ULONG ulMax, ULONG ulDefault) -{ - ULONG ulValue; - char* end; - char* envval = SDL_getenv(name); - - if (envval == NULL) - return ulDefault; - - ulValue = SDL_strtoul(envval, &end, 10); - return (end == envval) || (ulValue > ulMax)? ulDefault : ulMax; -} - -static int _MCIError(const char *func, ULONG ulResult) -{ - CHAR acBuf[128]; - mciGetErrorString(ulResult, acBuf, sizeof(acBuf)); - return SDL_SetError("[%s] %s", func, acBuf); -} - -static void _mixIOError(const char *function, ULONG ulRC) -{ - debug_os2("%s() - failed, rc = 0x%X (%s)", - function, ulRC, - (ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" : - (ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown"); -} - -static LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, - ULONG ulFlags) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; - ULONG ulRC; - - if (ulFlags != MIX_WRITE_COMPLETE) { - debug_os2("flags = 0x%X", ulFlags); - return 0; - } - - /*lockDecr((int *)&pAData->ulQueuedBuf);*/ - ulRC = DosPostEventSem(pAData->hevBuf); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem(), rc = %u", ulRC); - } - - return 1; /* return value doesn't seem to matter. */ -} - -static LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, - ULONG ulFlags) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; - ULONG ulRC; - - if (ulFlags != MIX_READ_COMPLETE) { - debug_os2("flags = 0x%X", ulFlags); - return 0; - } - - pAData->stMCIMixSetup.pmixRead(pAData->stMCIMixSetup.ulMixHandle, pBuffer, 1); - - ulRC = DosPostEventSem(pAData->hevBuf); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem(), rc = %u", ulRC); - } - - return 1; -} - - -static void OS2_DetectDevices(void) -{ - MCI_SYSINFO_PARMS stMCISysInfo; - CHAR acBuf[256]; - ULONG ulDevicesNum; - MCI_SYSINFO_LOGDEVICE stLogDevice; - MCI_SYSINFO_PARMS stSysInfoParams; - ULONG ulRC; - ULONG ulHandle = 0; - - acBuf[0] = '\0'; - stMCISysInfo.pszReturn = acBuf; - stMCISysInfo.ulRetSize = sizeof(acBuf); - stMCISysInfo.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_QUANTITY, - &stMCISysInfo, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_QUANTITY - failed, rc = 0x%X", ulRC); - return; - } - - ulDevicesNum = SDL_strtoul(stMCISysInfo.pszReturn, NULL, 10); - - for (stSysInfoParams.ulNumber = 0; stSysInfoParams.ulNumber < ulDevicesNum; - stSysInfoParams.ulNumber++) { - /* Get device install name. */ - stSysInfoParams.pszReturn = acBuf; - stSysInfoParams.ulRetSize = sizeof(acBuf); - stSysInfoParams.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_INSTALLNAME, - &stSysInfoParams, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_INSTALLNAME - failed, rc = 0x%X", ulRC); - continue; - } - - /* Get textual product description. */ - stSysInfoParams.ulItem = MCI_SYSINFO_QUERY_DRIVER; - stSysInfoParams.pSysInfoParm = &stLogDevice; - SDL_strlcpy(stLogDevice.szInstallName, stSysInfoParams.pszReturn, MAX_DEVICE_NAME); - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_ITEM, - &stSysInfoParams, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_ITEM - failed, rc = 0x%X", ulRC); - continue; - } - - ulHandle++; - SDL_AddAudioDevice(0, stLogDevice.szProductInfo, NULL, (void *)(ulHandle)); - ulHandle++; - SDL_AddAudioDevice(1, stLogDevice.szProductInfo, NULL, (void *)(ulHandle)); - } -} - -static void OS2_WaitDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - ULONG ulRC; - - /* Wait for an audio chunk to finish */ - ulRC = DosWaitEventSem(pAData->hevBuf, 5000); - if (ulRC != NO_ERROR) { - debug_os2("DosWaitEventSem(), rc = %u", ulRC); - } -} - -static Uint8 *OS2_GetDeviceBuf(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - return (Uint8 *) pAData->aMixBuffers[pAData->ulNextBuf].pBuffer; -} - -static void OS2_PlayDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - ULONG ulRC; - PMCI_MIX_BUFFER pMixBuffer = &pAData->aMixBuffers[pAData->ulNextBuf]; - - /* Queue it up */ - /*lockIncr((int *)&pAData->ulQueuedBuf);*/ - ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle, - pMixBuffer, 1); - if (ulRC != MCIERR_SUCCESS) { - _mixIOError("pmixWrite", ulRC); - } else { - pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers; - } -} - -static void OS2_CloseDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - MCI_GENERIC_PARMS sMCIGenericParms; - ULONG ulRC; - - if (pAData == NULL) - return; - - /* Close up audio */ - if (pAData->usDeviceId != (USHORT)~0) { /* Device is open. */ - if (pAData->stMCIMixSetup.ulBitsPerSample != 0) { /* Mixer was initialized. */ - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_DEINIT, - &pAData->stMCIMixSetup, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_MIXSETUP, MCI_MIXSETUP_DEINIT - failed"); - } - } - - if (pAData->cMixBuffers != 0) { /* Buffers was allocated. */ - MCI_BUFFER_PARMS stMCIBuffer; - - stMCIBuffer.ulBufferSize = pAData->aMixBuffers[0].ulBufferLength; - stMCIBuffer.ulNumBuffers = pAData->cMixBuffers; - stMCIBuffer.pBufList = pAData->aMixBuffers; - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER, - MCI_WAIT | MCI_DEALLOCATE_MEMORY, &stMCIBuffer, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_BUFFER, MCI_DEALLOCATE_MEMORY - failed"); - } - } - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_CLOSE, MCI_WAIT, - &sMCIGenericParms, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_CLOSE - failed"); - } - } - - if (pAData->hevBuf != NULLHANDLE) - DosCloseEventSem(pAData->hevBuf); - - SDL_free(pAData); -} - -static int OS2_OpenDevice(_THIS, const char *devname) -{ - SDL_PrivateAudioData *pAData; - SDL_AudioFormat test_format; - MCI_AMP_OPEN_PARMS stMCIAmpOpen; - MCI_BUFFER_PARMS stMCIBuffer; - ULONG ulRC; - ULONG ulIdx; - BOOL new_freq; - SDL_bool iscapture = _this->iscapture; - - new_freq = FALSE; - SDL_zero(stMCIAmpOpen); - SDL_zero(stMCIBuffer); - - for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - if (test_format == AUDIO_U8 || test_format == AUDIO_S16) - break; - } - if (!test_format) { - debug_os2("Unsupported audio format, AUDIO_S16 used"); - test_format = AUDIO_S16; - } - - pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); - if (pAData == NULL) - return SDL_OutOfMemory(); - _this->hidden = pAData; - - ulRC = DosCreateEventSem(NULL, &pAData->hevBuf, DCE_AUTORESET, TRUE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateEventSem() failed, rc = %u", ulRC); - return -1; - } - - /* Open audio device */ - stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0; - stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_OPEN, - (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)? - MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE : - MCI_WAIT | MCI_OPEN_TYPE_ID, - &stMCIAmpOpen, 0); - if (ulRC != MCIERR_SUCCESS) { - stMCIAmpOpen.usDeviceID = (USHORT)~0; - return _MCIError("MCI_OPEN", ulRC); - } - pAData->usDeviceId = stMCIAmpOpen.usDeviceID; - - if (iscapture) { - MCI_CONNECTOR_PARMS stMCIConnector; - MCI_AMP_SET_PARMS stMCIAmpSet; - BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0); - - /* Set particular connector. */ - SDL_zero(stMCIConnector); - stMCIConnector.ulConnectorType = (fLineIn)? MCI_LINE_IN_CONNECTOR : - MCI_MICROPHONE_CONNECTOR; - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_CONNECTOR, - MCI_WAIT | MCI_ENABLE_CONNECTOR | - MCI_CONNECTOR_TYPE, &stMCIConnector, 0); - - /* Disable monitor. */ - SDL_zero(stMCIAmpSet); - stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR; - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET, - MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM, - &stMCIAmpSet, 0); - - /* Set record volume. */ - stMCIAmpSet.ulLevel = _getEnvULong("SDL_AUDIO_RECVOL", 100, 90); - stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO; - stMCIAmpSet.ulAudio = MCI_SET_AUDIO_ALL; /* Both cnannels. */ - stMCIAmpSet.ulValue = (fLineIn) ? MCI_LINE_IN_CONNECTOR : - MCI_MICROPHONE_CONNECTOR ; - - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET, - MCI_WAIT | MCI_SET_AUDIO | MCI_AMP_SET_GAIN, - &stMCIAmpSet, 0); - } - - _this->spec.format = test_format; - _this->spec.channels = _this->spec.channels > 1 ? 2 : 1; - if (_this->spec.freq < 8000) { - _this->spec.freq = 8000; - new_freq = TRUE; - } else if (_this->spec.freq > 48000) { - _this->spec.freq = 48000; - new_freq = TRUE; - } - - /* Setup mixer. */ - pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM; - pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(test_format); - pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq; - pAData->stMCIMixSetup.ulChannels = _this->spec.channels; - pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; - if (!iscapture) { - pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY; - pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent; - } else { - pAData->stMCIMixSetup.ulFormatMode= MCI_RECORD; - pAData->stMCIMixSetup.pmixEvent = cbAudioReadEvent; - } - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0); - if (ulRC != MCIERR_SUCCESS && _this->spec.freq > 44100) { - new_freq = TRUE; - pAData->stMCIMixSetup.ulSamplesPerSec = 44100; - _this->spec.freq = 44100; - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0); - } - - debug_os2("Setup mixer [BPS: %u, Freq.: %u, Channels: %u]: %s", - pAData->stMCIMixSetup.ulBitsPerSample, - pAData->stMCIMixSetup.ulSamplesPerSec, - pAData->stMCIMixSetup.ulChannels, - (ulRC == MCIERR_SUCCESS)? "SUCCESS" : "FAIL"); - - if (ulRC != MCIERR_SUCCESS) { - pAData->stMCIMixSetup.ulBitsPerSample = 0; - return _MCIError("MCI_MIXSETUP", ulRC); - } - - if (_this->spec.samples == 0 || new_freq == TRUE) { - /* also see SDL_audio.c:prepare_audiospec() */ - /* Pick a default of ~46 ms at desired frequency */ - Uint32 samples = (_this->spec.freq / 1000) * 46; - Uint32 power2 = 1; - while (power2 < samples) { - power2 <<= 1; - } - _this->spec.samples = power2; - } - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&_this->spec); - - /* Allocate memory buffers */ - stMCIBuffer.ulBufferSize = _this->spec.size;/* (_this->spec.freq / 1000) * 100 */ - stMCIBuffer.ulNumBuffers = NUM_BUFFERS; - stMCIBuffer.pBufList = pAData->aMixBuffers; - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER, - MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0); - if (ulRC != MCIERR_SUCCESS) { - return _MCIError("MCI_BUFFER", ulRC); - } - pAData->cMixBuffers = stMCIBuffer.ulNumBuffers; - _this->spec.size = stMCIBuffer.ulBufferSize; - - /* Fill all device buffers with data */ - for (ulIdx = 0; ulIdx < stMCIBuffer.ulNumBuffers; ulIdx++) { - pAData->aMixBuffers[ulIdx].ulFlags = 0; - pAData->aMixBuffers[ulIdx].ulBufferLength = stMCIBuffer.ulBufferSize; - pAData->aMixBuffers[ulIdx].ulUserParm = (ULONG)pAData; - - SDL_memset(((PMCI_MIX_BUFFER)stMCIBuffer.pBufList)[ulIdx].pBuffer, - _this->spec.silence, stMCIBuffer.ulBufferSize); - } - - /* Write buffers to kick off the amp mixer */ - ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle, - pAData->aMixBuffers, 1); - if (ulRC != MCIERR_SUCCESS) { - _mixIOError("pmixWrite", ulRC); - return -1; - } - - return 0; -} - - -static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->DetectDevices = OS2_DetectDevices; - impl->OpenDevice = OS2_OpenDevice; - impl->PlayDevice = OS2_PlayDevice; - impl->WaitDevice = OS2_WaitDevice; - impl->GetDeviceBuf = OS2_GetDeviceBuf; - impl->CloseDevice = OS2_CloseDevice; - - /* TODO: IMPLEMENT CAPTURE SUPPORT: - impl->CaptureFromDevice = ; - impl->FlushCapture = ; - impl->HasCaptureSupport = SDL_TRUE; - */ - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap OS2AUDIO_bootstrap = { - "DART", "OS/2 DART", OS2_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/os2/SDL_os2audio.h b/src/audio/os2/SDL_os2audio.h deleted file mode 100644 index 07ebbae39..000000000 --- a/src/audio/os2/SDL_os2audio.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2mm_h_ -#define SDL_os2mm_h_ - -#include "../SDL_sysaudio.h" - -#define INCL_OS2MM -#define INCL_PM -#define INCL_DOS -#define INCL_DOSERRORS -#include -#include - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *_this - -#define NUM_BUFFERS 3 - -typedef struct SDL_PrivateAudioData -{ - USHORT usDeviceId; - BYTE _pad[2]; - MCI_MIXSETUP_PARMS stMCIMixSetup; - HEV hevBuf; - ULONG ulNextBuf; - ULONG cMixBuffers; - MCI_MIX_BUFFER aMixBuffers[NUM_BUFFERS]; -/* ULONG ulQueuedBuf;*/ -} SDL_PrivateAudioData; - -#endif /* SDL_os2mm_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/SDL_os2.c b/src/core/os2/SDL_os2.c deleted file mode 100644 index 553f88cfd..000000000 --- a/src/core/os2/SDL_os2.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include "../../SDL_internal.h" - -#if defined(__OS2__) - -#include "SDL_os2.h" - -/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */ -void SDL_OS2Quit(void) -{ - /* Unload DLL used for iconv. We can do it at any time and use iconv again - - * dynamic library will be loaded on first call iconv_open() (see geniconv). */ - libiconv_clean(); -} - -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/SDL_os2.h b/src/core/os2/SDL_os2.h deleted file mode 100644 index 84068cc13..000000000 --- a/src/core/os2/SDL_os2.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_os2_h_ -#define SDL_os2_h_ - -#include "SDL_log.h" -#include "SDL_stdinc.h" - -#ifdef OS2DEBUG -#if (OS2DEBUG-0 >= 2) -# define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \ - __func__ "(): " ##s, ##__VA_ARGS__) -#else -# define debug_os2(s,...) printf(__func__ "(): " ##s "\n", ##__VA_ARGS__) -#endif - -#else /* no debug */ - -# define debug_os2(s,...) do {} while (0) - -#endif /* OS2DEBUG */ - -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -#define OS2_SysToUTF8(S) SDL_iconv_string("UTF-8", "", (char *)(S), SDL_strlen(S)+1) -#define OS2_UTF8ToSys(S) SDL_iconv_string("", "UTF-8", (char *)(S), SDL_strlen(S)+1) -#define libiconv_clean() do {} while(0) -#else -/* StrUTF8New() - geniconv/sys2utf8.c */ -#include "geniconv/geniconv.h" -#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1) -#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1) -#endif - -/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */ -void SDL_OS2Quit(void); - -#endif /* SDL_os2_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/geniconv.c b/src/core/os2/geniconv/geniconv.c deleted file mode 100644 index 5976fe79f..000000000 --- a/src/core/os2/geniconv/geniconv.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -/* - Universal iconv implementation for OS/2. - - Andrey Vasilkin, 2016. -*/ - -#define INCL_DOSMODULEMGR /* Module Manager */ -#define INCL_DOSERRORS /* Error values */ -#include - -#include "geniconv.h" - -/*#define DEBUG*/ -#ifdef DEBUG -# include -# define iconv_debug(s,...) printf(__func__"(): "##s"\n" ,##__VA_ARGS__) -#else -# define iconv_debug(s,...) do {} while (0) -#endif - -/* Exports from os2iconv.c */ -extern iconv_t _System os2_iconv_open (const char* tocode, const char* fromcode); -extern size_t _System os2_iconv (iconv_t cd, - char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); -extern int _System os2_iconv_close (iconv_t cd); - -/* Functions pointers */ -typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*); -typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *); -typedef int (_System *FNICONV_CLOSE)(iconv_t); - -static HMODULE hmIconv = NULLHANDLE; -static FNICONV_OPEN fn_iconv_open = os2_iconv_open; -static FNICONV fn_iconv = os2_iconv; -static FNICONV_CLOSE fn_iconv_close = os2_iconv_close; - -static int geniconv_init = 0; - - -static BOOL _loadDLL(const char *dllname, - const char *sym_iconvopen, - const char *sym_iconv, - const char *sym_iconvclose) -{ - ULONG rc; - char error[256]; - - rc = DosLoadModule(error, sizeof(error), dllname, &hmIconv); - if (rc != NO_ERROR) { - iconv_debug("DLL %s not loaded: %s", dllname, error); - return FALSE; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconvopen, (PFN *)&fn_iconv_open); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconvopen, dllname); - goto fail; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconv, (PFN *)&fn_iconv); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconv, dllname); - goto fail; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconvclose, (PFN *)&fn_iconv_close); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconvclose, dllname); - goto fail; - } - - iconv_debug("DLL %s used", dllname); - return TRUE; - - fail: - DosFreeModule(hmIconv); - hmIconv = NULLHANDLE; - return FALSE; -} - -static void _init(void) -{ - if (geniconv_init) { - return; /* Already initialized */ - } - - geniconv_init = 1; - - /* Try to load kiconv.dll, iconv2.dll or iconv.dll */ - if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") && - !_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") && - !_loadDLL("ICONV", "_iconv_open", "_iconv", "_iconv_close") ) { - /* No DLL was loaded - use OS/2 conversion objects API */ - iconv_debug("Uni*() API used"); - fn_iconv_open = os2_iconv_open; - fn_iconv = os2_iconv; - fn_iconv_close = os2_iconv_close; - } -} - - -/* Public routines. - * ---------------- - */ - -/* function to unload the used iconv dynamic library */ -void libiconv_clean(void) -{ - geniconv_init = 0; - - /* reset the function pointers. */ - fn_iconv_open = os2_iconv_open; - fn_iconv = os2_iconv; - fn_iconv_close = os2_iconv_close; - - if (hmIconv != NULLHANDLE) { - DosFreeModule(hmIconv); - hmIconv = NULLHANDLE; - } -} - -iconv_t libiconv_open(const char* tocode, const char* fromcode) -{ - _init(); - return fn_iconv_open(tocode, fromcode); -} - -size_t libiconv(iconv_t cd, char* * inbuf, size_t *inbytesleft, - char* * outbuf, size_t *outbytesleft) -{ - return fn_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); -} - -int libiconv_close(iconv_t cd) -{ - return fn_iconv_close(cd); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/geniconv.h b/src/core/os2/geniconv/geniconv.h deleted file mode 100644 index 607fe8f8d..000000000 --- a/src/core/os2/geniconv/geniconv.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -/* - Universal iconv implementation for OS/2. - - Andrey Vasilkin, 2016. -*/ - -#ifndef GENICONV_H -#define GENICONV_H - -#include "iconv.h" - -#ifdef iconv_open -#undef iconv_open -#endif -#define iconv_open libiconv_open - -#ifdef iconv -#undef iconv -#endif -#define iconv libiconv - -#ifdef iconv_close -#undef iconv_close -#endif -#define iconv_close libiconv_close - -#define iconv_clean libiconv_clean - -/* Non-standard function for iconv to unload the used dynamic library */ -void libiconv_clean(void); - -iconv_t libiconv_open (const char *tocode, const char *fromcode); -int libiconv_close(iconv_t cd); -size_t libiconv (iconv_t cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - -/* System codepage <-> UTF-8 - * - * StrUTF8() - * Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8 to - * the system cp (to_utf8 is 0). Converted ASCIIZ string will be placed at the - * buffer dst, up to c_dst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes. - * Returns the number of bytes written into dst, not counting the terminating - * 0 byte(s) or -1 on error. - */ -int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src); - -/* StrUTF8New() - * Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8 - * to the system cp (to_utf8 is 0). Memory for the new string is obtained by - * using libc malloc(). - * Returns converted string, terminating two bytes 0 is appended to the result. - * Returns null on error. - */ -char *StrUTF8New(int to_utf8, char *str, int c_str); - -/* StrUTF8Free() - * Deallocates the memory block allocated by StrUTF8New() (just libc free()). - */ -void StrUTF8Free(char *str); - -#endif /* GENICONV_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/iconv.h b/src/core/os2/geniconv/iconv.h deleted file mode 100644 index b336dabe3..000000000 --- a/src/core/os2/geniconv/iconv.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ICONV_H_ /* minimal iconv.h header based on public knowledge */ -#define ICONV_H_ - -#include /* size_t */ -#include - -typedef void *iconv_t; - -#ifdef __cplusplus -extern "C" { -#endif - -extern iconv_t iconv_open(const char *, const char *); -extern size_t iconv(iconv_t, char **, size_t *, char **, size_t *); -extern int iconv_close(iconv_t); - -#ifdef __cplusplus -} -#endif - -#endif /* ICONV_H_ */ diff --git a/src/core/os2/geniconv/makefile b/src/core/os2/geniconv/makefile deleted file mode 100644 index 566c13d29..000000000 --- a/src/core/os2/geniconv/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# Universal iconv implementation for OS/2. -# -# OpenWatcom makefile to build a library that uses kiconv.dll / iconv2.dll / -# iconv.dll or OS/2 Uni*() API. -# -# Andrey Vasilkin, 2016. -# - -LIBFILE = geniconv.lib - -all: $(LIBFILE) test.exe .symbolic - -CFLAGS = -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h -I. -bt=os2 -q -d0 -w2 -DGENICONV_STANDALONE=1 - -SRCS = geniconv.c os2cp.c os2iconv.c -SRCS+= sys2utf8.c - -OBJS = $(SRCS:.c=.obj) - -LIBS = libuls.lib libconv.lib $(LIBFILE) - -test.exe: $(LIBFILE) test.obj - wlink op quiet system os2v2 file test.obj lib {$(LIBS)} name $* - -$(LIBFILE): $(OBJS) - @if exist $@ rm $@ - @for %f in ($(OBJS)) do wlib -q -b $* +%f - -.c.obj: - wcc386 $(CFLAGS) -fo=$^@ $< - -clean: .SYMBOLIC - @if exist *.obj rm *.obj - @if exist *.err rm *.err - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist test.exe rm test.exe diff --git a/src/core/os2/geniconv/os2cp.c b/src/core/os2/geniconv/os2cp.c deleted file mode 100644 index 0a651e17d..000000000 --- a/src/core/os2/geniconv/os2cp.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#define INCL_DOSNLS -#define INCL_DOSERRORS -#include - -#include "os2cp.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#include -#define SDL_isspace isspace -#define SDL_strchr strchr -#define SDL_memcpy memcpy -#define SDL_strupr strupr -#define SDL_strcmp strcmp -#endif - -typedef struct _CP2NAME { - ULONG ulCode; - PSZ pszName; -} CP2NAME; - -typedef struct _NAME2CP { - PSZ pszName; - ULONG ulCode; -} NAME2CP; - -static CP2NAME aCP2Name[] = { - {367, "ANSI_X3.4-1968"}, - {813, "ECMA-118"}, - {819, "CP819"}, - {850, "850"}, - {862, "862"}, - {866, "866"}, - {874, "ISO-IR-166"}, - {878, "KOI8-R"}, - {896, "JISX0201-1976"}, - {901, "ISO-8859-13"}, - {912, "ISO-8859-2"}, - {913, "ISO-8859-3"}, - {914, "ISO-8859-4"}, - {915, "CYRILLIC"}, - {920, "ISO-8859-9"}, - {923, "ISO-8859-15"}, - {943, "MS_KANJI"}, - {954, "EUC-JP"}, - {964, "EUC-TW"}, - {970, "EUC-KR"}, - {1051, "HP-ROMAN8"}, - {1089, "ARABIC"}, - {1129, "VISCII"}, - {1168, "KOI8-U"}, - {1200, "ISO-10646-UCS-2"}, - {1202, "UTF-16LE"}, - {1204, "UCS-2BE"}, - {1208, "UTF-8"}, - {1232, "UTF-32BE"}, - {1234, "UTF-32LE"}, - {1236, "ISO-10646-UCS-4"}, - {1250, "CP1250"}, - {1251, "CP1251"}, - {1252, "CP1252"}, - {1253, "CP1253"}, - {1254, "CP1254"}, - {1255, "CP1255"}, - {1256, "CP1256"}, - {1257, "CP1257"}, - {1275, "MAC"}, - {1383, "CN-GB"}, - {1386, "GBK"}, - {1392, "GB18030"}, - {62210, "HEBREW"} -}; - -static NAME2CP aName2CP[] = { - {"850", 850}, - {"862", 862}, - {"866", 866}, - {"ANSI_X3.4-1968", 367}, - {"ANSI_X3.4-1986", 367}, - {"ARABIC", 1089}, - {"ASCII", 367}, - {"ASMO-708", 1089}, - {"CN-GB", 1383}, - {"CP1250", 1250}, - {"CP1251", 1251}, - {"CP1252", 1252}, - {"CP1253", 1253}, - {"CP1254", 1254}, - {"CP1255", 1255}, - {"CP1256", 1256}, - {"CP1257", 1257}, - {"CP367", 367}, - {"CP819", 819}, - {"CP850", 850}, - {"CP862", 862}, - {"CP866", 866}, - {"CP936", 1386}, - {"CSASCII", 367}, - {"CSEUCKR", 970}, - {"CSEUCPKDFMTJAPANESE", 954}, - {"CSEUCTW", 964}, - {"CSGB2312", 1383}, - {"CSHALFWIDTHKATAKANA", 896}, - {"CSHPROMAN8", 1051}, - {"CSIBM866", 866}, - {"CSISOLATIN1", 819}, - {"CSISOLATIN2", 912}, - {"CSISOLATIN3", 913}, - {"CSISOLATIN4", 914}, - {"CSISOLATIN5", 920}, - {"CSISOLATINARABIC", 1089}, - {"CSISOLATINCYRILLIC", 915}, - {"CSISOLATINGREEK", 813}, - {"CSISOLATINHEBREW", 62210}, - {"CSKOI8R", 878}, - {"CSKSC56011987", 970}, - {"CSMACINTOSH", 1275}, - {"CSPC850MULTILINGUAL", 850}, - {"CSPC862LATINHEBREW", 862}, - {"CSSHIFTJIS", 943}, - {"CSUCS4", 1236}, - {"CSUNICODE", 1200}, - {"CSUNICODE11", 1204}, - {"CSVISCII", 1129}, - {"CYRILLIC", 915}, - {"ECMA-114", 1089}, - {"ECMA-118", 813}, - {"ELOT_928", 813}, - {"EUC-CN", 1383}, - {"EUC-JP", 954}, - {"EUC-KR", 970}, - {"EUC-TW", 964}, - {"EUCCN", 1383}, - {"EUCJP", 954}, - {"EUCKR", 970}, - {"EUCTW", 964}, - {"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 954}, - {"GB18030", 1392}, - {"GB2312", 1383}, - {"GBK", 1386}, - {"GREEK", 813}, - {"GREEK8", 813}, - {"HEBREW", 62210}, - {"HP-ROMAN8", 1051}, - {"IBM367", 367}, - {"IBM819", 819}, - {"IBM850", 850}, - {"IBM862", 862}, - {"IBM866", 866}, - {"ISO-10646-UCS-2", 1200}, - {"ISO-10646-UCS-4", 1236}, - {"ISO-8859-1", 819}, - {"ISO-8859-13", 901}, - {"ISO-8859-15", 923}, - {"ISO-8859-2", 912}, - {"ISO-8859-3", 913}, - {"ISO-8859-4", 914}, - {"ISO-8859-5", 915}, - {"ISO-8859-6", 1089}, - {"ISO-8859-7", 813}, - {"ISO-8859-8", 62210}, - {"ISO-8859-9", 920}, - {"ISO-IR-100", 819}, - {"ISO-IR-101", 912}, - {"ISO-IR-109", 913}, - {"ISO-IR-110", 914}, - {"ISO-IR-126", 813}, - {"ISO-IR-127", 1089}, - {"ISO-IR-138", 62210}, - {"ISO-IR-144", 915}, - {"ISO-IR-148", 920}, - {"ISO-IR-149", 970}, - {"ISO-IR-166", 874}, - {"ISO-IR-179", 901}, - {"ISO-IR-203", 923}, - {"ISO-IR-6", 367}, - {"ISO646-US", 367}, - {"ISO8859-1", 819}, - {"ISO8859-13", 901}, - {"ISO8859-15", 923}, - {"ISO8859-2", 912}, - {"ISO8859-3", 913}, - {"ISO8859-4", 914}, - {"ISO8859-5", 915}, - {"ISO8859-6", 1089}, - {"ISO8859-7", 813}, - {"ISO8859-8", 62210}, - {"ISO8859-9", 920}, - {"ISO_646.IRV:1991", 367}, - {"ISO_8859-1", 819}, - {"ISO_8859-13", 901}, - {"ISO_8859-15", 923}, - {"ISO_8859-15:1998", 923}, - {"ISO_8859-1:1987", 819}, - {"ISO_8859-2", 912}, - {"ISO_8859-2:1987", 912}, - {"ISO_8859-3", 913}, - {"ISO_8859-3:1988", 913}, - {"ISO_8859-4", 914}, - {"ISO_8859-4:1988", 914}, - {"ISO_8859-5", 915}, - {"ISO_8859-5:1988", 915}, - {"ISO_8859-6", 1089}, - {"ISO_8859-6:1987", 1089}, - {"ISO_8859-7", 813}, - {"ISO_8859-7:1987", 813}, - {"ISO_8859-7:2003", 813}, - {"ISO_8859-8", 62210}, - {"ISO_8859-8:1988", 62210}, - {"ISO_8859-9", 920}, - {"ISO_8859-9:1989", 920}, - {"JISX0201-1976", 896}, - {"JIS_X0201", 896}, - {"KOI8-R", 878}, - {"KOI8-U", 1168}, - {"KOREAN", 970}, - {"KSC_5601", 970}, - {"KS_C_5601-1987", 970}, - {"KS_C_5601-1989", 970}, - {"L1", 819}, - {"L2", 912}, - {"L3", 913}, - {"L4", 914}, - {"L5", 920}, - {"L7", 901}, - {"LATIN-9", 923}, - {"LATIN1", 819}, - {"LATIN2", 912}, - {"LATIN3", 913}, - {"LATIN4", 914}, - {"LATIN5", 920}, - {"LATIN7", 901}, - {"MAC", 1275}, - {"MACINTOSH", 1275}, - {"MACROMAN", 1275}, - {"MS-ANSI", 1252}, - {"MS-ARAB", 1256}, - {"MS-CYRL", 1251}, - {"MS-EE", 1250}, - {"MS-GREEK", 1253}, - {"MS-HEBR", 1255}, - {"MS-TURK", 1254}, - {"MS936", 1386}, - {"MS_KANJI", 943}, - {"R8", 1051}, - {"ROMAN8", 1051}, - {"SHIFT-JIS", 943}, - {"SHIFT_JIS", 943}, - {"SJIS", 943}, - {"TIS-620", 874}, - {"TIS620", 874}, - {"TIS620-0", 874}, - {"TIS620.2529-1", 874}, - {"TIS620.2533-0", 874}, - {"TIS620.2533-1", 874}, - {"UCS-2", 1200}, - {"UCS-2BE", 1204}, - {"UCS-4", 1236}, - {"UNICODE-1-1", 1204}, - {"UNICODEBIG", 1204}, - {"US", 367}, - {"US-ASCII", 367}, - {"UTF-16", 1204}, - {"UTF-16BE", 1200}, - {"UTF-16LE", 1202}, - {"UTF-32", 1236}, - {"UTF-32BE", 1232}, - {"UTF-32LE", 1234}, - {"UTF-8", 1208}, - {"VISCII", 1129}, - {"VISCII1.1-1", 1129}, - {"WINBALTRIM", 1257}, - {"WINDOWS-1250", 1250}, - {"WINDOWS-1251", 1251}, - {"WINDOWS-1252", 1252}, - {"WINDOWS-1253", 1253}, - {"WINDOWS-1254", 1254}, - {"WINDOWS-1255", 1255}, - {"WINDOWS-1256", 1256}, - {"WINDOWS-1257", 1257}, - {"WINDOWS-936", 1386}, - {"X0201", 896} -}; - -char *os2cpToName(unsigned long cp) -{ - ULONG ulLo = 0; - ULONG ulHi = (sizeof(aCP2Name) / sizeof(struct _CP2NAME)) - 1; - ULONG ulNext; - LONG lFound = -1; - - if (cp == SYSTEM_CP) { - ULONG aulCP[3]; - ULONG cCP; - if (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR) { - return NULL; - } - cp = aulCP[0]; - } - - if (aCP2Name[0].ulCode > cp || aCP2Name[ulHi].ulCode < cp) { - return NULL; - } - if (aCP2Name[0].ulCode == cp) { - return aCP2Name[0].pszName; - } - if (aCP2Name[ulHi].ulCode == cp) { - return aCP2Name[ulHi].pszName; - } - - while ((ulHi - ulLo) > 1) { - ulNext = (ulLo + ulHi) / 2; - - if (aCP2Name[ulNext].ulCode < cp) { - ulLo = ulNext; - } else if (aCP2Name[ulNext].ulCode > cp) { - ulHi = ulNext; - } else { - lFound = ulNext; - break; - } - } - - return (lFound == -1)? NULL : aCP2Name[lFound].pszName; -} - -unsigned long os2cpFromName(char *cp) -{ - ULONG ulLo = 0; - ULONG ulHi = (sizeof(aName2CP) / sizeof(struct _NAME2CP)) - 1; - ULONG ulNext; - LONG lFound = -1; - LONG lCmp; - PCHAR pcEnd; - CHAR acBuf[64]; - - if (cp == NULL) { - ULONG aulCP[3]; - ULONG cCP; - return (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)? 0 : aulCP[0]; - } - - while (SDL_isspace((unsigned char) *cp)) { - cp++; - } - - pcEnd = SDL_strchr(cp, ' '); - if (pcEnd == NULL) { - pcEnd = SDL_strchr(cp, '\0'); - } - ulNext = pcEnd - cp; - if (ulNext >= sizeof(acBuf)) { - return 0; - } - - SDL_memcpy(acBuf, cp, ulNext); - acBuf[ulNext] = '\0'; - SDL_strupr(acBuf); - - lCmp = SDL_strcmp(aName2CP[0].pszName, acBuf); - if (lCmp > 0) { - return 0; - } - if (lCmp == 0) { - return aName2CP[0].ulCode; - } - - lCmp = SDL_strcmp(aName2CP[ulHi].pszName, acBuf); - if (lCmp < 0) { - return 0; - } - if (lCmp == 0) { - return aName2CP[ulHi].ulCode; - } - - while ((ulHi - ulLo) > 1) { - ulNext = (ulLo + ulHi) / 2; - - lCmp = SDL_strcmp(aName2CP[ulNext].pszName, acBuf); - if (lCmp < 0) { - ulLo = ulNext; - } else if (lCmp > 0) { - ulHi = ulNext; - } else { - lFound = ulNext; - break; - } - } - - return (lFound == -1)? 0 : aName2CP[lFound].ulCode; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/os2cp.h b/src/core/os2/geniconv/os2cp.h deleted file mode 100644 index db3e167ec..000000000 --- a/src/core/os2/geniconv/os2cp.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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 OS2CP_H -#define OS2CP_H 1 - -#define SYSTEM_CP 0 - -char *os2cpToName(unsigned long cp); -unsigned long os2cpFromName(char *cp); - -#endif /* OS2CP_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/os2iconv.c b/src/core/os2/geniconv/os2iconv.c deleted file mode 100644 index 13ad2cdc6..000000000 --- a/src/core/os2/geniconv/os2iconv.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -/* - Implementation iconv via OS/2 conversion objects API. - - Andrey Vasilkin. -*/ - -#define ICONV_THREAD_SAFE 1 - -#include "geniconv.h" -#define _ULS_CALLCONV_ -#define CALLCONV _System -#include -#ifdef ICONV_THREAD_SAFE -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#include -#endif - -#include "os2cp.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#include -#include -#if !defined(min) -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#endif -#define SDL_min min -#define SDL_strcasecmp stricmp -#define SDL_snprintf _snprintf -#define SDL_malloc malloc -#define SDL_free free -#define SDL_memcpy memcpy -#endif - -#define MAX_CP_NAME_LEN 64 - -typedef struct iuconv_obj { - UconvObject uo_tocode; - UconvObject uo_fromcode; - int buf_len; - UniChar *buf; -#ifdef ICONV_THREAD_SAFE - HMTX hMtx; -#endif -} iuconv_obj; - - -static int _createUconvObj(const char *code, UconvObject *uobj) -{ - UniChar uc_code[MAX_CP_NAME_LEN]; - int i; - const unsigned char *ch = - (const unsigned char *)code; - - if (code == NULL) - uc_code[0] = 0; - else { - for (i = 0; i < MAX_CP_NAME_LEN; i++) { - uc_code[i] = (unsigned short)*ch; - if (! (*ch)) - break; - ch++; - } - } - - return UniCreateUconvObject(uc_code, uobj); -} - -static int uconv_open(const char *code, UconvObject *uobj) -{ - int rc; - - if (!SDL_strcasecmp(code, "UTF-16")) { - *uobj = NULL; - return ULS_SUCCESS; - } - - rc = _createUconvObj(code, uobj); - if (rc != ULS_SUCCESS) { - unsigned long cp = os2cpFromName((char *)code); - char cp_name[16]; - if (cp != 0 && SDL_snprintf(cp_name, sizeof(cp_name), "IBM-%u", cp) > 0) { - rc = _createUconvObj(cp_name, uobj); - } - } - - return rc; -} - - -iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode) -{ - UconvObject uo_tocode; - UconvObject uo_fromcode; - int rc; - iuconv_obj *iuobj; - - if (tocode == NULL) { - tocode = ""; - } - if (fromcode == NULL) { - fromcode = ""; - } - - if (SDL_strcasecmp(tocode, fromcode) != 0) { - rc = uconv_open(fromcode, &uo_fromcode); - if (rc != ULS_SUCCESS) { - errno = EINVAL; - return (iconv_t)(-1); - } - rc = uconv_open(tocode, &uo_tocode); - if (rc != ULS_SUCCESS) { - UniFreeUconvObject(uo_fromcode); - errno = EINVAL; - return (iconv_t)(-1); - } - } else { - uo_tocode = NULL; - uo_fromcode = NULL; - } - - iuobj = (iuconv_obj *) SDL_malloc(sizeof(iuconv_obj)); - iuobj->uo_tocode = uo_tocode; - iuobj->uo_fromcode = uo_fromcode; - iuobj->buf_len = 0; - iuobj->buf = NULL; -#ifdef ICONV_THREAD_SAFE - DosCreateMutexSem(NULL, &iuobj->hMtx, 0, FALSE); -#endif - - return iuobj; -} - -size_t _System os2_iconv(iconv_t cd, - char **inbuf, size_t *inbytesleft , - char **outbuf, size_t *outbytesleft) -{ - UconvObject uo_tocode = ((iuconv_obj *)(cd))->uo_tocode; - UconvObject uo_fromcode = ((iuconv_obj *)(cd))->uo_fromcode; - size_t nonIdenticalConv = 0; - UniChar *uc_buf; - size_t uc_buf_len; - UniChar **uc_str; - size_t *uc_str_len; - int rc; - size_t ret = (size_t)(-1); - - if (uo_tocode == NULL && uo_fromcode == NULL) { - uc_buf_len = SDL_min(*inbytesleft, *outbytesleft); - SDL_memcpy(*outbuf, *inbuf, uc_buf_len); - *inbytesleft -= uc_buf_len; - *outbytesleft -= uc_buf_len; - outbuf += uc_buf_len; - inbuf += uc_buf_len; - return uc_buf_len; - } - -#ifdef ICONV_THREAD_SAFE - DosRequestMutexSem(((iuconv_obj *)(cd))->hMtx, SEM_INDEFINITE_WAIT); -#endif - - if (uo_tocode && uo_fromcode && (((iuconv_obj *)cd)->buf_len >> 1) < *inbytesleft) { - if (((iuconv_obj *)cd)->buf != NULL) { - SDL_free(((iuconv_obj *)cd)->buf); - } - ((iuconv_obj *)cd)->buf_len = *inbytesleft << 1; - ((iuconv_obj *)cd)->buf = (UniChar *) SDL_malloc(((iuconv_obj *)cd)->buf_len); - } - - if (uo_fromcode) { - if (uo_tocode) { - uc_buf = ((iuconv_obj *)cd)->buf; - uc_buf_len = ((iuconv_obj *)cd)->buf_len; - uc_str = &uc_buf; - } else { - uc_str = (UniChar **)outbuf; - uc_buf_len = *outbytesleft; - } - uc_buf_len = uc_buf_len >> 1; - uc_str_len = &uc_buf_len; - rc = UniUconvToUcs(uo_fromcode, (void **)inbuf, inbytesleft, - uc_str, uc_str_len, &nonIdenticalConv); - uc_buf_len = uc_buf_len << 1; - if (!uo_tocode) { - *outbytesleft = uc_buf_len; - } - - if (rc != ULS_SUCCESS) { - errno = EILSEQ; - goto done; - } else if (*inbytesleft && !*uc_str_len) { - errno = E2BIG; - goto done; - } - - if (!uo_tocode) { - return nonIdenticalConv; - } - - uc_buf = ((iuconv_obj *)cd)->buf; - uc_buf_len = ((iuconv_obj *)cd)->buf_len - uc_buf_len; - uc_str = &uc_buf; - uc_str_len = &uc_buf_len; - } else { - uc_str = (UniChar **)inbuf; - uc_str_len = inbytesleft; - } - - *uc_str_len = *uc_str_len>>1; - rc = UniUconvFromUcs(uo_tocode, uc_str, uc_str_len, (void **)outbuf, - outbytesleft, &nonIdenticalConv); - if (rc != ULS_SUCCESS) { - switch (rc) { - case ULS_BUFFERFULL: - errno = E2BIG; - break; - case ULS_ILLEGALSEQUENCE: - errno = EILSEQ; - break; - case ULS_INVALID: - errno = EINVAL; - break; - } - goto done; - } else if (*uc_str_len && !*outbytesleft) { - errno = E2BIG; - goto done; - } - - ret = nonIdenticalConv; - -done: - -#ifdef ICONV_THREAD_SAFE - DosReleaseMutexSem(((iuconv_obj *)cd)->hMtx); -#endif - return ret; -} - -int _System os2_iconv_close(iconv_t cd) -{ - if (!cd) return 0; - -#ifdef ICONV_THREAD_SAFE - DosCloseMutexSem(((iuconv_obj *)cd)->hMtx); -#endif - if (((iuconv_obj *)cd)->uo_tocode != NULL) { - UniFreeUconvObject(((iuconv_obj *)cd)->uo_tocode); - } - if (((iuconv_obj *)cd)->uo_fromcode != NULL) { - UniFreeUconvObject(((iuconv_obj *)cd)->uo_fromcode); - } - - if (((iuconv_obj *)cd)->buf != NULL) { - SDL_free(((iuconv_obj *)cd)->buf); - } - SDL_free(cd); - - return 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/sys2utf8.c b/src/core/os2/geniconv/sys2utf8.c deleted file mode 100644 index 753e9b67f..000000000 --- a/src/core/os2/geniconv/sys2utf8.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include "geniconv.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#define SDL_malloc malloc -#define SDL_realloc realloc -#define SDL_free free -#endif - -int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src) -{ - size_t rc; - char *dststart = dst; - iconv_t cd; - char *tocp, *fromcp; - int err = 0; - - if (c_dst < 4) { - return -1; - } - - if (to_utf8) { - tocp = "UTF-8"; - fromcp = ""; - } else { - tocp = ""; - fromcp = "UTF-8"; - } - - cd = iconv_open(tocp, fromcp); - if (cd == (iconv_t)-1) { - return -1; - } - - while (c_src > 0) { - rc = iconv(cd, &src, (size_t *)&c_src, &dst, (size_t *)&c_dst); - if (rc == (size_t)-1) { - if (errno == EILSEQ) { - /* Try to skip invalid character */ - src++; - c_src--; - continue; - } - - err = 1; - break; - } - } - - iconv_close(cd); - - /* Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp) */ - if (to_utf8) { - if (c_dst < 1) { - dst--; - err = 1; /* The destination buffer overflow */ - } - *dst = '\0'; - } else { - if (c_dst < 2) { - dst -= (c_dst == 0) ? 2 : 1; - err = 1; /* The destination buffer overflow */ - } - *((short *)dst) = '\0'; - } - - return (err) ? -1 : (dst - dststart); -} - -char *StrUTF8New(int to_utf8, char *str, int c_str) -{ - int c_newstr = (((c_str > 4) ? c_str : 4) + 1) * 2; - char * newstr = (char *) SDL_malloc(c_newstr); - - if (newstr == NULL) { - return NULL; - } - - c_newstr = StrUTF8(to_utf8, newstr, c_newstr, str, c_str); - if (c_newstr != -1) { - str = (char *) SDL_realloc(newstr, c_newstr + ((to_utf8) ? 1 : sizeof(short))); - if (str) { - return str; - } - } - - SDL_free(newstr); - return NULL; -} - -void StrUTF8Free(char *str) -{ - SDL_free(str); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/test.c b/src/core/os2/geniconv/test.c deleted file mode 100644 index 25e16228a..000000000 --- a/src/core/os2/geniconv/test.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include -#include -#include -#include "geniconv.h" - -int main(void) -{ - char acBuf[128]; - char *inbuf = "ôÅÓÔ - ÐÒÏ×ÅÒËÁ"; /* KOI8-R string */ - size_t inbytesleft = strlen(inbuf); - char *outbuf = acBuf; - size_t outbytesleft = sizeof(acBuf); - iconv_t ic; - - /* KOI8 -> system cp */ - ic = iconv_open("", "KOI8-R"); - if (ic == (iconv_t)(-1)) { - puts("iconv_open() fail"); - return 1; - } - - iconv(ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft); - printf("KOI8-R to system cp: %s\n", acBuf); - - iconv_close(ic); - - /* System cp -> UTF-8 -> system cp: */ - - /* System cp -> UTF-8 by StrUTF8New() */ - inbuf = StrUTF8New(1, acBuf, strlen(acBuf)); - - /* UTF-8 -> system cp. by StrUTF8() */ - if (StrUTF8(0, acBuf, sizeof(acBuf), inbuf, strlen(inbuf)) == -1) { - puts("StrUTF8() failed"); - } else { - printf("system cp. -> UTF-8 -> system cp.: %s\n", acBuf); - } - - free(inbuf); - - /* Unload used DLL */ - iconv_clean(); - - puts("Done."); - return 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/iconv2.lbc b/src/core/os2/iconv2.lbc deleted file mode 100644 index d9c68753f..000000000 --- a/src/core/os2/iconv2.lbc +++ /dev/null @@ -1,4 +0,0 @@ -# OpenWatcom exports file for libiconv -++'libiconv'.'ICONV2'..'_libiconv' -++'libiconv_close'.'ICONV2'..'_libiconv_close' -++'libiconv_open'.'ICONV2'..'_libiconv_open' diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 540f6a54e..b922418a1 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -27,14 +27,6 @@ #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" #endif -#if defined(__OS2__) -#undef HAVE_SYSCTLBYNAME -#define INCL_DOS -#include -#ifndef QSV_NUMPROCESSORS -#define QSV_NUMPROCESSORS 26 -#endif -#endif /* CPU feature detection for SDL */ @@ -680,12 +672,6 @@ SDL_GetCPUCount(void) SDL_CPUCount = info.dwNumberOfProcessors; } #endif -#ifdef __OS2__ - if (SDL_CPUCount <= 0) { - DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, - &SDL_CPUCount, sizeof(SDL_CPUCount) ); - } -#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -1064,13 +1050,6 @@ SDL_GetSystemRAM(void) } } #endif -#ifdef __OS2__ - if (SDL_SystemRAM <= 0) { - Uint32 sysram = 0; - DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); - SDL_SystemRAM = (int) (sysram / 0x100000U); - } -#endif #ifdef __RISCOS__ if (SDL_SystemRAM <= 0) { _kernel_swi_regs regs; diff --git a/src/dynapi/SDL3.exports b/src/dynapi/SDL3.exports deleted file mode 100644 index 7bc5863a3..000000000 --- a/src/dynapi/SDL3.exports +++ /dev/null @@ -1,869 +0,0 @@ -# Windows exports file for Watcom -# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. -++'_SDL_DYNAPI_entry'.'SDL3.dll'.'SDL_DYNAPI_entry' -++'_SDL_SetError'.'SDL3.dll'.'SDL_SetError' -++'_SDL_Log'.'SDL3.dll'.'SDL_Log' -++'_SDL_LogVerbose'.'SDL3.dll'.'SDL_LogVerbose' -++'_SDL_LogDebug'.'SDL3.dll'.'SDL_LogDebug' -++'_SDL_LogInfo'.'SDL3.dll'.'SDL_LogInfo' -++'_SDL_LogWarn'.'SDL3.dll'.'SDL_LogWarn' -++'_SDL_LogError'.'SDL3.dll'.'SDL_LogError' -++'_SDL_LogCritical'.'SDL3.dll'.'SDL_LogCritical' -++'_SDL_LogMessage'.'SDL3.dll'.'SDL_LogMessage' -++'_SDL_sscanf'.'SDL3.dll'.'SDL_sscanf' -++'_SDL_snprintf'.'SDL3.dll'.'SDL_snprintf' -++'_SDL_CreateThread'.'SDL3.dll'.'SDL_CreateThread' -++'_SDL_RWFromFP'.'SDL3.dll'.'SDL_RWFromFP' -++'_SDL_RegisterApp'.'SDL3.dll'.'SDL_RegisterApp' -++'_SDL_UnregisterApp'.'SDL3.dll'.'SDL_UnregisterApp' -++'_SDL_Direct3D9GetAdapterIndex'.'SDL3.dll'.'SDL_Direct3D9GetAdapterIndex' -++'_SDL_RenderGetD3D9Device'.'SDL3.dll'.'SDL_RenderGetD3D9Device' -# ++'_SDL_iPhoneSetAnimationCallback'.'SDL3.dll'.'SDL_iPhoneSetAnimationCallback' -# ++'_SDL_iPhoneSetEventPump'.'SDL3.dll'.'SDL_iPhoneSetEventPump' -# ++'_SDL_AndroidGetJNIEnv'.'SDL3.dll'.'SDL_AndroidGetJNIEnv' -# ++'_SDL_AndroidGetActivity'.'SDL3.dll'.'SDL_AndroidGetActivity' -# ++'_SDL_AndroidGetInternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetInternalStoragePath' -# ++'_SDL_AndroidGetExternalStorageState'.'SDL3.dll'.'SDL_AndroidGetExternalStorageState' -# ++'_SDL_AndroidGetExternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetExternalStoragePath' -++'_SDL_Init'.'SDL3.dll'.'SDL_Init' -++'_SDL_InitSubSystem'.'SDL3.dll'.'SDL_InitSubSystem' -++'_SDL_QuitSubSystem'.'SDL3.dll'.'SDL_QuitSubSystem' -++'_SDL_WasInit'.'SDL3.dll'.'SDL_WasInit' -++'_SDL_Quit'.'SDL3.dll'.'SDL_Quit' -++'_SDL_ReportAssertion'.'SDL3.dll'.'SDL_ReportAssertion' -++'_SDL_SetAssertionHandler'.'SDL3.dll'.'SDL_SetAssertionHandler' -++'_SDL_GetAssertionReport'.'SDL3.dll'.'SDL_GetAssertionReport' -++'_SDL_ResetAssertionReport'.'SDL3.dll'.'SDL_ResetAssertionReport' -++'_SDL_AtomicTryLock'.'SDL3.dll'.'SDL_AtomicTryLock' -++'_SDL_AtomicLock'.'SDL3.dll'.'SDL_AtomicLock' -++'_SDL_AtomicUnlock'.'SDL3.dll'.'SDL_AtomicUnlock' -++'_SDL_AtomicCAS'.'SDL3.dll'.'SDL_AtomicCAS' -++'_SDL_AtomicSet'.'SDL3.dll'.'SDL_AtomicSet' -++'_SDL_AtomicGet'.'SDL3.dll'.'SDL_AtomicGet' -++'_SDL_AtomicAdd'.'SDL3.dll'.'SDL_AtomicAdd' -++'_SDL_AtomicCASPtr'.'SDL3.dll'.'SDL_AtomicCASPtr' -++'_SDL_AtomicSetPtr'.'SDL3.dll'.'SDL_AtomicSetPtr' -++'_SDL_AtomicGetPtr'.'SDL3.dll'.'SDL_AtomicGetPtr' -++'_SDL_GetNumAudioDrivers'.'SDL3.dll'.'SDL_GetNumAudioDrivers' -++'_SDL_GetAudioDriver'.'SDL3.dll'.'SDL_GetAudioDriver' -++'_SDL_AudioInit'.'SDL3.dll'.'SDL_AudioInit' -++'_SDL_AudioQuit'.'SDL3.dll'.'SDL_AudioQuit' -++'_SDL_GetCurrentAudioDriver'.'SDL3.dll'.'SDL_GetCurrentAudioDriver' -++'_SDL_OpenAudio'.'SDL3.dll'.'SDL_OpenAudio' -++'_SDL_GetNumAudioDevices'.'SDL3.dll'.'SDL_GetNumAudioDevices' -++'_SDL_GetAudioDeviceName'.'SDL3.dll'.'SDL_GetAudioDeviceName' -++'_SDL_OpenAudioDevice'.'SDL3.dll'.'SDL_OpenAudioDevice' -++'_SDL_GetAudioStatus'.'SDL3.dll'.'SDL_GetAudioStatus' -++'_SDL_GetAudioDeviceStatus'.'SDL3.dll'.'SDL_GetAudioDeviceStatus' -++'_SDL_PauseAudio'.'SDL3.dll'.'SDL_PauseAudio' -++'_SDL_PauseAudioDevice'.'SDL3.dll'.'SDL_PauseAudioDevice' -++'_SDL_LoadWAV_RW'.'SDL3.dll'.'SDL_LoadWAV_RW' -++'_SDL_FreeWAV'.'SDL3.dll'.'SDL_FreeWAV' -++'_SDL_BuildAudioCVT'.'SDL3.dll'.'SDL_BuildAudioCVT' -++'_SDL_ConvertAudio'.'SDL3.dll'.'SDL_ConvertAudio' -++'_SDL_MixAudio'.'SDL3.dll'.'SDL_MixAudio' -++'_SDL_MixAudioFormat'.'SDL3.dll'.'SDL_MixAudioFormat' -++'_SDL_LockAudio'.'SDL3.dll'.'SDL_LockAudio' -++'_SDL_LockAudioDevice'.'SDL3.dll'.'SDL_LockAudioDevice' -++'_SDL_UnlockAudio'.'SDL3.dll'.'SDL_UnlockAudio' -++'_SDL_UnlockAudioDevice'.'SDL3.dll'.'SDL_UnlockAudioDevice' -++'_SDL_CloseAudio'.'SDL3.dll'.'SDL_CloseAudio' -++'_SDL_CloseAudioDevice'.'SDL3.dll'.'SDL_CloseAudioDevice' -++'_SDL_SetClipboardText'.'SDL3.dll'.'SDL_SetClipboardText' -++'_SDL_GetClipboardText'.'SDL3.dll'.'SDL_GetClipboardText' -++'_SDL_HasClipboardText'.'SDL3.dll'.'SDL_HasClipboardText' -++'_SDL_GetCPUCount'.'SDL3.dll'.'SDL_GetCPUCount' -++'_SDL_GetCPUCacheLineSize'.'SDL3.dll'.'SDL_GetCPUCacheLineSize' -++'_SDL_HasRDTSC'.'SDL3.dll'.'SDL_HasRDTSC' -++'_SDL_HasAltiVec'.'SDL3.dll'.'SDL_HasAltiVec' -++'_SDL_HasMMX'.'SDL3.dll'.'SDL_HasMMX' -++'_SDL_Has3DNow'.'SDL3.dll'.'SDL_Has3DNow' -++'_SDL_HasSSE'.'SDL3.dll'.'SDL_HasSSE' -++'_SDL_HasSSE2'.'SDL3.dll'.'SDL_HasSSE2' -++'_SDL_HasSSE3'.'SDL3.dll'.'SDL_HasSSE3' -++'_SDL_HasSSE41'.'SDL3.dll'.'SDL_HasSSE41' -++'_SDL_HasSSE42'.'SDL3.dll'.'SDL_HasSSE42' -++'_SDL_GetSystemRAM'.'SDL3.dll'.'SDL_GetSystemRAM' -++'_SDL_GetError'.'SDL3.dll'.'SDL_GetError' -++'_SDL_ClearError'.'SDL3.dll'.'SDL_ClearError' -++'_SDL_Error'.'SDL3.dll'.'SDL_Error' -++'_SDL_PumpEvents'.'SDL3.dll'.'SDL_PumpEvents' -++'_SDL_PeepEvents'.'SDL3.dll'.'SDL_PeepEvents' -++'_SDL_HasEvent'.'SDL3.dll'.'SDL_HasEvent' -++'_SDL_HasEvents'.'SDL3.dll'.'SDL_HasEvents' -++'_SDL_FlushEvent'.'SDL3.dll'.'SDL_FlushEvent' -++'_SDL_FlushEvents'.'SDL3.dll'.'SDL_FlushEvents' -++'_SDL_PollEvent'.'SDL3.dll'.'SDL_PollEvent' -++'_SDL_WaitEvent'.'SDL3.dll'.'SDL_WaitEvent' -++'_SDL_WaitEventTimeout'.'SDL3.dll'.'SDL_WaitEventTimeout' -++'_SDL_PushEvent'.'SDL3.dll'.'SDL_PushEvent' -++'_SDL_SetEventFilter'.'SDL3.dll'.'SDL_SetEventFilter' -++'_SDL_GetEventFilter'.'SDL3.dll'.'SDL_GetEventFilter' -++'_SDL_AddEventWatch'.'SDL3.dll'.'SDL_AddEventWatch' -++'_SDL_DelEventWatch'.'SDL3.dll'.'SDL_DelEventWatch' -++'_SDL_FilterEvents'.'SDL3.dll'.'SDL_FilterEvents' -++'_SDL_EventState'.'SDL3.dll'.'SDL_EventState' -++'_SDL_RegisterEvents'.'SDL3.dll'.'SDL_RegisterEvents' -++'_SDL_GetBasePath'.'SDL3.dll'.'SDL_GetBasePath' -++'_SDL_GetPrefPath'.'SDL3.dll'.'SDL_GetPrefPath' -++'_SDL_GameControllerAddMapping'.'SDL3.dll'.'SDL_GameControllerAddMapping' -++'_SDL_GameControllerMappingForGUID'.'SDL3.dll'.'SDL_GameControllerMappingForGUID' -++'_SDL_GameControllerMapping'.'SDL3.dll'.'SDL_GameControllerMapping' -++'_SDL_IsGameController'.'SDL3.dll'.'SDL_IsGameController' -++'_SDL_GameControllerNameForIndex'.'SDL3.dll'.'SDL_GameControllerNameForIndex' -++'_SDL_GameControllerOpen'.'SDL3.dll'.'SDL_GameControllerOpen' -++'_SDL_GameControllerName'.'SDL3.dll'.'SDL_GameControllerName' -++'_SDL_GameControllerGetAttached'.'SDL3.dll'.'SDL_GameControllerGetAttached' -++'_SDL_GameControllerGetJoystick'.'SDL3.dll'.'SDL_GameControllerGetJoystick' -++'_SDL_GameControllerEventState'.'SDL3.dll'.'SDL_GameControllerEventState' -++'_SDL_GameControllerUpdate'.'SDL3.dll'.'SDL_GameControllerUpdate' -++'_SDL_GameControllerGetAxisFromString'.'SDL3.dll'.'SDL_GameControllerGetAxisFromString' -++'_SDL_GameControllerGetStringForAxis'.'SDL3.dll'.'SDL_GameControllerGetStringForAxis' -++'_SDL_GameControllerGetBindForAxis'.'SDL3.dll'.'SDL_GameControllerGetBindForAxis' -++'_SDL_GameControllerGetAxis'.'SDL3.dll'.'SDL_GameControllerGetAxis' -++'_SDL_GameControllerGetButtonFromString'.'SDL3.dll'.'SDL_GameControllerGetButtonFromString' -++'_SDL_GameControllerGetStringForButton'.'SDL3.dll'.'SDL_GameControllerGetStringForButton' -++'_SDL_GameControllerGetBindForButton'.'SDL3.dll'.'SDL_GameControllerGetBindForButton' -++'_SDL_GameControllerGetButton'.'SDL3.dll'.'SDL_GameControllerGetButton' -++'_SDL_GameControllerClose'.'SDL3.dll'.'SDL_GameControllerClose' -++'_SDL_RecordGesture'.'SDL3.dll'.'SDL_RecordGesture' -++'_SDL_SaveAllDollarTemplates'.'SDL3.dll'.'SDL_SaveAllDollarTemplates' -++'_SDL_SaveDollarTemplate'.'SDL3.dll'.'SDL_SaveDollarTemplate' -++'_SDL_LoadDollarTemplates'.'SDL3.dll'.'SDL_LoadDollarTemplates' -++'_SDL_NumHaptics'.'SDL3.dll'.'SDL_NumHaptics' -++'_SDL_HapticName'.'SDL3.dll'.'SDL_HapticName' -++'_SDL_HapticOpen'.'SDL3.dll'.'SDL_HapticOpen' -++'_SDL_HapticOpened'.'SDL3.dll'.'SDL_HapticOpened' -++'_SDL_HapticIndex'.'SDL3.dll'.'SDL_HapticIndex' -++'_SDL_MouseIsHaptic'.'SDL3.dll'.'SDL_MouseIsHaptic' -++'_SDL_HapticOpenFromMouse'.'SDL3.dll'.'SDL_HapticOpenFromMouse' -++'_SDL_JoystickIsHaptic'.'SDL3.dll'.'SDL_JoystickIsHaptic' -++'_SDL_HapticOpenFromJoystick'.'SDL3.dll'.'SDL_HapticOpenFromJoystick' -++'_SDL_HapticClose'.'SDL3.dll'.'SDL_HapticClose' -++'_SDL_HapticNumEffects'.'SDL3.dll'.'SDL_HapticNumEffects' -++'_SDL_HapticNumEffectsPlaying'.'SDL3.dll'.'SDL_HapticNumEffectsPlaying' -++'_SDL_HapticQuery'.'SDL3.dll'.'SDL_HapticQuery' -++'_SDL_HapticNumAxes'.'SDL3.dll'.'SDL_HapticNumAxes' -++'_SDL_HapticEffectSupported'.'SDL3.dll'.'SDL_HapticEffectSupported' -++'_SDL_HapticNewEffect'.'SDL3.dll'.'SDL_HapticNewEffect' -++'_SDL_HapticUpdateEffect'.'SDL3.dll'.'SDL_HapticUpdateEffect' -++'_SDL_HapticRunEffect'.'SDL3.dll'.'SDL_HapticRunEffect' -++'_SDL_HapticStopEffect'.'SDL3.dll'.'SDL_HapticStopEffect' -++'_SDL_HapticDestroyEffect'.'SDL3.dll'.'SDL_HapticDestroyEffect' -++'_SDL_HapticGetEffectStatus'.'SDL3.dll'.'SDL_HapticGetEffectStatus' -++'_SDL_HapticSetGain'.'SDL3.dll'.'SDL_HapticSetGain' -++'_SDL_HapticSetAutocenter'.'SDL3.dll'.'SDL_HapticSetAutocenter' -++'_SDL_HapticPause'.'SDL3.dll'.'SDL_HapticPause' -++'_SDL_HapticUnpause'.'SDL3.dll'.'SDL_HapticUnpause' -++'_SDL_HapticStopAll'.'SDL3.dll'.'SDL_HapticStopAll' -++'_SDL_HapticRumbleSupported'.'SDL3.dll'.'SDL_HapticRumbleSupported' -++'_SDL_HapticRumbleInit'.'SDL3.dll'.'SDL_HapticRumbleInit' -++'_SDL_HapticRumblePlay'.'SDL3.dll'.'SDL_HapticRumblePlay' -++'_SDL_HapticRumbleStop'.'SDL3.dll'.'SDL_HapticRumbleStop' -++'_SDL_SetHintWithPriority'.'SDL3.dll'.'SDL_SetHintWithPriority' -++'_SDL_SetHint'.'SDL3.dll'.'SDL_SetHint' -++'_SDL_GetHint'.'SDL3.dll'.'SDL_GetHint' -++'_SDL_AddHintCallback'.'SDL3.dll'.'SDL_AddHintCallback' -++'_SDL_DelHintCallback'.'SDL3.dll'.'SDL_DelHintCallback' -++'_SDL_ClearHints'.'SDL3.dll'.'SDL_ClearHints' -++'_SDL_NumJoysticks'.'SDL3.dll'.'SDL_NumJoysticks' -++'_SDL_JoystickNameForIndex'.'SDL3.dll'.'SDL_JoystickNameForIndex' -++'_SDL_JoystickOpen'.'SDL3.dll'.'SDL_JoystickOpen' -++'_SDL_JoystickName'.'SDL3.dll'.'SDL_JoystickName' -++'_SDL_JoystickGetDeviceGUID'.'SDL3.dll'.'SDL_JoystickGetDeviceGUID' -++'_SDL_JoystickGetGUID'.'SDL3.dll'.'SDL_JoystickGetGUID' -++'_SDL_JoystickGetGUIDString'.'SDL3.dll'.'SDL_JoystickGetGUIDString' -++'_SDL_JoystickGetGUIDFromString'.'SDL3.dll'.'SDL_JoystickGetGUIDFromString' -++'_SDL_JoystickGetAttached'.'SDL3.dll'.'SDL_JoystickGetAttached' -++'_SDL_JoystickInstanceID'.'SDL3.dll'.'SDL_JoystickInstanceID' -++'_SDL_JoystickNumAxes'.'SDL3.dll'.'SDL_JoystickNumAxes' -++'_SDL_JoystickNumBalls'.'SDL3.dll'.'SDL_JoystickNumBalls' -++'_SDL_JoystickNumHats'.'SDL3.dll'.'SDL_JoystickNumHats' -++'_SDL_JoystickNumButtons'.'SDL3.dll'.'SDL_JoystickNumButtons' -++'_SDL_JoystickUpdate'.'SDL3.dll'.'SDL_JoystickUpdate' -++'_SDL_JoystickEventState'.'SDL3.dll'.'SDL_JoystickEventState' -++'_SDL_JoystickGetAxis'.'SDL3.dll'.'SDL_JoystickGetAxis' -++'_SDL_JoystickGetHat'.'SDL3.dll'.'SDL_JoystickGetHat' -++'_SDL_JoystickGetBall'.'SDL3.dll'.'SDL_JoystickGetBall' -++'_SDL_JoystickGetButton'.'SDL3.dll'.'SDL_JoystickGetButton' -++'_SDL_JoystickClose'.'SDL3.dll'.'SDL_JoystickClose' -++'_SDL_GetKeyboardFocus'.'SDL3.dll'.'SDL_GetKeyboardFocus' -++'_SDL_GetKeyboardState'.'SDL3.dll'.'SDL_GetKeyboardState' -++'_SDL_GetModState'.'SDL3.dll'.'SDL_GetModState' -++'_SDL_SetModState'.'SDL3.dll'.'SDL_SetModState' -++'_SDL_GetKeyFromScancode'.'SDL3.dll'.'SDL_GetKeyFromScancode' -++'_SDL_GetScancodeFromKey'.'SDL3.dll'.'SDL_GetScancodeFromKey' -++'_SDL_GetScancodeName'.'SDL3.dll'.'SDL_GetScancodeName' -++'_SDL_GetScancodeFromName'.'SDL3.dll'.'SDL_GetScancodeFromName' -++'_SDL_GetKeyName'.'SDL3.dll'.'SDL_GetKeyName' -++'_SDL_GetKeyFromName'.'SDL3.dll'.'SDL_GetKeyFromName' -++'_SDL_StartTextInput'.'SDL3.dll'.'SDL_StartTextInput' -++'_SDL_IsTextInputActive'.'SDL3.dll'.'SDL_IsTextInputActive' -++'_SDL_StopTextInput'.'SDL3.dll'.'SDL_StopTextInput' -++'_SDL_SetTextInputRect'.'SDL3.dll'.'SDL_SetTextInputRect' -++'_SDL_HasScreenKeyboardSupport'.'SDL3.dll'.'SDL_HasScreenKeyboardSupport' -++'_SDL_IsScreenKeyboardShown'.'SDL3.dll'.'SDL_IsScreenKeyboardShown' -++'_SDL_LoadObject'.'SDL3.dll'.'SDL_LoadObject' -++'_SDL_LoadFunction'.'SDL3.dll'.'SDL_LoadFunction' -++'_SDL_UnloadObject'.'SDL3.dll'.'SDL_UnloadObject' -++'_SDL_LogSetAllPriority'.'SDL3.dll'.'SDL_LogSetAllPriority' -++'_SDL_LogSetPriority'.'SDL3.dll'.'SDL_LogSetPriority' -++'_SDL_LogGetPriority'.'SDL3.dll'.'SDL_LogGetPriority' -++'_SDL_LogResetPriorities'.'SDL3.dll'.'SDL_LogResetPriorities' -++'_SDL_LogMessageV'.'SDL3.dll'.'SDL_LogMessageV' -++'_SDL_LogGetOutputFunction'.'SDL3.dll'.'SDL_LogGetOutputFunction' -++'_SDL_LogSetOutputFunction'.'SDL3.dll'.'SDL_LogSetOutputFunction' -++'_SDL_SetMainReady'.'SDL3.dll'.'SDL_SetMainReady' -++'_SDL_ShowMessageBox'.'SDL3.dll'.'SDL_ShowMessageBox' -++'_SDL_ShowSimpleMessageBox'.'SDL3.dll'.'SDL_ShowSimpleMessageBox' -++'_SDL_GetMouseFocus'.'SDL3.dll'.'SDL_GetMouseFocus' -++'_SDL_GetMouseState'.'SDL3.dll'.'SDL_GetMouseState' -++'_SDL_GetRelativeMouseState'.'SDL3.dll'.'SDL_GetRelativeMouseState' -++'_SDL_WarpMouseInWindow'.'SDL3.dll'.'SDL_WarpMouseInWindow' -++'_SDL_SetRelativeMouseMode'.'SDL3.dll'.'SDL_SetRelativeMouseMode' -++'_SDL_GetRelativeMouseMode'.'SDL3.dll'.'SDL_GetRelativeMouseMode' -++'_SDL_CreateCursor'.'SDL3.dll'.'SDL_CreateCursor' -++'_SDL_CreateColorCursor'.'SDL3.dll'.'SDL_CreateColorCursor' -++'_SDL_CreateSystemCursor'.'SDL3.dll'.'SDL_CreateSystemCursor' -++'_SDL_SetCursor'.'SDL3.dll'.'SDL_SetCursor' -++'_SDL_GetCursor'.'SDL3.dll'.'SDL_GetCursor' -++'_SDL_GetDefaultCursor'.'SDL3.dll'.'SDL_GetDefaultCursor' -++'_SDL_FreeCursor'.'SDL3.dll'.'SDL_FreeCursor' -++'_SDL_ShowCursor'.'SDL3.dll'.'SDL_ShowCursor' -++'_SDL_CreateMutex'.'SDL3.dll'.'SDL_CreateMutex' -++'_SDL_LockMutex'.'SDL3.dll'.'SDL_LockMutex' -++'_SDL_TryLockMutex'.'SDL3.dll'.'SDL_TryLockMutex' -++'_SDL_UnlockMutex'.'SDL3.dll'.'SDL_UnlockMutex' -++'_SDL_DestroyMutex'.'SDL3.dll'.'SDL_DestroyMutex' -++'_SDL_CreateSemaphore'.'SDL3.dll'.'SDL_CreateSemaphore' -++'_SDL_DestroySemaphore'.'SDL3.dll'.'SDL_DestroySemaphore' -++'_SDL_SemWait'.'SDL3.dll'.'SDL_SemWait' -++'_SDL_SemTryWait'.'SDL3.dll'.'SDL_SemTryWait' -++'_SDL_SemWaitTimeout'.'SDL3.dll'.'SDL_SemWaitTimeout' -++'_SDL_SemPost'.'SDL3.dll'.'SDL_SemPost' -++'_SDL_SemValue'.'SDL3.dll'.'SDL_SemValue' -++'_SDL_CreateCond'.'SDL3.dll'.'SDL_CreateCond' -++'_SDL_DestroyCond'.'SDL3.dll'.'SDL_DestroyCond' -++'_SDL_CondSignal'.'SDL3.dll'.'SDL_CondSignal' -++'_SDL_CondBroadcast'.'SDL3.dll'.'SDL_CondBroadcast' -++'_SDL_CondWait'.'SDL3.dll'.'SDL_CondWait' -++'_SDL_CondWaitTimeout'.'SDL3.dll'.'SDL_CondWaitTimeout' -++'_SDL_GetPixelFormatName'.'SDL3.dll'.'SDL_GetPixelFormatName' -++'_SDL_PixelFormatEnumToMasks'.'SDL3.dll'.'SDL_PixelFormatEnumToMasks' -++'_SDL_MasksToPixelFormatEnum'.'SDL3.dll'.'SDL_MasksToPixelFormatEnum' -++'_SDL_AllocFormat'.'SDL3.dll'.'SDL_AllocFormat' -++'_SDL_FreeFormat'.'SDL3.dll'.'SDL_FreeFormat' -++'_SDL_AllocPalette'.'SDL3.dll'.'SDL_AllocPalette' -++'_SDL_SetPixelFormatPalette'.'SDL3.dll'.'SDL_SetPixelFormatPalette' -++'_SDL_SetPaletteColors'.'SDL3.dll'.'SDL_SetPaletteColors' -++'_SDL_FreePalette'.'SDL3.dll'.'SDL_FreePalette' -++'_SDL_MapRGB'.'SDL3.dll'.'SDL_MapRGB' -++'_SDL_MapRGBA'.'SDL3.dll'.'SDL_MapRGBA' -++'_SDL_GetRGB'.'SDL3.dll'.'SDL_GetRGB' -++'_SDL_GetRGBA'.'SDL3.dll'.'SDL_GetRGBA' -++'_SDL_CalculateGammaRamp'.'SDL3.dll'.'SDL_CalculateGammaRamp' -++'_SDL_GetPlatform'.'SDL3.dll'.'SDL_GetPlatform' -++'_SDL_GetPowerInfo'.'SDL3.dll'.'SDL_GetPowerInfo' -++'_SDL_HasIntersection'.'SDL3.dll'.'SDL_HasIntersection' -++'_SDL_IntersectRect'.'SDL3.dll'.'SDL_IntersectRect' -++'_SDL_UnionRect'.'SDL3.dll'.'SDL_UnionRect' -++'_SDL_EnclosePoints'.'SDL3.dll'.'SDL_EnclosePoints' -++'_SDL_IntersectRectAndLine'.'SDL3.dll'.'SDL_IntersectRectAndLine' -++'_SDL_GetNumRenderDrivers'.'SDL3.dll'.'SDL_GetNumRenderDrivers' -++'_SDL_GetRenderDriverInfo'.'SDL3.dll'.'SDL_GetRenderDriverInfo' -++'_SDL_CreateWindowAndRenderer'.'SDL3.dll'.'SDL_CreateWindowAndRenderer' -++'_SDL_CreateRenderer'.'SDL3.dll'.'SDL_CreateRenderer' -++'_SDL_CreateSoftwareRenderer'.'SDL3.dll'.'SDL_CreateSoftwareRenderer' -++'_SDL_GetRenderer'.'SDL3.dll'.'SDL_GetRenderer' -++'_SDL_GetRendererInfo'.'SDL3.dll'.'SDL_GetRendererInfo' -++'_SDL_GetRendererOutputSize'.'SDL3.dll'.'SDL_GetRendererOutputSize' -++'_SDL_CreateTexture'.'SDL3.dll'.'SDL_CreateTexture' -++'_SDL_CreateTextureFromSurface'.'SDL3.dll'.'SDL_CreateTextureFromSurface' -++'_SDL_QueryTexture'.'SDL3.dll'.'SDL_QueryTexture' -++'_SDL_SetTextureColorMod'.'SDL3.dll'.'SDL_SetTextureColorMod' -++'_SDL_GetTextureColorMod'.'SDL3.dll'.'SDL_GetTextureColorMod' -++'_SDL_SetTextureAlphaMod'.'SDL3.dll'.'SDL_SetTextureAlphaMod' -++'_SDL_GetTextureAlphaMod'.'SDL3.dll'.'SDL_GetTextureAlphaMod' -++'_SDL_SetTextureBlendMode'.'SDL3.dll'.'SDL_SetTextureBlendMode' -++'_SDL_GetTextureBlendMode'.'SDL3.dll'.'SDL_GetTextureBlendMode' -++'_SDL_UpdateTexture'.'SDL3.dll'.'SDL_UpdateTexture' -++'_SDL_UpdateYUVTexture'.'SDL3.dll'.'SDL_UpdateYUVTexture' -++'_SDL_LockTexture'.'SDL3.dll'.'SDL_LockTexture' -++'_SDL_UnlockTexture'.'SDL3.dll'.'SDL_UnlockTexture' -++'_SDL_RenderTargetSupported'.'SDL3.dll'.'SDL_RenderTargetSupported' -++'_SDL_SetRenderTarget'.'SDL3.dll'.'SDL_SetRenderTarget' -++'_SDL_GetRenderTarget'.'SDL3.dll'.'SDL_GetRenderTarget' -++'_SDL_RenderSetLogicalSize'.'SDL3.dll'.'SDL_RenderSetLogicalSize' -++'_SDL_RenderGetLogicalSize'.'SDL3.dll'.'SDL_RenderGetLogicalSize' -++'_SDL_RenderSetViewport'.'SDL3.dll'.'SDL_RenderSetViewport' -++'_SDL_RenderGetViewport'.'SDL3.dll'.'SDL_RenderGetViewport' -++'_SDL_RenderSetClipRect'.'SDL3.dll'.'SDL_RenderSetClipRect' -++'_SDL_RenderGetClipRect'.'SDL3.dll'.'SDL_RenderGetClipRect' -++'_SDL_RenderSetScale'.'SDL3.dll'.'SDL_RenderSetScale' -++'_SDL_RenderGetScale'.'SDL3.dll'.'SDL_RenderGetScale' -++'_SDL_SetRenderDrawColor'.'SDL3.dll'.'SDL_SetRenderDrawColor' -++'_SDL_GetRenderDrawColor'.'SDL3.dll'.'SDL_GetRenderDrawColor' -++'_SDL_SetRenderDrawBlendMode'.'SDL3.dll'.'SDL_SetRenderDrawBlendMode' -++'_SDL_GetRenderDrawBlendMode'.'SDL3.dll'.'SDL_GetRenderDrawBlendMode' -++'_SDL_RenderClear'.'SDL3.dll'.'SDL_RenderClear' -++'_SDL_RenderDrawPoint'.'SDL3.dll'.'SDL_RenderDrawPoint' -++'_SDL_RenderDrawPoints'.'SDL3.dll'.'SDL_RenderDrawPoints' -++'_SDL_RenderDrawLine'.'SDL3.dll'.'SDL_RenderDrawLine' -++'_SDL_RenderDrawLines'.'SDL3.dll'.'SDL_RenderDrawLines' -++'_SDL_RenderDrawRect'.'SDL3.dll'.'SDL_RenderDrawRect' -++'_SDL_RenderDrawRects'.'SDL3.dll'.'SDL_RenderDrawRects' -++'_SDL_RenderFillRect'.'SDL3.dll'.'SDL_RenderFillRect' -++'_SDL_RenderFillRects'.'SDL3.dll'.'SDL_RenderFillRects' -++'_SDL_RenderCopy'.'SDL3.dll'.'SDL_RenderCopy' -++'_SDL_RenderCopyEx'.'SDL3.dll'.'SDL_RenderCopyEx' -++'_SDL_RenderReadPixels'.'SDL3.dll'.'SDL_RenderReadPixels' -++'_SDL_RenderPresent'.'SDL3.dll'.'SDL_RenderPresent' -++'_SDL_DestroyTexture'.'SDL3.dll'.'SDL_DestroyTexture' -++'_SDL_DestroyRenderer'.'SDL3.dll'.'SDL_DestroyRenderer' -++'_SDL_GL_BindTexture'.'SDL3.dll'.'SDL_GL_BindTexture' -++'_SDL_GL_UnbindTexture'.'SDL3.dll'.'SDL_GL_UnbindTexture' -++'_SDL_RWFromFile'.'SDL3.dll'.'SDL_RWFromFile' -++'_SDL_RWFromMem'.'SDL3.dll'.'SDL_RWFromMem' -++'_SDL_RWFromConstMem'.'SDL3.dll'.'SDL_RWFromConstMem' -++'_SDL_AllocRW'.'SDL3.dll'.'SDL_AllocRW' -++'_SDL_FreeRW'.'SDL3.dll'.'SDL_FreeRW' -++'_SDL_ReadU8'.'SDL3.dll'.'SDL_ReadU8' -++'_SDL_ReadLE16'.'SDL3.dll'.'SDL_ReadLE16' -++'_SDL_ReadBE16'.'SDL3.dll'.'SDL_ReadBE16' -++'_SDL_ReadLE32'.'SDL3.dll'.'SDL_ReadLE32' -++'_SDL_ReadBE32'.'SDL3.dll'.'SDL_ReadBE32' -++'_SDL_ReadLE64'.'SDL3.dll'.'SDL_ReadLE64' -++'_SDL_ReadBE64'.'SDL3.dll'.'SDL_ReadBE64' -++'_SDL_WriteU8'.'SDL3.dll'.'SDL_WriteU8' -++'_SDL_WriteLE16'.'SDL3.dll'.'SDL_WriteLE16' -++'_SDL_WriteBE16'.'SDL3.dll'.'SDL_WriteBE16' -++'_SDL_WriteLE32'.'SDL3.dll'.'SDL_WriteLE32' -++'_SDL_WriteBE32'.'SDL3.dll'.'SDL_WriteBE32' -++'_SDL_WriteLE64'.'SDL3.dll'.'SDL_WriteLE64' -++'_SDL_WriteBE64'.'SDL3.dll'.'SDL_WriteBE64' -++'_SDL_CreateShapedWindow'.'SDL3.dll'.'SDL_CreateShapedWindow' -++'_SDL_IsShapedWindow'.'SDL3.dll'.'SDL_IsShapedWindow' -++'_SDL_SetWindowShape'.'SDL3.dll'.'SDL_SetWindowShape' -++'_SDL_GetShapedWindowMode'.'SDL3.dll'.'SDL_GetShapedWindowMode' -++'_SDL_malloc'.'SDL3.dll'.'SDL_malloc' -++'_SDL_calloc'.'SDL3.dll'.'SDL_calloc' -++'_SDL_realloc'.'SDL3.dll'.'SDL_realloc' -++'_SDL_free'.'SDL3.dll'.'SDL_free' -++'_SDL_getenv'.'SDL3.dll'.'SDL_getenv' -++'_SDL_setenv'.'SDL3.dll'.'SDL_setenv' -++'_SDL_qsort'.'SDL3.dll'.'SDL_qsort' -++'_SDL_abs'.'SDL3.dll'.'SDL_abs' -++'_SDL_isdigit'.'SDL3.dll'.'SDL_isdigit' -++'_SDL_isspace'.'SDL3.dll'.'SDL_isspace' -++'_SDL_toupper'.'SDL3.dll'.'SDL_toupper' -++'_SDL_tolower'.'SDL3.dll'.'SDL_tolower' -++'_SDL_memset'.'SDL3.dll'.'SDL_memset' -++'_SDL_memcpy'.'SDL3.dll'.'SDL_memcpy' -++'_SDL_memmove'.'SDL3.dll'.'SDL_memmove' -++'_SDL_memcmp'.'SDL3.dll'.'SDL_memcmp' -++'_SDL_wcslen'.'SDL3.dll'.'SDL_wcslen' -++'_SDL_wcslcpy'.'SDL3.dll'.'SDL_wcslcpy' -++'_SDL_wcslcat'.'SDL3.dll'.'SDL_wcslcat' -++'_SDL_strlen'.'SDL3.dll'.'SDL_strlen' -++'_SDL_strlcpy'.'SDL3.dll'.'SDL_strlcpy' -++'_SDL_utf8strlcpy'.'SDL3.dll'.'SDL_utf8strlcpy' -++'_SDL_strlcat'.'SDL3.dll'.'SDL_strlcat' -++'_SDL_strdup'.'SDL3.dll'.'SDL_strdup' -++'_SDL_strrev'.'SDL3.dll'.'SDL_strrev' -++'_SDL_strupr'.'SDL3.dll'.'SDL_strupr' -++'_SDL_strlwr'.'SDL3.dll'.'SDL_strlwr' -++'_SDL_strchr'.'SDL3.dll'.'SDL_strchr' -++'_SDL_strrchr'.'SDL3.dll'.'SDL_strrchr' -++'_SDL_strstr'.'SDL3.dll'.'SDL_strstr' -++'_SDL_itoa'.'SDL3.dll'.'SDL_itoa' -++'_SDL_uitoa'.'SDL3.dll'.'SDL_uitoa' -++'_SDL_ltoa'.'SDL3.dll'.'SDL_ltoa' -++'_SDL_ultoa'.'SDL3.dll'.'SDL_ultoa' -++'_SDL_lltoa'.'SDL3.dll'.'SDL_lltoa' -++'_SDL_ulltoa'.'SDL3.dll'.'SDL_ulltoa' -++'_SDL_atoi'.'SDL3.dll'.'SDL_atoi' -++'_SDL_atof'.'SDL3.dll'.'SDL_atof' -++'_SDL_strtol'.'SDL3.dll'.'SDL_strtol' -++'_SDL_strtoul'.'SDL3.dll'.'SDL_strtoul' -++'_SDL_strtoll'.'SDL3.dll'.'SDL_strtoll' -++'_SDL_strtoull'.'SDL3.dll'.'SDL_strtoull' -++'_SDL_strtod'.'SDL3.dll'.'SDL_strtod' -++'_SDL_strcmp'.'SDL3.dll'.'SDL_strcmp' -++'_SDL_strncmp'.'SDL3.dll'.'SDL_strncmp' -++'_SDL_strcasecmp'.'SDL3.dll'.'SDL_strcasecmp' -++'_SDL_strncasecmp'.'SDL3.dll'.'SDL_strncasecmp' -++'_SDL_vsnprintf'.'SDL3.dll'.'SDL_vsnprintf' -++'_SDL_acos'.'SDL3.dll'.'SDL_acos' -++'_SDL_asin'.'SDL3.dll'.'SDL_asin' -++'_SDL_atan'.'SDL3.dll'.'SDL_atan' -++'_SDL_atan2'.'SDL3.dll'.'SDL_atan2' -++'_SDL_ceil'.'SDL3.dll'.'SDL_ceil' -++'_SDL_copysign'.'SDL3.dll'.'SDL_copysign' -++'_SDL_cos'.'SDL3.dll'.'SDL_cos' -++'_SDL_cosf'.'SDL3.dll'.'SDL_cosf' -++'_SDL_fabs'.'SDL3.dll'.'SDL_fabs' -++'_SDL_floor'.'SDL3.dll'.'SDL_floor' -++'_SDL_log'.'SDL3.dll'.'SDL_log' -++'_SDL_pow'.'SDL3.dll'.'SDL_pow' -++'_SDL_scalbn'.'SDL3.dll'.'SDL_scalbn' -++'_SDL_sin'.'SDL3.dll'.'SDL_sin' -++'_SDL_sinf'.'SDL3.dll'.'SDL_sinf' -++'_SDL_sqrt'.'SDL3.dll'.'SDL_sqrt' -++'_SDL_iconv_open'.'SDL3.dll'.'SDL_iconv_open' -++'_SDL_iconv_close'.'SDL3.dll'.'SDL_iconv_close' -++'_SDL_iconv'.'SDL3.dll'.'SDL_iconv' -++'_SDL_iconv_string'.'SDL3.dll'.'SDL_iconv_string' -++'_SDL_CreateRGBSurface'.'SDL3.dll'.'SDL_CreateRGBSurface' -++'_SDL_CreateRGBSurfaceFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceFrom' -++'_SDL_FreeSurface'.'SDL3.dll'.'SDL_FreeSurface' -++'_SDL_SetSurfacePalette'.'SDL3.dll'.'SDL_SetSurfacePalette' -++'_SDL_LockSurface'.'SDL3.dll'.'SDL_LockSurface' -++'_SDL_UnlockSurface'.'SDL3.dll'.'SDL_UnlockSurface' -++'_SDL_LoadBMP_RW'.'SDL3.dll'.'SDL_LoadBMP_RW' -++'_SDL_SaveBMP_RW'.'SDL3.dll'.'SDL_SaveBMP_RW' -++'_SDL_SetSurfaceRLE'.'SDL3.dll'.'SDL_SetSurfaceRLE' -++'_SDL_SetColorKey'.'SDL3.dll'.'SDL_SetColorKey' -++'_SDL_GetColorKey'.'SDL3.dll'.'SDL_GetColorKey' -++'_SDL_SetSurfaceColorMod'.'SDL3.dll'.'SDL_SetSurfaceColorMod' -++'_SDL_GetSurfaceColorMod'.'SDL3.dll'.'SDL_GetSurfaceColorMod' -++'_SDL_SetSurfaceAlphaMod'.'SDL3.dll'.'SDL_SetSurfaceAlphaMod' -++'_SDL_GetSurfaceAlphaMod'.'SDL3.dll'.'SDL_GetSurfaceAlphaMod' -++'_SDL_SetSurfaceBlendMode'.'SDL3.dll'.'SDL_SetSurfaceBlendMode' -++'_SDL_GetSurfaceBlendMode'.'SDL3.dll'.'SDL_GetSurfaceBlendMode' -++'_SDL_SetClipRect'.'SDL3.dll'.'SDL_SetClipRect' -++'_SDL_GetClipRect'.'SDL3.dll'.'SDL_GetClipRect' -++'_SDL_ConvertSurface'.'SDL3.dll'.'SDL_ConvertSurface' -++'_SDL_ConvertSurfaceFormat'.'SDL3.dll'.'SDL_ConvertSurfaceFormat' -++'_SDL_ConvertPixels'.'SDL3.dll'.'SDL_ConvertPixels' -++'_SDL_FillRect'.'SDL3.dll'.'SDL_FillRect' -++'_SDL_FillRects'.'SDL3.dll'.'SDL_FillRects' -++'_SDL_UpperBlit'.'SDL3.dll'.'SDL_UpperBlit' -++'_SDL_LowerBlit'.'SDL3.dll'.'SDL_LowerBlit' -++'_SDL_SoftStretch'.'SDL3.dll'.'SDL_SoftStretch' -++'_SDL_UpperBlitScaled'.'SDL3.dll'.'SDL_UpperBlitScaled' -++'_SDL_LowerBlitScaled'.'SDL3.dll'.'SDL_LowerBlitScaled' -++'_SDL_GetWindowWMInfo'.'SDL3.dll'.'SDL_GetWindowWMInfo' -++'_SDL_GetThreadName'.'SDL3.dll'.'SDL_GetThreadName' -++'_SDL_ThreadID'.'SDL3.dll'.'SDL_ThreadID' -++'_SDL_GetThreadID'.'SDL3.dll'.'SDL_GetThreadID' -++'_SDL_SetThreadPriority'.'SDL3.dll'.'SDL_SetThreadPriority' -++'_SDL_WaitThread'.'SDL3.dll'.'SDL_WaitThread' -++'_SDL_DetachThread'.'SDL3.dll'.'SDL_DetachThread' -++'_SDL_TLSCreate'.'SDL3.dll'.'SDL_TLSCreate' -++'_SDL_TLSGet'.'SDL3.dll'.'SDL_TLSGet' -++'_SDL_TLSSet'.'SDL3.dll'.'SDL_TLSSet' -++'_SDL_GetTicks'.'SDL3.dll'.'SDL_GetTicks' -++'_SDL_GetPerformanceCounter'.'SDL3.dll'.'SDL_GetPerformanceCounter' -++'_SDL_GetPerformanceFrequency'.'SDL3.dll'.'SDL_GetPerformanceFrequency' -++'_SDL_Delay'.'SDL3.dll'.'SDL_Delay' -++'_SDL_AddTimer'.'SDL3.dll'.'SDL_AddTimer' -++'_SDL_RemoveTimer'.'SDL3.dll'.'SDL_RemoveTimer' -++'_SDL_GetNumTouchDevices'.'SDL3.dll'.'SDL_GetNumTouchDevices' -++'_SDL_GetTouchDevice'.'SDL3.dll'.'SDL_GetTouchDevice' -++'_SDL_GetNumTouchFingers'.'SDL3.dll'.'SDL_GetNumTouchFingers' -++'_SDL_GetTouchFinger'.'SDL3.dll'.'SDL_GetTouchFinger' -++'_SDL_GetVersion'.'SDL3.dll'.'SDL_GetVersion' -++'_SDL_GetRevision'.'SDL3.dll'.'SDL_GetRevision' -++'_SDL_GetRevisionNumber'.'SDL3.dll'.'SDL_GetRevisionNumber' -++'_SDL_GetNumVideoDrivers'.'SDL3.dll'.'SDL_GetNumVideoDrivers' -++'_SDL_GetVideoDriver'.'SDL3.dll'.'SDL_GetVideoDriver' -++'_SDL_VideoInit'.'SDL3.dll'.'SDL_VideoInit' -++'_SDL_VideoQuit'.'SDL3.dll'.'SDL_VideoQuit' -++'_SDL_GetCurrentVideoDriver'.'SDL3.dll'.'SDL_GetCurrentVideoDriver' -++'_SDL_GetNumVideoDisplays'.'SDL3.dll'.'SDL_GetNumVideoDisplays' -++'_SDL_GetDisplayName'.'SDL3.dll'.'SDL_GetDisplayName' -++'_SDL_GetDisplayBounds'.'SDL3.dll'.'SDL_GetDisplayBounds' -++'_SDL_GetDisplayDPI'.'SDL3.dll'.'SDL_GetDisplayDPI' -++'_SDL_GetNumDisplayModes'.'SDL3.dll'.'SDL_GetNumDisplayModes' -++'_SDL_GetDisplayMode'.'SDL3.dll'.'SDL_GetDisplayMode' -++'_SDL_GetDesktopDisplayMode'.'SDL3.dll'.'SDL_GetDesktopDisplayMode' -++'_SDL_GetCurrentDisplayMode'.'SDL3.dll'.'SDL_GetCurrentDisplayMode' -++'_SDL_GetClosestDisplayMode'.'SDL3.dll'.'SDL_GetClosestDisplayMode' -++'_SDL_GetWindowDisplayIndex'.'SDL3.dll'.'SDL_GetWindowDisplayIndex' -++'_SDL_SetWindowDisplayMode'.'SDL3.dll'.'SDL_SetWindowDisplayMode' -++'_SDL_GetWindowDisplayMode'.'SDL3.dll'.'SDL_GetWindowDisplayMode' -++'_SDL_GetWindowPixelFormat'.'SDL3.dll'.'SDL_GetWindowPixelFormat' -++'_SDL_CreateWindow'.'SDL3.dll'.'SDL_CreateWindow' -++'_SDL_CreateWindowFrom'.'SDL3.dll'.'SDL_CreateWindowFrom' -++'_SDL_GetWindowID'.'SDL3.dll'.'SDL_GetWindowID' -++'_SDL_GetWindowFromID'.'SDL3.dll'.'SDL_GetWindowFromID' -++'_SDL_GetWindowFlags'.'SDL3.dll'.'SDL_GetWindowFlags' -++'_SDL_SetWindowTitle'.'SDL3.dll'.'SDL_SetWindowTitle' -++'_SDL_GetWindowTitle'.'SDL3.dll'.'SDL_GetWindowTitle' -++'_SDL_SetWindowIcon'.'SDL3.dll'.'SDL_SetWindowIcon' -++'_SDL_SetWindowData'.'SDL3.dll'.'SDL_SetWindowData' -++'_SDL_GetWindowData'.'SDL3.dll'.'SDL_GetWindowData' -++'_SDL_SetWindowPosition'.'SDL3.dll'.'SDL_SetWindowPosition' -++'_SDL_GetWindowPosition'.'SDL3.dll'.'SDL_GetWindowPosition' -++'_SDL_SetWindowSize'.'SDL3.dll'.'SDL_SetWindowSize' -++'_SDL_GetWindowSize'.'SDL3.dll'.'SDL_GetWindowSize' -++'_SDL_SetWindowMinimumSize'.'SDL3.dll'.'SDL_SetWindowMinimumSize' -++'_SDL_GetWindowMinimumSize'.'SDL3.dll'.'SDL_GetWindowMinimumSize' -++'_SDL_SetWindowMaximumSize'.'SDL3.dll'.'SDL_SetWindowMaximumSize' -++'_SDL_GetWindowMaximumSize'.'SDL3.dll'.'SDL_GetWindowMaximumSize' -++'_SDL_SetWindowBordered'.'SDL3.dll'.'SDL_SetWindowBordered' -++'_SDL_ShowWindow'.'SDL3.dll'.'SDL_ShowWindow' -++'_SDL_HideWindow'.'SDL3.dll'.'SDL_HideWindow' -++'_SDL_RaiseWindow'.'SDL3.dll'.'SDL_RaiseWindow' -++'_SDL_MaximizeWindow'.'SDL3.dll'.'SDL_MaximizeWindow' -++'_SDL_MinimizeWindow'.'SDL3.dll'.'SDL_MinimizeWindow' -++'_SDL_RestoreWindow'.'SDL3.dll'.'SDL_RestoreWindow' -++'_SDL_SetWindowFullscreen'.'SDL3.dll'.'SDL_SetWindowFullscreen' -++'_SDL_GetWindowSurface'.'SDL3.dll'.'SDL_GetWindowSurface' -++'_SDL_UpdateWindowSurface'.'SDL3.dll'.'SDL_UpdateWindowSurface' -++'_SDL_UpdateWindowSurfaceRects'.'SDL3.dll'.'SDL_UpdateWindowSurfaceRects' -++'_SDL_SetWindowGrab'.'SDL3.dll'.'SDL_SetWindowGrab' -++'_SDL_GetWindowGrab'.'SDL3.dll'.'SDL_GetWindowGrab' -++'_SDL_SetWindowBrightness'.'SDL3.dll'.'SDL_SetWindowBrightness' -++'_SDL_GetWindowBrightness'.'SDL3.dll'.'SDL_GetWindowBrightness' -++'_SDL_SetWindowGammaRamp'.'SDL3.dll'.'SDL_SetWindowGammaRamp' -++'_SDL_GetWindowGammaRamp'.'SDL3.dll'.'SDL_GetWindowGammaRamp' -++'_SDL_DestroyWindow'.'SDL3.dll'.'SDL_DestroyWindow' -++'_SDL_IsScreenSaverEnabled'.'SDL3.dll'.'SDL_IsScreenSaverEnabled' -++'_SDL_EnableScreenSaver'.'SDL3.dll'.'SDL_EnableScreenSaver' -++'_SDL_DisableScreenSaver'.'SDL3.dll'.'SDL_DisableScreenSaver' -++'_SDL_GL_LoadLibrary'.'SDL3.dll'.'SDL_GL_LoadLibrary' -++'_SDL_GL_GetProcAddress'.'SDL3.dll'.'SDL_GL_GetProcAddress' -++'_SDL_GL_UnloadLibrary'.'SDL3.dll'.'SDL_GL_UnloadLibrary' -++'_SDL_GL_ExtensionSupported'.'SDL3.dll'.'SDL_GL_ExtensionSupported' -++'_SDL_GL_SetAttribute'.'SDL3.dll'.'SDL_GL_SetAttribute' -++'_SDL_GL_GetAttribute'.'SDL3.dll'.'SDL_GL_GetAttribute' -++'_SDL_GL_CreateContext'.'SDL3.dll'.'SDL_GL_CreateContext' -++'_SDL_GL_MakeCurrent'.'SDL3.dll'.'SDL_GL_MakeCurrent' -++'_SDL_GL_GetCurrentWindow'.'SDL3.dll'.'SDL_GL_GetCurrentWindow' -++'_SDL_GL_GetCurrentContext'.'SDL3.dll'.'SDL_GL_GetCurrentContext' -++'_SDL_GL_GetDrawableSize'.'SDL3.dll'.'SDL_GL_GetDrawableSize' -++'_SDL_GL_SetSwapInterval'.'SDL3.dll'.'SDL_GL_SetSwapInterval' -++'_SDL_GL_GetSwapInterval'.'SDL3.dll'.'SDL_GL_GetSwapInterval' -++'_SDL_GL_SwapWindow'.'SDL3.dll'.'SDL_GL_SwapWindow' -++'_SDL_GL_DeleteContext'.'SDL3.dll'.'SDL_GL_DeleteContext' -++'_SDL_vsscanf'.'SDL3.dll'.'SDL_vsscanf' -++'_SDL_GameControllerAddMappingsFromRW'.'SDL3.dll'.'SDL_GameControllerAddMappingsFromRW' -++'_SDL_GL_ResetAttributes'.'SDL3.dll'.'SDL_GL_ResetAttributes' -++'_SDL_HasAVX'.'SDL3.dll'.'SDL_HasAVX' -++'_SDL_GetDefaultAssertionHandler'.'SDL3.dll'.'SDL_GetDefaultAssertionHandler' -++'_SDL_GetAssertionHandler'.'SDL3.dll'.'SDL_GetAssertionHandler' -++'_SDL_DXGIGetOutputInfo'.'SDL3.dll'.'SDL_DXGIGetOutputInfo' -++'_SDL_RenderIsClipEnabled'.'SDL3.dll'.'SDL_RenderIsClipEnabled' -# ++'_SDL_WinRTRunApp'.'SDL3.dll'.'SDL_WinRTRunApp' -++'_SDL_WarpMouseGlobal'.'SDL3.dll'.'SDL_WarpMouseGlobal' -# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL3.dll'.'SDL_WinRTGetFSPathUNICODE' -# ++'_SDL_WinRTGetFSPathUTF8'.'SDL3.dll'.'SDL_WinRTGetFSPathUTF8' -++'_SDL_sqrtf'.'SDL3.dll'.'SDL_sqrtf' -++'_SDL_tan'.'SDL3.dll'.'SDL_tan' -++'_SDL_tanf'.'SDL3.dll'.'SDL_tanf' -++'_SDL_CaptureMouse'.'SDL3.dll'.'SDL_CaptureMouse' -++'_SDL_SetWindowHitTest'.'SDL3.dll'.'SDL_SetWindowHitTest' -++'_SDL_GetGlobalMouseState'.'SDL3.dll'.'SDL_GetGlobalMouseState' -++'_SDL_HasAVX2'.'SDL3.dll'.'SDL_HasAVX2' -++'_SDL_QueueAudio'.'SDL3.dll'.'SDL_QueueAudio' -++'_SDL_GetQueuedAudioSize'.'SDL3.dll'.'SDL_GetQueuedAudioSize' -++'_SDL_ClearQueuedAudio'.'SDL3.dll'.'SDL_ClearQueuedAudio' -++'_SDL_GetGrabbedWindow'.'SDL3.dll'.'SDL_GetGrabbedWindow' -++'_SDL_SetWindowsMessageHook'.'SDL3.dll'.'SDL_SetWindowsMessageHook' -++'_SDL_JoystickCurrentPowerLevel'.'SDL3.dll'.'SDL_JoystickCurrentPowerLevel' -++'_SDL_GameControllerFromInstanceID'.'SDL3.dll'.'SDL_GameControllerFromInstanceID' -++'_SDL_JoystickFromInstanceID'.'SDL3.dll'.'SDL_JoystickFromInstanceID' -++'_SDL_GetDisplayUsableBounds'.'SDL3.dll'.'SDL_GetDisplayUsableBounds' -++'_SDL_GetWindowBordersSize'.'SDL3.dll'.'SDL_GetWindowBordersSize' -++'_SDL_SetWindowOpacity'.'SDL3.dll'.'SDL_SetWindowOpacity' -++'_SDL_GetWindowOpacity'.'SDL3.dll'.'SDL_GetWindowOpacity' -++'_SDL_SetWindowInputFocus'.'SDL3.dll'.'SDL_SetWindowInputFocus' -++'_SDL_SetWindowModalFor'.'SDL3.dll'.'SDL_SetWindowModalFor' -++'_SDL_RenderSetIntegerScale'.'SDL3.dll'.'SDL_RenderSetIntegerScale' -++'_SDL_RenderGetIntegerScale'.'SDL3.dll'.'SDL_RenderGetIntegerScale' -++'_SDL_DequeueAudio'.'SDL3.dll'.'SDL_DequeueAudio' -++'_SDL_SetWindowResizable'.'SDL3.dll'.'SDL_SetWindowResizable' -++'_SDL_CreateRGBSurfaceWithFormat'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormat' -++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormatFrom' -++'_SDL_GetHintBoolean'.'SDL3.dll'.'SDL_GetHintBoolean' -++'_SDL_JoystickGetDeviceVendor'.'SDL3.dll'.'SDL_JoystickGetDeviceVendor' -++'_SDL_JoystickGetDeviceProduct'.'SDL3.dll'.'SDL_JoystickGetDeviceProduct' -++'_SDL_JoystickGetDeviceProductVersion'.'SDL3.dll'.'SDL_JoystickGetDeviceProductVersion' -++'_SDL_JoystickGetVendor'.'SDL3.dll'.'SDL_JoystickGetVendor' -++'_SDL_JoystickGetProduct'.'SDL3.dll'.'SDL_JoystickGetProduct' -++'_SDL_JoystickGetProductVersion'.'SDL3.dll'.'SDL_JoystickGetProductVersion' -++'_SDL_GameControllerGetVendor'.'SDL3.dll'.'SDL_GameControllerGetVendor' -++'_SDL_GameControllerGetProduct'.'SDL3.dll'.'SDL_GameControllerGetProduct' -++'_SDL_GameControllerGetProductVersion'.'SDL3.dll'.'SDL_GameControllerGetProductVersion' -++'_SDL_HasNEON'.'SDL3.dll'.'SDL_HasNEON' -++'_SDL_GameControllerNumMappings'.'SDL3.dll'.'SDL_GameControllerNumMappings' -++'_SDL_GameControllerMappingForIndex'.'SDL3.dll'.'SDL_GameControllerMappingForIndex' -++'_SDL_JoystickGetAxisInitialState'.'SDL3.dll'.'SDL_JoystickGetAxisInitialState' -++'_SDL_JoystickGetDeviceType'.'SDL3.dll'.'SDL_JoystickGetDeviceType' -++'_SDL_JoystickGetType'.'SDL3.dll'.'SDL_JoystickGetType' -++'_SDL_MemoryBarrierReleaseFunction'.'SDL3.dll'.'SDL_MemoryBarrierReleaseFunction' -++'_SDL_MemoryBarrierAcquireFunction'.'SDL3.dll'.'SDL_MemoryBarrierAcquireFunction' -++'_SDL_JoystickGetDeviceInstanceID'.'SDL3.dll'.'SDL_JoystickGetDeviceInstanceID' -++'_SDL_utf8strlen'.'SDL3.dll'.'SDL_utf8strlen' -++'_SDL_LoadFile_RW'.'SDL3.dll'.'SDL_LoadFile_RW' -++'_SDL_wcscmp'.'SDL3.dll'.'SDL_wcscmp' -++'_SDL_ComposeCustomBlendMode'.'SDL3.dll'.'SDL_ComposeCustomBlendMode' -++'_SDL_DuplicateSurface'.'SDL3.dll'.'SDL_DuplicateSurface' -++'_SDL_Vulkan_LoadLibrary'.'SDL3.dll'.'SDL_Vulkan_LoadLibrary' -++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL3.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr' -++'_SDL_Vulkan_UnloadLibrary'.'SDL3.dll'.'SDL_Vulkan_UnloadLibrary' -++'_SDL_Vulkan_GetInstanceExtensions'.'SDL3.dll'.'SDL_Vulkan_GetInstanceExtensions' -++'_SDL_Vulkan_CreateSurface'.'SDL3.dll'.'SDL_Vulkan_CreateSurface' -++'_SDL_Vulkan_GetDrawableSize'.'SDL3.dll'.'SDL_Vulkan_GetDrawableSize' -++'_SDL_LockJoysticks'.'SDL3.dll'.'SDL_LockJoysticks' -++'_SDL_UnlockJoysticks'.'SDL3.dll'.'SDL_UnlockJoysticks' -++'_SDL_GetMemoryFunctions'.'SDL3.dll'.'SDL_GetMemoryFunctions' -++'_SDL_SetMemoryFunctions'.'SDL3.dll'.'SDL_SetMemoryFunctions' -++'_SDL_GetNumAllocations'.'SDL3.dll'.'SDL_GetNumAllocations' -++'_SDL_NewAudioStream'.'SDL3.dll'.'SDL_NewAudioStream' -++'_SDL_AudioStreamPut'.'SDL3.dll'.'SDL_AudioStreamPut' -++'_SDL_AudioStreamGet'.'SDL3.dll'.'SDL_AudioStreamGet' -++'_SDL_AudioStreamClear'.'SDL3.dll'.'SDL_AudioStreamClear' -++'_SDL_AudioStreamAvailable'.'SDL3.dll'.'SDL_AudioStreamAvailable' -++'_SDL_FreeAudioStream'.'SDL3.dll'.'SDL_FreeAudioStream' -++'_SDL_AudioStreamFlush'.'SDL3.dll'.'SDL_AudioStreamFlush' -++'_SDL_acosf'.'SDL3.dll'.'SDL_acosf' -++'_SDL_asinf'.'SDL3.dll'.'SDL_asinf' -++'_SDL_atanf'.'SDL3.dll'.'SDL_atanf' -++'_SDL_atan2f'.'SDL3.dll'.'SDL_atan2f' -++'_SDL_ceilf'.'SDL3.dll'.'SDL_ceilf' -++'_SDL_copysignf'.'SDL3.dll'.'SDL_copysignf' -++'_SDL_fabsf'.'SDL3.dll'.'SDL_fabsf' -++'_SDL_floorf'.'SDL3.dll'.'SDL_floorf' -++'_SDL_logf'.'SDL3.dll'.'SDL_logf' -++'_SDL_powf'.'SDL3.dll'.'SDL_powf' -++'_SDL_scalbnf'.'SDL3.dll'.'SDL_scalbnf' -++'_SDL_fmod'.'SDL3.dll'.'SDL_fmod' -++'_SDL_fmodf'.'SDL3.dll'.'SDL_fmodf' -++'_SDL_SetYUVConversionMode'.'SDL3.dll'.'SDL_SetYUVConversionMode' -++'_SDL_GetYUVConversionMode'.'SDL3.dll'.'SDL_GetYUVConversionMode' -++'_SDL_GetYUVConversionModeForResolution'.'SDL3.dll'.'SDL_GetYUVConversionModeForResolution' -++'_SDL_RenderGetMetalLayer'.'SDL3.dll'.'SDL_RenderGetMetalLayer' -++'_SDL_RenderGetMetalCommandEncoder'.'SDL3.dll'.'SDL_RenderGetMetalCommandEncoder' -# ++'_SDL_IsAndroidTV'.'SDL3.dll'.'SDL_IsAndroidTV' -# ++'_SDL_WinRTGetDeviceFamily'.'SDL3.dll'.'SDL_WinRTGetDeviceFamily' -++'_SDL_log10'.'SDL3.dll'.'SDL_log10' -++'_SDL_log10f'.'SDL3.dll'.'SDL_log10f' -++'_SDL_GameControllerMappingForDeviceIndex'.'SDL3.dll'.'SDL_GameControllerMappingForDeviceIndex' -# ++'_SDL_LinuxSetThreadPriority'.'SDL3.dll'.'SDL_LinuxSetThreadPriority' -++'_SDL_HasAVX512F'.'SDL3.dll'.'SDL_HasAVX512F' -# ++'_SDL_IsChromebook'.'SDL3.dll'.'SDL_IsChromebook' -# ++'_SDL_IsDeXMode'.'SDL3.dll'.'SDL_IsDeXMode' -# ++'_SDL_AndroidBackButton'.'SDL3.dll'.'SDL_AndroidBackButton' -++'_SDL_exp'.'SDL3.dll'.'SDL_exp' -++'_SDL_expf'.'SDL3.dll'.'SDL_expf' -++'_SDL_wcsdup'.'SDL3.dll'.'SDL_wcsdup' -++'_SDL_GameControllerRumble'.'SDL3.dll'.'SDL_GameControllerRumble' -++'_SDL_JoystickRumble'.'SDL3.dll'.'SDL_JoystickRumble' -++'_SDL_NumSensors'.'SDL3.dll'.'SDL_NumSensors' -++'_SDL_SensorGetDeviceName'.'SDL3.dll'.'SDL_SensorGetDeviceName' -++'_SDL_SensorGetDeviceType'.'SDL3.dll'.'SDL_SensorGetDeviceType' -++'_SDL_SensorGetDeviceNonPortableType'.'SDL3.dll'.'SDL_SensorGetDeviceNonPortableType' -++'_SDL_SensorGetDeviceInstanceID'.'SDL3.dll'.'SDL_SensorGetDeviceInstanceID' -++'_SDL_SensorOpen'.'SDL3.dll'.'SDL_SensorOpen' -++'_SDL_SensorFromInstanceID'.'SDL3.dll'.'SDL_SensorFromInstanceID' -++'_SDL_SensorGetName'.'SDL3.dll'.'SDL_SensorGetName' -++'_SDL_SensorGetType'.'SDL3.dll'.'SDL_SensorGetType' -++'_SDL_SensorGetNonPortableType'.'SDL3.dll'.'SDL_SensorGetNonPortableType' -++'_SDL_SensorGetInstanceID'.'SDL3.dll'.'SDL_SensorGetInstanceID' -++'_SDL_SensorGetData'.'SDL3.dll'.'SDL_SensorGetData' -++'_SDL_SensorClose'.'SDL3.dll'.'SDL_SensorClose' -++'_SDL_SensorUpdate'.'SDL3.dll'.'SDL_SensorUpdate' -++'_SDL_IsTablet'.'SDL3.dll'.'SDL_IsTablet' -++'_SDL_GetDisplayOrientation'.'SDL3.dll'.'SDL_GetDisplayOrientation' -++'_SDL_HasColorKey'.'SDL3.dll'.'SDL_HasColorKey' -++'_SDL_CreateThreadWithStackSize'.'SDL3.dll'.'SDL_CreateThreadWithStackSize' -++'_SDL_JoystickGetDevicePlayerIndex'.'SDL3.dll'.'SDL_JoystickGetDevicePlayerIndex' -++'_SDL_JoystickGetPlayerIndex'.'SDL3.dll'.'SDL_JoystickGetPlayerIndex' -++'_SDL_GameControllerGetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerGetPlayerIndex' -++'_SDL_RenderFlush'.'SDL3.dll'.'SDL_RenderFlush' -++'_SDL_RenderDrawPointF'.'SDL3.dll'.'SDL_RenderDrawPointF' -++'_SDL_RenderDrawPointsF'.'SDL3.dll'.'SDL_RenderDrawPointsF' -++'_SDL_RenderDrawLineF'.'SDL3.dll'.'SDL_RenderDrawLineF' -++'_SDL_RenderDrawLinesF'.'SDL3.dll'.'SDL_RenderDrawLinesF' -++'_SDL_RenderDrawRectF'.'SDL3.dll'.'SDL_RenderDrawRectF' -++'_SDL_RenderDrawRectsF'.'SDL3.dll'.'SDL_RenderDrawRectsF' -++'_SDL_RenderFillRectF'.'SDL3.dll'.'SDL_RenderFillRectF' -++'_SDL_RenderFillRectsF'.'SDL3.dll'.'SDL_RenderFillRectsF' -++'_SDL_RenderCopyF'.'SDL3.dll'.'SDL_RenderCopyF' -++'_SDL_RenderCopyExF'.'SDL3.dll'.'SDL_RenderCopyExF' -++'_SDL_GetTouchDeviceType'.'SDL3.dll'.'SDL_GetTouchDeviceType' -# ++'_SDL_UIKitRunApp'.'SDL3.dll'.'SDL_UIKitRunApp' -++'_SDL_SIMDGetAlignment'.'SDL3.dll'.'SDL_SIMDGetAlignment' -++'_SDL_SIMDAlloc'.'SDL3.dll'.'SDL_SIMDAlloc' -++'_SDL_SIMDFree'.'SDL3.dll'.'SDL_SIMDFree' -++'_SDL_RWsize'.'SDL3.dll'.'SDL_RWsize' -++'_SDL_RWseek'.'SDL3.dll'.'SDL_RWseek' -++'_SDL_RWtell'.'SDL3.dll'.'SDL_RWtell' -++'_SDL_RWread'.'SDL3.dll'.'SDL_RWread' -++'_SDL_RWwrite'.'SDL3.dll'.'SDL_RWwrite' -++'_SDL_RWclose'.'SDL3.dll'.'SDL_RWclose' -++'_SDL_LoadFile'.'SDL3.dll'.'SDL_LoadFile' -++'_SDL_Metal_CreateView'.'SDL3.dll'.'SDL_Metal_CreateView' -++'_SDL_Metal_DestroyView'.'SDL3.dll'.'SDL_Metal_DestroyView' -++'_SDL_LockTextureToSurface'.'SDL3.dll'.'SDL_LockTextureToSurface' -++'_SDL_HasARMSIMD'.'SDL3.dll'.'SDL_HasARMSIMD' -++'_SDL_strtokr'.'SDL3.dll'.'SDL_strtokr' -++'_SDL_wcsstr'.'SDL3.dll'.'SDL_wcsstr' -++'_SDL_wcsncmp'.'SDL3.dll'.'SDL_wcsncmp' -++'_SDL_GameControllerTypeForIndex'.'SDL3.dll'.'SDL_GameControllerTypeForIndex' -++'_SDL_GameControllerGetType'.'SDL3.dll'.'SDL_GameControllerGetType' -++'_SDL_GameControllerFromPlayerIndex'.'SDL3.dll'.'SDL_GameControllerFromPlayerIndex' -++'_SDL_GameControllerSetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerSetPlayerIndex' -++'_SDL_JoystickFromPlayerIndex'.'SDL3.dll'.'SDL_JoystickFromPlayerIndex' -++'_SDL_JoystickSetPlayerIndex'.'SDL3.dll'.'SDL_JoystickSetPlayerIndex' -++'_SDL_SetTextureScaleMode'.'SDL3.dll'.'SDL_SetTextureScaleMode' -++'_SDL_GetTextureScaleMode'.'SDL3.dll'.'SDL_GetTextureScaleMode' -++'_SDL_OnApplicationWillTerminate'.'SDL3.dll'.'SDL_OnApplicationWillTerminate' -++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL3.dll'.'SDL_OnApplicationDidReceiveMemoryWarning' -++'_SDL_OnApplicationWillResignActive'.'SDL3.dll'.'SDL_OnApplicationWillResignActive' -++'_SDL_OnApplicationDidEnterBackground'.'SDL3.dll'.'SDL_OnApplicationDidEnterBackground' -++'_SDL_OnApplicationWillEnterForeground'.'SDL3.dll'.'SDL_OnApplicationWillEnterForeground' -++'_SDL_OnApplicationDidBecomeActive'.'SDL3.dll'.'SDL_OnApplicationDidBecomeActive' -# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL3.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation' -# ++'_SDL_GetAndroidSDKVersion'.'SDL3.dll'.'SDL_GetAndroidSDKVersion' -++'_SDL_isupper'.'SDL3.dll'.'SDL_isupper' -++'_SDL_islower'.'SDL3.dll'.'SDL_islower' -++'_SDL_JoystickAttachVirtual'.'SDL3.dll'.'SDL_JoystickAttachVirtual' -++'_SDL_JoystickDetachVirtual'.'SDL3.dll'.'SDL_JoystickDetachVirtual' -++'_SDL_JoystickIsVirtual'.'SDL3.dll'.'SDL_JoystickIsVirtual' -++'_SDL_JoystickSetVirtualAxis'.'SDL3.dll'.'SDL_JoystickSetVirtualAxis' -++'_SDL_JoystickSetVirtualButton'.'SDL3.dll'.'SDL_JoystickSetVirtualButton' -++'_SDL_JoystickSetVirtualHat'.'SDL3.dll'.'SDL_JoystickSetVirtualHat' -++'_SDL_GetErrorMsg'.'SDL3.dll'.'SDL_GetErrorMsg' -++'_SDL_LockSensors'.'SDL3.dll'.'SDL_LockSensors' -++'_SDL_UnlockSensors'.'SDL3.dll'.'SDL_UnlockSensors' -++'_SDL_Metal_GetLayer'.'SDL3.dll'.'SDL_Metal_GetLayer' -++'_SDL_Metal_GetDrawableSize'.'SDL3.dll'.'SDL_Metal_GetDrawableSize' -++'_SDL_trunc'.'SDL3.dll'.'SDL_trunc' -++'_SDL_truncf'.'SDL3.dll'.'SDL_truncf' -++'_SDL_GetPreferredLocales'.'SDL3.dll'.'SDL_GetPreferredLocales' -++'_SDL_SIMDRealloc'.'SDL3.dll'.'SDL_SIMDRealloc' -# ++'_SDL_AndroidRequestPermission'.'SDL3.dll'.'SDL_AndroidRequestPermission' -++'_SDL_OpenURL'.'SDL3.dll'.'SDL_OpenURL' -++'_SDL_HasSurfaceRLE'.'SDL3.dll'.'SDL_HasSurfaceRLE' -++'_SDL_GameControllerHasLED'.'SDL3.dll'.'SDL_GameControllerHasLED' -++'_SDL_GameControllerSetLED'.'SDL3.dll'.'SDL_GameControllerSetLED' -++'_SDL_JoystickHasLED'.'SDL3.dll'.'SDL_JoystickHasLED' -++'_SDL_JoystickSetLED'.'SDL3.dll'.'SDL_JoystickSetLED' -++'_SDL_GameControllerRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerRumbleTriggers' -++'_SDL_JoystickRumbleTriggers'.'SDL3.dll'.'SDL_JoystickRumbleTriggers' -++'_SDL_GameControllerHasAxis'.'SDL3.dll'.'SDL_GameControllerHasAxis' -++'_SDL_GameControllerHasButton'.'SDL3.dll'.'SDL_GameControllerHasButton' -++'_SDL_GameControllerGetNumTouchpads'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpads' -++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpadFingers' -++'_SDL_GameControllerGetTouchpadFinger'.'SDL3.dll'.'SDL_GameControllerGetTouchpadFinger' -++'_SDL_crc32'.'SDL3.dll'.'SDL_crc32' -++'_SDL_GameControllerGetSerial'.'SDL3.dll'.'SDL_GameControllerGetSerial' -++'_SDL_JoystickGetSerial'.'SDL3.dll'.'SDL_JoystickGetSerial' -++'_SDL_GameControllerHasSensor'.'SDL3.dll'.'SDL_GameControllerHasSensor' -++'_SDL_GameControllerSetSensorEnabled'.'SDL3.dll'.'SDL_GameControllerSetSensorEnabled' -++'_SDL_GameControllerIsSensorEnabled'.'SDL3.dll'.'SDL_GameControllerIsSensorEnabled' -++'_SDL_GameControllerGetSensorData'.'SDL3.dll'.'SDL_GameControllerGetSensorData' -++'_SDL_wcscasecmp'.'SDL3.dll'.'SDL_wcscasecmp' -++'_SDL_wcsncasecmp'.'SDL3.dll'.'SDL_wcsncasecmp' -++'_SDL_round'.'SDL3.dll'.'SDL_round' -++'_SDL_roundf'.'SDL3.dll'.'SDL_roundf' -++'_SDL_lround'.'SDL3.dll'.'SDL_lround' -++'_SDL_lroundf'.'SDL3.dll'.'SDL_lroundf' -++'_SDL_SoftStretchLinear'.'SDL3.dll'.'SDL_SoftStretchLinear' -++'_SDL_RenderGetD3D11Device'.'SDL3.dll'.'SDL_RenderGetD3D11Device' -++'_SDL_UpdateNVTexture'.'SDL3.dll'.'SDL_UpdateNVTexture' -++'_SDL_SetWindowKeyboardGrab'.'SDL3.dll'.'SDL_SetWindowKeyboardGrab' -++'_SDL_SetWindowMouseGrab'.'SDL3.dll'.'SDL_SetWindowMouseGrab' -++'_SDL_GetWindowKeyboardGrab'.'SDL3.dll'.'SDL_GetWindowKeyboardGrab' -++'_SDL_GetWindowMouseGrab'.'SDL3.dll'.'SDL_GetWindowMouseGrab' -++'_SDL_isalpha'.'SDL3.dll'.'SDL_isalpha' -++'_SDL_isalnum'.'SDL3.dll'.'SDL_isalnum' -++'_SDL_isblank'.'SDL3.dll'.'SDL_isblank' -++'_SDL_iscntrl'.'SDL3.dll'.'SDL_iscntrl' -++'_SDL_isxdigit'.'SDL3.dll'.'SDL_isxdigit' -++'_SDL_ispunct'.'SDL3.dll'.'SDL_ispunct' -++'_SDL_isprint'.'SDL3.dll'.'SDL_isprint' -++'_SDL_isgraph'.'SDL3.dll'.'SDL_isgraph' -# ++'_SDL_AndroidShowToast'.'SDL3.dll'.'SDL_AndroidShowToast' -++'_SDL_GetAudioDeviceSpec'.'SDL3.dll'.'SDL_GetAudioDeviceSpec' -++'_SDL_TLSCleanup'.'SDL3.dll'.'SDL_TLSCleanup' -++'_SDL_SetWindowAlwaysOnTop'.'SDL3.dll'.'SDL_SetWindowAlwaysOnTop' -++'_SDL_FlashWindow'.'SDL3.dll'.'SDL_FlashWindow' -++'_SDL_GameControllerSendEffect'.'SDL3.dll'.'SDL_GameControllerSendEffect' -++'_SDL_JoystickSendEffect'.'SDL3.dll'.'SDL_JoystickSendEffect' -++'_SDL_GameControllerGetSensorDataRate'.'SDL3.dll'.'SDL_GameControllerGetSensorDataRate' -++'_SDL_SetTextureUserData'.'SDL3.dll'.'SDL_SetTextureUserData' -++'_SDL_GetTextureUserData'.'SDL3.dll'.'SDL_GetTextureUserData' -++'_SDL_RenderGeometry'.'SDL3.dll'.'SDL_RenderGeometry' -++'_SDL_RenderGeometryRaw'.'SDL3.dll'.'SDL_RenderGeometryRaw' -++'_SDL_RenderSetVSync'.'SDL3.dll'.'SDL_RenderSetVSync' -++'_SDL_asprintf'.'SDL3.dll'.'SDL_asprintf' -++'_SDL_vasprintf'.'SDL3.dll'.'SDL_vasprintf' -++'_SDL_GetWindowICCProfile'.'SDL3.dll'.'SDL_GetWindowICCProfile' -++'_SDL_GetTicks64'.'SDL3.dll'.'SDL_GetTicks64' -# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL3.dll'.'SDL_LinuxSetThreadPriorityAndPolicy' -++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton' -++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis' -++'_SDL_hid_init'.'SDL3.dll'.'SDL_hid_init' -++'_SDL_hid_exit'.'SDL3.dll'.'SDL_hid_exit' -++'_SDL_hid_device_change_count'.'SDL3.dll'.'SDL_hid_device_change_count' -++'_SDL_hid_enumerate'.'SDL3.dll'.'SDL_hid_enumerate' -++'_SDL_hid_free_enumeration'.'SDL3.dll'.'SDL_hid_free_enumeration' -++'_SDL_hid_open'.'SDL3.dll'.'SDL_hid_open' -++'_SDL_hid_open_path'.'SDL3.dll'.'SDL_hid_open_path' -++'_SDL_hid_write'.'SDL3.dll'.'SDL_hid_write' -++'_SDL_hid_read_timeout'.'SDL3.dll'.'SDL_hid_read_timeout' -++'_SDL_hid_read'.'SDL3.dll'.'SDL_hid_read' -++'_SDL_hid_set_nonblocking'.'SDL3.dll'.'SDL_hid_set_nonblocking' -++'_SDL_hid_send_feature_report'.'SDL3.dll'.'SDL_hid_send_feature_report' -++'_SDL_hid_get_feature_report'.'SDL3.dll'.'SDL_hid_get_feature_report' -++'_SDL_hid_close'.'SDL3.dll'.'SDL_hid_close' -++'_SDL_hid_get_manufacturer_string'.'SDL3.dll'.'SDL_hid_get_manufacturer_string' -++'_SDL_hid_get_product_string'.'SDL3.dll'.'SDL_hid_get_product_string' -++'_SDL_hid_get_serial_number_string'.'SDL3.dll'.'SDL_hid_get_serial_number_string' -++'_SDL_hid_get_indexed_string'.'SDL3.dll'.'SDL_hid_get_indexed_string' -++'_SDL_SetWindowMouseRect'.'SDL3.dll'.'SDL_SetWindowMouseRect' -++'_SDL_GetWindowMouseRect'.'SDL3.dll'.'SDL_GetWindowMouseRect' -++'_SDL_RenderWindowToLogical'.'SDL3.dll'.'SDL_RenderWindowToLogical' -++'_SDL_RenderLogicalToWindow'.'SDL3.dll'.'SDL_RenderLogicalToWindow' -++'_SDL_JoystickHasRumble'.'SDL3.dll'.'SDL_JoystickHasRumble' -++'_SDL_JoystickHasRumbleTriggers'.'SDL3.dll'.'SDL_JoystickHasRumbleTriggers' -++'_SDL_GameControllerHasRumble'.'SDL3.dll'.'SDL_GameControllerHasRumble' -++'_SDL_GameControllerHasRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerHasRumbleTriggers' -++'_SDL_hid_ble_scan'.'SDL3.dll'.'SDL_hid_ble_scan' -++'_SDL_PremultiplyAlpha'.'SDL3.dll'.'SDL_PremultiplyAlpha' -# ++'_SDL_AndroidSendMessage'.'SDL3.dll'.'SDL_AndroidSendMessage' -++'_SDL_GetTouchName'.'SDL3.dll'.'SDL_GetTouchName' -++'_SDL_ClearComposition'.'SDL3.dll'.'SDL_ClearComposition' -++'_SDL_IsTextInputShown'.'SDL3.dll'.'SDL_IsTextInputShown' -++'_SDL_HasIntersectionF'.'SDL3.dll'.'SDL_HasIntersectionF' -++'_SDL_IntersectFRect'.'SDL3.dll'.'SDL_IntersectFRect' -++'_SDL_UnionFRect'.'SDL3.dll'.'SDL_UnionFRect' -++'_SDL_EncloseFPoints'.'SDL3.dll'.'SDL_EncloseFPoints' -++'_SDL_IntersectFRectAndLine'.'SDL3.dll'.'SDL_IntersectFRectAndLine' -++'_SDL_RenderGetWindow'.'SDL3.dll'.'SDL_RenderGetWindow' -++'_SDL_bsearch'.'SDL3.dll'.'SDL_bsearch' -++'_SDL_GameControllerPathForIndex'.'SDL3.dll'.'SDL_GameControllerPathForIndex' -++'_SDL_GameControllerPath'.'SDL3.dll'.'SDL_GameControllerPath' -++'_SDL_JoystickPathForIndex'.'SDL3.dll'.'SDL_JoystickPathForIndex' -++'_SDL_JoystickPath'.'SDL3.dll'.'SDL_JoystickPath' -++'_SDL_JoystickAttachVirtualEx'.'SDL3.dll'.'SDL_JoystickAttachVirtualEx' -++'_SDL_GameControllerGetFirmwareVersion'.'SDL3.dll'.'SDL_GameControllerGetFirmwareVersion' -++'_SDL_JoystickGetFirmwareVersion'.'SDL3.dll'.'SDL_JoystickGetFirmwareVersion' -++'_SDL_GUIDToString'.'SDL3.dll'.'SDL_GUIDToString' -++'_SDL_GUIDFromString'.'SDL3.dll'.'SDL_GUIDFromString' -++'_SDL_HasLSX'.'SDL3.dll'.'SDL_HasLSX' -++'_SDL_HasLASX'.'SDL3.dll'.'SDL_HasLASX' -++'_SDL_RenderGetD3D12Device'.'SDL3.dll'.'SDL_RenderGetD3D12Device' -++'_SDL_utf8strnlen'.'SDL3.dll'.'SDL_utf8strnlen' -# ++'_SDL_GDKGetTaskQueue'.'SDL3.dll'.'SDL_GDKGetTaskQueue' -# ++'_SDL_GDKRunApp'.'SDL3.dll'.'SDL_GDKRunApp' -++'_SDL_GetOriginalMemoryFunctions'.'SDL3.dll'.'SDL_GetOriginalMemoryFunctions' -++'_SDL_ResetKeyboard'.'SDL3.dll'.'SDL_ResetKeyboard' -++'_SDL_GetDefaultAudioInfo'.'SDL3.dll'.'SDL_GetDefaultAudioInfo' -++'_SDL_GetPointDisplayIndex'.'SDL3.dll'.'SDL_GetPointDisplayIndex' -++'_SDL_GetRectDisplayIndex'.'SDL3.dll'.'SDL_GetRectDisplayIndex' -++'_SDL_ResetHint'.'SDL3.dll'.'SDL_ResetHint' -++'_SDL_crc16'.'SDL3.dll'.'SDL_crc16' -++'_SDL_GetWindowSizeInPixels'.'SDL3.dll'.'SDL_GetWindowSizeInPixels' -++'_SDL_GetJoystickGUIDInfo'.'SDL3.dll'.'SDL_GetJoystickGUIDInfo' -++'_SDL_SetPrimarySelectionText'.'SDL3.dll'.'SDL_SetPrimarySelectionText' -++'_SDL_GetPrimarySelectionText'.'SDL3.dll'.'SDL_GetPrimarySelectionText' -++'_SDL_HasPrimarySelectionText'.'SDL3.dll'.'SDL_HasPrimarySelectionText' -++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL3.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' -++'_SDL_SensorGetDataWithTimestamp'.'SDL3.dll'.'SDL_SensorGetDataWithTimestamp' -++'_SDL_ResetHints'.'SDL3.dll'.'SDL_ResetHints' -++'_SDL_strcasestr'.'SDL3.dll'.'SDL_strcasestr' diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 033c4a75d..58b189842 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -24,13 +24,6 @@ #if SDL_DYNAMIC_API -#if defined(__OS2__) -#define INCL_DOS -#define INCL_DOSERRORS -#include -#include -#endif - #include "SDL.h" /* These headers have system specific definitions, so aren't included above */ @@ -356,20 +349,6 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) return retval; } -#elif defined(__OS2__) -static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) -{ - HMODULE hmodule; - PFN retval = NULL; - char error[256]; - if (DosLoadModule(error, sizeof(error), fname, &hmodule) == NO_ERROR) { - if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { - DosFreeModule(hmodule); - } - } - return (void *)retval; -} - #else #error Please define your platform. #endif diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 7b3e02da1..be2c9379b 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -50,8 +50,6 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) -#elif defined(__OS2__) -SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif @@ -749,8 +747,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return) #if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) -#elif defined(__OS2__) -SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return) #endif diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl index 6c19a8f7d..b99a8a492 100755 --- a/src/dynapi/gendynapi.pl +++ b/src/dynapi/gendynapi.pl @@ -33,7 +33,6 @@ use File::Basename; chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; -my $sdl3_exports = "src/dynapi/SDL3.exports"; my %existing = (); if (-f $sdl_dynapi_procs_h) { @@ -48,7 +47,6 @@ if (-f $sdl_dynapi_procs_h) { open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); -open(SDL3_EXPORTS, '>>', $sdl3_exports) or die("Can't open $sdl3_exports: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { @@ -135,7 +133,6 @@ while (my $d = readdir(HEADERS)) { print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; - print SDL3_EXPORTS "++'_${fn}'.'SDL3.dll'.'${fn}'\n"; } else { print("Failed to parse decl [$decl]!\n"); } @@ -146,6 +143,5 @@ closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); -close(SDL3_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 994b6a6db..27ee80393 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -31,10 +31,6 @@ #if defined(__WIN32__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif -#if defined(__OS2__) -#define INCL_WIN -#include -#endif /* #define DEBUG_MOUSE */ @@ -57,8 +53,6 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol } else { #if defined(__WIN32__) || defined(__WINGDK__) mouse->double_click_time = GetDoubleClickTime(); -#elif defined(__OS2__) - mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME); #else mouse->double_click_time = 500; #endif diff --git a/src/filesystem/os2/SDL_sysfilesystem.c b/src/filesystem/os2/SDL_sysfilesystem.c deleted file mode 100644 index 3203f0b3a..000000000 --- a/src/filesystem/os2/SDL_sysfilesystem.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_FILESYSTEM_OS2 - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent filesystem routines */ - -#include "../../core/os2/SDL_os2.h" -#include "SDL_error.h" -#include "SDL_filesystem.h" - -#define INCL_DOSFILEMGR -#define INCL_DOSPROCESS -#define INCL_DOSMODULEMGR -#define INCL_DOSERRORS -#include - - -char * -SDL_GetBasePath(void) -{ - PTIB tib; - PPIB pib; - ULONG ulRC = DosGetInfoBlocks(&tib, &pib); - PCHAR pcEnd; - CHAR acBuf[CCHMAXPATH]; - - if (ulRC != NO_ERROR) { - SDL_SetError("Can't get process information block (E%lu)", ulRC); - return NULL; - } - - ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf); - if (ulRC != NO_ERROR) { - SDL_SetError("Can't query the module name (E%lu)", ulRC); - return NULL; - } - - pcEnd = SDL_strrchr(acBuf, '\\'); - if (pcEnd != NULL) - pcEnd[1] = '\0'; - else { - if (acBuf[1] == ':') /* e.g. "C:FOO" */ - acBuf[2] = '\0'; - else { - SDL_SetError("No path in module name"); - return NULL; - } - } - - return OS2_SysToUTF8(acBuf); -} - -char * -SDL_GetPrefPath(const char *org, const char *app) -{ - PSZ pszPath; - CHAR acBuf[CCHMAXPATH]; - int lPosApp, lPosOrg; - PSZ pszApp, pszOrg; - - if (!app) { - SDL_InvalidParamError("app"); - return NULL; - } - - pszPath = SDL_getenv("HOME"); - if (!pszPath) { - pszPath = SDL_getenv("ETC"); - if (!pszPath) { - SDL_SetError("HOME or ETC environment not set"); - return NULL; - } - } - - if (!org) { - lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s", pszPath); - } else { - pszOrg = OS2_UTF8ToSys(org); - if (!pszOrg) { - SDL_OutOfMemory(); - return NULL; - } - lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg); - SDL_free(pszOrg); - } - if (lPosApp < 0) - return NULL; - - DosCreateDir(acBuf, NULL); - - pszApp = OS2_UTF8ToSys(app); - if (!pszApp) { - SDL_OutOfMemory(); - return NULL; - } - - lPosOrg = SDL_snprintf(&acBuf[lPosApp], sizeof(acBuf) - lPosApp - 1, "\\%s", pszApp); - SDL_free(pszApp); - if (lPosOrg < 0) - return NULL; - - DosCreateDir(acBuf, NULL); - *((PUSHORT)&acBuf[lPosApp + lPosOrg]) = (USHORT)'\0\\'; - - return OS2_SysToUTF8(acBuf); -} - -#endif /* SDL_FILESYSTEM_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index 9e2a43589..199870197 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -418,9 +418,6 @@ static int is_language_supported(libusb_device_handle *dev, uint16_t lang) /* This function returns a newly allocated wide string containing the USB device string numbered by the index. The returned string must be freed by using free(). */ -#if defined(__OS2__) /* don't use iconv on OS/2: no support for wchar_t. */ -#define NO_ICONV -#endif static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) { char buf[512]; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 033929694..de15d5d12 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -87,9 +87,6 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */ &SDL_BSD_JoystickDriver, #endif -#ifdef SDL_JOYSTICK_OS2 - &SDL_OS2_JoystickDriver, -#endif #ifdef SDL_JOYSTICK_PS2 &SDL_PS2_JoystickDriver, #endif diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 015007c59..ae8372ef7 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -239,7 +239,6 @@ extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; extern SDL_JoystickDriver SDL_WGI_JoystickDriver; extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver; extern SDL_JoystickDriver SDL_WINMM_JoystickDriver; -extern SDL_JoystickDriver SDL_OS2_JoystickDriver; extern SDL_JoystickDriver SDL_PS2_JoystickDriver; extern SDL_JoystickDriver SDL_PSP_JoystickDriver; extern SDL_JoystickDriver SDL_VITA_JoystickDriver; diff --git a/src/joystick/os2/SDL_os2joystick.c b/src/joystick/os2/SDL_os2joystick.c deleted file mode 100644 index bf2dc605c..000000000 --- a/src/joystick/os2/SDL_os2joystick.c +++ /dev/null @@ -1,799 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_JOYSTICK_OS2 - -/* OS/2 Joystick driver, contributed by Daniel Caetano */ - -#define INCL_DOSDEVICES -#define INCL_DOSDEVIOCTL -#define INCL_DOSMEMMGR -#include - -/***************************************************************** - * OS/2 Joystick driver defs. Based on docs at edm2.com and in old - * drivers available at hobbes.nmsu.edu and www.os2site.com - *****************************************************************/ - -#define GAME_GET_VERSION 0x01 -#define GAME_GET_PARMS 0x02 -#define GAME_GET_CALIB 0x04 -#define GAME_GET_STATUS 0x10 - -#define IOCTL_CAT_USER 0x80 -#define GAME_PORT_GET 0x20 -#define GAME_PORT_RESET 0x60 - -#pragma pack(push,1) -typedef struct { - USHORT uJs_AxCnt, uJs_AyCnt; /* A joystick X/Y pos */ - USHORT uJs_BxCnt, uJs_ByCnt; /* B joystick X/Y pos */ - USHORT usJs_ButtonA1Cnt, usJs_ButtonA2Cnt;/* A1/A2 press cnts */ - USHORT usJs_ButtonB1Cnt, usJs_ButtonB2Cnt;/* B1/B2 press cnts */ - UCHAR ucJs_JoyStickMask; /* mask of connected joystick pots */ - UCHAR ucJs_ButtonStatus; /* bits of switches down */ - ULONG ulJs_Ticks; /* total clock ticks (60 Hz) */ -} GAME_PORT_STRUCT; -#pragma pack(pop) - -typedef struct { - USHORT useA, useB; - USHORT mode; - USHORT format; - USHORT sampDiv; - USHORT scale; - USHORT res1, res2; -} GAME_PARM_STRUCT; - -typedef struct { - SHORT x, y; -} GAME_2DPOS_STRUCT; - -typedef struct { - SHORT lower, centre, upper; -} GAME_3POS_STRUCT; - -typedef struct { - GAME_3POS_STRUCT Ax, Ay, Bx, By; -} GAME_CALIB_STRUCT; - -typedef struct { - GAME_2DPOS_STRUCT A, B; - USHORT butMask; -} GAME_DATA_STRUCT; - -typedef struct { - GAME_DATA_STRUCT curdata; - USHORT b1cnt, b2cnt, b3cnt, b4cnt; -} GAME_STATUS_STRUCT; - -/*****************************************************************/ - -#include "SDL_joystick.h" -#include "SDL_events.h" -#include "../SDL_sysjoystick.h" -#include "../SDL_joystick_c.h" - -static HFILE hJoyPort = NULLHANDLE; /* Joystick GAME$ Port Address */ -#define MAX_JOYSTICKS 2 /* Maximum of two joysticks */ -#define MAX_AXES 4 /* each joystick can have up to 4 axes */ -#define MAX_BUTTONS 8 /* 8 buttons */ -#define MAX_HATS 0 /* 0 hats - OS/2 doesn't support it */ -#define MAX_BALLS 0 /* and 0 balls - OS/2 doesn't support it */ -#define MAX_JOYNAME 128 /* Joystick name may have 128 characters */ -/* Calc Button Flag for buttons A to D */ -#define JOY_BUTTON_FLAG(n) (1< MAX_JOYSTICKS) maxdevs = MAX_JOYSTICKS; - - /* Defines min/max axes values (callibration) */ - ulDataLen = sizeof(stGameCalib); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_CALIB, - NULL, 0, NULL, &stGameCalib, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(&hJoyPort); - return SDL_SetError("Could not read callibration data."); - } - - /* Determine how many joysticks are active */ - numdevs = 0; /* Points no device */ - ucNewJoystickMask = 0x0F; /* read all 4 joystick axis */ - ulDataLen = sizeof(ucNewJoystickMask); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_RESET, - &ucNewJoystickMask, ulDataLen, &ulDataLen, NULL, 0, NULL); - if (rc == 0) - { - ulDataLen = sizeof(stJoyStatus); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET, - NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(&hJoyPort); - return SDL_SetError("Could not call joystick port."); - } - ulLastTick = stJoyStatus.ulJs_Ticks; - while (stJoyStatus.ulJs_Ticks == ulLastTick) - { - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET, - NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen); - } - if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0) numdevs++; - if (((stJoyStatus.ucJs_JoyStickMask >> 2) & 0x03) > 0) numdevs++; - } - - if (numdevs > maxdevs) numdevs = maxdevs; - - /* If *any* joystick was detected... Let's configure SDL for them */ - if (numdevs > 0) - { - /* Verify if it is a "user defined" joystick */ - if (joyGetEnv(&joycfg)) - { - GAME_3POS_STRUCT * axis[4]; - axis[0] = &stGameCalib.Ax; - axis[1] = &stGameCalib.Ay; - axis[2] = &stGameCalib.Bx; - axis[3] = &stGameCalib.By; - - /* Say it has one device only (user defined is always one device only) */ - numdevs = 1; - - /* Define Device 0 as... */ - SYS_JoyData[0].id = 0; - - /* Define Number of Axes... up to 4 */ - if (joycfg.axes>MAX_AXES) joycfg.axes = MAX_AXES; - SYS_JoyData[0].axes = joycfg.axes; - - /* Define number of buttons... 8 if 2 axes, 6 if 3 axes and 4 if 4 axes */ - maxbut = MAX_BUTTONS; - if (joycfg.axes>2) maxbut -= ((joycfg.axes - 2)<<1); /* MAX_BUTTONS - 2*(axes-2) */ - if (joycfg.buttons > maxbut) joycfg.buttons = maxbut; - SYS_JoyData[0].buttons = joycfg.buttons; - - /* Define number of hats */ - if (joycfg.hats > MAX_HATS) joycfg.hats = MAX_HATS; - SYS_JoyData[0].hats = joycfg.hats; - - /* Define number of balls */ - if (joycfg.balls > MAX_BALLS) joycfg.balls = MAX_BALLS; - SYS_JoyData[0].balls = joycfg.balls; - - /* Initialize Axes Callibration Values */ - for (i=0; ilower; - SYS_JoyData[0].axes_med[i] = axis[i]->centre; - SYS_JoyData[0].axes_max[i] = axis[i]->upper; - } - /* Initialize Buttons 5 to 8 structures */ - if (joycfg.buttons>=5) SYS_JoyData[0].buttoncalc[0] = ((axis[2]->lower+axis[3]->centre)>>1); - if (joycfg.buttons>=6) SYS_JoyData[0].buttoncalc[1] = ((axis[3]->lower+axis[3]->centre)>>1); - if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2] = ((axis[2]->upper+axis[3]->centre)>>1); - if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3] = ((axis[3]->upper+axis[3]->centre)>>1); - /* Intialize Joystick Name */ - SDL_strlcpy (SYS_JoyData[0].szDeviceName,joycfg.name, SDL_arraysize(SYS_JoyData[0].szDeviceName)); - } - /* Default Init ... autoconfig */ - else - { - /* if two devices were detected... configure as Joy1 4 axis and Joy2 2 axis */ - if (numdevs == 2) - { - /* Define Device 0 as 4 axes, 4 buttons */ - SYS_JoyData[0].id=0; - SYS_JoyData[0].axes = 4; - SYS_JoyData[0].buttons = 4; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper; - SYS_JoyData[0].axes_min[2] = stGameCalib.Bx.lower; - SYS_JoyData[0].axes_med[2] = stGameCalib.Bx.centre; - SYS_JoyData[0].axes_max[2] = stGameCalib.Bx.upper; - SYS_JoyData[0].axes_min[3] = stGameCalib.By.lower; - SYS_JoyData[0].axes_med[3] = stGameCalib.By.centre; - SYS_JoyData[0].axes_max[3] = stGameCalib.By.upper; - /* Define Device 1 as 2 axes, 2 buttons */ - SYS_JoyData[1].id=1; - SYS_JoyData[1].axes = 2; - SYS_JoyData[1].buttons = 2; - SYS_JoyData[1].hats = 0; - SYS_JoyData[1].balls = 0; - SYS_JoyData[1].axes_min[0] = stGameCalib.Bx.lower; - SYS_JoyData[1].axes_med[0] = stGameCalib.Bx.centre; - SYS_JoyData[1].axes_max[0] = stGameCalib.Bx.upper; - SYS_JoyData[1].axes_min[1] = stGameCalib.By.lower; - SYS_JoyData[1].axes_med[1] = stGameCalib.By.centre; - SYS_JoyData[1].axes_max[1] = stGameCalib.By.upper; - } - /* One joystick only? */ - else - { - /* If it is joystick A... */ - if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0) - { - /* Define Device 0 as 2 axes, 4 buttons */ - SYS_JoyData[0].id=0; - SYS_JoyData[0].axes = 2; - SYS_JoyData[0].buttons = 4; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper; - } - /* If not, it is joystick B */ - else - { - /* Define Device 1 as 2 axes, 2 buttons */ - SYS_JoyData[0].id=1; - SYS_JoyData[0].axes = 2; - SYS_JoyData[0].buttons = 2; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Bx.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Bx.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Bx.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.By.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.By.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper; - } - } - - /* Hack to define Joystick Port Names */ - if (numdevs > maxdevs) numdevs = maxdevs; - - for (i = 0; i < numdevs; i++) - { - SDL_snprintf(SYS_JoyData[i].szDeviceName, - SDL_arraysize(SYS_JoyData[i].szDeviceName), - "Default Joystick %c", 'A'+SYS_JoyData[i].id); - } - } - } - /* Return the number of devices found */ - numjoysticks = numdevs; - return numdevs; -} - -static int OS2_NumJoysticks(void) -{ - return numjoysticks; -} - -static void OS2_JoystickDetect(void) -{ -} - -static const char *OS2_JoystickGetDeviceName(int device_index) -{ - /* No need to verify if device exists, already done in upper layer */ - return SYS_JoyData[device_index].szDeviceName; -} - -static const char *OS2_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - -static int OS2_JoystickGetDevicePlayerIndex(int device_index) -{ - return -1; -} - -static void OS2_JoystickSetDevicePlayerIndex(int device_index, int player_index) -{ -} - -static SDL_JoystickGUID OS2_JoystickGetDeviceGUID(int device_index) -{ - /* the GUID is just the name for now */ - const char *name = OS2_JoystickGetDeviceName(device_index); - return SDL_CreateJoystickGUIDForName(name); -} - -static SDL_JoystickID OS2_JoystickGetDeviceInstanceID(int device_index) -{ - return device_index; -} - -/******************************************************************************/ -/* Function to open a joystick for use. */ -/* The joystick to open is specified by the device index. */ -/* This should fill the nbuttons and naxes fields of the joystick structure. */ -/* It returns 0, or -1 if there is an error. */ -/******************************************************************************/ -static int OS2_JoystickOpen(SDL_Joystick *joystick, int device_index) -{ - int index; /* Index shortcut for index in joystick structure */ - int i; /* Generic Counter */ - - /* allocate memory for system specific hardware data */ - joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata)); - if (!joystick->hwdata) - { - return SDL_OutOfMemory(); - } - - /* ShortCut Pointer */ - index = device_index; - joystick->instance_id = device_index; - - /* Define offsets and scales for all axes */ - joystick->hwdata->id = SYS_JoyData[index].id; - for (i = 0; i < MAX_AXES; ++i) - { - if ((i < 2) || i < SYS_JoyData[index].axes) - { - joystick->hwdata->transaxes[i].offset = ((SDL_JOYSTICK_AXIS_MAX + SDL_JOYSTICK_AXIS_MIN)>>1) - SYS_JoyData[index].axes_med[i]; - joystick->hwdata->transaxes[i].scale1 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MIN/SYS_JoyData[index].axes_min[i])); - joystick->hwdata->transaxes[i].scale2 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MAX/SYS_JoyData[index].axes_max[i])); - } - else - { - joystick->hwdata->transaxes[i].offset = 0; - joystick->hwdata->transaxes[i].scale1 = 1.0f; /* Just in case */ - joystick->hwdata->transaxes[i].scale2 = 1.0f; /* Just in case */ - } - } - - /* fill nbuttons, naxes, and nhats fields */ - joystick->nbuttons = SYS_JoyData[index].buttons; - joystick->naxes = SYS_JoyData[index].axes; - - /* joystick->nhats = SYS_JoyData[index].hats; */ - joystick->nhats = 0; /* No support for hats at this time */ - - /* joystick->nballs = SYS_JoyData[index].balls; */ - joystick->nballs = 0; /* No support for balls at this time */ - - return 0; -} - -static int OS2_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) -{ - return SDL_Unsupported(); -} - -static Uint32 OS2_JoystickGetCapabilities(SDL_Joystick *joystick) -{ - return 0; -} - -static int OS2_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) -{ - return SDL_Unsupported(); -} - -/***************************************************************************/ -/* Function to update the state of a joystick - called as a device poll. */ -/* This function shouldn't update the joystick structure directly, */ -/* but instead should call SDL_PrivateJoystick*() to deliver events */ -/* and update joystick device state. */ -/***************************************************************************/ -static void OS2_JoystickUpdate(SDL_Joystick *joystick) -{ - APIRET rc; /* Generic OS/2 return code */ - int index; /* index shortcurt to joystick index */ - int i; /* Generic counter */ - int normbut; /* Number of buttons reported by joystick */ - int corr; /* Correction for button names */ - Sint16 value; /* Values used to update axis values */ - struct _transaxes *transaxes; /* Shortcut for Correction structure */ - Uint32 pos[MAX_AXES]; /* Vector to inform the Axis status */ - ULONG ulDataLen; /* Size of data */ - GAME_STATUS_STRUCT stGameStatus; /* Joystick Status Structure */ - - ulDataLen = sizeof(stGameStatus); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_STATUS, - NULL, 0, NULL, &stGameStatus, ulDataLen, &ulDataLen); - if (rc != 0) - { - SDL_SetError("Could not read joystick status."); - return; /* Could not read data */ - } - - /* Shortcut pointer */ - index = joystick->instance_id; - - /* joystick motion events */ - - if (SYS_JoyData[index].id == 0) - { - pos[0] = stGameStatus.curdata.A.x; - pos[1] = stGameStatus.curdata.A.y; - if (SYS_JoyData[index].axes >= 3) pos[2] = stGameStatus.curdata.B.x; - else pos[2] = 0; - if (SYS_JoyData[index].axes >= 4) pos[3] = stGameStatus.curdata.B.y; - else pos[3] = 0; - /* OS/2 basic drivers do not support more than 4 axes joysticks */ - } - else if (SYS_JoyData[index].id == 1) - { - pos[0] = stGameStatus.curdata.B.x; - pos[1] = stGameStatus.curdata.B.y; - pos[2] = 0; - pos[3] = 0; - } - - /* Corrects the movements using the callibration */ - transaxes = joystick->hwdata->transaxes; - for (i = 0; i < joystick->naxes; i++) - { - value = pos[i] + transaxes[i].offset; - if (value < 0) - { - value *= transaxes[i].scale1; - if (value > 0) value = SDL_JOYSTICK_AXIS_MIN; - } - else - { - value *= transaxes[i].scale2; - if (value < 0) value = SDL_JOYSTICK_AXIS_MAX; - } - SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)value); - } - - /* joystick button A to D events */ - if (SYS_JoyData[index].id == 1) corr = 2; - else corr = 0; - normbut = 4; /* Number of normal buttons */ - if (joystick->nbuttons < normbut) normbut = joystick->nbuttons; - for (i = corr; (i-corr) < normbut; ++i) - { - /* - Button A: 1110 0000 - Button B: 1101 0000 - Button C: 1011 0000 - Button D: 0111 0000 - */ - if ((~stGameStatus.curdata.butMask)>>4 & JOY_BUTTON_FLAG(i)) - { - SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_PRESSED); - } - else - { - SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_RELEASED); - } - } - - /* Joystick button E to H buttons */ - /* - Button E: Axis 2 X Left - Button F: Axis 2 Y Up - Button G: Axis 2 X Right - Button H: Axis 2 Y Down - */ - if (joystick->nbuttons >= 5) - { - if (stGameStatus.curdata.B.x < SYS_JoyData[index].buttoncalc[0]) SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_RELEASED); - } - if (joystick->nbuttons >= 6) - { - if (stGameStatus.curdata.B.y < SYS_JoyData[index].buttoncalc[1]) SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_RELEASED); - } - if (joystick->nbuttons >= 7) - { - if (stGameStatus.curdata.B.x > SYS_JoyData[index].buttoncalc[2]) SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_RELEASED); - } - if (joystick->nbuttons >= 8) - { - if (stGameStatus.curdata.B.y > SYS_JoyData[index].buttoncalc[3]) SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_RELEASED); - } - - /* joystick hat events */ - /* Not Supported under OS/2 */ - /* joystick ball events */ - /* Not Supported under OS/2 */ -} - -/******************************************/ -/* Function to close a joystick after use */ -/******************************************/ -static void OS2_JoystickClose(SDL_Joystick *joystick) -{ - /* free system specific hardware data */ - SDL_free(joystick->hwdata); -} - -/********************************************************************/ -/* Function to perform any system-specific joystick related cleanup */ -/********************************************************************/ -static void OS2_JoystickQuit(void) -{ - joyPortClose(&hJoyPort); -} - -static SDL_bool OS2_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) -{ - return SDL_FALSE; -} - - -/************************/ -/* OS/2 Implementations */ -/************************/ - -/*****************************************/ -/* Open Joystick Port, if not opened yet */ -/*****************************************/ -static int joyPortOpen(HFILE * hGame) -{ - APIRET rc; /* Generic Return Code */ - ULONG ulAction; /* ? */ - ULONG ulVersion; /* Version of joystick driver */ - ULONG ulDataLen; /* Size of version data */ - - /* Verifies if joyport is not already open... */ - if (*hGame != NULLHANDLE) return 0; - - /* Open GAME$ for read */ - rc = DosOpen("GAME$ ", hGame, &ulAction, 0, FILE_READONLY, - FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL); - if (rc != 0) - { - return SDL_SetError("Could not open Joystick Port."); - } - - /* Get Joystick Driver Version... must be 2.0 or higher */ - ulVersion = 0; - ulDataLen = sizeof(ulVersion); - rc = DosDevIOCtl(*hGame, IOCTL_CAT_USER, GAME_GET_VERSION, - NULL, 0, NULL, &ulVersion, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(hGame); - return SDL_SetError("Could not get Joystick Driver version."); - } - if (ulVersion < 0x20) - { - joyPortClose(hGame); - return SDL_SetError("Driver too old. At least IBM driver version 2.0 required."); - } - return 0; -} - -/****************************/ -/* Close JoyPort, if opened */ -/****************************/ -static void joyPortClose(HFILE * hGame) -{ - if (*hGame != NULLHANDLE) DosClose(*hGame); - *hGame = NULLHANDLE; -} - -/***************************/ -/* Get SDL Joystick EnvVar */ -/***************************/ -static int joyGetEnv(struct _joycfg * joydata) -{ - const char *joyenv; /* Pointer to tested character */ - char tempnumber[5]; /* Temporary place to put numeric texts */ - - joyenv = SDL_getenv("SDL_OS2_JOYSTICK"); - if (joyenv == NULL) return 0; - - /* Joystick Environment is defined! */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - - /* If the string name starts with '... get if fully */ - if (*joyenv == '\'') { - joyenv++; - joyenv += joyGetData(joyenv,joydata->name,'\'',sizeof(joydata->name)); - } - /* If not, get it until the next space */ - else if (*joyenv == '\"') { - joyenv++; - joyenv += joyGetData(joyenv,joydata->name,'\"',sizeof(joydata->name)); - } - else { - joyenv += joyGetData(joyenv,joydata->name, ' ',sizeof(joydata->name)); - } - - /* Now get the number of axes */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->axes = SDL_atoi(tempnumber); - - /* Now get the number of buttons */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->buttons = SDL_atoi(tempnumber); - - /* Now get the number of hats */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->hats = SDL_atoi(tempnumber); - - /* Now get the number of balls */ - while (*joyenv==' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->balls = SDL_atoi(tempnumber); - return 1; -} - -/************************************************************************/ -/* Get a text from in the string starting in joyenv until it finds */ -/* the stopchar or maxchars is reached. The result is placed in name. */ -/************************************************************************/ -static int joyGetData(const char *joyenv, char *name, char stopchar, size_t maxchars) -{ - char *nameptr; /* Pointer to the selected character */ - int chcnt = 0; /* Count how many characters where copied */ - - nameptr = name; - while (*joyenv!=stopchar && *joyenv!=0) - { - if (nameptr < (name + (maxchars-1))) - { - *nameptr = *joyenv; /* Only copy if smaller than maximum */ - nameptr++; - } - chcnt++; - joyenv++; - } - if (*joyenv == stopchar) - { - joyenv++; /* Jump stopchar */ - chcnt++; - } - *nameptr = 0; /* Mark last byte */ - return chcnt; -} - -SDL_JoystickDriver SDL_OS2_JoystickDriver = -{ - OS2_JoystickInit, - OS2_NumJoysticks, - OS2_JoystickDetect, - OS2_JoystickGetDeviceName, - OS2_JoystickGetDevicePath, - OS2_JoystickGetDevicePlayerIndex, - OS2_JoystickSetDevicePlayerIndex, - OS2_JoystickGetDeviceGUID, - OS2_JoystickGetDeviceInstanceID, - OS2_JoystickOpen, - OS2_JoystickRumble, - OS2_JoystickRumbleTriggers, - OS2_JoystickGetCapabilities, - OS2_JoystickSetLED, - OS2_JoystickSendEffect, - OS2_JoystickSetSensorsEnabled, - OS2_JoystickUpdate, - OS2_JoystickClose, - OS2_JoystickQuit, - OS2_JoystickGetGamepadMapping -}; - -#endif /* SDL_JOYSTICK_OS2 */ diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c deleted file mode 100644 index 292196ecb..000000000 --- a/src/loadso/os2/SDL_sysloadso.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_LOADSO_OS2 - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent library loading routines */ - -#include "SDL_loadso.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSMODULEMGR -#define INCL_DOSERRORS -#include - -void * -SDL_LoadObject(const char *sofile) -{ - ULONG ulRC; - HMODULE hModule; - CHAR acError[256]; - PSZ pszModName; - - if (!sofile) { - SDL_InvalidParamError("sofile"); - return NULL; - } - - pszModName = OS2_UTF8ToSys(sofile); - ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); - - if (ulRC != NO_ERROR && !SDL_strrchr(pszModName, '\\') && !SDL_strrchr(pszModName, '/')) { - /* strip .dll extension and retry only if name has no path. */ - size_t len = SDL_strlen(pszModName); - if (len > 4 && SDL_strcasecmp(&pszModName[len - 4], ".dll") == 0) { - pszModName[len - 4] = '\0'; - ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); - } - } - if (ulRC != NO_ERROR) { - SDL_SetError("Failed loading %s: %s (E%u)", sofile, acError, ulRC); - hModule = NULLHANDLE; - } - SDL_free(pszModName); - - return (void *)hModule; -} - -void * -SDL_LoadFunction(void *handle, const char *name) -{ - ULONG ulRC; - PFN pFN; - - ulRC = DosQueryProcAddr((HMODULE)handle, 0, name, &pFN); - if (ulRC != NO_ERROR) { - /* retry with an underscore prepended, e.g. for gcc-built dlls. */ - SDL_bool isstack; - size_t len = SDL_strlen(name) + 1; - char *_name = SDL_small_alloc(char, len + 1, &isstack); - _name[0] = '_'; - SDL_memcpy(&_name[1], name, len); - ulRC = DosQueryProcAddr((HMODULE)handle, 0, _name, &pFN); - SDL_small_free(_name, isstack); - } - if (ulRC != NO_ERROR) { - SDL_SetError("Failed loading procedure %s (E%u)", name, ulRC); - return NULL; - } - - return (void *)pFN; -} - -void -SDL_UnloadObject(void *handle) -{ - if (handle != NULL) { - DosFreeModule((HMODULE)handle); - } -} - -#endif /* SDL_LOADSO_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index f3348eaa9..faa66d715 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -42,8 +42,6 @@ #include "n3ds/SDL_systhread_c.h" #elif SDL_THREAD_STDCPP #include "stdcpp/SDL_systhread_c.h" -#elif SDL_THREAD_OS2 -#include "os2/SDL_systhread_c.h" #elif SDL_THREAD_NGAGE #include "ngage/SDL_systhread_c.h" #else diff --git a/src/thread/os2/SDL_sysmutex.c b/src/thread/os2/SDL_sysmutex.c deleted file mode 100644 index d3fc7a3bd..000000000 --- a/src/thread/os2/SDL_sysmutex.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* An implementation of mutexes for OS/2 */ - -#include "SDL_thread.h" -#include "SDL_systhread_c.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#include - -struct SDL_mutex { - HMTX _handle; -}; - -/* Create a mutex */ -SDL_mutex * -SDL_CreateMutex(void) -{ - ULONG ulRC; - HMTX hMtx; - - ulRC = DosCreateMutexSem(NULL, &hMtx, 0, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateMutexSem(), rc = %u", ulRC); - return NULL; - } - - return (SDL_mutex *)hMtx; -} - -/* Free the mutex */ -void -SDL_DestroyMutex(SDL_mutex * mutex) -{ - HMTX hMtx = (HMTX)mutex; - if (hMtx != NULLHANDLE) { - const ULONG ulRC = DosCloseMutexSem(hMtx); - if (ulRC != NO_ERROR) { - debug_os2("DosCloseMutexSem(), rc = %u", ulRC); - } - } -} - -/* Lock the mutex */ -int -SDL_LockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosRequestMutexSem(hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) { - debug_os2("DosRequestMutexSem(), rc = %u", ulRC); - return -1; - } - - return 0; -} - -/* try Lock the mutex */ -int -SDL_TryLockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosRequestMutexSem(hMtx, SEM_IMMEDIATE_RETURN); - - if (ulRC == ERROR_TIMEOUT) - return SDL_MUTEX_TIMEDOUT; - - if (ulRC != NO_ERROR) { - debug_os2("DosRequestMutexSem(), rc = %u", ulRC); - return -1; - } - - return 0; -} - -/* Unlock the mutex */ -int -SDL_UnlockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosReleaseMutexSem(hMtx); - if (ulRC != NO_ERROR) - return SDL_SetError("DosReleaseMutexSem(), rc = %u", ulRC); - - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_syssem.c b/src/thread/os2/SDL_syssem.c deleted file mode 100644 index 79bf0673f..000000000 --- a/src/thread/os2/SDL_syssem.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* An implementation of semaphores for OS/2 */ - -#include "SDL_thread.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#define INCL_DOSMISC -#include - -struct SDL_semaphore { - HEV hEv; - HMTX hMtx; - ULONG cPost; -}; - - -SDL_sem * -SDL_CreateSemaphore(Uint32 initial_value) -{ - ULONG ulRC; - SDL_sem *pSDLSem = SDL_malloc(sizeof(SDL_sem)); - - if (pSDLSem == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - ulRC = DosCreateEventSem(NULL, &pSDLSem->hEv, DCE_AUTORESET, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateEventSem(), rc = %u", ulRC); - SDL_free(pSDLSem); - return NULL; - } - - ulRC = DosCreateMutexSem(NULL, &pSDLSem->hMtx, 0, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateMutexSem(), rc = %u", ulRC); - DosCloseEventSem(pSDLSem->hEv); - SDL_free(pSDLSem); - return NULL; - } - - pSDLSem->cPost = initial_value; - - return pSDLSem; -} - -void -SDL_DestroySemaphore(SDL_sem * sem) -{ - if (!sem) return; - - DosCloseMutexSem(sem->hMtx); - DosCloseEventSem(sem->hEv); - SDL_free(sem); -} - -int -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) -{ - ULONG ulRC; - ULONG ulStartTime, ulCurTime; - ULONG ulTimeout; - ULONG cPost; - - if (sem == NULL) - return SDL_InvalidParamError("sem"); - - if (timeout != SEM_INDEFINITE_WAIT) - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStartTime, sizeof(ULONG)); - - while (TRUE) { - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - cPost = sem->cPost; - if (sem->cPost != 0) - sem->cPost--; - - DosReleaseMutexSem(sem->hMtx); - - if (cPost != 0) - break; - - if (timeout == SEM_INDEFINITE_WAIT) - ulTimeout = SEM_INDEFINITE_WAIT; - else { - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulCurTime, sizeof(ULONG)); - ulTimeout = ulCurTime - ulStartTime; - if (timeout < ulTimeout) - return SDL_MUTEX_TIMEDOUT; - ulTimeout = timeout - ulTimeout; - } - - ulRC = DosWaitEventSem(sem->hEv, ulTimeout); - if (ulRC == ERROR_TIMEOUT) - return SDL_MUTEX_TIMEDOUT; - - if (ulRC != NO_ERROR) - return SDL_SetError("DosWaitEventSem() failed, rc = %u", ulRC); - } - - return 0; -} - -int -SDL_SemTryWait(SDL_sem * sem) -{ - return SDL_SemWaitTimeout(sem, 0); -} - -int -SDL_SemWait(SDL_sem * sem) -{ - return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); -} - -Uint32 -SDL_SemValue(SDL_sem * sem) -{ - ULONG ulRC; - - if (sem == NULL) { - SDL_InvalidParamError("sem"); - return 0; - } - - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - ulRC = sem->cPost; - DosReleaseMutexSem(sem->hMtx); - - return ulRC; -} - -int -SDL_SemPost(SDL_sem * sem) -{ - ULONG ulRC; - - if (sem == NULL) - return SDL_InvalidParamError("sem"); - - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - sem->cPost++; - - ulRC = DosPostEventSem(sem->hEv); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem() failed, rc = %u", ulRC); - } - - DosReleaseMutexSem(sem->hMtx); - - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c deleted file mode 100644 index 8c64e9c32..000000000 --- a/src/thread/os2/SDL_systhread.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* Thread management routines for SDL */ - -#include "SDL_thread.h" -#include "../SDL_systhread.h" -#include "../SDL_thread_c.h" -#include "../SDL_systhread.h" -#include "SDL_systls_c.h" -#include "../../core/os2/SDL_os2.h" -#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD -#error This source only adjusted for SDL_PASSED_BEGINTHREAD_ENDTHREAD -#endif - -#define INCL_DOSPROCESS -#define INCL_DOSERRORS -#include -#include - - -static void RunThread(void *data) -{ - SDL_Thread *thread = (SDL_Thread *) data; - pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc; - - if (ppSDLTLSData != NULL) - *ppSDLTLSData = NULL; - - SDL_RunThread(thread); - - if (pfnEndThread != NULL) - pfnEndThread(); -} - -int -SDL_SYS_CreateThread(SDL_Thread * thread, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread) -{ - if (thread->stacksize == 0) - thread->stacksize = 65536; - - if (pfnBeginThread) { - /* Save the function which we will have to call to clear the RTL of calling app! */ - thread->endfunc = pfnEndThread; - /* Start the thread using the runtime library of calling app! */ - thread->handle = (SYS_ThreadHandle) - pfnBeginThread(RunThread, NULL, thread->stacksize, thread); - } else { - thread->endfunc = _endthread; - thread->handle = (SYS_ThreadHandle) - _beginthread(RunThread, NULL, thread->stacksize, thread); - } - - if (thread->handle == -1) - return SDL_SetError("Not enough resources to create thread"); - - return 0; -} - -void -SDL_SYS_SetupThread(const char *name) -{ - /* nothing. */ -} - -SDL_threadID -SDL_ThreadID(void) -{ - PTIB tib; - PPIB pib; - - DosGetInfoBlocks(&tib, &pib); - return tib->tib_ptib2->tib2_ultid; -} - -int -SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) -{ - ULONG ulRC; - - ulRC = DosSetPriority(PRTYS_THREAD, - (priority < SDL_THREAD_PRIORITY_NORMAL)? PRTYC_IDLETIME : - (priority > SDL_THREAD_PRIORITY_NORMAL)? PRTYC_TIMECRITICAL : - PRTYC_REGULAR, - 0, 0); - if (ulRC != NO_ERROR) - return SDL_SetError("DosSetPriority() failed, rc = %u", ulRC); - - return 0; -} - -void -SDL_SYS_WaitThread(SDL_Thread * thread) -{ - ULONG ulRC = DosWaitThread((PTID)&thread->handle, DCWW_WAIT); - - if (ulRC != NO_ERROR) { - debug_os2("DosWaitThread() failed, rc = %u", ulRC); - } -} - -void -SDL_SYS_DetachThread(SDL_Thread * thread) -{ - /* nothing. */ -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systhread_c.h b/src/thread/os2/SDL_systhread_c.h deleted file mode 100644 index dedceb396..000000000 --- a/src/thread/os2/SDL_systhread_c.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -typedef int SYS_ThreadHandle; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systls.c b/src/thread/os2/SDL_systls.c deleted file mode 100644 index b48a4bd39..000000000 --- a/src/thread/os2/SDL_systls.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -#include "../../core/os2/SDL_os2.h" - -#include "SDL_thread.h" -#include "../SDL_thread_c.h" - -#define INCL_DOSPROCESS -#define INCL_DOSERRORS -#include - -SDL_TLSData **ppSDLTLSData = NULL; - -static ULONG cTLSAlloc = 0; - -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void) -{ - ULONG ulRC; - - if (cTLSAlloc == 0 || ppSDLTLSData == NULL) { - /* First call - allocate the thread local memory (1 DWORD) */ - ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC); - } - } - cTLSAlloc++; -} - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void) -{ - ULONG ulRC; - - if (cTLSAlloc != 0) - cTLSAlloc--; - - if (cTLSAlloc == 0 && ppSDLTLSData != NULL) { - /* Last call - free the thread local memory */ - ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC); - } else { - ppSDLTLSData = NULL; - } - } -} - -SDL_TLSData *SDL_SYS_GetTLSData(void) -{ - return (ppSDLTLSData == NULL)? NULL : *ppSDLTLSData; -} - -int SDL_SYS_SetTLSData(SDL_TLSData *data) -{ - if (!ppSDLTLSData) - return -1; - - *ppSDLTLSData = data; - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systls_c.h b/src/thread/os2/SDL_systls_c.h deleted file mode 100644 index e40d5ddcf..000000000 --- a/src/thread/os2/SDL_systls_c.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -#include "../SDL_thread_c.h" - -extern SDL_TLSData **ppSDLTLSData; - -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void); - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void); - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index 8f44e473c..3701cf01f 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -45,23 +45,6 @@ typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned, unsigned *threadID); typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); -#elif defined(__WATCOMC__) -/* This is for Watcom targets except OS2 */ -#if __WATCOMC__ < 1240 -#define __watcall -#endif -typedef unsigned long (__watcall * pfnSDL_CurrentBeginThread) (void *, - unsigned, - unsigned - (__stdcall * - func) (void - *), - void *arg, - unsigned, - unsigned - *threadID); -typedef void (__watcall * pfnSDL_CurrentEndThread) (unsigned code); - #else typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall * diff --git a/src/timer/os2/SDL_systimer.c b/src/timer/os2/SDL_systimer.c deleted file mode 100644 index 8a8425d29..000000000 --- a/src/timer/os2/SDL_systimer.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_TIMER_OS2 - -#include "SDL_timer.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSERRORS -#define INCL_DOSMISC -#define INCL_DOSPROFILE -#define INCL_DOSSEMAPHORES -#define INCL_DOSDATETIME -#define INCL_DOSPROCESS -#define INCL_DOSEXCEPTIONS -#include - -/* No need to switch priorities in SDL_Delay() for OS/2 versions > Warp3 fp 42, */ -/*#define _SWITCH_PRIORITY*/ - -typedef unsigned long long ULLONG; - -static SDL_bool ticks_started = SDL_FALSE; -static ULONG ulTmrFreq = 0; -static ULLONG ullTmrStart = 0; - -void -SDL_TicksInit(void) -{ - ULONG ulTmrStart; /* for 32-bit fallback. */ - ULONG ulRC; - - if (ticks_started) { - return; - } - ticks_started = SDL_TRUE; - - ulRC = DosTmrQueryFreq(&ulTmrFreq); - if (ulRC != NO_ERROR) { - debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC); - } else { - ulRC = DosTmrQueryTime((PQWORD)&ullTmrStart); - if (ulRC == NO_ERROR) { - return; - } - debug_os2("DosTmrQueryTime() failed, rc = %u", ulRC); - } - - ulTmrFreq = 0; /* Error - use DosQuerySysInfo() for timer. */ - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrStart, sizeof (ULONG)); - ullTmrStart = (ULLONG) ulTmrStart; -} - -void -SDL_TicksQuit(void) -{ - ticks_started = SDL_FALSE; -} - -Uint64 -SDL_GetTicks64(void) -{ - Uint64 ui64Result; - ULLONG ullTmrNow; - - if (!ticks_started) { - SDL_TicksInit(); - } - - if (ulTmrFreq != 0) { - DosTmrQueryTime((PQWORD)&ullTmrNow); - ui64Result = (ullTmrNow - ullTmrStart) * 1000 / ulTmrFreq; - } else { - /* note that this counter rolls over to 0 every ~49 days. Fix your system so DosTmrQueryTime works if you need to avoid this. */ - ULONG ulTmrNow; - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrNow, sizeof (ULONG)); - ui64Result = (((Uint64) ulTmrNow) - ullTmrStart); - } - - return ui64Result; -} - -Uint64 -SDL_GetPerformanceCounter(void) -{ - QWORD qwTmrNow; - - if (ulTmrFreq == 0 || (DosTmrQueryTime(&qwTmrNow) != NO_ERROR)) { - return SDL_GetTicks64(); - } - return *((Uint64 *)&qwTmrNow); -} - -Uint64 -SDL_GetPerformanceFrequency(void) -{ - return (ulTmrFreq == 0)? 1000 : (Uint64)ulTmrFreq; -} - -void -SDL_Delay(Uint32 ms) -{ - HTIMER hTimer = NULLHANDLE; - ULONG ulRC; -#ifdef _SWITCH_PRIORITY - PPIB pib; - PTIB tib; - BOOL fSetPriority = ms < 50; - ULONG ulSavePriority; - ULONG ulNesting; -#endif - HEV hevTimer; - - if (ms == 0) { - DosSleep(0); - return; - } - - ulRC = DosCreateEventSem(NULL, &hevTimer, DC_SEM_SHARED, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosAsyncTimer() failed, rc = %u", ulRC); - DosSleep(ms); - return; - } - -#ifdef _SWITCH_PRIORITY - if (fSetPriority) { - if (DosGetInfoBlocks(&tib, &pib) != NO_ERROR) - fSetPriority = FALSE; - else { - ulSavePriority = tib->tib_ptib2->tib2_ulpri; - if (((ulSavePriority & 0xFF00) == 0x0300) || /* already have high pr. */ - (DosEnterMustComplete( &ulNesting) != NO_ERROR)) - fSetPriority = FALSE; - else { - DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0); - } - } - } -#endif - - DosResetEventSem(hevTimer, &ulRC); - ulRC = DosAsyncTimer(ms, (HSEM)hevTimer, &hTimer); - -#ifdef _SWITCH_PRIORITY - if (fSetPriority) { - if (DosSetPriority(PRTYS_THREAD, (ulSavePriority >> 8) & 0xFF, 0, 0) == NO_ERROR) - DosSetPriority(PRTYS_THREAD, 0, ulSavePriority & 0xFF, 0); - DosExitMustComplete(&ulNesting); - } -#endif - - if (ulRC != NO_ERROR) { - debug_os2("DosAsyncTimer() failed, rc = %u", ulRC); - } else { - DosWaitEventSem(hevTimer, SEM_INDEFINITE_WAIT); - } - - if (ulRC != NO_ERROR) - DosSleep(ms); - - DosCloseEventSem(hevTimer); -} - -#endif /* SDL_TIMER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 4bc1f111f..8f2a9308a 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -474,8 +474,6 @@ extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; extern VideoBootStrap NGAGE_bootstrap; -extern VideoBootStrap OS2DIVE_bootstrap; -extern VideoBootStrap OS2VMAN_bootstrap; /* Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work */ extern SDL_bool SDL_OnVideoThread(void); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 064276cb1..019aa78ae 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -131,10 +131,6 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_NGAGE &NGAGE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OS2 - &OS2DIVE_bootstrap, - &OS2VMAN_bootstrap, -#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #if SDL_INPUT_LINUXEV @@ -4456,9 +4452,6 @@ SDL_GetMessageBoxCount(void) #if SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_OS2 -#include "os2/SDL_os2messagebox.h" -#endif #if SDL_VIDEO_DRIVER_RISCOS #include "riscos/SDL_riscosmessagebox.h" #endif @@ -4466,7 +4459,7 @@ SDL_GetMessageBoxCount(void) #include "vita/SDL_vitamessagebox.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 || SDL_VIDEO_DRIVER_RISCOS +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_RISCOS static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; @@ -4581,13 +4574,6 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) retval = 0; } #endif -#if SDL_VIDEO_DRIVER_OS2 - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) && - OS2_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif #if SDL_VIDEO_DRIVER_RISCOS if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) && diff --git a/src/video/os2/SDL_gradd.h b/src/video/os2/SDL_gradd.h deleted file mode 100644 index a1369a260..000000000 --- a/src/video/os2/SDL_gradd.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -gradd.h structures and constants -- only the ones used by SDL_os2vman.c. - -Based on public knowledge from around the internet including pages from -http://www.osfree.org and http://www.edm2.com -*/ - -#ifndef SDL_gradd_h_ -#define SDL_gradd_h_ - -typedef struct _INITPROCOUT { - ULONG ulLength; /* Length of the INITPROCOUT data structure, in bytes. */ - ULONG ulVRAMVirt; /* 32-bit virtual address of VRAM. */ -} INITPROCOUT; -typedef INITPROCOUT *PINITPROCOUT; - -#define RC_SUCCESS 0 - -typedef ULONG GID; -typedef ULONG (_System FNVMIENTRY) ( - GID gid, ULONG ulFunction, - PVOID pIn, - PVOID pOut /* PINITPROCOUT */ -); - -#define VMI_CMD_INITPROC 1 -#define VMI_CMD_TERMPROC 3 -#define VMI_CMD_QUERYMODES 5 -#define VMI_CMD_SETMODE 6 -#define VMI_CMD_PALETTE 7 -#define VMI_CMD_BITBLT 8 -#define VMI_CMD_LINE 9 -#define VMI_CMD_REQUESTHW 14 -#define VMI_CMD_QUERYCURRENTMODE 0x1001 - -#define QUERYMODE_NUM_MODES 0x01 -#define QUERYMODE_MODE_DATA 0x02 - -typedef struct _HWPALETTEINFO { - ULONG ulLength; /* Size of the HWPALETTEINFO data structure, in bytes. */ - ULONG fFlags; /* Palette flag. */ - ULONG ulStartIndex; /* Starting palette index. */ - ULONG ulNumEntries; /* Number of palette slots to query or set. */ - PRGB2 pRGBs; /* Pointer to the array of RGB values. */ -} HWPALETTEINFO; -typedef HWPALETTEINFO *PHWPALETTEINFO; - -#define PALETTE_GET 0x01 -#define PALETTE_SET 0x02 - -typedef struct _BMAPINFO { - ULONG ulLength; /* Length of the BMAPINFO data structure, in bytes. */ - ULONG ulType; /* Description of the Blt. */ - ULONG ulWidth; /* Width in pels of the bit map. */ - ULONG ulHeight; /* Height in pels of the bit map. */ - ULONG ulBpp; /* Number of bits per pel/color depth. */ - ULONG ulBytesPerLine; /* Number of aligned bytes per line. */ - PBYTE pBits; /* Pointer to bit-map bits. */ -} BMAPINFO; -typedef BMAPINFO *PBMAPINFO; - -#define BMAP_VRAM 0 -#define BMAP_MEMORY 1 - -typedef struct _LINEPACK { - ULONG ulStyleStep; /* Value to be added to ulStyleValue. */ - ULONG ulStyleValue; /* Style value at the current pel. */ - ULONG ulFlags; /* Flags used for the LINEPACK data structure. */ - struct _LINEPACK *plpkNext; /* Pointer to next LINEPACK data structure. */ - ULONG ulAbsDeltaX; /* Clipped Bresenham Delta X, absolute. */ - ULONG ulAbsDeltaY; /* Clipped Bresenham Delta Y, absolute. */ - POINTL ptlClipStart; /* Pointer to location for device to perform Bresenham algorithm. */ - POINTL ptlClipEnd; /* Ending location for Bresenham algorithm (see ptlClipStart). */ - POINTL ptlStart; /* Pointer to starting location for line. */ - POINTL ptlEnd; /* Ending location for line. */ - LONG lClipStartError;/* Standard Bresenham error at the clipped start point. */ -} LINEPACK; -typedef LINEPACK *PLINEPACK; - -typedef struct _LINEINFO { - ULONG ulLength; /* Length of LINEINFO data structure. */ - ULONG ulType; /* Defines line type. */ - ULONG ulStyleMask; /* A 32-bit style mask. */ - ULONG cLines; /* Count of lines to be drawn. */ - ULONG ulFGColor; /* Line Foreground color. */ - ULONG ulBGColor; /* Line Background color. */ - USHORT usForeROP; /* Line Foreground mix. */ - USHORT usBackROP; /* Line Background mix. */ - PBMAPINFO pDstBmapInfo; /* Pointer to destination surface bit map. */ - PLINEPACK alpkLinePack; /* Pointer to LINEPACK data structure. */ - PRECTL prclBounds; /* Pointer to bounding rect of a clipped line. */ -} LINEINFO; -typedef LINEINFO *PLINEINFO; - -#define LINE_DO_FIRST_PEL 0x02 -#define LINE_DIR_Y_POSITIVE 0x04 -#define LINE_HORIZONTAL 0x08 -#define LINE_DIR_X_POSITIVE 0x20 -#define LINE_VERTICAL 0x1000 -#define LINE_DO_LAST_PEL 0x4000 -#define LINE_SOLID 0x01 - -typedef struct _BLTRECT { - ULONG ulXOrg; /* X origin of the destination Blt. */ - ULONG ulYOrg; /* Y origin of the destination Blt. */ - ULONG ulXExt; /* X extent of the BitBlt. */ - ULONG ulYExt; /* Y extent of the BitBlt. */ -} BLTRECT; -typedef BLTRECT *PBLTRECT; - -typedef struct _BITBLTINFO { - ULONG ulLength; /* Length of the BITBLTINFO data structure, in bytes. */ - ULONG ulBltFlags; /* Flags for rendering of rasterized data. */ - ULONG cBlits; /* Count of Blts to be performed. */ - ULONG ulROP; /* Raster operation. */ - ULONG ulMonoBackROP; /* Background mix if B_APPLY_BACK_ROP is set. */ - ULONG ulSrcFGColor; /* Monochrome source Foreground color. */ - ULONG ulSrcBGColor; /* Monochrome source Background color and transparent color. */ - ULONG ulPatFGColor; /* Monochrome pattern Foreground color. */ - ULONG ulPatBGColor; /* Monochrome pattern Background color. */ - PBYTE abColors; /* Pointer to color translation table. */ - PBMAPINFO pSrcBmapInfo; /* Pointer to source bit map (BMAPINFO) */ - PBMAPINFO pDstBmapInfo; /* Pointer to destination bit map (BMAPINFO). */ - PBMAPINFO pPatBmapInfo; /* Pointer to pattern bit map (BMAPINFO). */ - PPOINTL aptlSrcOrg; /* Pointer to array of source origin POINTLs. */ - PPOINTL aptlPatOrg; /* Pointer to array of pattern origin POINTLs. */ - PBLTRECT abrDst; /* Pointer to array of Blt rects. */ - PRECTL prclSrcBounds; /* Pointer to source bounding rect of source Blts. */ - PRECTL prclDstBounds; /* Pointer to destination bounding rect of destination Blts. */ -} BITBLTINFO; -typedef BITBLTINFO *PBITBLTINFO; - -#define BF_DEFAULT_STATE 0x0 -#define BF_ROP_INCL_SRC (0x01 << 2) -#define BF_PAT_HOLLOW (0x01 << 8) - -typedef struct _GDDMODEINFO { - ULONG ulLength; /* Size of the GDDMODEINFO data structure, in bytes. */ - ULONG ulModeId; /* ID used to make SETMODE request. */ - ULONG ulBpp; /* Number of colors (bpp). */ - ULONG ulHorizResolution;/* Number of horizontal pels. */ - ULONG ulVertResolution; /* Number of vertical scan lines. */ - ULONG ulRefreshRate; /* Refresh rate in Hz. */ - PBYTE pbVRAMPhys; /* Physical address of VRAM. */ - ULONG ulApertureSize; /* Size of VRAM, in bytes. */ - ULONG ulScanLineSize; /* Size of one scan line, in bytes. */ - - ULONG fccColorEncoding, ulTotalVRAMSize, cColors; -} GDDMODEINFO; -typedef GDDMODEINFO *PGDDMODEINFO; - -typedef struct _HWREQIN { - ULONG ulLength; /* Size of the HWREQIN data structure, in bytes. */ - ULONG ulFlags; /* Request option flags. */ - ULONG cScrChangeRects; /* Count of screen rectangles affected by HWREQIN. */ - PRECTL arectlScreen; /* Array of screen rectangles affected by HWREQIN. */ -} HWREQIN; -typedef HWREQIN *PHWREQIN; - -#define REQUEST_HW 0x01 - -/* -BOOL GreDeath(HDC hdc, PVOID pInstance, LONG lFunction); -LONG GreResurrection(HDC hdc, LONG cbVmem, PULONG pReserved, PVOID pInstance, LONG lFunction); -*/ -#define GreDeath(h) (BOOL)Gre32Entry3((ULONG)(h), 0, 0x40B7L) -#define GreResurrection(h,n,r) (LONG)Gre32Entry5((ULONG)(h), (ULONG)(n), (ULONG)(r), 0, 0x40B8L) -ULONG _System Gre32Entry3(ULONG, ULONG, ULONG); -ULONG _System Gre32Entry5(ULONG, ULONG, ULONG, ULONG, ULONG); - -#endif /* SDL_gradd_h_ */ diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c deleted file mode 100644 index 56cfde1b3..000000000 --- a/src/video/os2/SDL_os2dive.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" -#include "../SDL_sysvideo.h" -#define INCL_WIN -#define INCL_GPI -#include -#define _MEERROR_H_ -#include -#include -#define INCL_MM_OS2 -#include -#include -#include "SDL_os2output.h" - -typedef struct _VODATA { - HDIVE hDive; - PVOID pBuffer; - ULONG ulDIVEBufNum; - FOURCC fccColorEncoding; - ULONG ulWidth; - ULONG ulHeight; - BOOL fBlitterReady; -} VODATA; - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo); -static PVODATA voOpen(void); -static VOID voClose(PVODATA pVOData); -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible); -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); -static VOID voVideoBufFree(PVODATA pVOData); -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); - -OS2VIDEOOUTPUT voDive = { - voQueryInfo, - voOpen, - voClose, - voSetVisibleRegion, - voVideoBufAlloc, - voVideoBufFree, - voUpdate -}; - - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) -{ - DIVE_CAPS sDiveCaps; - FOURCC fccFormats[100]; - - /* Query information about display hardware from DIVE. */ - SDL_zeroa(fccFormats); - SDL_zero(sDiveCaps); - sDiveCaps.pFormatData = fccFormats; - sDiveCaps.ulFormatLength = 100; - sDiveCaps.ulStructLen = sizeof(DIVE_CAPS); - - if (DiveQueryCaps(&sDiveCaps, DIVE_BUFFER_SCREEN)) { - debug_os2("DiveQueryCaps() failed."); - return FALSE; - } - - if (sDiveCaps.ulDepth < 8) { - debug_os2("Not enough screen colors to run DIVE. " - "Must be at least 256 colors."); - return FALSE; - } - - pInfo->ulBPP = sDiveCaps.ulDepth; - pInfo->fccColorEncoding = sDiveCaps.fccColorEncoding; - pInfo->ulScanLineSize = sDiveCaps.ulScanLineBytes; - pInfo->ulHorizResolution = sDiveCaps.ulHorizontalResolution; - pInfo->ulVertResolution = sDiveCaps.ulVerticalResolution; - - return TRUE; -} - -PVODATA voOpen(void) -{ - PVODATA pVOData = SDL_calloc(1, sizeof(VODATA)); - - if (pVOData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - if (DiveOpen(&pVOData->hDive, FALSE, NULL) != DIVE_SUCCESS) { - SDL_free(pVOData); - SDL_SetError("DIVE: A display engine instance open failed"); - return NULL; - } - - return pVOData; -} - -static VOID voClose(PVODATA pVOData) -{ - voVideoBufFree(pVOData); - DiveClose(pVOData->hDive); - SDL_free(pVOData); -} - -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible) -{ - HPS hps; - HRGN hrgn; - RGNRECT rgnCtl; - PRECTL prectl = NULL; - ULONG ulRC; - - if (!fVisible) { - if (pVOData->fBlitterReady) { - pVOData->fBlitterReady = FALSE; - DiveSetupBlitter(pVOData->hDive, 0); - debug_os2("DIVE blitter is tuned off"); - } - return TRUE; - } - - /* Query visible rectangles */ - hps = WinGetPS(hwnd); - hrgn = GpiCreateRegion(hps, 0, NULL); - if (hrgn == NULLHANDLE) { - WinReleasePS(hps); - SDL_SetError("GpiCreateRegion() failed"); - } else { - WinQueryVisibleRegion(hwnd, hrgn); - if (hrgnShape != NULLHANDLE) - GpiCombineRegion(hps, hrgn, hrgn, hrgnShape, CRGN_AND); - - rgnCtl.ircStart = 1; - rgnCtl.crc = 0; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL); - if (rgnCtl.crcReturned != 0) { - prectl = SDL_malloc(rgnCtl.crcReturned * sizeof(RECTL)); - if (prectl != NULL) { - rgnCtl.ircStart = 1; - rgnCtl.crc = rgnCtl.crcReturned; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prectl); - } else { - SDL_OutOfMemory(); - } - } - GpiDestroyRegion(hps, hrgn); - WinReleasePS(hps); - - if (prectl != NULL) { - /* Setup DIVE blitter. */ - SETUP_BLITTER sSetupBlitter; - SWP swp; - POINTL pointl = { 0,0 }; - - WinQueryWindowPos(hwnd, &swp); - WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); - - sSetupBlitter.ulStructLen = sizeof(SETUP_BLITTER); - sSetupBlitter.fccSrcColorFormat = pVOData->fccColorEncoding; - sSetupBlitter.fInvert = FALSE; - sSetupBlitter.ulSrcWidth = pVOData->ulWidth; - sSetupBlitter.ulSrcHeight = pVOData->ulHeight; - sSetupBlitter.ulSrcPosX = 0; - sSetupBlitter.ulSrcPosY = 0; - sSetupBlitter.ulDitherType = 0; - sSetupBlitter.fccDstColorFormat = FOURCC_SCRN; - sSetupBlitter.ulDstWidth = swp.cx; - sSetupBlitter.ulDstHeight = swp.cy; - sSetupBlitter.lDstPosX = 0; - sSetupBlitter.lDstPosY = 0; - sSetupBlitter.lScreenPosX = pointl.x; - sSetupBlitter.lScreenPosY = pointl.y; - - sSetupBlitter.ulNumDstRects = rgnCtl.crcReturned; - sSetupBlitter.pVisDstRects = prectl; - - ulRC = DiveSetupBlitter(pVOData->hDive, &sSetupBlitter); - SDL_free(prectl); - - if (ulRC == DIVE_SUCCESS) { - pVOData->fBlitterReady = TRUE; - WinInvalidateRect(hwnd, NULL, TRUE); - debug_os2("DIVE blitter is ready now."); - return TRUE; - } - - SDL_SetError("DiveSetupBlitter(), rc = 0x%X", ulRC); - } /* if (prectl != NULL) */ - } /* if (hrgn == NULLHANDLE) else */ - - pVOData->fBlitterReady = FALSE; - DiveSetupBlitter(pVOData->hDive, 0); - return FALSE; -} - -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, FOURCC fccColorEncoding, - PULONG pulScanLineSize) -{ - ULONG ulRC; - ULONG ulScanLineSize = ulWidth * (ulBPP >> 3); - - /* Destroy previous buffer. */ - voVideoBufFree(pVOData); - - if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0) - return NULL; - - /* Bytes per line. */ - ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */ - *pulScanLineSize = ulScanLineSize; - - ulRC = DosAllocMem(&pVOData->pBuffer, - (ulHeight * ulScanLineSize) + sizeof(ULONG), - PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocMem(), rc = %u", ulRC); - return NULL; - } - - ulRC = DiveAllocImageBuffer(pVOData->hDive, &pVOData->ulDIVEBufNum, - fccColorEncoding, ulWidth, ulHeight, - ulScanLineSize, pVOData->pBuffer); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveAllocImageBuffer(), rc = 0x%X", ulRC); - DosFreeMem(pVOData->pBuffer); - pVOData->pBuffer = NULL; - pVOData->ulDIVEBufNum = 0; - return NULL; - } - - pVOData->fccColorEncoding = fccColorEncoding; - pVOData->ulWidth = ulWidth; - pVOData->ulHeight = ulHeight; - - debug_os2("buffer: 0x%P, DIVE buffer number: %u", - pVOData->pBuffer, pVOData->ulDIVEBufNum); - - return pVOData->pBuffer; -} - -static VOID voVideoBufFree(PVODATA pVOData) -{ - ULONG ulRC; - - if (pVOData->ulDIVEBufNum != 0) { - ulRC = DiveFreeImageBuffer(pVOData->hDive, pVOData->ulDIVEBufNum); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveFreeImageBuffer(,%u), rc = %u", pVOData->ulDIVEBufNum, ulRC); - } else { - debug_os2("DIVE buffer %u destroyed", pVOData->ulDIVEBufNum); - } - pVOData->ulDIVEBufNum = 0; - } - - if (pVOData->pBuffer != NULL) { - ulRC = DosFreeMem(pVOData->pBuffer); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeMem(), rc = %u", ulRC); - } - pVOData->pBuffer = NULL; - } -} - -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects) -{ - ULONG ulRC; - - if (!pVOData->fBlitterReady || (pVOData->ulDIVEBufNum == 0)) { - debug_os2("DIVE blitter is not ready"); - return FALSE; - } - - if (pSDLRects != NULL) { - PBYTE pbLineMask; - - pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight); - if (pbLineMask == NULL) { - debug_os2("Not enough stack size"); - return FALSE; - } - SDL_memset(pbLineMask, 0, pVOData->ulHeight); - - for ( ; ((LONG)cSDLRects) > 0; cSDLRects--, pSDLRects++) { - SDL_memset(&pbLineMask[pSDLRects->y], 1, pSDLRects->h); - } - - ulRC = DiveBlitImageLines(pVOData->hDive, pVOData->ulDIVEBufNum, - DIVE_BUFFER_SCREEN, pbLineMask); - SDL_stack_free(pbLineMask); - - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveBlitImageLines(), rc = 0x%X", ulRC); - } - } else { - ulRC = DiveBlitImage(pVOData->hDive, pVOData->ulDIVEBufNum, - DIVE_BUFFER_SCREEN); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveBlitImage(), rc = 0x%X", ulRC); - } - } - - return ulRC == DIVE_SUCCESS; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2messagebox.c b/src/video/os2/SDL_os2messagebox.c deleted file mode 100644 index c904fa5cb..000000000 --- a/src/video/os2/SDL_os2messagebox.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -/* Display a OS/2 message box */ - -#include "SDL.h" -#include "../../core/os2/SDL_os2.h" -#include "SDL_os2video.h" -#define INCL_WIN -#include - -#define IDD_TEXT_MESSAGE 1001 -#define IDD_BITMAP 1002 -#define IDD_PB_FIRST 1003 - -typedef struct _MSGBOXDLGDATA { - USHORT cb; - HWND hwndUnder; -} MSGBOXDLGDATA; - -static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData) -{ - HPS hps = WinGetPS(hwnd); - POINTL aptText[TXTBOX_COUNT]; - HENUM hEnum; - HWND hWndNext; - CHAR acBuf[256]; - ULONG cbBuf; - ULONG cButtons = 0; - ULONG ulButtonsCY = 0; - ULONG ulButtonsCX = 0; - RECTL rectl; - ULONG ulX; - ULONG ulIdx; - struct _BUTTON { - HWND hwnd; /* Button window handle. */ - ULONG ulCX; /* Button width in dialog coordinates. */ - } aButtons[32]; - RECTL rectlItem; - HAB hab = WinQueryAnchorBlock(hwnd); - - /* --- Align the buttons to the right/bottom. --- */ - - /* Collect window handles of all buttons in dialog. */ - hEnum = WinBeginEnumWindows(hwnd); - - while ((hWndNext = WinGetNextWindow(hEnum)) != NULLHANDLE) { - if (WinQueryClassName(hWndNext, sizeof(acBuf), acBuf) == 0) { - continue; - } - if (SDL_strcmp(acBuf, "#3") == 0) { /* Class name of button. */ - if (cButtons < sizeof(aButtons) / sizeof(struct _BUTTON)) { - aButtons[cButtons].hwnd = hWndNext; - cButtons++; - } - } - } - WinEndEnumWindows(hEnum); - - /* Query size of text for each button, get width of each button, total - * buttons width (ulButtonsCX) and max. height (ulButtonsCX) in _dialog - * coordinates_. */ - hps = WinGetPS(hwnd); - - for(ulIdx = 0; ulIdx < cButtons; ulIdx++) { - /* Query size of text in window coordinates. */ - cbBuf = WinQueryWindowText(aButtons[ulIdx].hwnd, sizeof(acBuf), acBuf); - GpiQueryTextBox(hps, cbBuf, acBuf, TXTBOX_COUNT, aptText); - aptText[TXTBOX_TOPRIGHT].x -= aptText[TXTBOX_BOTTOMLEFT].x; - aptText[TXTBOX_TOPRIGHT].y -= aptText[TXTBOX_BOTTOMLEFT].y; - /* Convert text size to dialog coordinates. */ - WinMapDlgPoints(hwnd, &aptText[TXTBOX_TOPRIGHT], 1, FALSE); - /* Add vertical and horizontal space for button's frame (dialog coord.). */ - if (aptText[TXTBOX_TOPRIGHT].x < 30) { /* Minimal button width. */ - aptText[TXTBOX_TOPRIGHT].x = 30; - } else { - aptText[TXTBOX_TOPRIGHT].x += 4; - } - aptText[TXTBOX_TOPRIGHT].y += 3; - - aButtons[ulIdx].ulCX = aptText[TXTBOX_TOPRIGHT].x; /* Store button width */ - ulButtonsCX += aptText[TXTBOX_TOPRIGHT].x + 2; /* Add total btn. width */ - /* Get max. height for buttons. */ - if (ulButtonsCY < aptText[TXTBOX_TOPRIGHT].y) - ulButtonsCY = aptText[TXTBOX_TOPRIGHT].y + 1; - } - - WinReleasePS(hps); - - /* Expand horizontal size of the window to fit all buttons and move window - * to the center of parent window. */ - - /* Convert total width of buttons to window coordinates. */ - aptText[0].x = ulButtonsCX + 4; - WinMapDlgPoints(hwnd, &aptText[0], 1, TRUE); - /* Check width of the window and expand as needed. */ - WinQueryWindowRect(hwnd, &rectlItem); - if (rectlItem.xRight <= aptText[0].x) - rectlItem.xRight = aptText[0].x; - - /* Move window rectangle to the center of owner window. */ - WinQueryWindowRect(pDlgData->hwndUnder, &rectl); - /* Left-bottom point of centered dialog on owner window. */ - rectl.xLeft = (rectl.xRight - rectlItem.xRight) / 2; - rectl.yBottom = (rectl.yTop - rectlItem.yTop) / 2; - /* Map left-bottom point to desktop. */ - WinMapWindowPoints(pDlgData->hwndUnder, HWND_DESKTOP, (PPOINTL)&rectl, 1); - WinOffsetRect(hab, &rectlItem, rectl.xLeft, rectl.yBottom); - - /* Set new rectangle for the window. */ - WinSetWindowPos(hwnd, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom, - rectlItem.xRight - rectlItem.xLeft, - rectlItem.yTop - rectlItem.yBottom, - SWP_SIZE | SWP_MOVE); - - /* Set buttons positions. */ - - /* Get horizontal position for the first button. */ - WinMapDlgPoints(hwnd, (PPOINTL)&rectlItem, 2, FALSE); /* Win size to dlg coord. */ - ulX = rectlItem.xRight - rectlItem.xLeft - ulButtonsCX - 2; /* First button position. */ - - /* Set positions and sizes for all buttons. */ - for (ulIdx = 0; ulIdx < cButtons; ulIdx++) { - /* Get poisition and size for the button in dialog coordinates. */ - aptText[0].x = ulX; - aptText[0].y = 2; - aptText[1].x = aButtons[ulIdx].ulCX; - aptText[1].y = ulButtonsCY; - /* Convert to window coordinates. */ - WinMapDlgPoints(hwnd, aptText, 2, TRUE); - - WinSetWindowPos(aButtons[ulIdx].hwnd, HWND_TOP, - aptText[0].x, aptText[0].y, aptText[1].x, aptText[1].y, - SWP_MOVE | SWP_SIZE); - - /* Offset horizontal position for the next button. */ - ulX += aButtons[ulIdx].ulCX + 2; - } - - /* Set right bound of the text to right bound of the last button and - * bottom bound of the text just above the buttons. */ - - aptText[2].x = 25; /* Left bound of text in dlg coordinates. */ - aptText[2].y = ulButtonsCY + 3; /* Bottom bound of the text in dlg coords. */ - WinMapDlgPoints(hwnd, &aptText[2], 1, TRUE); /* Convert ^^^ to win. coords */ - hWndNext = WinWindowFromID(hwnd, IDD_TEXT_MESSAGE); - WinQueryWindowRect(hWndNext, &rectlItem); - rectlItem.xLeft = aptText[2].x; - rectlItem.yBottom = aptText[2].y; - /* Right bound of the text equals right bound of the last button. */ - rectlItem.xRight = aptText[0].x + aptText[1].x; - WinSetWindowPos(hWndNext, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom, - rectlItem.xRight - rectlItem.xLeft, - rectlItem.yTop - rectlItem.yBottom, - SWP_MOVE | SWP_SIZE); -} - -static MRESULT EXPENTRY DynDlgProc(HWND hwnd, USHORT message, MPARAM mp1, MPARAM mp2) -{ - switch (message) { - case WM_INITDLG: - _wmInitDlg(hwnd, (MSGBOXDLGDATA*)mp2); - break; - - case WM_COMMAND: - switch (SHORT1FROMMP(mp1)) { - case DID_OK: - WinDismissDlg(hwnd, FALSE); - break; - default: - break; - } - - default: - return(WinDefDlgProc(hwnd, message, mp1, mp2)); - } - - return FALSE; -} - -static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) -{ - SDL_MessageBoxButtonData* - pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; - ULONG cSDLBtnData = messageboxdata->numbuttons; - - PSZ pszTitle = OS2_UTF8ToSys(messageboxdata->title); - ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1); - PSZ pszText = OS2_UTF8ToSys(messageboxdata->message); - ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1); - - PDLGTEMPLATE pTemplate; - ULONG cbTemplate; - ULONG ulIdx; - PCHAR pcDlgData; - PDLGTITEM pDlgItem; - PSZ pszBtnText; - ULONG cbBtnText; - HWND hwnd; - - const SDL_MessageBoxColor* pSDLColors = (messageboxdata->colorScheme == NULL)? - NULL : messageboxdata->colorScheme->colors; - const SDL_MessageBoxColor* pSDLColor; - - MSGBOXDLGDATA stDlgData; - - /* Build a dialog tamplate in memory */ - - /* Size of template */ - cbTemplate = sizeof(DLGTEMPLATE) + ((2 + cSDLBtnData) * sizeof(DLGTITEM)) + - sizeof(ULONG) + /* First item data - frame control data. */ - cbTitle + /* First item data - frame title + ZERO. */ - cbText + /* Second item data - ststic text + ZERO.*/ - 3; /* Third item data - system icon Id. */ - - /* Button items datas - text for buttons. */ - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) { - pszBtnText = (PSZ)pSDLBtnData[ulIdx].text; - cbTemplate += (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); - } - - /* Presentation parameter space. */ - if (pSDLColors != NULL) { - cbTemplate += 26 /* PP for frame. */ + - 26 /* PP for static text. */ + - (48 * cSDLBtnData); /* PP for buttons. */ - } - - /* Allocate memory for the dialog template. */ - pTemplate = (PDLGTEMPLATE) SDL_malloc(cbTemplate); - /* Pointer on data for dialog items in allocated memory. */ - pcDlgData = &((PCHAR)pTemplate)[sizeof(DLGTEMPLATE) + - ((2 + cSDLBtnData) * sizeof(DLGTITEM))]; - - /* Header info */ - pTemplate->cbTemplate = cbTemplate; /* size of dialog template to pass to WinCreateDlg() */ - pTemplate->type = 0; /* Currently always 0. */ - pTemplate->codepage = 0; - pTemplate->offadlgti = 14; /* Offset to array of DLGTITEMs. */ - pTemplate->fsTemplateStatus = 0; /* Reserved field? */ - - /* Index in array of dlg items of item to get focus, */ - /* if 0 then focus goes to first control that can have focus. */ - pTemplate->iItemFocus = 0; - pTemplate->coffPresParams = 0; - - /* First item info - frame */ - pDlgItem = pTemplate->adlgti; - pDlgItem->fsItemStatus = 0; /* Reserved? */ - /* Number of dialog item child windows owned by this item. */ - pDlgItem->cChildren = 2 + cSDLBtnData; /* Ststic text + buttons. */ - /* Length of class name, if 0 then offClassname contains a WC_ value. */ - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_FRAME; - /* Length of text. */ - pDlgItem->cchText = cbTitle; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to title text. */ - /* Copy text for the title into the dialog template. */ - if (pszTitle != NULL) { - SDL_memcpy(pcDlgData, pszTitle, cbTitle); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - - pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | - FS_DLGBORDER | WS_SAVEBITS; - pDlgItem->x = 100; - pDlgItem->y = 100; - pDlgItem->cx = 175; - pDlgItem->cy = 65; - pDlgItem->id = DID_OK; /* An ID value? */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the frame - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 22; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r; - pcDlgData += 11; - } - - /* Offset to ctl data. */ - pDlgItem->offCtlData = pcDlgData - (PCHAR)pTemplate; - /* Put CtlData for the dialog in here */ - *((PULONG)pcDlgData) = FCF_TITLEBAR | FCF_SYSMENU; - pcDlgData += sizeof(ULONG); - - /* Second item info - static text (message). */ - pDlgItem++; - pDlgItem->fsItemStatus = 0; - /* No children since its a control, it could have child control */ - /* (ex. a group box). */ - pDlgItem->cChildren = 0; - /* Length of class name, 0 - offClassname contains a WC_ constant. */ - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_STATIC; - - pDlgItem->cchText = cbText; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ - /* Copy message text into the dialog template. */ - if (pszText != NULL) { - SDL_memcpy(pcDlgData, pszText, cbText); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - - pDlgItem->flStyle = SS_TEXT | DT_TOP | DT_LEFT | DT_WORDBREAK | WS_VISIBLE; - /* It will be really set in _wmInitDlg(). */ - pDlgItem->x = 25; - pDlgItem->y = 13; - pDlgItem->cx = 147; - pDlgItem->cy = 62; /* It will be used. */ - - pDlgItem->id = IDD_TEXT_MESSAGE; /* an ID value */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the static text - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 22; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r; - pcDlgData += 11; - } - pDlgItem->offCtlData = 0; - - /* Third item info - static bitmap. */ - pDlgItem++; - pDlgItem->fsItemStatus = 0; - pDlgItem->cChildren = 0; - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_STATIC; - - pDlgItem->cchText = 3; /* 0xFF, low byte of the icon Id, high byte of icon Id. */ - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the Id. */ - /* Write system icon ID into dialog template. */ - *((PBYTE)pcDlgData) = 0xFF; /* First byte is 0xFF, next 2 are system pointer Id. */ - pcDlgData++; - *((PUSHORT)pcDlgData) = ((messageboxdata->flags & SDL_MESSAGEBOX_ERROR) != 0)? - SPTR_ICONERROR : - ((messageboxdata->flags & SDL_MESSAGEBOX_WARNING) != 0)? - SPTR_ICONWARNING : SPTR_ICONINFORMATION; - pcDlgData += 2; - - pDlgItem->flStyle = SS_SYSICON | WS_VISIBLE; - - pDlgItem->x = 4; - pDlgItem->y = 45; /* It will be really set in _wmInitDlg(). */ - pDlgItem->cx = 0; - pDlgItem->cy = 0; - - pDlgItem->id = IDD_BITMAP; - pDlgItem->offPresParams = 0; - pDlgItem->offCtlData = 0; - - /* Next items - buttons. */ - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) { - pDlgItem++; - - pDlgItem->fsItemStatus = 0; - pDlgItem->cChildren = 0; /* No children. */ - pDlgItem->cchClassName = 0; /* 0 - offClassname is WC_ constant. */ - pDlgItem->offClassName = (USHORT)WC_BUTTON; - - pszBtnText = OS2_UTF8ToSys(pSDLBtnData[ulIdx].text); - cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); - pDlgItem->cchText = cbBtnText; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ - /* Copy text for the button into the dialog template. */ - if (pszBtnText != NULL) { - SDL_memcpy(pcDlgData, pszBtnText, cbBtnText); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - SDL_free(pszBtnText); - - pDlgItem->flStyle = BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE; - if (pSDLBtnData[ulIdx].flags == SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { - pDlgItem->flStyle |= BS_DEFAULT; - pTemplate->iItemFocus = ulIdx + 3; /* +3 - frame, static text and icon. */ - pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]; - } else { - pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT]; - } - - /* It will be really set in _wmInitDlg() */ - pDlgItem->x = 10; - pDlgItem->y = 10; - pDlgItem->cx = 70; - pDlgItem->cy = 15; - - pDlgItem->id = IDD_PB_FIRST + ulIdx; /* an ID value */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the button - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 44; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColor->b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColor->g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColor->r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BORDERLIGHTCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BORDERDARKCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r; - pcDlgData += 11; - } - pDlgItem->offCtlData = 0; - } - /* Check, end of templ. data: &((PCHAR)pTemplate)[cbTemplate] == pcDlgData */ - - /* Create the dialog from template. */ - stDlgData.cb = sizeof(MSGBOXDLGDATA); - stDlgData.hwndUnder = (messageboxdata->window != NULL && messageboxdata->window->driverdata != NULL)? - ((WINDATA *)messageboxdata->window->driverdata)->hwnd : HWND_DESKTOP; - - hwnd = WinCreateDlg(HWND_DESKTOP, /* Parent is desktop. */ - stDlgData.hwndUnder, - (PFNWP)DynDlgProc, pTemplate, &stDlgData); - SDL_free(pTemplate); - SDL_free(pszTitle); - SDL_free(pszText); - - return hwnd; -} - - -int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) -{ - HWND hwnd; - ULONG ulRC; - SDL_MessageBoxButtonData - *pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; - ULONG cSDLBtnData = messageboxdata->numbuttons; - BOOL fVideoInitialized = SDL_WasInit(SDL_INIT_VIDEO); - HAB hab; - HMQ hmq; - BOOL fSuccess = FALSE; - - if (!fVideoInitialized) { - PTIB tib; - PPIB pib; - - DosGetInfoBlocks(&tib, &pib); - if (pib->pib_ultype == 2 || pib->pib_ultype == 0) { - /* VIO windowable or fullscreen protect-mode session */ - pib->pib_ultype = 3; /* Presentation Manager protect-mode session */ - } - - hab = WinInitialize(0); - if (hab == NULLHANDLE) { - debug_os2("WinInitialize() failed"); - return -1; - } - hmq = WinCreateMsgQueue(hab, 0); - if (hmq == NULLHANDLE) { - debug_os2("WinCreateMsgQueue() failed"); - return -1; - } - } - - /* Create dynamic dialog. */ - hwnd = _makeDlg(messageboxdata); - /* Show dialog and obtain button Id. */ - ulRC = WinProcessDlg(hwnd); - /* Destroy dialog, */ - WinDestroyWindow(hwnd); - - if (ulRC == DID_CANCEL) { - /* Window closed by ESC, Alt+F4 or system menu. */ - ULONG ulIdx; - - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++, pSDLBtnData++) { - if (pSDLBtnData->flags == SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { - *buttonid = pSDLBtnData->buttonid; - fSuccess = TRUE; - break; - } - } - } else { - /* Button pressed. */ - ulRC -= IDD_PB_FIRST; - if (ulRC < cSDLBtnData) { - *buttonid = pSDLBtnData[ulRC].buttonid; - fSuccess = TRUE; - } - } - - if (!fVideoInitialized) { - WinDestroyMsgQueue(hmq); - WinTerminate(hab); - } - - return (fSuccess)? 0 : -1; -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2messagebox.h b/src/video/os2/SDL_os2messagebox.h deleted file mode 100644 index c3b8969df..000000000 --- a/src/video/os2/SDL_os2messagebox.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -extern int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2mouse.c b/src/video/os2/SDL_os2mouse.c deleted file mode 100644 index dd0b7c193..000000000 --- a/src/video/os2/SDL_os2mouse.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_os2video.h" -#include "../../events/SDL_mouse_c.h" -#include "SDL_os2util.h" - -HPOINTER hptrCursor = NULLHANDLE; - -static SDL_Cursor* OS2_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) -{ - ULONG ulMaxW = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER); - ULONG ulMaxH = WinQuerySysValue(HWND_DESKTOP, SV_CYPOINTER); - HPOINTER hptr; - SDL_Cursor* pSDLCursor; - - if (surface->w > ulMaxW || surface->h > ulMaxH) { - debug_os2("Given image size is %u x %u, maximum allowed size is %u x %u", - surface->w, surface->h, ulMaxW, ulMaxH); - return NULL; - } - - hptr = utilCreatePointer(surface, hot_x, ulMaxH - hot_y - 1); - if (hptr == NULLHANDLE) - return NULL; - - pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { - WinDestroyPointer(hptr); - SDL_OutOfMemory(); - return NULL; - } - - pSDLCursor->driverdata = (void *)hptr; - return pSDLCursor; -} - -static SDL_Cursor* OS2_CreateSystemCursor(SDL_SystemCursor id) -{ - SDL_Cursor* pSDLCursor; - LONG lSysId; - HPOINTER hptr; - - switch (id) { - case SDL_SYSTEM_CURSOR_ARROW: lSysId = SPTR_ARROW; break; - case SDL_SYSTEM_CURSOR_IBEAM: lSysId = SPTR_TEXT; break; - case SDL_SYSTEM_CURSOR_WAIT: lSysId = SPTR_WAIT; break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: lSysId = SPTR_MOVE; break; - case SDL_SYSTEM_CURSOR_WAITARROW: lSysId = SPTR_WAIT; break; - case SDL_SYSTEM_CURSOR_SIZENWSE: lSysId = SPTR_SIZENWSE; break; - case SDL_SYSTEM_CURSOR_SIZENESW: lSysId = SPTR_SIZENESW; break; - case SDL_SYSTEM_CURSOR_SIZEWE: lSysId = SPTR_SIZEWE; break; - case SDL_SYSTEM_CURSOR_SIZENS: lSysId = SPTR_SIZENS; break; - case SDL_SYSTEM_CURSOR_SIZEALL: lSysId = SPTR_MOVE; break; - case SDL_SYSTEM_CURSOR_NO: lSysId = SPTR_ILLEGAL; break; - case SDL_SYSTEM_CURSOR_HAND: lSysId = SPTR_ARROW; break; - default: - debug_os2("Unknown cursor id: %u", id); - return NULL; - } - - /* On eCS SPTR_WAIT for last paramether fCopy=TRUE/FALSE gives different - * "wait" icons. -=8( ) */ - hptr = WinQuerySysPointer(HWND_DESKTOP, lSysId, - id == SDL_SYSTEM_CURSOR_WAIT); - if (hptr == NULLHANDLE) { - debug_os2("Cannot load OS/2 system pointer %u for SDL cursor id %u", - lSysId, id); - return NULL; - } - - pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { - WinDestroyPointer(hptr); - SDL_OutOfMemory(); - return NULL; - } - - pSDLCursor->driverdata = (void *)hptr; - return pSDLCursor; -} - -static void OS2_FreeCursor(SDL_Cursor *cursor) -{ - HPOINTER hptr = (HPOINTER)cursor->driverdata; - - WinDestroyPointer(hptr); - SDL_free(cursor); -} - -static int OS2_ShowCursor(SDL_Cursor *cursor) -{ - hptrCursor = (cursor != NULL)? (HPOINTER)cursor->driverdata : NULLHANDLE; - return ((SDL_GetMouseFocus() == NULL) || - WinSetPointer(HWND_DESKTOP, hptrCursor))? 0 : -1; -} - -static void OS2_WarpMouse(SDL_Window * window, int x, int y) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - POINTL pointl; - - pointl.x = x; - pointl.y = window->h - y; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); -/* pWinData->lSkipWMMouseMove++; ???*/ - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); -} - -static int OS2_WarpMouseGlobal(int x, int y) -{ - WinSetPointerPos(HWND_DESKTOP, x, - WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - y); - return 0; -} - -static int OS2_CaptureMouse(SDL_Window *window) -{ - return WinSetCapture(HWND_DESKTOP, (window == NULL)? NULLHANDLE : - ((WINDATA *)window->driverdata)->hwnd)? 0 : -1; -} - -static Uint32 OS2_GetGlobalMouseState(int *x, int *y) -{ - POINTL pointl; - ULONG ulRes; - - WinQueryPointerPos(HWND_DESKTOP, &pointl); - *x = pointl.x; - *y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - pointl.y - 1; - - ulRes = (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)? SDL_BUTTON_LMASK : 0; - if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) - ulRes |= SDL_BUTTON_RMASK; - if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) - ulRes |= SDL_BUTTON_MMASK; - - return ulRes; -} - - -void OS2_InitMouse(_THIS, ULONG hab) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - pSDLMouse->CreateCursor = OS2_CreateCursor; - pSDLMouse->CreateSystemCursor = OS2_CreateSystemCursor; - pSDLMouse->ShowCursor = OS2_ShowCursor; - pSDLMouse->FreeCursor = OS2_FreeCursor; - pSDLMouse->WarpMouse = OS2_WarpMouse; - pSDLMouse->WarpMouseGlobal = OS2_WarpMouseGlobal; - pSDLMouse->CaptureMouse = OS2_CaptureMouse; - pSDLMouse->GetGlobalMouseState = OS2_GetGlobalMouseState; - - SDL_SetDefaultCursor(OS2_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); - if (hptrCursor == NULLHANDLE) - hptrCursor = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, TRUE); -} - -void OS2_QuitMouse(_THIS) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if (pSDLMouse->def_cursor != NULL) { - SDL_free(pSDLMouse->def_cursor); - pSDLMouse->def_cursor = NULL; - pSDLMouse->cur_cursor = NULL; - } -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2mouse.h b/src/video/os2/SDL_os2mouse.h deleted file mode 100644 index 52f5ba3f7..000000000 --- a/src/video/os2/SDL_os2mouse.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2mouse_h_ -#define SDL_os2mouse_h_ - -extern HPOINTER hptrCursor; - -extern void OS2_InitMouse(_THIS, ULONG hab); -extern void OS2_QuitMouse(_THIS); - -#endif /* SDL_os2mouse_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2output.h b/src/video/os2/SDL_os2output.h deleted file mode 100644 index 7ded650e9..000000000 --- a/src/video/os2/SDL_os2output.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_os2output_ -#define SDL_os2output_ - -#include "../../core/os2/SDL_os2.h" - -typedef struct _VODATA *PVODATA; - -typedef struct _VIDEOOUTPUTINFO { - ULONG ulBPP; - ULONG fccColorEncoding; - ULONG ulScanLineSize; - ULONG ulHorizResolution; - ULONG ulVertResolution; -} VIDEOOUTPUTINFO; - -typedef struct _OS2VIDEOOUTPUT { - BOOL (*QueryInfo)(VIDEOOUTPUTINFO *pInfo); - PVODATA (*Open)(); - VOID (*Close)(PVODATA pVOData); - - BOOL (*SetVisibleRegion)(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, HRGN hrgnShape, - BOOL fVisible); - - PVOID (*VideoBufAlloc)(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); - - VOID (*VideoBufFree)(PVODATA pVOData); - BOOL (*Update)(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); -} OS2VIDEOOUTPUT; - -extern OS2VIDEOOUTPUT voDive; -extern OS2VIDEOOUTPUT voVMan; - -#endif /* SDL_os2output_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2util.c b/src/video/os2/SDL_os2util.c deleted file mode 100644 index bcc6c54e8..000000000 --- a/src/video/os2/SDL_os2util.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_os2util.h" - -HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) -{ - HBITMAP hbm; - BITMAPINFOHEADER2 bmih; - BITMAPINFO bmi; - HPS hps; - PULONG pulBitmap; - PULONG pulDst, pulSrc, pulDstMask; - ULONG ulY, ulX; - HPOINTER hptr = NULLHANDLE; - - if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) { - debug_os2("Image format should be SDL_PIXELFORMAT_ARGB8888"); - return NULLHANDLE; - } - - pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG)); - if (pulBitmap == NULL) { - SDL_OutOfMemory(); - return NULLHANDLE; - } - - /* pulDst - last line of surface (image) part of the result bitmap */ - pulDst = &pulBitmap[ (surface->h - 1) * surface->w ]; - /* pulDstMask - last line of mask part of the result bitmap */ - pulDstMask = &pulBitmap[ (2 * surface->h - 1) * surface->w ]; - /* pulSrc - first line of source image */ - pulSrc = (PULONG)surface->pixels; - - for (ulY = 0; ulY < surface->h; ulY++) { - for (ulX = 0; ulX < surface->w; ulX++) { - if ((pulSrc[ulX] & 0xFF000000) == 0) { - pulDst[ulX] = 0; - pulDstMask[ulX] = 0xFFFFFFFF; - } else { - pulDst[ulX] = pulSrc[ulX] & 0xFFFFFF; - pulDstMask[ulX] = 0; - } - } - - /* Set image and mask pointers on one line up */ - pulDst -= surface->w; - pulDstMask -= surface->w; - /* Set source image pointer to the next line */ - pulSrc = (PULONG) (((PCHAR)pulSrc) + surface->pitch); - } - - /* Create system bitmap object. */ - SDL_zero(bmih); - SDL_zero(bmi); - - bmih.cbFix = sizeof(BITMAPINFOHEADER2); - bmih.cx = surface->w; - bmih.cy = 2 * surface->h; - bmih.cPlanes = 1; - bmih.cBitCount = 32; - bmih.ulCompression = BCA_UNCOMP; - bmih.cbImage = bmih.cx * bmih.cy * 4; - - bmi.cbFix = sizeof(BITMAPINFOHEADER); - bmi.cx = bmih.cx; - bmi.cy = bmih.cy; - bmi.cPlanes = 1; - bmi.cBitCount = 32; - - hps = WinGetPS(HWND_DESKTOP); - hbm = GpiCreateBitmap(hps, (PBITMAPINFOHEADER2)&bmih, CBM_INIT, - (PBYTE)pulBitmap, (PBITMAPINFO2)&bmi); - if (hbm == GPI_ERROR) { - debug_os2("GpiCreateBitmap() failed"); - } else { - /* Create a system pointer object. */ - hptr = WinCreatePointer(HWND_DESKTOP, hbm, TRUE, ulHotX, ulHotY); - if (hptr == NULLHANDLE) { - debug_os2("WinCreatePointer() failed"); - } - } - GpiDeleteBitmap(hbm); - - WinReleasePS(hps); - SDL_free(pulBitmap); - - return hptr; -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2util.h b/src/video/os2/SDL_os2util.h deleted file mode 100644 index 9379dec54..000000000 --- a/src/video/os2/SDL_os2util.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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_os2util_h_ -#define SDL_os2util_h_ - -#include "SDL_log.h" -#include "../SDL_sysvideo.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_WIN -#define INCL_GPI -#include - -HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY); - -#endif /* SDL_os2util_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c deleted file mode 100644 index f0147dc08..000000000 --- a/src/video/os2/SDL_os2video.c +++ /dev/null @@ -1,1696 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_video.h" -#include "SDL_mouse.h" -#include "../SDL_pixels_c.h" -#include "../SDL_shape_internals.h" -#include "../../events/SDL_events_c.h" -#include "SDL_os2video.h" -#include "SDL_syswm.h" -#include "SDL_os2util.h" - -#define __MEERROR_H__ -#define _MEERROR_H_ -#include -#include -#ifndef FOURCC_R666 -#define FOURCC_R666 mmioFOURCC('R','6','6','6') -#endif - -#define WIN_CLIENT_CLASS "SDL3" -#define OS2DRIVER_NAME_DIVE "DIVE" -#define OS2DRIVER_NAME_VMAN "VMAN" - - -static const SDL_Scancode aSDLScancode[] = { - /* 0 1 2 3 4 5 6 7 */ - /* 8 9 A B C D E F */ - SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */ - SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */ - - SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */ - SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */ - - SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */ - SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */ - - SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, /*55*/SDL_SCANCODE_KP_MULTIPLY,/* 3 */ - SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */ - - SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_KP_7, /* 4 */ - /*72*/ SDL_SCANCODE_KP_8, /*73*/SDL_SCANCODE_KP_9, SDL_SCANCODE_KP_MINUS,/*75*/SDL_SCANCODE_KP_4, /*76*/SDL_SCANCODE_KP_5, /*77*/SDL_SCANCODE_KP_6, /*78*/SDL_SCANCODE_KP_PLUS, /*79*/SDL_SCANCODE_KP_1, /* 4 */ - - /*80*/ SDL_SCANCODE_KP_2, /*81*/SDL_SCANCODE_KP_3, SDL_SCANCODE_KP_0, /*83*/SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */ - /*88*/ SDL_SCANCODE_F12, /*89*/SDL_SCANCODE_PAUSE, /*90*/SDL_SCANCODE_KP_ENTER,/*91*/SDL_SCANCODE_RCTRL, /*92*/SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_RALT, /*95*/SDL_SCANCODE_UNKNOWN, /* 5 */ - - /*96*/ SDL_SCANCODE_HOME, /*97*/SDL_SCANCODE_UP, /*98*/SDL_SCANCODE_PAGEUP, SDL_SCANCODE_LEFT, /*100*/SDL_SCANCODE_RIGHT, SDL_SCANCODE_END, /*102*/SDL_SCANCODE_DOWN, /*103*/SDL_SCANCODE_PAGEDOWN, /* 6 */ -/*104*/ SDL_SCANCODE_F17, /*105*/SDL_SCANCODE_DELETE, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN,/*110*/SDL_SCANCODE_UNKNOWN,/*111*/SDL_SCANCODE_UNKNOWN, /* 6 */ - -/*112*/ SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1,SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */ -/*120*/ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4,SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5,SDL_SCANCODE_APPLICATION,SDL_SCANCODE_INTERNATIONAL3,SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI /* 7 */ -}; - -/* Utilites. - * --------- - */ -static BOOL _getSDLPixelFormatData(SDL_PixelFormat *pSDLPixelFormat, - ULONG ulBPP, ULONG fccColorEncoding) -{ - ULONG ulRshift, ulGshift, ulBshift; - ULONG ulRmask, ulGmask, ulBmask; - ULONG ulRloss, ulGloss, ulBloss; - - pSDLPixelFormat->BitsPerPixel = ulBPP; - pSDLPixelFormat->BytesPerPixel = (pSDLPixelFormat->BitsPerPixel + 7) / 8; - - switch (fccColorEncoding) { - case FOURCC_LUT8: - ulRshift = 0; ulGshift = 0; ulBshift = 0; - ulRmask = 0; ulGmask = 0; ulBmask = 0; - ulRloss = 8; ulGloss = 8; ulBloss = 8; - break; - - case FOURCC_R555: - ulRshift = 10; ulGshift = 5; ulBshift = 0; - ulRmask = 0x7C00; ulGmask = 0x03E0; ulBmask = 0x001F; - ulRloss = 3; ulGloss = 3; ulBloss = 3; - break; - - case FOURCC_R565: - ulRshift = 11; ulGshift = 5; ulBshift = 0; - ulRmask = 0xF800; ulGmask = 0x07E0; ulBmask = 0x001F; - ulRloss = 3; ulGloss = 2; ulBloss = 3; - break; - - case FOURCC_R664: - ulRshift = 10; ulGshift = 4; ulBshift = 0; - ulRmask = 0xFC00; ulGmask = 0x03F0; ulBmask = 0x000F; - ulRloss = 2; ulGloss = 4; ulBloss = 3; - break; - - case FOURCC_R666: - ulRshift = 12; ulGshift = 6; ulBshift = 0; - ulRmask = 0x03F000; ulGmask = 0x000FC0; ulBmask = 0x00003F; - ulRloss = 2; ulGloss = 2; ulBloss = 2; - break; - - case FOURCC_RGB3: - case FOURCC_RGB4: - ulRshift = 0; ulGshift = 8; ulBshift = 16; - ulRmask = 0x0000FF; ulGmask = 0x00FF00; ulBmask = 0xFF0000; - ulRloss = 0x00; ulGloss = 0x00; ulBloss = 0x00; - break; - - case FOURCC_BGR3: - case FOURCC_BGR4: - ulRshift = 16; ulGshift = 8; ulBshift = 0; - ulRmask = 0xFF0000; ulGmask = 0x00FF00; ulBmask = 0x0000FF; - ulRloss = 0; ulGloss = 0; ulBloss = 0; - break; - - default: -/* printf("Unknown color encoding: %.4s\n", fccColorEncoding);*/ - SDL_memset(pSDLPixelFormat, 0, sizeof(SDL_PixelFormat)); - return FALSE; - } - - pSDLPixelFormat->Rshift = ulRshift; - pSDLPixelFormat->Gshift = ulGshift; - pSDLPixelFormat->Bshift = ulBshift; - pSDLPixelFormat->Rmask = ulRmask; - pSDLPixelFormat->Gmask = ulGmask; - pSDLPixelFormat->Bmask = ulBmask; - pSDLPixelFormat->Rloss = ulRloss; - pSDLPixelFormat->Gloss = ulGloss; - pSDLPixelFormat->Bloss = ulBloss; - - pSDLPixelFormat->Ashift = 0x00; - pSDLPixelFormat->Amask = 0x00; - pSDLPixelFormat->Aloss = 0x00; - - return TRUE; -} - -static Uint32 _getSDLPixelFormat(ULONG ulBPP, FOURCC fccColorEncoding) -{ - SDL_PixelFormat stSDLPixelFormat; - Uint32 uiResult = SDL_PIXELFORMAT_UNKNOWN; - - if (_getSDLPixelFormatData(&stSDLPixelFormat, ulBPP, fccColorEncoding)) - uiResult = SDL_MasksToPixelFormatEnum(ulBPP, stSDLPixelFormat.Rmask, - stSDLPixelFormat.Gmask, - stSDLPixelFormat.Bmask, 0); - - return uiResult; -} - -static SDL_DisplayMode *_getDisplayModeForSDLWindow(SDL_Window *window) -{ - SDL_VideoDisplay *pSDLDisplay = SDL_GetDisplayForWindow(window); - - if (pSDLDisplay == NULL) { - debug_os2("No display for the window"); - return FALSE; - } - - return &pSDLDisplay->current_mode; -} - -static VOID _mouseCheck(WINDATA *pWinData) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if ((pSDLMouse->relative_mode || (pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) && - ((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0)) { - /* We will make a real capture in _wmMouseButton() */ - } else { - WinSetCapture(HWND_DESKTOP, NULLHANDLE); - } -} - - -/* PM window procedure. - * -------------------- - */ -static int OS2_ResizeWindowShape(SDL_Window *window); - -static VOID _setVisibleRegion(WINDATA *pWinData, BOOL fVisible) -{ - SDL_VideoDisplay *pSDLDisplay; - - if (! pWinData->pVOData) - return; - - pSDLDisplay = (fVisible)? SDL_GetDisplayForWindow(pWinData->window) : NULL; - pWinData->pOutput->SetVisibleRegion(pWinData->pVOData, pWinData->hwnd, - (pSDLDisplay == NULL) ? - NULL : &pSDLDisplay->current_mode, - pWinData->hrgnShape, fVisible); -} - -static VOID _wmPaint(WINDATA *pWinData, HWND hwnd) -{ - if (pWinData->pVOData == NULL || - !pWinData->pOutput->Update(pWinData->pVOData, hwnd, NULL, 0)) { - RECTL rectl; - HPS hps; - - hps = WinBeginPaint(hwnd, 0, &rectl); - WinFillRect(hps, &rectl, CLR_BLACK); - WinEndPaint(hps); - } -} - -static VOID _wmMouseMove(WINDATA *pWinData, SHORT lX, SHORT lY) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - POINTL pointl; - BOOL fWinActive = (pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0; - - if (!pSDLMouse->relative_mode || pSDLMouse->relative_mode_warp) { - if (!pSDLMouse->relative_mode && fWinActive && - ((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) && - (WinQueryCapture(HWND_DESKTOP) == pWinData->hwnd)) { - - pointl.x = lX; - pointl.y = lY; - - if (lX < 0) - lX = 0; - else if (lX >= pWinData->window->w) - lX = pWinData->window->w - 1; - - if (lY < 0) - lY = 0; - else if (lY >= pWinData->window->h) - lY = pWinData->window->h - 1; - - if (lX != pointl.x || lY != pointl.x) { - pointl.x = lX; - pointl.y = lY; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } - } - - SDL_SendMouseMotion(pWinData->window, 0, 0, lX, - pWinData->window->h - lY - 1); - return; - } - - if (fWinActive) { - pointl.x = pWinData->window->w / 2; - pointl.y = pWinData->window->h / 2; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - - SDL_SendMouseMotion(pWinData->window, 0, 1, - lX - pointl.x, pointl.y - lY); - - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } -} - -static VOID _wmMouseButton(WINDATA *pWinData, ULONG ulButton, BOOL fDown) -{ - static ULONG aBtnGROP2SDL[3] = { SDL_BUTTON_LEFT, SDL_BUTTON_RIGHT, - SDL_BUTTON_MIDDLE }; - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if ((pSDLMouse->relative_mode || ((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0)) && - ((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) && - (WinQueryCapture(HWND_DESKTOP) != pWinData->hwnd)) { - /* Mouse should be captured. */ - if (pSDLMouse->relative_mode && !pSDLMouse->relative_mode_warp) { - POINTL pointl; - - pointl.x = pWinData->window->w / 2; - pointl.y = pWinData->window->h / 2; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } - - WinSetCapture(HWND_DESKTOP, pWinData->hwnd); - } - - SDL_SendMouseButton(pWinData->window, 0, - (fDown)? SDL_PRESSED : SDL_RELEASED, - aBtnGROP2SDL[ulButton]); -} - -static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2) -{ - ULONG ulFlags = SHORT1FROMMP(mp1); /* WM_CHAR flags */ - ULONG ulVirtualKey = SHORT2FROMMP(mp2); /* Virtual key code VK_* */ - ULONG ulCharCode = SHORT1FROMMP(mp2); /* Character code */ - ULONG ulScanCode = CHAR4FROMMP(mp1); /* Scan code */ - - if (((ulFlags & (KC_VIRTUALKEY | KC_KEYUP | KC_ALT)) == (KC_VIRTUALKEY | KC_ALT)) && - (ulVirtualKey == VK_F4)) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_CLOSE, 0, 0); - } - - if ((ulFlags & KC_SCANCODE) != 0) { - SDL_SendKeyboardKey(((ulFlags & KC_KEYUP) == 0)? SDL_PRESSED : SDL_RELEASED, aSDLScancode[ulScanCode]); - } - - if ((ulFlags & KC_CHAR) != 0) { -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) - char *utf8 = SDL_iconv_string("UTF-8", "", (char *)&ulCharCode, 1); - SDL_SendKeyboardText((utf8 && *utf8) ? utf8 : (char *)&ulCharCode); - SDL_free(utf8); -#else - char utf8[4]; - int rc = StrUTF8(1, utf8, sizeof(utf8), (char *)&ulCharCode, 1); - SDL_SendKeyboardText((rc > 0) ? utf8 : (char *) &ulCharCode); -#endif - } -} - -static VOID _wmMove(WINDATA *pWinData) -{ - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(pWinData->window); - POINTL pointl = { 0,0 }; - RECTL rectl; - - WinQueryWindowRect(pWinData->hwnd, &rectl); - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 2); - - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MOVED, rectl.xLeft, - pSDLDisplayMode->h - rectl.yTop); -} - -static MRESULT _wmDragOver(WINDATA *pWinData, PDRAGINFO pDragInfo) -{ - ULONG ulIdx; - PDRAGITEM pDragItem; - USHORT usDrag = DOR_NEVERDROP; - USHORT usDragOp = DO_UNKNOWN; - - if (!DrgAccessDraginfo(pDragInfo)) - return MRFROM2SHORT(DOR_NEVERDROP, DO_UNKNOWN); - - for (ulIdx = 0; ulIdx < pDragInfo->cditem; ulIdx++) { - pDragItem = DrgQueryDragitemPtr(pDragInfo, ulIdx); - - /* We accept WPS files only. */ - if (!DrgVerifyRMF(pDragItem, "DRM_OS2FILE", NULL)) { - usDrag = DOR_NEVERDROP; - usDragOp = DO_UNKNOWN; - break; - } - - if (pDragInfo->usOperation == DO_DEFAULT && - (pDragItem->fsSupportedOps & DO_COPYABLE) != 0) { - usDrag = DOR_DROP; - usDragOp = DO_COPY; - } else - if (pDragInfo->usOperation == DO_LINK && - (pDragItem->fsSupportedOps & DO_LINKABLE) != 0) { - usDrag = DOR_DROP; - usDragOp = DO_LINK; - } else { - usDrag = DOR_NODROPOP; - usDragOp = DO_UNKNOWN; - break; - } - } - - /* Update window (The DIVE surface spoiled while dragging) */ - WinInvalidateRect(pWinData->hwnd, NULL, FALSE); - WinUpdateWindow(pWinData->hwnd); - - DrgFreeDraginfo(pDragInfo); - return MPFROM2SHORT(usDrag, usDragOp); -} - -static MRESULT _wmDrop(WINDATA *pWinData, PDRAGINFO pDragInfo) -{ - ULONG ulIdx; - PDRAGITEM pDragItem; - CHAR acFName[CCHMAXPATH]; - PCHAR pcFName; - - if (!DrgAccessDraginfo(pDragInfo)) - return MRFROM2SHORT(DOR_NEVERDROP, 0); - - for (ulIdx = 0; ulIdx < pDragInfo->cditem; ulIdx++) { - pDragItem = DrgQueryDragitemPtr(pDragInfo, ulIdx); - - if (DrgVerifyRMF(pDragItem, "DRM_OS2FILE", NULL) && - pDragItem->hstrContainerName != NULLHANDLE && - pDragItem->hstrSourceName != NULLHANDLE) { - /* Get file name from the item. */ - DrgQueryStrName(pDragItem->hstrContainerName, sizeof(acFName), acFName); - pcFName = SDL_strchr(acFName, '\0'); - DrgQueryStrName(pDragItem->hstrSourceName, - sizeof(acFName) - (pcFName - acFName), pcFName); - - /* Send to SDL full file name converted to UTF-8. */ - pcFName = OS2_SysToUTF8(acFName); - SDL_SendDropFile(pWinData->window, pcFName); - SDL_free(pcFName); - - /* Notify a source that a drag operation is complete. */ - if (pDragItem->hwndItem) - DrgSendTransferMsg(pDragItem->hwndItem, DM_ENDCONVERSATION, - (MPARAM)pDragItem->ulItemID, - (MPARAM)DMFL_TARGETSUCCESSFUL); - } - } - - DrgDeleteDraginfoStrHandles(pDragInfo); - DrgFreeDraginfo(pDragInfo); - - SDL_SendDropComplete(pWinData->window); - - return (MRESULT)FALSE; -} - -static MRESULT EXPENTRY wndFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - HWND hwndClient = WinQueryWindow(hwnd, QW_BOTTOM); - WINDATA * pWinData = (WINDATA *)WinQueryWindowULong(hwndClient, 0); - - if (pWinData == NULL) - return WinDefWindowProc(hwnd, msg, mp1, mp2); - - /* Send a SDL_SYSWMEVENT if the application wants them */ - if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { - SDL_SysWMmsg wmmsg; - - SDL_VERSION(&wmmsg.version); - wmmsg.subsystem = SDL_SYSWM_OS2; - wmmsg.msg.os2.fFrame = TRUE; - wmmsg.msg.os2.hwnd = hwnd; - wmmsg.msg.os2.msg = msg; - wmmsg.msg.os2.mp1 = mp1; - wmmsg.msg.os2.mp2 = mp2; - SDL_SendSysWMEvent(&wmmsg); - } - - switch (msg) { - case WM_MINMAXFRAME: - if ((((PSWP)mp1)->fl & SWP_RESTORE) != 0) { - pWinData->lSkipWMMove += 2; - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - if ((((PSWP)mp1)->fl & SWP_MINIMIZE) != 0) { - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove += 2; - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - if ((((PSWP)mp1)->fl & SWP_MAXIMIZE) != 0) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); - } - break; - - case WM_ADJUSTFRAMEPOS: - if (pWinData->lSkipWMAdjustFramePos > 0) { - pWinData->lSkipWMAdjustFramePos++; - break; - } - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) != 0 && - (((PSWP)mp1)->fl & SWP_RESTORE) != 0) { - /* Keep fullscreen window size on restore. */ - RECTL rectl; - - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); - rectl.yTop = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); - WinCalcFrameRect(hwnd, &rectl, FALSE); - ((PSWP)mp1)->x = rectl.xLeft; - ((PSWP)mp1)->y = rectl.yBottom; - ((PSWP)mp1)->cx = rectl.xRight - rectl.xLeft; - ((PSWP)mp1)->cy = rectl.yTop - rectl.yBottom; - } - if ((((PSWP)mp1)->fl & (SWP_SIZE | SWP_MINIMIZE)) == SWP_SIZE) { - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) != 0) { - /* SDL_WINDOW_FULLSCREEN_DESKTOP have flag SDL_WINDOW_FULLSCREEN... */ - if (SDL_IsShapedWindow(pWinData->window)) - OS2_ResizeWindowShape(pWinData->window); - break; - } - if ((SDL_GetWindowFlags(pWinData->window) & SDL_WINDOW_RESIZABLE) != 0) { - RECTL rectl; - int iMinW, iMinH, iMaxW, iMaxH; - int iWinW, iWinH; - - rectl.xLeft = 0; - rectl.yBottom = 0; - SDL_GetWindowSize(pWinData->window, - (int *)&rectl.xRight, (int *)&rectl.yTop); - iWinW = rectl.xRight; - iWinH = rectl.yTop; - - SDL_GetWindowMinimumSize(pWinData->window, &iMinW, &iMinH); - SDL_GetWindowMaximumSize(pWinData->window, &iMaxW, &iMaxH); - - if (iWinW < iMinW) - rectl.xRight = iMinW; - else if (iMaxW != 0 && iWinW > iMaxW) - rectl.xRight = iMaxW; - - if (iWinH < iMinH) - rectl.yTop = iMinW; - else if (iMaxH != 0 && iWinH > iMaxH) - rectl.yTop = iMaxH; - - if (rectl.xRight == iWinW && rectl.yTop == iWinH) { - if (SDL_IsShapedWindow(pWinData->window)) - OS2_ResizeWindowShape(pWinData->window); - break; - } - - WinCalcFrameRect(hwnd, &rectl, FALSE); - ((PSWP)mp1)->cx = rectl.xRight - rectl.xLeft; - ((PSWP)mp1)->cy = rectl.yTop - rectl.yBottom; - } - } - break; - } - - return pWinData->fnWndFrameProc(hwnd, msg, mp1, mp2); -} - -static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - WINDATA *pWinData = (WINDATA *)WinQueryWindowULong(hwnd, 0); - - if (pWinData == NULL) - return WinDefWindowProc(hwnd, msg, mp1, mp2); - - /* Send a SDL_SYSWMEVENT if the application wants them */ - if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { - SDL_SysWMmsg wmmsg; - - SDL_VERSION(&wmmsg.version); - wmmsg.subsystem = SDL_SYSWM_OS2; - wmmsg.msg.os2.fFrame = FALSE; - wmmsg.msg.os2.hwnd = hwnd; - wmmsg.msg.os2.msg = msg; - wmmsg.msg.os2.mp1 = mp1; - wmmsg.msg.os2.mp2 = mp2; - SDL_SendSysWMEvent(&wmmsg); - } - - switch (msg) { - case WM_CLOSE: - case WM_QUIT: - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_CLOSE, 0, 0); - if (pWinData->fnUserWndProc == NULL) - return (MRESULT)FALSE; - break; - - case WM_PAINT: - _wmPaint(pWinData, hwnd); - break; - - case WM_SHOW: - SDL_SendWindowEvent(pWinData->window, (SHORT1FROMMP(mp1) == 0)? - SDL_WINDOWEVENT_HIDDEN : - SDL_WINDOWEVENT_SHOWN , - 0, 0); - break; - - case WM_UPDATEFRAME: - /* Return TRUE - no further action for the frame control window procedure */ - return (MRESULT)TRUE; - - case WM_ACTIVATE: - if ((BOOL)mp1) { - POINTL pointl; - - if (SDL_GetKeyboardFocus() != pWinData->window) - SDL_SetKeyboardFocus(pWinData->window); - - WinQueryPointerPos(HWND_DESKTOP, &pointl); - WinMapWindowPoints(HWND_DESKTOP, pWinData->hwnd, &pointl, 1); - SDL_SendMouseMotion(pWinData->window, 0, 0, - pointl.x, pWinData->window->h - pointl.y - 1); - } else { - if (SDL_GetKeyboardFocus() == pWinData->window) - SDL_SetKeyboardFocus(NULL); - - WinSetCapture(HWND_DESKTOP, NULLHANDLE); - } - break; - - case WM_MOUSEMOVE: - WinSetPointer(HWND_DESKTOP, hptrCursor); - - if (pWinData->lSkipWMMouseMove > 0) - pWinData->lSkipWMMouseMove--; - else { - _wmMouseMove(pWinData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1)); - } - return (MRESULT)FALSE; - - case WM_BUTTON1DOWN: - case WM_BUTTON1DBLCLK: - _wmMouseButton(pWinData, 0, TRUE); - break; - - case WM_BUTTON1UP: - _wmMouseButton(pWinData, 0, FALSE); - break; - - case WM_BUTTON2DOWN: - case WM_BUTTON2DBLCLK: - _wmMouseButton(pWinData, 1, TRUE); - break; - - case WM_BUTTON2UP: - _wmMouseButton(pWinData, 1, FALSE); - break; - - case WM_BUTTON3DOWN: - case WM_BUTTON3DBLCLK: - _wmMouseButton(pWinData, 2, TRUE); - break; - - case WM_BUTTON3UP: - _wmMouseButton(pWinData, 2, FALSE); - break; - - case WM_TRANSLATEACCEL: - /* ALT and acceleration keys not allowed (must be processed in WM_CHAR) */ - if (mp1 == NULL || ((PQMSG)mp1)->msg != WM_CHAR) - break; - return (MRESULT)FALSE; - - case WM_CHAR: - _wmChar(pWinData, mp1, mp2); - break; - - case WM_SIZE: - if (pWinData->lSkipWMSize > 0) - pWinData->lSkipWMSize--; - else { - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_RESIZED, - SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); - } else { - pWinData->lSkipWMVRNEnabled++; - } - } - break; - - case WM_MOVE: - if (pWinData->lSkipWMMove > 0) - pWinData->lSkipWMMove--; - else if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { - _wmMove(pWinData); - } - break; - - case WM_VRNENABLED: - if (pWinData->lSkipWMVRNEnabled > 0) - pWinData->lSkipWMVRNEnabled--; - else { - _setVisibleRegion(pWinData, TRUE); - } - return (MRESULT)TRUE; - - case WM_VRNDISABLED: - _setVisibleRegion(pWinData, FALSE); - return (MRESULT)TRUE; - - case DM_DRAGOVER: - return _wmDragOver(pWinData, (PDRAGINFO)PVOIDFROMMP(mp1)); - - case DM_DROP: - return _wmDrop(pWinData, (PDRAGINFO)PVOIDFROMMP(mp1)); - } - - return (pWinData->fnUserWndProc != NULL)? - pWinData->fnUserWndProc(hwnd, msg, mp1, mp2) : - WinDefWindowProc(hwnd, msg, mp1, mp2); -} - - -/* SDL routines. - * ------------ - */ - -static void OS2_PumpEvents(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - QMSG qmsg; - - if (WinPeekMsg(pVData->hab, &qmsg, NULLHANDLE, 0, 0, PM_REMOVE)) - WinDispatchMsg(pVData->hab, &qmsg); -} - -static WINDATA *_setupWindow(_THIS, SDL_Window *window, HWND hwndFrame, - HWND hwnd) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - WINDATA *pWinData = SDL_calloc(1, sizeof(WINDATA)); - - if (pWinData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - pWinData->hwnd = hwnd; - pWinData->hwndFrame = hwndFrame; - pWinData->window = window; - window->driverdata = pWinData; - - WinSetWindowULong(hwnd, 0, (ULONG)pWinData); - pWinData->fnWndFrameProc = WinSubclassWindow(hwndFrame, wndFrameProc); - - pWinData->pOutput = pVData->pOutput; - pWinData->pVOData = pVData->pOutput->Open(); - - WinSetVisibleRegionNotify(hwnd, TRUE); - - return pWinData; -} - -static int OS2_CreateWindow(_THIS, SDL_Window *window) -{ - RECTL rectl; - HWND hwndFrame, hwnd; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - ULONG ulFrameFlags = FCF_TASKLIST | FCF_TITLEBAR | FCF_SYSMENU | - FCF_MINBUTTON | FCF_SHELLPOSITION; - ULONG ulSWPFlags = SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE; - WINDATA *pWinData; - - if (pSDLDisplayMode == NULL) - return -1; - - /* Create a PM window */ - if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) - ulFrameFlags |= FCF_SIZEBORDER | FCF_DLGBORDER | FCF_MAXBUTTON; - else if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) - ulFrameFlags |= FCF_DLGBORDER; - - if ((window->flags & SDL_WINDOW_MAXIMIZED) != 0) - ulSWPFlags |= SWP_MAXIMIZE; - else if ((window->flags & SDL_WINDOW_MINIMIZED) != 0) - ulSWPFlags |= SWP_MINIMIZE; - - hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags, - WIN_CLIENT_CLASS, "SDL3", 0, 0, 0, &hwnd); - if (hwndFrame == NULLHANDLE) - return SDL_SetError("Couldn't create window"); - - /* Setup window data and frame window procedure */ - pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { - WinDestroyWindow(hwndFrame); - return -1; - } - - /* Show window */ - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = window->w; - rectl.yTop = window->h; - WinCalcFrameRect(hwndFrame, &rectl, FALSE); - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove++; - WinSetWindowPos(hwndFrame, HWND_TOP, rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulSWPFlags); - - rectl.xLeft = 0; - rectl.yBottom = 0; - WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 1); - window->x = rectl.xLeft; - window->y = pSDLDisplayMode->h - (rectl.yBottom + window->h); - - window->flags |= SDL_WINDOW_SHOWN; - - return 0; -} - -static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - CHAR acBuf[256]; - CLASSINFO stCI; - HWND hwndUser = (HWND)data; - HWND hwndFrame, hwnd; - ULONG cbText; - PSZ pszText; - WINDATA *pWinData; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - SWP swp; - POINTL pointl; - - debug_os2("Enter"); - if (pSDLDisplayMode == NULL) - return -1; - - /* User can accept client OR frame window handle. - * Get client and frame window handles. */ - WinQueryClassName(hwndUser, sizeof(acBuf), acBuf); - if (!WinQueryClassInfo(pVData->hab, acBuf, &stCI)) - return SDL_SetError("Cannot get user window class information"); - - if ((stCI.flClassStyle & CS_FRAME) == 0) { - /* Client window handle is specified */ - hwndFrame = WinQueryWindow(hwndUser, QW_PARENT); - if (hwndFrame == NULLHANDLE) - return SDL_SetError("Cannot get parent window handle"); - - if ((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, 0, 0) == 0) - return SDL_SetError("Parent window is not a frame window"); - - hwnd = hwndUser; - } else { - /* Frame window handle is specified */ - hwnd = WinWindowFromID(hwndUser, FID_CLIENT); - if (hwnd == NULLHANDLE) - return SDL_SetError("Cannot get client window handle"); - - hwndFrame = hwndUser; - - WinQueryClassName(hwnd, sizeof(acBuf), acBuf); - if (!WinQueryClassInfo(pVData->hab, acBuf, &stCI)) - return SDL_SetError("Cannot get client window class information"); - } - - /* Check window's reserved storage */ - if (stCI.cbWindowData < sizeof(ULONG)) - return SDL_SetError("Reserved storage of window must be at least %u bytes", sizeof(ULONG)); - - /* Set SDL-window title */ - cbText = WinQueryWindowTextLength(hwndFrame); - pszText = SDL_stack_alloc(CHAR, cbText + 1); - - if (pszText != NULL) - cbText = (pszText != NULL)? WinQueryWindowText(hwndFrame, cbText, pszText) : 0; - - if (cbText != 0) - window->title = OS2_SysToUTF8(pszText); - - if (pszText != NULL) { - SDL_stack_free(pszText); - } - - /* Set SDL-window flags */ - window->flags &= ~(SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | - SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED | - SDL_WINDOW_MINIMIZED | SDL_WINDOW_INPUT_FOCUS); - - if (WinIsWindowVisible(hwnd)) - window->flags |= SDL_WINDOW_SHOWN; - - WinSendMsg(hwndFrame, WM_QUERYBORDERSIZE, MPFROMP(&pointl), 0); - if (pointl.y == WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER)) - window->flags |= SDL_WINDOW_RESIZABLE; - else if (pointl.y <= WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER)) - window->flags |= SDL_WINDOW_BORDERLESS; - - WinQueryWindowPos(hwndFrame, &swp); - - if ((swp.fl & SWP_MAXIMIZE) != 0) - window->flags |= SDL_WINDOW_MAXIMIZED; - if ((swp.fl & SWP_MINIMIZE) != 0) - window->flags |= SDL_WINDOW_MINIMIZED; - - pointl.x = 0; - pointl.y = 0; - WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); - window->x = pointl.x; - window->y = pSDLDisplayMode->h - (pointl.y + swp.cy); - - WinQueryWindowPos(hwnd, &swp); - window->w = swp.cx; - window->h = swp.cy; - - /* Setup window data and frame window procedure */ - pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { - SDL_free(window->title); - window->title = NULL; - return -1; - } - pWinData->fnUserWndProc = WinSubclassWindow(hwnd, wndProc); - - if (WinQueryActiveWindow(HWND_DESKTOP) == hwndFrame) - SDL_SetKeyboardFocus(window); - - return 0; -} - -static void OS2_DestroyWindow(_THIS, SDL_Window * window) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - if (pWinData == NULL) - return; - - if (pWinData->hrgnShape != NULLHANDLE) { - HPS hps = WinGetPS(pWinData->hwnd); - GpiDestroyRegion(hps, pWinData->hrgnShape); - WinReleasePS(hps); - } - - if (window->shaper) { - SDL_free(window->shaper); - window->shaper = NULL; - } - - if (pWinData->fnUserWndProc == NULL) { - /* Window was created by SDL (OS2_CreateWindow()), - * not by user (OS2_CreateWindowFrom()) */ - WinDestroyWindow(pWinData->hwndFrame); - } else { - WinSetWindowULong(pWinData->hwnd, 0, 0); - } - - if ((pVData != NULL) && (pWinData->pVOData != NULL)) { - pVData->pOutput->Close(pWinData->pVOData); - pWinData->pVOData = NULL; - } - - if (pWinData->hptrIcon != NULLHANDLE) { - WinDestroyPointer(pWinData->hptrIcon); - pWinData->hptrIcon = NULLHANDLE; - } - - SDL_free(pWinData); - window->driverdata = NULL; -} - -static void OS2_SetWindowTitle(_THIS, SDL_Window *window) -{ - PSZ pszTitle = (window->title == NULL)? NULL : OS2_UTF8ToSys(window->title); - - WinSetWindowText(((WINDATA *)window->driverdata)->hwndFrame, pszTitle); - SDL_free(pszTitle); -} - -static void OS2_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - HPOINTER hptr = utilCreatePointer(icon, 0, 0); - - if (hptr == NULLHANDLE) - return; - - /* Destroy old icon */ - if (pWinData->hptrIcon != NULLHANDLE) - WinDestroyPointer(pWinData->hptrIcon); - - /* Set new window icon */ - pWinData->hptrIcon = hptr; - if (!WinSendMsg(pWinData->hwndFrame, WM_SETICON, MPFROMLONG(hptr), 0)) { - debug_os2("Cannot set icon for the window"); - } -} - -static void OS2_SetWindowPosition(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - RECTL rectl; - ULONG ulFlags; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - - debug_os2("Enter"); - if (pSDLDisplayMode == NULL) - return; - - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = window->w; - rectl.yTop = window->h; - WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE); - - if (SDL_ShouldAllowTopmost() && - (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == - (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) ) - ulFlags = SWP_ZORDER | SWP_MOVE | SWP_SIZE; - else - ulFlags = SWP_MOVE | SWP_SIZE; - - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove++; - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, - window->x + rectl.xLeft, - (pSDLDisplayMode->h - window->y) - window->h + rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulFlags); -} - -static void OS2_SetWindowSize(_THIS, SDL_Window *window) -{ - debug_os2("Enter"); - OS2_SetWindowPosition(_this, window); -} - -static void OS2_ShowWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinShowWindow(pWinData->hwndFrame, TRUE); -} - -static void OS2_HideWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinShowWindow(pWinData->hwndFrame, FALSE); -} - -static void OS2_RaiseWindow(_THIS, SDL_Window *window) -{ - debug_os2("Enter"); - OS2_SetWindowPosition(_this, window); -} - -static void OS2_MaximizeWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE); -} - -static void OS2_MinimizeWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_DEACTIVATE); -} - -static void OS2_RestoreWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_RESTORE); -} - -static void OS2_SetWindowBordered(_THIS, SDL_Window * window, - SDL_bool bordered) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - ULONG ulStyle = WinQueryWindowULong(pWinData->hwndFrame, QWL_STYLE); - RECTL rectl; - - debug_os2("Enter"); - - /* New frame sytle */ - if (bordered) - ulStyle |= ((window->flags & SDL_WINDOW_RESIZABLE) != 0) ? FS_SIZEBORDER : FS_DLGBORDER; - else - ulStyle &= ~(FS_SIZEBORDER | FS_BORDER | FS_DLGBORDER); - - /* Save client window position */ - WinQueryWindowRect(pWinData->hwnd, &rectl); - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 2); - - /* Change the frame */ - WinSetWindowULong(pWinData->hwndFrame, QWL_STYLE, ulStyle); - WinSendMsg(pWinData->hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_BORDER), 0); - - /* Restore client window position */ - WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE); - pWinData->lSkipWMMove++; - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, - rectl.yTop - rectl.yBottom, - SWP_SIZE | SWP_MOVE | SWP_NOADJUST); -} - -static void OS2_SetWindowFullscreen(_THIS, SDL_Window *window, - SDL_VideoDisplay *display, - SDL_bool fullscreen) -{ - RECTL rectl; - ULONG ulFlags; - WINDATA *pWinData = (WINDATA *)window->driverdata; - SDL_DisplayMode *pSDLDisplayMode = &display->current_mode; - - debug_os2("Enter, fullscreen: %u", fullscreen); - - if (pSDLDisplayMode == NULL) - return; - - if (SDL_ShouldAllowTopmost() && - (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) - ulFlags = SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_NOADJUST; - else - ulFlags = SWP_SIZE | SWP_MOVE | SWP_NOADJUST; - - if (fullscreen) { - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = pSDLDisplayMode->w; - rectl.yTop = pSDLDisplayMode->h; - /* We need send the restore command now to allow WinCalcFrameRect() */ - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_RESTORE); - } else { - pWinData->lSkipWMMove++; - rectl.xLeft = window->windowed.x; - rectl.yTop = pSDLDisplayMode->h - window->windowed.y; - rectl.xRight = rectl.xLeft + window->windowed.w; - rectl.yBottom = rectl.yTop - window->windowed.h; - } - - if (!WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE)) { - debug_os2("WinCalcFrameRect() failed"); - } - else if (!WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, - rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulFlags)) { - debug_os2("WinSetWindowPos() failed"); - } -} - -static SDL_bool OS2_GetWindowWMInfo(_THIS, SDL_Window * window, - struct SDL_SysWMinfo *info) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - if (info->version.major <= SDL_MAJOR_VERSION) { - info->subsystem = SDL_SYSWM_OS2; - info->info.os2.hwnd = pWinData->hwnd; - info->info.os2.hwndFrame = pWinData->hwndFrame; - return SDL_TRUE; - } - - SDL_SetError("Application not compiled with SDL %u", - SDL_MAJOR_VERSION); - return SDL_FALSE; -} - -static void OS2_OnWindowEnter(_THIS, SDL_Window * window) -{ -} - -static int OS2_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) -{ - debug_os2("Enter"); - return 0; -} - -static void OS2_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter, %u", grabbed); - _mouseCheck(pWinData); -} - - -/* Shaper - */ -typedef struct _SHAPERECTS { - PRECTL pRects; - ULONG cRects; - ULONG ulWinHeight; -} SHAPERECTS; - -static void _combineRectRegions(SDL_ShapeTree *node, void *closure) -{ - SHAPERECTS *pShapeRects = (SHAPERECTS *)closure; - PRECTL pRect; - - /* Expand rectangles list */ - if ((pShapeRects->cRects & 0x0F) == 0) { - pRect = SDL_realloc(pShapeRects->pRects, (pShapeRects->cRects + 0x10) * sizeof(RECTL)); - if (pRect == NULL) - return; - pShapeRects->pRects = pRect; - } - - /* Add a new rectangle */ - pRect = &pShapeRects->pRects[pShapeRects->cRects]; - pShapeRects->cRects++; - /* Fill rectangle data */ - pRect->xLeft = node->data.shape.x; - pRect->yTop = pShapeRects->ulWinHeight - node->data.shape.y; - pRect->xRight += node->data.shape.w; - pRect->yBottom = pRect->yTop - node->data.shape.h; -} - -static SDL_WindowShaper* OS2_CreateShaper(SDL_Window * window) -{ - SDL_WindowShaper* pSDLShaper = SDL_malloc(sizeof(SDL_WindowShaper)); - - debug_os2("Enter"); - pSDLShaper->window = window; - pSDLShaper->mode.mode = ShapeModeDefault; - pSDLShaper->mode.parameters.binarizationCutoff = 1; - pSDLShaper->userx = 0; - pSDLShaper->usery = 0; - pSDLShaper->driverdata = (SDL_ShapeTree *)NULL; - window->shaper = pSDLShaper; - - if (OS2_ResizeWindowShape(window) != 0) { - window->shaper = NULL; - SDL_free(pSDLShaper); - return NULL; - } - - return pSDLShaper; -} - -static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, - SDL_WindowShapeMode *shape_mode) -{ - SDL_ShapeTree *pShapeTree; - WINDATA *pWinData; - SHAPERECTS stShapeRects; - HPS hps; - - debug_os2("Enter"); - if (shaper == NULL || shape == NULL || - (shape->format->Amask == 0 && shape_mode->mode != ShapeModeColorKey) || - shape->w != shaper->window->w || shape->h != shaper->window->h) { - return SDL_INVALID_SHAPE_ARGUMENT; - } - - if (shaper->driverdata != NULL) - SDL_FreeShapeTree((SDL_ShapeTree **)&shaper->driverdata); - - pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape); - shaper->driverdata = pShapeTree; - - SDL_zero(stShapeRects); - stShapeRects.ulWinHeight = shaper->window->h; - SDL_TraverseShapeTree(pShapeTree, &_combineRectRegions, &stShapeRects); - - pWinData = (WINDATA *)shaper->window->driverdata; - hps = WinGetPS(pWinData->hwnd); - - if (pWinData->hrgnShape != NULLHANDLE) - GpiDestroyRegion(hps, pWinData->hrgnShape); - - pWinData->hrgnShape = (stShapeRects.pRects == NULL) ? NULLHANDLE : - GpiCreateRegion(hps, stShapeRects.cRects, stShapeRects.pRects); - - WinReleasePS(hps); - SDL_free(stShapeRects.pRects); - WinSendMsg(pWinData->hwnd, WM_VRNENABLED, 0, 0); - - return 0; -} - -static int OS2_ResizeWindowShape(SDL_Window *window) -{ - debug_os2("Enter"); - if (window == NULL) - return -1; - - if (window->x != -1000) { - if (window->shaper->driverdata != NULL) - SDL_FreeShapeTree((SDL_ShapeTree **)window->shaper->driverdata); - - if (window->shaper->hasshape == SDL_TRUE) { - window->shaper->userx = window->x; - window->shaper->usery = window->y; - SDL_SetWindowPosition(window, -1000, -1000); - } - } - - return 0; -} - - -/* Frame buffer - */ -static void OS2_DestroyWindowFramebuffer(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - if (pWinData != NULL && pWinData->pVOData != NULL) - pWinData->pOutput->VideoBufFree(pWinData->pVOData); -} - -static int OS2_CreateWindowFramebuffer(_THIS, SDL_Window *window, - Uint32 *format, void **pixels, - int *pitch) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - SDL_VideoDisplay *pSDLDisplay = SDL_GetDisplayForWindow(window); - SDL_DisplayMode *pSDLDisplayMode; - MODEDATA *pModeData; - ULONG ulWidth, ulHeight; - - debug_os2("Enter"); - if (pSDLDisplay == NULL) { - debug_os2("No display for the window"); - return -1; - } - - pSDLDisplayMode = &pSDLDisplay->current_mode; - pModeData = (MODEDATA *)pSDLDisplayMode->driverdata; - if (pModeData == NULL) - return SDL_SetError("No mode data for the display"); - - SDL_GetWindowSize(window, (int *)&ulWidth, (int *)&ulHeight); - debug_os2("Window size: %u x %u", ulWidth, ulHeight); - - *pixels = pWinData->pOutput->VideoBufAlloc( - pWinData->pVOData, ulWidth, ulHeight, pModeData->ulDepth, - pModeData->fccColorEncoding, (PULONG)pitch); - if (*pixels == NULL) - return -1; - - *format = pSDLDisplayMode->format; - debug_os2("Pitch: %u, frame buffer: 0x%X.", *pitch, *pixels); - WinSendMsg(pWinData->hwnd, WM_VRNENABLED, 0, 0); - - return 0; -} - -static int OS2_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - const SDL_Rect *rects, int numrects) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - return pWinData->pOutput->Update(pWinData->pVOData, pWinData->hwnd, - (SDL_Rect *)rects, (ULONG)numrects) - ? 0 : -1; -} - - -/* Clipboard - */ -static int OS2_SetClipboardText(_THIS, const char *text) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard; - PSZ pszText = (text == NULL)? NULL : OS2_UTF8ToSys(text); - ULONG cbText; - ULONG ulRC; - BOOL fSuccess; - - debug_os2("Enter"); - if (pszText == NULL) - return -1; - cbText = SDL_strlen(pszText) + 1; - - ulRC = DosAllocSharedMem((PPVOID)&pszClipboard, 0, cbText, - PAG_COMMIT | PAG_READ | PAG_WRITE | - OBJ_GIVEABLE | OBJ_GETTABLE | OBJ_TILE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocSharedMem() failed, rc = %u", ulRC); - SDL_free(pszText); - return -1; - } - - SDL_memcpy(pszClipboard, pszText, cbText); - SDL_free(pszText); - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - fSuccess = FALSE; - } else { - WinEmptyClipbrd(pVData->hab); - fSuccess = WinSetClipbrdData(pVData->hab, (ULONG)pszClipboard, CF_TEXT, CFI_POINTER); - if (!fSuccess) { - debug_os2("WinOpenClipbrd() failed"); - } - WinCloseClipbrd(pVData->hab); - } - - if (!fSuccess) { - DosFreeMem(pszClipboard); - return -1; - } - return 0; -} - -static char *OS2_GetClipboardText(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard = NULL; - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - } else { - pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); - if (pszClipboard != NULL) - pszClipboard = OS2_SysToUTF8(pszClipboard); - WinCloseClipbrd(pVData->hab); - } - - return (pszClipboard == NULL) ? SDL_strdup("") : pszClipboard; -} - -static SDL_bool OS2_HasClipboardText(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard; - SDL_bool result; - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - return SDL_FALSE; - } - - pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); - result = (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; - WinCloseClipbrd(pVData->hab); - - return result; -} - - -static int OS2_VideoInit(_THIS) -{ - SDL_VideoData *pVData; - PTIB tib; - PPIB pib; - - /* Create SDL video driver private data */ - pVData = SDL_calloc(1, sizeof(SDL_VideoData)); - if (pVData == NULL) - return SDL_OutOfMemory(); - - /* Change process type code for use Win* API from VIO session */ - DosGetInfoBlocks(&tib, &pib); - if (pib->pib_ultype == 2 || pib->pib_ultype == 0) { - /* VIO windowable or fullscreen protect-mode session */ - pib->pib_ultype = 3; /* Presentation Manager protect-mode session */ - } - - /* PM initialization */ - pVData->hab = WinInitialize(0); - pVData->hmq = WinCreateMsgQueue(pVData->hab, 0); - if (pVData->hmq == NULLHANDLE) { - SDL_free(pVData); - return SDL_SetError("Message queue cannot be created."); - } - - if (!WinRegisterClass(pVData->hab, WIN_CLIENT_CLASS, wndProc, - CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT, - sizeof(SDL_VideoData*))) { - SDL_free(pVData); - return SDL_SetError("Window class not successfully registered."); - } - - if (SDL_strcasecmp(_this->name, OS2DRIVER_NAME_VMAN) == 0) - pVData->pOutput = &voVMan; - else - pVData->pOutput = &voDive; - - _this->driverdata = pVData; - - /* Add display */ - { - SDL_VideoDisplay stSDLDisplay; - SDL_DisplayMode stSDLDisplayMode; - DISPLAYDATA *pDisplayData; - MODEDATA *pModeData; - VIDEOOUTPUTINFO stVOInfo; - - if (!pVData->pOutput->QueryInfo(&stVOInfo)) { - SDL_free(pVData); - return SDL_SetError("Video mode query failed."); - } - - SDL_zero(stSDLDisplay); SDL_zero(stSDLDisplayMode); - - stSDLDisplayMode.format = _getSDLPixelFormat(stVOInfo.ulBPP, - stVOInfo.fccColorEncoding); - stSDLDisplayMode.w = stVOInfo.ulHorizResolution; - stSDLDisplayMode.h = stVOInfo.ulVertResolution; - stSDLDisplayMode.refresh_rate = 0; - stSDLDisplayMode.driverdata = NULL; - - pModeData = SDL_malloc(sizeof(MODEDATA)); - if (pModeData != NULL) { - pModeData->ulDepth = stVOInfo.ulBPP; - pModeData->fccColorEncoding = stVOInfo.fccColorEncoding; - pModeData->ulScanLineBytes = stVOInfo.ulScanLineSize; - stSDLDisplayMode.driverdata = pModeData; - } - - stSDLDisplay.name = "Primary"; - stSDLDisplay.desktop_mode = stSDLDisplayMode; - stSDLDisplay.current_mode = stSDLDisplayMode; - stSDLDisplay.driverdata = NULL; - stSDLDisplay.num_display_modes = 0; - - pDisplayData = SDL_malloc(sizeof(DISPLAYDATA)); - if (pDisplayData != NULL) { - HPS hps = WinGetPS(HWND_DESKTOP); - HDC hdc = GpiQueryDevice(hps); - - /* May be we can use CAPS_HORIZONTAL_RESOLUTION and - * CAPS_VERTICAL_RESOLUTION - pels per meter? */ - DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1, - (PLONG)&pDisplayData->ulDPIHor); - DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1, - (PLONG)&pDisplayData->ulDPIVer); - WinReleasePS(hps); - - pDisplayData->ulDPIDiag = SDL_ComputeDiagonalDPI( - stVOInfo.ulHorizResolution, stVOInfo.ulVertResolution, - (float)stVOInfo.ulHorizResolution / pDisplayData->ulDPIHor, - (float)stVOInfo.ulVertResolution / pDisplayData->ulDPIVer); - - stSDLDisplayMode.driverdata = pDisplayData; - } - - SDL_AddVideoDisplay(&stSDLDisplay, SDL_FALSE); - } - - OS2_InitMouse(_this, pVData->hab); - - return 0; -} - -static void OS2_VideoQuit(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - - OS2_QuitMouse(_this); - - WinDestroyMsgQueue(pVData->hmq); - WinTerminate(pVData->hab); - - /* our caller SDL_VideoQuit() already frees display_modes, driverdata, etc. */ -} - -static int OS2_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, - SDL_Rect *rect) -{ - debug_os2("Enter"); - - rect->x = 0; - rect->y = 0; - rect->w = display->desktop_mode.w; - rect->h = display->desktop_mode.h; - - return 0; -} - -static int OS2_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, - float *hdpi, float *vdpi) -{ - DISPLAYDATA *pDisplayData = (DISPLAYDATA *)display->driverdata; - - debug_os2("Enter"); - if (pDisplayData == NULL) - return -1; - - if (ddpi != NULL) - *hdpi = pDisplayData->ulDPIDiag; - if (hdpi != NULL) - *hdpi = pDisplayData->ulDPIHor; - if (vdpi != NULL) - *vdpi = pDisplayData->ulDPIVer; - - return 0; -} - -static void OS2_GetDisplayModes(_THIS, SDL_VideoDisplay *display) -{ - SDL_DisplayMode mode; - - debug_os2("Enter"); - SDL_copyp(&mode, &display->current_mode); - mode.driverdata = (MODEDATA *) SDL_malloc(sizeof(MODEDATA)); - if (!mode.driverdata) return; /* yikes.. */ - SDL_memcpy(mode.driverdata, display->current_mode.driverdata, sizeof(MODEDATA)); - SDL_AddDisplayMode(display, &mode); -} - -static int OS2_SetDisplayMode(_THIS, SDL_VideoDisplay *display, - SDL_DisplayMode *mode) -{ - debug_os2("Enter"); - return -1; -} - - -static void OS2_DeleteDevice(SDL_VideoDevice *device) -{ - SDL_free(device); -} - -static SDL_VideoDevice *OS2_CreateDevice(void) -{ - SDL_VideoDevice *device; - - /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_OutOfMemory(); - return NULL; - } - - /* Set the function pointers */ - device->VideoInit = OS2_VideoInit; - device->VideoQuit = OS2_VideoQuit; - device->GetDisplayBounds = OS2_GetDisplayBounds; - device->GetDisplayDPI = OS2_GetDisplayDPI; - device->GetDisplayModes = OS2_GetDisplayModes; - device->SetDisplayMode = OS2_SetDisplayMode; - device->PumpEvents = OS2_PumpEvents; - device->CreateSDLWindow = OS2_CreateWindow; - device->CreateSDLWindowFrom = OS2_CreateWindowFrom; - device->DestroyWindow = OS2_DestroyWindow; - device->SetWindowTitle = OS2_SetWindowTitle; - device->SetWindowIcon = OS2_SetWindowIcon; - device->SetWindowPosition = OS2_SetWindowPosition; - device->SetWindowSize = OS2_SetWindowSize; - device->ShowWindow = OS2_ShowWindow; - device->HideWindow = OS2_HideWindow; - device->RaiseWindow = OS2_RaiseWindow; - device->MaximizeWindow = OS2_MaximizeWindow; - device->MinimizeWindow = OS2_MinimizeWindow; - device->RestoreWindow = OS2_RestoreWindow; - device->SetWindowBordered = OS2_SetWindowBordered; - device->SetWindowFullscreen = OS2_SetWindowFullscreen; - device->GetWindowWMInfo = OS2_GetWindowWMInfo; - device->OnWindowEnter = OS2_OnWindowEnter; - device->SetWindowHitTest = OS2_SetWindowHitTest; - device->SetWindowMouseGrab = OS2_SetWindowMouseGrab; - device->CreateWindowFramebuffer = OS2_CreateWindowFramebuffer; - device->UpdateWindowFramebuffer = OS2_UpdateWindowFramebuffer; - device->DestroyWindowFramebuffer = OS2_DestroyWindowFramebuffer; - - device->SetClipboardText = OS2_SetClipboardText; - device->GetClipboardText = OS2_GetClipboardText; - device->HasClipboardText = OS2_HasClipboardText; - - device->shape_driver.CreateShaper = OS2_CreateShaper; - device->shape_driver.SetWindowShape = OS2_SetWindowShape; - device->shape_driver.ResizeWindowShape = OS2_ResizeWindowShape; - - device->free = OS2_DeleteDevice; - - return device; -} - -static SDL_VideoDevice *OS2DIVE_CreateDevice(void) -{ - VIDEOOUTPUTINFO stVOInfo; - if (!voDive.QueryInfo(&stVOInfo)) { - return NULL; - } - return OS2_CreateDevice(); -} - -static SDL_VideoDevice *OS2VMAN_CreateDevice(void) -{ - VIDEOOUTPUTINFO stVOInfo; - if (!voVMan.QueryInfo(&stVOInfo)) { - return NULL; - } - return OS2_CreateDevice(); -} - - -/* DIVE and VMAN bootstraps both call the same OS2_CreateDevice() function. - * Video output system will be selected in OS2_VideoInit() by driver name. */ -VideoBootStrap OS2DIVE_bootstrap = -{ - OS2DRIVER_NAME_DIVE, "OS/2 video driver", - OS2DIVE_CreateDevice -}; -VideoBootStrap OS2VMAN_bootstrap = -{ - OS2DRIVER_NAME_VMAN, "OS/2 video driver", - OS2VMAN_CreateDevice -}; - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2video.h b/src/video/os2/SDL_os2video.h deleted file mode 100644 index 688410c68..000000000 --- a/src/video/os2/SDL_os2video.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2video_h_ -#define SDL_os2video_h_ - -#include "../SDL_sysvideo.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOS -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_WIN -#define INCL_GPI -#define INCL_OS2MM -#define INCL_DOSMEMMGR -#include - -#include "SDL_os2mouse.h" -#include "SDL_os2output.h" - -typedef struct SDL_VideoData { - HAB hab; - HMQ hmq; - OS2VIDEOOUTPUT *pOutput; /* Video output routines */ -} SDL_VideoData; - -typedef struct _WINDATA { - SDL_Window *window; - OS2VIDEOOUTPUT *pOutput; /* Video output routines */ - HWND hwndFrame; - HWND hwnd; - PFNWP fnUserWndProc; - PFNWP fnWndFrameProc; - - PVODATA pVOData; /* Video output data */ - - HRGN hrgnShape; - HPOINTER hptrIcon; - RECTL rectlBeforeFS; - - LONG lSkipWMSize; - LONG lSkipWMMove; - LONG lSkipWMMouseMove; - LONG lSkipWMVRNEnabled; - LONG lSkipWMAdjustFramePos; -} WINDATA; - -typedef struct _DISPLAYDATA { - ULONG ulDPIHor; - ULONG ulDPIVer; - ULONG ulDPIDiag; -} DISPLAYDATA; - -typedef struct _MODEDATA { - ULONG ulDepth; - ULONG fccColorEncoding; - ULONG ulScanLineBytes; -} MODEDATA; - -#endif /* SDL_os2video_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2vman.c b/src/video/os2/SDL_os2vman.c deleted file mode 100644 index acb920061..000000000 --- a/src/video/os2/SDL_os2vman.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" -#include "../SDL_sysvideo.h" - -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_DOSMODULEMGR -#define INCL_WIN -#define INCL_GPI -#define INCL_GPIBITMAPS /* GPI bit map functions */ -#include -#include "SDL_os2output.h" -#include "SDL_os2video.h" - -#include "SDL_gradd.h" - -typedef struct _VODATA { - PVOID pBuffer; - HRGN hrgnVisible; - ULONG ulBPP; - ULONG ulScanLineSize; - ULONG ulWidth; - ULONG ulHeight; - ULONG ulScreenHeight; - ULONG ulScreenBytesPerLine; - RECTL rectlWin; - - PRECTL pRectl; - ULONG cRectl; - PBLTRECT pBltRect; - ULONG cBltRect; -} VODATA; - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo); -static PVODATA voOpen(); -static VOID voClose(PVODATA pVOData); -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible); -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); -static VOID voVideoBufFree(PVODATA pVOData); -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); - -OS2VIDEOOUTPUT voVMan = { - voQueryInfo, - voOpen, - voClose, - voSetVisibleRegion, - voVideoBufAlloc, - voVideoBufFree, - voUpdate -}; - - -static HMODULE hmodVMan = NULLHANDLE; -static FNVMIENTRY *pfnVMIEntry = NULL; -static ULONG ulVRAMAddress = 0; - -static VOID APIENTRY ExitVMan(VOID) -{ - if (ulVRAMAddress != 0 && hmodVMan != NULLHANDLE) { - pfnVMIEntry(0, VMI_CMD_TERMPROC, NULL, NULL); - DosFreeModule(hmodVMan); - } - - DosExitList(EXLST_EXIT, (PFNEXITLIST)NULL); -} - -static BOOL _vmanInit(void) -{ - ULONG ulRC; - CHAR acBuf[256]; - INITPROCOUT stInitProcOut; - - if (hmodVMan != NULLHANDLE) /* already initialized */ - return TRUE; - - /* Load vman.dll */ - ulRC = DosLoadModule(acBuf, sizeof(acBuf), "VMAN", &hmodVMan); - if (ulRC != NO_ERROR) { - debug_os2("Could not load VMAN.DLL, rc = %u : %s", ulRC, acBuf); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* Get VMIEntry */ - ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry); - if (ulRC != NO_ERROR) { - debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC); - DosFreeModule(hmodVMan); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* VMAN initialization */ - stInitProcOut.ulLength = sizeof(stInitProcOut); - ulRC = pfnVMIEntry(0, VMI_CMD_INITPROC, NULL, &stInitProcOut); - if (ulRC != RC_SUCCESS) { - debug_os2("Could not initialize VMAN for this process"); - pfnVMIEntry = NULL; - DosFreeModule(hmodVMan); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* Store video memory virtual address */ - ulVRAMAddress = stInitProcOut.ulVRAMVirt; - /* We use exit list for VMI_CMD_TERMPROC */ - if (DosExitList(EXLST_ADD | 0x00001000, (PFNEXITLIST)ExitVMan) != NO_ERROR) { - debug_os2("DosExitList() failed"); - } - - return TRUE; -} - -static PRECTL _getRectlArray(PVODATA pVOData, ULONG cRects) -{ - PRECTL pRectl; - - if (pVOData->cRectl >= cRects) - return pVOData->pRectl; - - pRectl = SDL_realloc(pVOData->pRectl, cRects * sizeof(RECTL)); - if (pRectl == NULL) - return NULL; - - pVOData->pRectl = pRectl; - pVOData->cRectl = cRects; - return pRectl; -} - -static PBLTRECT _getBltRectArray(PVODATA pVOData, ULONG cRects) -{ - PBLTRECT pBltRect; - - if (pVOData->cBltRect >= cRects) - return pVOData->pBltRect; - - pBltRect = SDL_realloc(pVOData->pBltRect, cRects * sizeof(BLTRECT)); - if (pBltRect == NULL) - return NULL; - - pVOData->pBltRect = pBltRect; - pVOData->cBltRect = cRects; - return pBltRect; -} - - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) -{ - ULONG ulRC; - GDDMODEINFO sCurModeInfo; - - if (!_vmanInit()) - return FALSE; - - /* Query current (desktop) mode */ - ulRC = pfnVMIEntry(0, VMI_CMD_QUERYCURRENTMODE, NULL, &sCurModeInfo); - if (ulRC != RC_SUCCESS) { - debug_os2("Could not query desktop video mode."); - return FALSE; - } - - pInfo->ulBPP = sCurModeInfo.ulBpp; - pInfo->ulHorizResolution = sCurModeInfo.ulHorizResolution; - pInfo->ulVertResolution = sCurModeInfo.ulVertResolution; - pInfo->ulScanLineSize = sCurModeInfo.ulScanLineSize; - pInfo->fccColorEncoding = sCurModeInfo.fccColorEncoding; - - return TRUE; -} - -static PVODATA voOpen(void) -{ - PVODATA pVOData; - - if (!_vmanInit()) - return NULL; - - pVOData = SDL_calloc(1, sizeof(VODATA)); - if (pVOData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - return pVOData; -} - -static VOID voClose(PVODATA pVOData) -{ - if (pVOData->pRectl != NULL) - SDL_free(pVOData->pRectl); - - if (pVOData->pBltRect != NULL) - SDL_free(pVOData->pBltRect); - - voVideoBufFree(pVOData); -} - -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible) -{ - HPS hps; - BOOL fSuccess = FALSE; - - hps = WinGetPS(hwnd); - - if (pVOData->hrgnVisible != NULLHANDLE) { - GpiDestroyRegion(hps, pVOData->hrgnVisible); - pVOData->hrgnVisible = NULLHANDLE; - } - - if (fVisible) { - /* Query visible rectangles */ - pVOData->hrgnVisible = GpiCreateRegion(hps, 0, NULL); - if (pVOData->hrgnVisible == NULLHANDLE) { - SDL_SetError("GpiCreateRegion() failed"); - } else { - if (WinQueryVisibleRegion(hwnd, pVOData->hrgnVisible) == RGN_ERROR) { - GpiDestroyRegion(hps, pVOData->hrgnVisible); - pVOData->hrgnVisible = NULLHANDLE; - } else { - if (hrgnShape != NULLHANDLE) - GpiCombineRegion(hps, pVOData->hrgnVisible, pVOData->hrgnVisible, - hrgnShape, CRGN_AND); - fSuccess = TRUE; - } - } - - WinQueryWindowRect(hwnd, &pVOData->rectlWin); - WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&pVOData->rectlWin, 2); - - if (pSDLDisplayMode != NULL) { - pVOData->ulScreenHeight = pSDLDisplayMode->h; - pVOData->ulScreenBytesPerLine = - ((MODEDATA *)pSDLDisplayMode->driverdata)->ulScanLineBytes; - } - } - - WinReleasePS(hps); - - return fSuccess; -} - -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize) -{ - ULONG ulRC; - ULONG ulScanLineSize = ulWidth * (ulBPP >> 3); - - /* Destroy previous buffer */ - voVideoBufFree(pVOData); - - if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0) - return NULL; - - /* Bytes per line */ - ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */ - *pulScanLineSize = ulScanLineSize; - - ulRC = DosAllocMem(&pVOData->pBuffer, - (ulHeight * ulScanLineSize) + sizeof(ULONG), - PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocMem(), rc = %u", ulRC); - return NULL; - } - - pVOData->ulBPP = ulBPP; - pVOData->ulScanLineSize = ulScanLineSize; - pVOData->ulWidth = ulWidth; - pVOData->ulHeight = ulHeight; - - return pVOData->pBuffer; -} - -static VOID voVideoBufFree(PVODATA pVOData) -{ - ULONG ulRC; - - if (pVOData->pBuffer == NULL) - return; - - ulRC = DosFreeMem(pVOData->pBuffer); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeMem(), rc = %u", ulRC); - } else { - pVOData->pBuffer = NULL; - } -} - -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects) -{ - PRECTL prectlDst, prectlScan; - HPS hps; - HRGN hrgnUpdate; - RGNRECT rgnCtl; - SDL_Rect stSDLRectDef; - BMAPINFO bmiSrc; - BMAPINFO bmiDst; - PPOINTL pptlSrcOrg; - PBLTRECT pbrDst; - HWREQIN sHWReqIn; - BITBLTINFO sBitbltInfo; - ULONG ulIdx; - - if (pVOData->pBuffer == NULL) - return FALSE; - - if (pVOData->hrgnVisible == NULLHANDLE) - return TRUE; - - bmiSrc.ulLength = sizeof(BMAPINFO); - bmiSrc.ulType = BMAP_MEMORY; - bmiSrc.ulWidth = pVOData->ulWidth; - bmiSrc.ulHeight = pVOData->ulHeight; - bmiSrc.ulBpp = pVOData->ulBPP; - bmiSrc.ulBytesPerLine = pVOData->ulScanLineSize; - bmiSrc.pBits = (PBYTE)pVOData->pBuffer; - - bmiDst.ulLength = sizeof(BMAPINFO); - bmiDst.ulType = BMAP_VRAM; - bmiDst.pBits = (PBYTE)ulVRAMAddress; - bmiDst.ulWidth = bmiSrc.ulWidth; - bmiDst.ulHeight = bmiSrc.ulHeight; - bmiDst.ulBpp = bmiSrc.ulBpp; - bmiDst.ulBytesPerLine = pVOData->ulScreenBytesPerLine; - - /* List of update rectangles. This is the intersection of requested - * rectangles and visible rectangles. */ - if (cSDLRects == 0) { - /* Full update requested */ - stSDLRectDef.x = 0; - stSDLRectDef.y = 0; - stSDLRectDef.w = bmiSrc.ulWidth; - stSDLRectDef.h = bmiSrc.ulHeight; - pSDLRects = &stSDLRectDef; - cSDLRects = 1; - } - - /* Make list of destination rectangles (prectlDst) list from the source - * list (prectl). */ - prectlDst = _getRectlArray(pVOData, cSDLRects); - if (prectlDst == NULL) { - debug_os2("Not enough memory"); - return FALSE; - } - prectlScan = prectlDst; - for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, pSDLRects++, prectlScan++) { - prectlScan->xLeft = pSDLRects->x; - prectlScan->yTop = pVOData->ulHeight - pSDLRects->y; - prectlScan->xRight = prectlScan->xLeft + pSDLRects->w; - prectlScan->yBottom = prectlScan->yTop - pSDLRects->h; - } - - hps = WinGetPS(hwnd); - if (hps == NULLHANDLE) - return FALSE; - - /* Make destination region to update */ - hrgnUpdate = GpiCreateRegion(hps, cSDLRects, prectlDst); - /* "AND" on visible and destination regions, result is region to update */ - GpiCombineRegion(hps, hrgnUpdate, hrgnUpdate, pVOData->hrgnVisible, CRGN_AND); - - /* Get rectangles of the region to update */ - rgnCtl.ircStart = 1; - rgnCtl.crc = 0; - rgnCtl.ulDirection = 1; - rgnCtl.crcReturned = 0; - GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, NULL); - if (rgnCtl.crcReturned == 0) { - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - return TRUE; - } - /* We don't need prectlDst, use it again to store update regions */ - prectlDst = _getRectlArray(pVOData, rgnCtl.crcReturned); - if (prectlDst == NULL) { - debug_os2("Not enough memory"); - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - return FALSE; - } - rgnCtl.ircStart = 1; - rgnCtl.crc = rgnCtl.crcReturned; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, prectlDst); - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - cSDLRects = rgnCtl.crcReturned; - - /* Now cRect/prectlDst is a list of regions in window (update && visible) */ - - /* Make lists for blitting from update regions */ - pbrDst = _getBltRectArray(pVOData, cSDLRects); - if (pbrDst == NULL) { - debug_os2("Not enough memory"); - return FALSE; - } - - prectlScan = prectlDst; - pptlSrcOrg = (PPOINTL)prectlDst; /* Yes, this memory block will be used again */ - for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, prectlScan++, pptlSrcOrg++) { - pbrDst[ulIdx].ulXOrg = pVOData->rectlWin.xLeft + prectlScan->xLeft; - pbrDst[ulIdx].ulYOrg = pVOData->ulScreenHeight - - (pVOData->rectlWin.yBottom + prectlScan->yTop); - pbrDst[ulIdx].ulXExt = prectlScan->xRight - prectlScan->xLeft; - pbrDst[ulIdx].ulYExt = prectlScan->yTop - prectlScan->yBottom; - pptlSrcOrg->x = prectlScan->xLeft; - pptlSrcOrg->y = bmiSrc.ulHeight - prectlScan->yTop; - } - pptlSrcOrg = (PPOINTL)prectlDst; - - /* Request HW */ - sHWReqIn.ulLength = sizeof(HWREQIN); - sHWReqIn.ulFlags = REQUEST_HW; - sHWReqIn.cScrChangeRects = 1; - sHWReqIn.arectlScreen = &pVOData->rectlWin; - if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed"); - sHWReqIn.cScrChangeRects = 0; /* for fail signal only */ - } else { - RECTL rclSrcBounds; - - rclSrcBounds.xLeft = 0; - rclSrcBounds.yBottom = 0; - rclSrcBounds.xRight = bmiSrc.ulWidth; - rclSrcBounds.yTop = bmiSrc.ulHeight; - - SDL_zero(sBitbltInfo); - sBitbltInfo.ulLength = sizeof(BITBLTINFO); - sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW; - sBitbltInfo.cBlits = cSDLRects; - sBitbltInfo.ulROP = ROP_SRCCOPY; - sBitbltInfo.pSrcBmapInfo = &bmiSrc; - sBitbltInfo.pDstBmapInfo = &bmiDst; - sBitbltInfo.prclSrcBounds = &rclSrcBounds; - sBitbltInfo.prclDstBounds = &pVOData->rectlWin; - sBitbltInfo.aptlSrcOrg = pptlSrcOrg; - sBitbltInfo.abrDst = pbrDst; - - /* Screen update */ - if (pfnVMIEntry(0, VMI_CMD_BITBLT, &sBitbltInfo, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_BITBLT,,) failed"); - sHWReqIn.cScrChangeRects = 0; /* for fail signal only */ - } - - /* Release HW */ - sHWReqIn.ulFlags = 0; - if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed"); - } - } - - return sHWReqIn.cScrChangeRects != 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/Makefile.in b/test/Makefile.in index 0927871e7..aae311280 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -269,22 +269,14 @@ testnative$(EXE): $(srcdir)/testnative.c \ $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ endif -ifeq (@ISOS2@,true) -testnative$(EXE): $(srcdir)/testnative.c \ - $(srcdir)/testnativeos2.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -endif - #there's probably a better way of doing this ifeq (@ISMACOSX@,false) ifeq (@ISWINDOWS@,false) ifeq (@ISUNIX@,false) -ifeq (@ISOS2@,false) testnative$(EXE): ; endif endif endif -endif testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) diff --git a/test/Makefile.os2 b/test/Makefile.os2 deleted file mode 100644 index 3f6daf859..000000000 --- a/test/Makefile.os2 +++ /dev/null @@ -1,18 +0,0 @@ -# Open Watcom makefile to build SDL3 tests for OS/2 -# wmake -f Makefile.os2 -# -# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 - -SYSTEM = os2v2 - -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" - -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -CFLAGS+= -wx -wcd=303 -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif - -TNSRCS = testnative.c testnativeos2.c - -!include watcom.mif diff --git a/test/Makefile.w32 b/test/Makefile.w32 deleted file mode 100644 index 55ad493f4..000000000 --- a/test/Makefile.w32 +++ /dev/null @@ -1,21 +0,0 @@ -# Open Watcom makefile to build SDL3 tests for Win32 -# wmake -f Makefile.w32 -# -# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 - -SYSTEM = nt - -INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos" - -CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -CFLAGS+= -wx -wcd=303 -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -CFLAGS+= -DSDL_MAIN_HANDLED -CFLAGS+= -DHAVE_OPENGL -GLLIBS = opengl32.lib - -TNSRCS = testnative.c testnativew32.c - -!include watcom.mif diff --git a/test/configure b/test/configure index f524bd4d3..c620cc661 100755 --- a/test/configure +++ b/test/configure @@ -633,7 +633,6 @@ SDL_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG -ISOS2 ISUNIX ISWINDOWS ISMACOSX @@ -3557,7 +3556,6 @@ fi ISUNIX="false" ISWINDOWS="false" ISMACOSX="false" -ISOS2="false" case "$host" in *-*-cygwin* | *-*-mingw*) @@ -3658,12 +3656,6 @@ fi MATHLIB="" SYS_GL_LIBS="" ;; - *-*-os2*) - ISOS2="true" - EXE=".exe" - MATHLIB="" - SYS_GL_LIBS="" - ;; *) ISUNIX="true" EXE="" @@ -3718,7 +3710,6 @@ esac - SDL_VERSION=3.0.0 diff --git a/test/configure.ac b/test/configure.ac index 60b60ada1..b096d7330 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -18,7 +18,6 @@ dnl (Haiku, for example, sets none of these.) ISUNIX="false" ISWINDOWS="false" ISMACOSX="false" -ISOS2="false" dnl Figure out which math library to use case "$host" in @@ -76,12 +75,6 @@ case "$host" in MATHLIB="" SYS_GL_LIBS="" ;; - *-*-os2*) - ISOS2="true" - EXE=".exe" - MATHLIB="" - SYS_GL_LIBS="" - ;; *) dnl Oh well, call it Unix... ISUNIX="true" @@ -97,7 +90,6 @@ AC_SUBST(MATHLIB) AC_SUBST(ISMACOSX) AC_SUBST(ISWINDOWS) AC_SUBST(ISUNIX) -AC_SUBST(ISOS2) dnl Check for SDL SDL_VERSION=3.0.0 diff --git a/test/testnative.c b/test/testnative.c index e115089d5..75ed9808c 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -32,9 +32,6 @@ static NativeWindowFactory *factories[] = { #endif #ifdef TEST_NATIVE_COCOA &CocoaWindowFactory, -#endif -#ifdef TEST_NATIVE_OS2 - &OS2WindowFactory, #endif NULL }; diff --git a/test/testnative.h b/test/testnative.h index 694f46ec8..528194927 100644 --- a/test/testnative.h +++ b/test/testnative.h @@ -13,7 +13,6 @@ /* Definitions for platform dependent windowing functions to test SDL integration with native windows */ - #include "SDL.h" /* This header includes all the necessary system headers for native windows */ @@ -44,8 +43,3 @@ extern NativeWindowFactory X11WindowFactory; #define TEST_NATIVE_COCOA extern NativeWindowFactory CocoaWindowFactory; #endif - -#ifdef SDL_VIDEO_DRIVER_OS2 -#define TEST_NATIVE_OS2 -extern NativeWindowFactory OS2WindowFactory; -#endif diff --git a/test/testnativeos2.c b/test/testnativeos2.c deleted file mode 100644 index 6998fa614..000000000 --- a/test/testnativeos2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 1997-2022 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. -*/ - -#include "testnative.h" - -#ifdef TEST_NATIVE_OS2 - -#define WIN_CLIENT_CLASS "SDL Test" - -static void *CreateWindowNative(int w, int h); -static void DestroyWindowNative(void *window); - -NativeWindowFactory OS2WindowFactory = { - "DIVE", - CreateWindowNative, - DestroyWindowNative -}; - -static void *CreateWindowNative(int w, int h) -{ - HWND hwnd, hwndFrame; - ULONG ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR | - FCF_SYSMENU | FCF_SHELLPOSITION | - FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON; - - WinRegisterClass(0, WIN_CLIENT_CLASS, WinDefWindowProc, - CS_SIZEREDRAW | CS_MOVENOTIFY, - sizeof(ULONG)); /* We should have minimum 4 bytes. */ - - hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags, - WIN_CLIENT_CLASS, "SDL Test", 0, 0, 1, &hwnd); - if (hwndFrame == NULLHANDLE) { - return NULL; - } - - WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, w, h, - SWP_ZORDER | SWP_ACTIVATE | SWP_SIZE | SWP_SHOW); - - return (void *)hwndFrame; /* We may return client or frame window - handle for SDL_CreateWindowFrom(). */ -} - -static void DestroyWindowNative(void *window) -{ - WinDestroyWindow((HWND) window); -} - -#endif /* TEST_NATIVE_OS2 */ diff --git a/test/watcom.mif b/test/watcom.mif deleted file mode 100644 index 6d0d9d405..000000000 --- a/test/watcom.mif +++ /dev/null @@ -1,122 +0,0 @@ -INCPATH+= -I"../include" -LIBPATH = .. -LIBS = SDL3.lib SDL3test.lib testutils.lib - -#CFLAGS+= -DHAVE_SDL_TTF -#TTFLIBS = SDL3ttf.lib - -CFLAGS+= $(INCPATH) - -TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe & - testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe & - testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe & - testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe & - testintersections.exe testjoystick.exe testkeys.exe testloadso.exe & - testlock.exe testmessage.exe testoverlay2.exe testplatform.exe & - testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe & - testrendertarget.exe testrumble.exe testscale.exe testsem.exe & - testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe & - teststreaming.exe testthread.exe testtimer.exe testver.exe & - testviewport.exe testwm2.exe torturethread.exe checkkeys.exe & - checkkeysthreads.exe testmouse.exe testgles.exe testgles2.exe & - controllermap.exe testhaptic.exe testqsort.exe testresample.exe & - testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe & - testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe & - testautomation.exe testaudiohotplug.exe testcustomcursor.exe testmultiaudio.exe & - testoffscreen.exe testurl.exe - -noninteractive = & - testatomic.exe & - testerror.exe & - testfilesystem.exe & - testkeys.exe & - testlocale.exe & - testplatform.exe & - testpower.exe & - testqsort.exe & - testthread.exe & - testtimer.exe & - testver.exe - -needs_audio = & - testaudioinfo.exe & - testsurround.exe - -needs_display = & - testbounds.exe & - testdisplayinfo.exe - -TESTS = $(noninteractive) $(needs_audio) $(needs_display) - -# testautomation sources -TASRCS = testautomation.c & - testautomation_audio.c testautomation_clipboard.c & - testautomation_events.c testautomation_guid.c & - testautomation_hints.c testautomation_joystick.c & - testautomation_keyboard.c testautomation_main.c & - testautomation_math.c testautomation_mouse.c & - testautomation_pixels.c testautomation_platform.c & - testautomation_rect.c testautomation_render.c & - testautomation_rwops.c testautomation_sdltest.c & - testautomation_stdlib.c testautomation_surface.c & - testautomation_syswm.c testautomation_timer.c & - testautomation_video.c - -OBJS = $(TARGETS:.exe=.obj) -COBJS = $(CSRCS:.c=.obj) -TAOBJS = $(TASRCS:.c=.obj) -TNOBJS = $(TNSRCS:.c=.obj) - -all: testutils.lib $(TARGETS) - -.c: ../src/test - -.obj.exe: - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -.c.obj: - wcc386 $(CFLAGS) -fo=$^@ $< - -# specials -testvulkan.obj: testvulkan.c - # new vulkan headers result in lots of W202 warnings - wcc386 $(CFLAGS) -wcd=202 -fo=$^@ $< - -testautomation.exe: $(TAOBJS) - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testnative.exe: $(TNOBJS) - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testyuv.exe: testyuv.obj testyuv_cvt.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testshader.exe: testshader.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(GLLIBS)} op q op el file {$<} name $@ - -testime.exe: testime.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ - -testutils.lib: testutils.obj - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $< - -check: .SYMBOLIC $(TESTS) - @set SDL_AUDIODRIVER=dummy - @set SDL_VIDEODRIVER=dummy - @copy "../SDL3.dll" . - @for %exe in ($(TESTS)) do %exe - -check-quick: .SYMBOLIC $(TESTS) - @set SDL_TESTS_QUICK=1 - @set SDL_AUDIODRIVER=dummy - @set SDL_VIDEODRIVER=dummy - @copy "../SDL3.dll" . - @for %exe in ($(TESTS)) do %exe - -clean: .SYMBOLIC - rm -f *.obj *.err -distclean: .SYMBOLIC clean - rm -f *.exe *.lib From ed8637f437d5b52fd1d62669279f382fe2879683 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 22 Nov 2022 08:28:56 -0800 Subject: [PATCH 415/459] Fixed typo --- include/SDL_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_version.h b/include/SDL_version.h index 6b6c59ba2..81b521cda 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -102,7 +102,7 @@ typedef struct SDL_version * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - (SDL_COMPILEDVERSION >= SDL_VERSIONUM(X, Y, Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /** * Get the version of SDL that is linked against your program. From 68b30d24e0d4581f7e61c0b1dc8bc6e8b0594d01 Mon Sep 17 00:00:00 2001 From: pionere Date: Tue, 22 Nov 2022 10:48:23 +0100 Subject: [PATCH 416/459] cmake: get rid of the duplicated _USE_MATH_DEFINES - define _USE_MATH_DEFINES in SDL_stdinc.h only - define _USE_MATH_DEFINES if not defined already --- CMakeLists.txt | 1 - include/SDL_stdinc.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 702d0c433..c1bcefd3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -999,7 +999,6 @@ if(SDL_LIBC) endforeach() set(HAVE_ALLOCA 1) check_symbol_exists(M_PI math.h HAVE_M_PI) - target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI set(STDC_HEADERS 1) else() set(HAVE_LIBC TRUE) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 70dba7db6..401515211 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -80,7 +80,7 @@ # include #endif #ifdef HAVE_MATH_H -# if defined(_MSC_VER) +# if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. From 05e2c8f2ce020c9c891f21e245a6607360fe5c75 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Tue, 22 Nov 2022 12:12:17 +0000 Subject: [PATCH 417/459] Update README-riscos.md to reflect that atomic functions have been fixed --- docs/README-riscos.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README-riscos.md b/docs/README-riscos.md index f7ddb2e20..4c31b5cf7 100644 --- a/docs/README-riscos.md +++ b/docs/README-riscos.md @@ -16,16 +16,18 @@ Currently, SDL for RISC OS only supports compiling with GCCSDK under Linux. Both The following commands can be used to build SDL for RISC OS using autoconf: - ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics + ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV make make install The following commands can be used to build SDL for RISC OS using CMake: - cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF + cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release cmake --build build-riscos cmake --build build-riscos --target install +When using GCCSDK 4.7.4 release 6 or earlier versions, the builtin atomic functions are broken, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake. Newer versions of GCCSDK don't have this problem. + Current level of implementation ------------------------------- @@ -36,6 +38,4 @@ The filesystem APIs return either Unix-style paths or RISC OS-style paths based The audio, loadso, thread and timer APIs are currently provided by UnixLib. -GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake. - The joystick, locale and power APIs are not yet implemented. From cdb54ad21e5eeaf271ad01c74a888c44841199e7 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 22 Nov 2022 19:51:56 +0300 Subject: [PATCH 418/459] removed arts, esd, fusionsound, nas, paudio, sndio, sunaudio, winmm audio backends. --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 37 +- acinclude/esd.m4 | 173 ----- cmake/sdlchecks.cmake | 180 ----- configure | 1074 --------------------------- configure.ac | 284 ------- include/SDL_config.h.cmake | 15 - include/SDL_config.h.in | 15 - src/audio/SDL_audio.c | 27 - src/audio/SDL_sysaudio.h | 8 - src/audio/arts/SDL_artsaudio.c | 357 --------- src/audio/arts/SDL_artsaudio.h | 53 -- src/audio/esd/SDL_esdaudio.c | 335 --------- src/audio/esd/SDL_esdaudio.h | 51 -- src/audio/fusionsound/SDL_fsaudio.c | 317 -------- src/audio/fusionsound/SDL_fsaudio.h | 50 -- src/audio/nas/SDL_nasaudio.c | 461 ------------ src/audio/nas/SDL_nasaudio.h | 56 -- src/audio/paudio/SDL_paudio.c | 494 ------------ src/audio/paudio/SDL_paudio.h | 48 -- src/audio/sndio/SDL_sndioaudio.c | 387 ---------- src/audio/sndio/SDL_sndioaudio.h | 49 -- src/audio/sun/SDL_sunaudio.c | 420 ----------- src/audio/sun/SDL_sunaudio.h | 47 -- src/audio/winmm/SDL_winmm.c | 459 ------------ src/audio/winmm/SDL_winmm.h | 45 -- 26 files changed, 2 insertions(+), 5442 deletions(-) delete mode 100644 acinclude/esd.m4 delete mode 100644 src/audio/arts/SDL_artsaudio.c delete mode 100644 src/audio/arts/SDL_artsaudio.h delete mode 100644 src/audio/esd/SDL_esdaudio.c delete mode 100644 src/audio/esd/SDL_esdaudio.h delete mode 100644 src/audio/fusionsound/SDL_fsaudio.c delete mode 100644 src/audio/fusionsound/SDL_fsaudio.h delete mode 100644 src/audio/nas/SDL_nasaudio.c delete mode 100644 src/audio/nas/SDL_nasaudio.h delete mode 100644 src/audio/paudio/SDL_paudio.c delete mode 100644 src/audio/paudio/SDL_paudio.h delete mode 100644 src/audio/sndio/SDL_sndioaudio.c delete mode 100644 src/audio/sndio/SDL_sndioaudio.h delete mode 100644 src/audio/sun/SDL_sunaudio.c delete mode 100644 src/audio/sun/SDL_sunaudio.h delete mode 100644 src/audio/winmm/SDL_winmm.c delete mode 100644 src/audio/winmm/SDL_winmm.h diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 250f8905c..43309172a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: sudo apt-get update sudo apt-get install build-essential git make autoconf automake libtool \ pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ - libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \ + libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \ libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \ libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index c1bcefd3f..260ab3aa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,22 +460,10 @@ dep_option(SDL_PTHREADS_SEM "Use pthread semaphores" ON "SDL_PTHREADS" OF dep_option(SDL_OSS "Support the OSS audio API" ON "UNIX_SYS OR RISCOS" OFF) set_option(SDL_ALSA "Support the ALSA audio API" ${UNIX_SYS}) dep_option(SDL_ALSA_SHARED "Dynamically load ALSA audio support" ON "SDL_ALSA" OFF) -set_option(SDL_JACK "Support the JACK audio API" ${UNIX_SYS}) -dep_option(SDL_JACK_SHARED "Dynamically load JACK audio support" ON "SDL_JACK" OFF) -set_option(SDL_ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) -dep_option(SDL_ESD_SHARED "Dynamically load ESD audio support" ON "SDL_ESD" OFF) set_option(SDL_PIPEWIRE "Use Pipewire audio" ${UNIX_SYS}) dep_option(SDL_PIPEWIRE_SHARED "Dynamically load Pipewire support" ON "SDL_PIPEWIRE" OFF) set_option(SDL_PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) dep_option(SDL_PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "SDL_PULSEAUDIO" OFF) -set_option(SDL_ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS}) -dep_option(SDL_ARTS_SHARED "Dynamically load aRts audio support" ON "SDL_ARTS" OFF) -set_option(SDL_NAS "Support the NAS audio API" ${UNIX_SYS}) -dep_option(SDL_NAS_SHARED "Dynamically load NAS audio support" ON "SDL_NAS" OFF) -set_option(SDL_SNDIO "Support the sndio audio API" ${UNIX_SYS}) -dep_option(SDL_SNDIO_SHARED "Dynamically load the sndio audio API" ON "SDL_SNDIO" OFF) -set_option(SDL_FUSIONSOUND "Use FusionSound audio driver" OFF) -dep_option(SDL_FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "SDL_FUSIONSOUND" OFF) set_option(SDL_LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) dep_option(SDL_LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "SDL_LIBSAMPLERATE" OFF) set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) @@ -1405,32 +1393,16 @@ elseif(EMSCRIPTEN) elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) - if(SYSV5 OR SOLARIS OR HPUX) - set(SDL_AUDIO_DRIVER_SUNAUDIO 1) - file(GLOB SUN_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sun/*.c) - list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - elseif(NETBSD) + if(NETBSD) set(SDL_AUDIO_DRIVER_NETBSD 1) file(GLOB NETBSD_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/netbsd/*.c) list(APPEND SOURCE_FILES ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) - elseif(AIX) - set(SDL_AUDIO_DRIVER_PAUDIO 1) - file(GLOB AIX_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/paudio/*.c) - list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) endif() CheckOSS() CheckALSA() - CheckJACK() CheckPipewire() CheckPulseAudio() - CheckESD() - CheckARTS() - CheckNAS() - CheckSNDIO() - CheckFusionSound() endif() if(SDL_VIDEO) @@ -1790,13 +1762,6 @@ elseif(WINDOWS) check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H) if(SDL_AUDIO) - if(NOT WINDOWS_STORE) - set(SDL_AUDIO_DRIVER_WINMM 1) - file(GLOB WINMM_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/winmm/*.c) - list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - endif() - if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_DSOUND 1) file(GLOB DSOUND_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/directsound/*.c) diff --git a/acinclude/esd.m4 b/acinclude/esd.m4 deleted file mode 100644 index bd4b84849..000000000 --- a/acinclude/esd.m4 +++ /dev/null @@ -1,173 +0,0 @@ -# Configure paths for ESD -# Manish Singh 98-9-30 -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS -dnl -AC_DEFUN([AM_PATH_ESD], -[dnl -dnl Get the cflags and libraries from the esd-config script -dnl -AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], - esd_prefix="$withval", esd_prefix="") -AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], - esd_exec_prefix="$withval", esd_exec_prefix="") -AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], - , enable_esdtest=yes) - - if test x$esd_exec_prefix != x ; then - esd_args="$esd_args --exec-prefix=$esd_exec_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_exec_prefix/bin/esd-config - fi - fi - if test x$esd_prefix != x ; then - esd_args="$esd_args --prefix=$esd_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_prefix/bin/esd-config - fi - fi - - AC_PATH_PROG(ESD_CONFIG, esd-config, no) - min_esd_version=ifelse([$1], ,0.2.7,$1) - AC_MSG_CHECKING(for ESD - version >= $min_esd_version) - no_esd="" - if test "$ESD_CONFIG" = "no" ; then - no_esd=yes - else - ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` - ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` - - esd_major_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - esd_minor_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_esdtest" = "xyes" ; then - AC_LANG_PUSH([C]) - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" -dnl -dnl Now check if the installed ESD is sufficiently new. (Also sanity -dnl checks the results of esd-config to some extent -dnl - rm -f conf.esdtest - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include - -int main (void) -{ - int major, minor, micro; - FILE *fp = fopen("conf.esdtest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_esd_version"); - exit(1); - } - - if (($esd_major_version > major) || - (($esd_major_version == major) && ($esd_minor_version > minor)) || - (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); - printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); - printf("*** to point to the correct copy of esd-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} -]])], [], [no_esd=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - AC_LANG_POP([C]) - fi - fi - if test "x$no_esd" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$ESD_CONFIG" = "no" ; then -dnl echo "*** The esd-config script installed by ESD could not be found" -dnl echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" -dnl echo "*** your path, or set the ESD_CONFIG environment variable to the" -dnl echo "*** full path to esd-config." - : - else - if test -f conf.esdtest ; then - : - else - echo "*** Could not run ESD test program, checking why..." - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - AC_LANG_PUSH([C]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], [[ return 0; ]])], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding ESD or finding the wrong" - echo "*** version of ESD. If it is not finding ESD, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means ESD was incorrectly installed" - echo "*** or that you have moved ESD since it was installed. In the latter case, you" - echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - AC_LANG_POP([C]) - fi - fi - ESD_CFLAGS="" - ESD_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(ESD_CFLAGS) - AC_SUBST(ESD_LIBS) - rm -f conf.esdtest -]) - -dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]]) -dnl Test, whether esd supports multiple recording clients (version >=0.2.21) -dnl -AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD], -[dnl - AC_MSG_NOTICE([whether installed esd version supports multiple recording clients]) - ac_save_ESD_CFLAGS="$ESD_CFLAGS" - ac_save_ESD_LIBS="$ESD_LIBS" - AM_PATH_ESD(0.2.21, - ifelse([$1], , [ - AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true) - AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1, - [Define if you have esound with support of multiple recording clients.])], - [$1]), - ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2]) - if test "x$ac_save_ESD_CFLAGS" != x ; then - ESD_CFLAGS="$ac_save_ESD_CFLAGS" - fi - if test "x$ac_save_ESD_LIBS" != x ; then - ESD_LIBS="$ac_save_ESD_LIBS" - fi - ) -]) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index b65d63aab..553d67092 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -165,186 +165,6 @@ macro(CheckPulseAudio) endif() endmacro() -# Requires: -# - PkgCheckModules -# Optional: -# - SDL_JACK_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckJACK) - if(SDL_JACK) - pkg_check_modules(PKG_JACK jack) - if(PKG_JACK_FOUND) - set(HAVE_JACK TRUE) - file(GLOB JACK_SOURCES ${SDL3_SOURCE_DIR}/src/audio/jack/*.c) - list(APPEND SOURCE_FILES ${JACK_SOURCES}) - set(SDL_AUDIO_DRIVER_JACK 1) - list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) - if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") - endif() - FindLibraryAndSONAME("jack" LIBDIRS ${PKG_JACK_LIBRARY_DIRS}) - if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") - set(HAVE_JACK_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_JACK_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - PkgCheckModules -# Optional: -# - SDL_ESD_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckESD) - if(SDL_ESD) - pkg_check_modules(PKG_ESD esound) - if(PKG_ESD_FOUND) - set(HAVE_ESD TRUE) - file(GLOB ESD_SOURCES ${SDL3_SOURCE_DIR}/src/audio/esd/*.c) - list(APPEND SOURCE_FILES ${ESD_SOURCES}) - set(SDL_AUDIO_DRIVER_ESD 1) - list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) - if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") - endif() - FindLibraryAndSONAME(esd LIBDIRS ${PKG_ESD_LIBRARY_DIRS}) - if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") - set(HAVE_ESD_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - n/a -# Optional: -# - SDL_ARTS_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckARTS) - if(SDL_ARTS) - find_program(ARTS_CONFIG arts-config) - if(ARTS_CONFIG) - execute_process(CMD_ARTSCFLAGS ${ARTS_CONFIG} --cflags - OUTPUT_VARIABLE ARTS_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) - list(APPEND EXTRA_CFLAGS ${ARTS_CFLAGS}) - execute_process(CMD_ARTSLIBS ${ARTS_CONFIG} --libs - OUTPUT_VARIABLE ARTS_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) - file(GLOB ARTS_SOURCES ${SDL3_SOURCE_DIR}/src/audio/arts/*.c) - list(APPEND SOURCE_FILES ${ARTS_SOURCES}) - set(SDL_AUDIO_DRIVER_ARTS 1) - set(HAVE_ARTS TRUE) - if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading") - endif() - FindLibraryAndSONAME(artsc) - if(SDL_ARTS_SHARED AND ARTSC_LIB AND HAVE_SDL_LOADSO) - # TODO - set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") - set(HAVE_ARTS_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - n/a -# Optional: -# - SDL_NAS_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckNAS) - if(SDL_NAS) - # TODO: set include paths properly, so the NAS headers are found - check_include_file(audio/audiolib.h HAVE_NAS_H) - find_library(D_NAS_LIB audio) - if(HAVE_NAS_H AND D_NAS_LIB) - set(HAVE_NAS TRUE) - file(GLOB NAS_SOURCES ${SDL3_SOURCE_DIR}/src/audio/nas/*.c) - list(APPEND SOURCE_FILES ${NAS_SOURCES}) - set(SDL_AUDIO_DRIVER_NAS 1) - if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic NAS loading") - endif() - FindLibraryAndSONAME("audio") - if(SDL_NAS_SHARED AND AUDIO_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"") - set(HAVE_NAS_SHARED TRUE) - else() - list(APPEND EXTRA_LIBS ${D_NAS_LIB}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - PkgCheckModules -# Optional: -# - SDL_SNDIO_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckSNDIO) - if(SDL_SNDIO) - pkg_check_modules(PKG_SNDIO sndio) - if(PKG_SNDIO_FOUND) - set(HAVE_SNDIO TRUE) - file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c) - list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) - set(SDL_AUDIO_DRIVER_SNDIO 1) - list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS}) - if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") - endif() - FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS}) - if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") - set(HAVE_SNDIO_SHARED TRUE) - else() - list(APPEND EXTRA_LIBS ${PKG_SNDIO_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - PkgCheckModules -# Optional: -# - FUSIONSOUND_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckFusionSound) - if(FUSIONSOUND) - pkg_check_modules(PKG_FUSIONSOUND fusionsound>=1.0.0) - if(PKG_FUSIONSOUND_FOUND) - set(HAVE_FUSIONSOUND TRUE) - file(GLOB FUSIONSOUND_SOURCES ${SDL3_SOURCE_DIR}/src/audio/fusionsound/*.c) - list(APPEND SOURCE_FILES ${FUSIONSOUND_SOURCES}) - set(SDL_AUDIO_DRIVER_FUSIONSOUND 1) - list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS}) - if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading") - endif() - FindLibraryAndSONAME("fusionsound" LIBDIRS ${PKG_FUSIONSOUND_LIBRARY_DIRS}) - if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") - set(HAVE_FUSIONSOUND_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - # Requires: # - SDL_LIBSAMPLERATE # Optional: diff --git a/configure b/configure index 79763cbba..a641003f7 100755 --- a/configure +++ b/configure @@ -706,20 +706,10 @@ RPI_LIBS RPI_CFLAGS DECOR_LIBS DECOR_CFLAGS -FUSIONSOUND_LIBS -FUSIONSOUND_CFLAGS -SNDIO_LIBS -SNDIO_CFLAGS -ARTSCONFIG PULSEAUDIO_LIBS PULSEAUDIO_CFLAGS PIPEWIRE_LIBS PIPEWIRE_CFLAGS -ESD_CONFIG -ESD_LIBS -ESD_CFLAGS -JACK_LIBS -JACK_CFLAGS ALSA_LIBS ALSA_CFLAGS ALLOCA @@ -878,25 +868,10 @@ with_alsa_prefix with_alsa_inc_prefix enable_alsatest enable_alsa_shared -enable_jack -enable_jack_shared -enable_esd -with_esd_prefix -with_esd_exec_prefix -enable_esdtest -enable_esd_shared enable_pipewire enable_pipewire_shared enable_pulseaudio enable_pulseaudio_shared -enable_arts -enable_arts_shared -enable_nas -enable_nas_shared -enable_sndio -enable_sndio_shared -enable_fusionsound -enable_fusionsound_shared enable_diskaudio enable_dummyaudio enable_libsamplerate @@ -974,18 +949,10 @@ PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR CPP -JACK_CFLAGS -JACK_LIBS -ESD_CFLAGS -ESD_LIBS PIPEWIRE_CFLAGS PIPEWIRE_LIBS PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS -SNDIO_CFLAGS -SNDIO_LIBS -FUSIONSOUND_CFLAGS -FUSIONSOUND_LIBS DECOR_CFLAGS DECOR_LIBS RPI_CFLAGS @@ -1676,28 +1643,12 @@ Optional Features: --enable-alsa support the ALSA audio API [default=yes] --disable-alsatest Do not try to compile and run a test Alsa program --enable-alsa-shared dynamically load ALSA audio support [default=yes] - --enable-jack use JACK audio [default=yes] - --enable-jack-shared dynamically load JACK audio support [default=yes] - --enable-esd support the Enlightened Sound Daemon [default=yes] - --disable-esdtest Do not try to compile and run a test ESD program - --enable-esd-shared dynamically load ESD audio support [default=yes] --enable-pipewire use Pipewire audio [default=yes] --enable-pipewire-shared dynamically load Pipewire support [default=yes] --enable-pulseaudio use PulseAudio [default=yes] --enable-pulseaudio-shared dynamically load PulseAudio support [default=yes] - --enable-arts support the Analog Real Time Synthesizer - [default=yes] - --enable-arts-shared dynamically load aRts audio support [default=yes] - --enable-nas support the NAS audio API [default=yes] - --enable-nas-shared dynamically load NAS audio support [default=yes] - --enable-sndio support the sndio audio API [default=yes] - --enable-sndio-shared dynamically load sndio audio support [default=yes] - --enable-fusionsound use FusionSound audio driver [default=no] - --enable-fusionsound-shared - dynamically load fusionsound audio support - [default=yes] --enable-diskaudio support the disk writer audio driver [default=yes] --enable-dummyaudio support the dummy audio driver [default=yes] --enable-libsamplerate use libsamplerate for audio rate conversion @@ -1799,8 +1750,6 @@ Optional Packages: compiler's sysroot if not specified). --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional) --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional) - --with-esd-prefix=PFX Prefix where ESD is installed (optional) - --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional) --with-x use the X Window System Some influential environment variables: @@ -1822,10 +1771,6 @@ Some influential environment variables: PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path CPP C preprocessor - JACK_CFLAGS C compiler flags for JACK, overriding pkg-config - JACK_LIBS linker flags for JACK, overriding pkg-config - ESD_CFLAGS C compiler flags for ESD, overriding pkg-config - ESD_LIBS linker flags for ESD, overriding pkg-config PIPEWIRE_CFLAGS C compiler flags for PIPEWIRE, overriding pkg-config PIPEWIRE_LIBS @@ -1834,13 +1779,6 @@ Some influential environment variables: C compiler flags for PULSEAUDIO, overriding pkg-config PULSEAUDIO_LIBS linker flags for PULSEAUDIO, overriding pkg-config - SNDIO_CFLAGS - C compiler flags for SNDIO, overriding pkg-config - SNDIO_LIBS linker flags for SNDIO, overriding pkg-config - FUSIONSOUND_CFLAGS - C compiler flags for FUSIONSOUND, overriding pkg-config - FUSIONSOUND_LIBS - linker flags for FUSIONSOUND, overriding pkg-config DECOR_CFLAGS C compiler flags for DECOR, overriding pkg-config DECOR_LIBS linker flags for DECOR, overriding pkg-config @@ -21326,504 +21264,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC \"$alsa_lib\"" >>confdefs.h fi } -CheckJACK() -{ - # Check whether --enable-jack was given. -if test ${enable_jack+y} -then : - enableval=$enable_jack; -else $as_nop - enable_jack=yes -fi - - if test x$enable_audio = xyes -a x$enable_jack = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.125" >&5 -printf %s "checking for jack >= 0.125... " >&6; } - -if test -n "$JACK_CFLAGS"; then - pkg_cv_JACK_CFLAGS="$JACK_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 - ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_JACK_CFLAGS=`$PKG_CONFIG --cflags "jack >= 0.125" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$JACK_LIBS"; then - pkg_cv_JACK_LIBS="$JACK_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 - ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_JACK_LIBS=`$PKG_CONFIG --libs "jack >= 0.125" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - JACK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jack >= 0.125" 2>&1` - else - JACK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jack >= 0.125" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$JACK_PKG_ERRORS" >&5 - - audio_jack=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - audio_jack=no -else - JACK_CFLAGS=$pkg_cv_JACK_CFLAGS - JACK_LIBS=$pkg_cv_JACK_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - audio_jack=yes -fi - - if test x$audio_jack = xyes; then - # Check whether --enable-jack-shared was given. -if test ${enable_jack_shared+y} -then : - enableval=$enable_jack_shared; -else $as_nop - enable_jack_shared=yes -fi - - jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_jack_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_jack_shared = xyes && test x$jack_lib != x; then - echo "-- dynamic libjack -> $jack_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK_DYNAMIC \"$jack_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" - - case "$host" in - # On Solaris, jack must be linked deferred explicitly - # to prevent undefined symbol failures. - *-*-solaris*) - JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" - esac - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" - SUMMARY_audio="${SUMMARY_audio} jack" - fi - have_audio=yes - fi - fi -} - -CheckESD() -{ - # Check whether --enable-esd was given. -if test ${enable_esd+y} -then : - enableval=$enable_esd; -else $as_nop - enable_esd=yes -fi - - if test x$enable_audio = xyes -a x$enable_esd = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for esound >= 0.2.8" >&5 -printf %s "checking for esound >= 0.2.8... " >&6; } - -if test -n "$ESD_CFLAGS"; then - pkg_cv_ESD_CFLAGS="$ESD_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"esound >= 0.2.8\""; } >&5 - ($PKG_CONFIG --exists --print-errors "esound >= 0.2.8") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_ESD_CFLAGS=`$PKG_CONFIG --cflags "esound >= 0.2.8" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$ESD_LIBS"; then - pkg_cv_ESD_LIBS="$ESD_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"esound >= 0.2.8\""; } >&5 - ($PKG_CONFIG --exists --print-errors "esound >= 0.2.8") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_ESD_LIBS=`$PKG_CONFIG --libs "esound >= 0.2.8" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - ESD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "esound >= 0.2.8" 2>&1` - else - ESD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "esound >= 0.2.8" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$ESD_PKG_ERRORS" >&5 - - have_esd=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - have_esd=no -else - ESD_CFLAGS=$pkg_cv_ESD_CFLAGS - ESD_LIBS=$pkg_cv_ESD_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - have_esd=yes -fi - if test x$have_esd = xno; then - -# Check whether --with-esd-prefix was given. -if test ${with_esd_prefix+y} -then : - withval=$with_esd_prefix; esd_prefix="$withval" -else $as_nop - esd_prefix="" -fi - - -# Check whether --with-esd-exec-prefix was given. -if test ${with_esd_exec_prefix+y} -then : - withval=$with_esd_exec_prefix; esd_exec_prefix="$withval" -else $as_nop - esd_exec_prefix="" -fi - -# Check whether --enable-esdtest was given. -if test ${enable_esdtest+y} -then : - enableval=$enable_esdtest; -else $as_nop - enable_esdtest=yes -fi - - - if test x$esd_exec_prefix != x ; then - esd_args="$esd_args --exec-prefix=$esd_exec_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_exec_prefix/bin/esd-config - fi - fi - if test x$esd_prefix != x ; then - esd_args="$esd_args --prefix=$esd_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_prefix/bin/esd-config - fi - fi - - # Extract the first word of "esd-config", so it can be a program name with args. -set dummy esd-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ESD_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $ESD_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ESD_CONFIG="$ESD_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ESD_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_ESD_CONFIG" && ac_cv_path_ESD_CONFIG="no" - ;; -esac -fi -ESD_CONFIG=$ac_cv_path_ESD_CONFIG -if test -n "$ESD_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 -printf "%s\n" "$ESD_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - min_esd_version=0.2.8 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 -printf %s "checking for ESD - version >= $min_esd_version... " >&6; } - no_esd="" - if test "$ESD_CONFIG" = "no" ; then - no_esd=yes - else - ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` - ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` - - esd_major_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - esd_minor_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_esdtest" = "xyes" ; then - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - rm -f conf.esdtest - if test "$cross_compiling" = yes -then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int main (void) -{ - int major, minor, micro; - FILE *fp = fopen("conf.esdtest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_esd_version"); - exit(1); - } - - if (($esd_major_version > major) || - (($esd_major_version == major) && ($esd_minor_version > minor)) || - (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); - printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); - printf("*** to point to the correct copy of esd-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - -else $as_nop - no_esd=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - fi - fi - if test "x$no_esd" = x ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - have_esd=yes - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - if test "$ESD_CONFIG" = "no" ; then - : - else - if test -f conf.esdtest ; then - : - else - echo "*** Could not run ESD test program, checking why..." - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main (void) -{ - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding ESD or finding the wrong" - echo "*** version of ESD. If it is not finding ESD, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else $as_nop - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means ESD was incorrectly installed" - echo "*** or that you have moved ESD since it was installed. In the latter case, you" - echo "*** may want to edit the esd-config script: $ESD_CONFIG" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - fi - fi - ESD_CFLAGS="" - ESD_LIBS="" - have_esd=no - fi - - - rm -f conf.esdtest - - fi - if test x$have_esd = xyes; then - # Check whether --enable-esd-shared was given. -if test ${enable_esd_shared+y} -then : - enableval=$enable_esd_shared; -else $as_nop - enable_esd_shared=yes -fi - - esd_lib=`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_esd_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_esd_shared = xyes && test x$esd_lib != x; then - echo "-- dynamic libesd -> $esd_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD_DYNAMIC \"$esd_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" - SUMMARY_audio="${SUMMARY_audio} esd" - fi - have_audio=yes - fi - fi -} - CheckPipewire() { # Check whether --enable-pipewire was given. @@ -22072,493 +21512,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" fi } -CheckARTSC() -{ - # Check whether --enable-arts was given. -if test ${enable_arts+y} -then : - enableval=$enable_arts; -else $as_nop - enable_arts=yes -fi - - if test x$enable_audio = xyes -a x$enable_arts = xyes; then - # Extract the first word of "artsc-config", so it can be a program name with args. -set dummy artsc-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ARTSCONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $ARTSCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ARTSCONFIG="$ARTSCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ARTSCONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ARTSCONFIG=$ac_cv_path_ARTSCONFIG -if test -n "$ARTSCONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 -printf "%s\n" "$ARTSCONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then - : # arts isn't installed - else - ARTS_CFLAGS=`$ARTSCONFIG --cflags` - ARTS_LIBS=`$ARTSCONFIG --libs` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 -printf %s "checking for aRts development environment... " >&6; } - audio_arts=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTS_CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main (void) -{ - - arts_stream_t stream; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - audio_arts=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS="$save_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 -printf "%s\n" "$audio_arts" >&6; } - if test x$audio_arts = xyes; then - # Check whether --enable-arts-shared was given. -if test ${enable_arts_shared+y} -then : - enableval=$enable_arts_shared; -else $as_nop - enable_arts_shared=yes -fi - - arts_lib=`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_arts_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_arts_shared = xyes && test x$arts_lib != x; then - echo "-- dynamic libartsc -> $arts_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC \"$arts_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" - SUMMARY_audio="${SUMMARY_audio} arts" - fi - have_audio=yes - fi - fi - fi -} - -CheckNAS() -{ - # Check whether --enable-nas was given. -if test ${enable_nas+y} -then : - enableval=$enable_nas; -else $as_nop - enable_nas=yes -fi - - if test x$enable_audio = xyes -a x$enable_nas = xyes; then - ac_fn_c_check_header_compile "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" -if test "x$ac_cv_header_audio_audiolib_h" = xyes -then : - have_nas_hdr=yes -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 -printf %s "checking for AuOpenServer in -laudio... " >&6; } -if test ${ac_cv_lib_audio_AuOpenServer+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-laudio $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char AuOpenServer (); -int -main (void) -{ -return AuOpenServer (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_audio_AuOpenServer=yes -else $as_nop - ac_cv_lib_audio_AuOpenServer=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audio_AuOpenServer" >&5 -printf "%s\n" "$ac_cv_lib_audio_AuOpenServer" >&6; } -if test "x$ac_cv_lib_audio_AuOpenServer" = xyes -then : - have_nas_lib=yes -fi - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 -printf %s "checking for NAS audio support... " >&6; } - have_nas=no - - if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then - have_nas=yes - NAS_LIBS="-laudio" - - elif test -r /usr/X11R6/include/audio/audiolib.h; then - have_nas=yes - NAS_CFLAGS="-I/usr/X11R6/include/" - NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" - - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 -printf "%s\n" "$have_nas" >&6; } - - if test x$have_nas = xyes; then - # Check whether --enable-nas-shared was given. -if test ${enable_nas_shared+y} -then : - enableval=$enable_nas_shared; -else $as_nop - enable_nas_shared=yes -fi - - nas_lib=`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - if test x$have_loadso != xyes && \ - test x$enable_nas_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_nas_shared = xyes && test x$nas_lib != x; then - echo "-- dynamic libaudio -> $nas_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS_DYNAMIC \"$nas_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" - SUMMARY_audio="${SUMMARY_audio} nas" - fi - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" - have_audio=yes - fi - fi -} - -CheckSNDIO() -{ - # Check whether --enable-sndio was given. -if test ${enable_sndio+y} -then : - enableval=$enable_sndio; -else $as_nop - enable_sndio=yes -fi - - if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio" >&5 -printf %s "checking for sndio... " >&6; } - -if test -n "$SNDIO_CFLAGS"; then - pkg_cv_SNDIO_CFLAGS="$SNDIO_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_SNDIO_CFLAGS=`$PKG_CONFIG --cflags "sndio" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$SNDIO_LIBS"; then - pkg_cv_SNDIO_LIBS="$SNDIO_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 - ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_SNDIO_LIBS=`$PKG_CONFIG --libs "sndio" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - SNDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sndio" 2>&1` - else - SNDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sndio" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$SNDIO_PKG_ERRORS" >&5 - - audio_sndio=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - audio_sndio=no -else - SNDIO_CFLAGS=$pkg_cv_SNDIO_CFLAGS - SNDIO_LIBS=$pkg_cv_SNDIO_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - audio_sndio=yes -fi - - if test x$audio_sndio = xyes; then - # Check whether --enable-sndio-shared was given. -if test ${enable_sndio_shared+y} -then : - enableval=$enable_sndio_shared; -else $as_nop - enable_sndio_shared=yes -fi - - sndio_lib=`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - if test x$have_loadso != xyes && \ - test x$enable_sndio_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then - echo "-- dynamic libsndio -> $sndio_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC \"$sndio_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS" - SUMMARY_audio="${SUMMARY_audio} sndio" - fi - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS" - have_audio=yes - fi - fi -} - -CheckFusionSound() -{ - # Check whether --enable-fusionsound was given. -if test ${enable_fusionsound+y} -then : - enableval=$enable_fusionsound; -else $as_nop - enable_fusionsound=no -fi - - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 -printf %s "checking for fusionsound >= 1.1.1... " >&6; } - -if test -n "$FUSIONSOUND_CFLAGS"; then - pkg_cv_FUSIONSOUND_CFLAGS="$FUSIONSOUND_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags "fusionsound >= 1.1.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$FUSIONSOUND_LIBS"; then - pkg_cv_FUSIONSOUND_LIBS="$FUSIONSOUND_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSIONSOUND_LIBS=`$PKG_CONFIG --libs "fusionsound >= 1.1.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fusionsound >= 1.1.1" 2>&1` - else - FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fusionsound >= 1.1.1" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$FUSIONSOUND_PKG_ERRORS" >&5 - - fusionsound=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fusionsound=no -else - FUSIONSOUND_CFLAGS=$pkg_cv_FUSIONSOUND_CFLAGS - FUSIONSOUND_LIBS=$pkg_cv_FUSIONSOUND_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - fusionsound=yes -fi - - if test x$fusionsound = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - # Check whether --enable-fusionsound-shared was given. -if test ${enable_fusionsound_shared+y} -then : - enableval=$enable_fusionsound_shared; -else $as_nop - enable_fusionsound_shared=yes -fi - - fusionsound_shared=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -printf %s "checking for FusionSound dynamic loading support... " >&6; } - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC \"libfusionsound.so\"" >>confdefs.h - - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -printf "%s\n" "$fusionsound_shared" >&6; } - - have_audio=yes - fi - fi -} - CheckDiskAudio() { # Check whether --enable-diskaudio was given. @@ -28356,12 +27309,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h CheckALSA CheckPipewire CheckPulseAudio - CheckJACK - CheckARTSC - CheckESD - CheckNAS - CheckSNDIO - CheckFusionSound CheckLibSampleRate # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! CheckRPI @@ -28414,14 +27361,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in - sysv5|solaris|hpux) - -printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" - SUMMARY_audio="${SUMMARY_audio} sun" - have_audio=yes - ;; netbsd) # Don't use this on OpenBSD, it's busted. printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h @@ -28430,14 +27369,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; - aix) - -printf "%s\n" "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" - SUMMARY_audio="${SUMMARY_audio} paudio" - have_audio=yes - ;; android) printf "%s\n" "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h @@ -28673,11 +27604,6 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_D3D12 1" >>confdefs.h fi # Set up files for the audio library if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} winmm" - SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then printf "%s\n" "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index d0bcbf16f..b92d0b8c9 100644 --- a/configure.ac +++ b/configure.ac @@ -996,88 +996,6 @@ CheckALSA() fi } -dnl Find JACK Audio -CheckJACK() -{ - AC_ARG_ENABLE(jack, -[AS_HELP_STRING([--enable-jack], [use JACK audio [default=yes]])], - , enable_jack=yes) - if test x$enable_audio = xyes -a x$enable_jack = xyes; then - PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no) - - if test x$audio_jack = xyes; then - AC_ARG_ENABLE(jack-shared, -[AS_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [default=yes]])], - , enable_jack_shared=yes) - jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_jack_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_jack_shared = xyes && test x$jack_lib != x; then - echo "-- dynamic libjack -> $jack_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" - - case "$host" in - # On Solaris, jack must be linked deferred explicitly - # to prevent undefined symbol failures. - *-*-solaris*) - JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" - esac - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" - SUMMARY_audio="${SUMMARY_audio} jack" - fi - have_audio=yes - fi - fi -} - -dnl Find the ESD includes and libraries -CheckESD() -{ - AC_ARG_ENABLE(esd, -[AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]])], - , enable_esd=yes) - if test x$enable_audio = xyes -a x$enable_esd = xyes; then - PKG_CHECK_MODULES([ESD], [esound >= 0.2.8], have_esd=yes, have_esd=no) - if test x$have_esd = xno; then - AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) - fi - if test x$have_esd = xyes; then - AC_ARG_ENABLE(esd-shared, -[AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]])], - , enable_esd_shared=yes) - esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_esd_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_esd_shared = xyes && test x$esd_lib != x; then - echo "-- dynamic libesd -> $esd_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" - SUMMARY_audio="${SUMMARY_audio} esd" - fi - have_audio=yes - fi - fi -} - dnl Find Pipewire CheckPipewire() { @@ -1158,187 +1076,6 @@ CheckPulseAudio() fi } -CheckARTSC() -{ - AC_ARG_ENABLE(arts, -[AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]])], - , enable_arts=yes) - if test x$enable_audio = xyes -a x$enable_arts = xyes; then - AC_PATH_PROG(ARTSCONFIG, artsc-config) - if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then - : # arts isn't installed - else - ARTS_CFLAGS=`$ARTSCONFIG --cflags` - ARTS_LIBS=`$ARTSCONFIG --libs` - AC_MSG_CHECKING(for aRts development environment) - audio_arts=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTS_CFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - arts_stream_t stream; - ]])], [audio_arts=yes],[]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT($audio_arts) - if test x$audio_arts = xyes; then - AC_ARG_ENABLE(arts-shared, -[AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]])], - , enable_arts_shared=yes) - arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_arts_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_arts_shared = xyes && test x$arts_lib != x; then - echo "-- dynamic libartsc -> $arts_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" - SUMMARY_audio="${SUMMARY_audio} arts" - fi - have_audio=yes - fi - fi - fi -} - -dnl See if the NAS audio interface is supported -CheckNAS() -{ - AC_ARG_ENABLE(nas, -[AS_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]])], - , enable_nas=yes) - if test x$enable_audio = xyes -a x$enable_nas = xyes; then - AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes) - AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes) - - AC_MSG_CHECKING(for NAS audio support) - have_nas=no - - if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then - have_nas=yes - NAS_LIBS="-laudio" - - elif test -r /usr/X11R6/include/audio/audiolib.h; then - have_nas=yes - NAS_CFLAGS="-I/usr/X11R6/include/" - NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" - - fi - - AC_MSG_RESULT($have_nas) - - if test x$have_nas = xyes; then - AC_ARG_ENABLE(nas-shared, -[AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [default=yes]])], - , enable_nas_shared=yes) - nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - if test x$have_loadso != xyes && \ - test x$enable_nas_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_nas_shared = xyes && test x$nas_lib != x; then - echo "-- dynamic libaudio -> $nas_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" - SUMMARY_audio="${SUMMARY_audio} nas" - fi - - AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" - have_audio=yes - fi - fi -} - -dnl See if the sndio audio interface is supported -CheckSNDIO() -{ - AC_ARG_ENABLE(sndio, -[AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])], - , enable_sndio=yes) - if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no) - - if test x$audio_sndio = xyes; then - AC_ARG_ENABLE(sndio-shared, -[AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])], - , enable_sndio_shared=yes) - sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - if test x$have_loadso != xyes && \ - test x$enable_sndio_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then - echo "-- dynamic libsndio -> $sndio_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS" - SUMMARY_audio="${SUMMARY_audio} sndio" - fi - - AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS" - have_audio=yes - fi - fi -} - -dnl Find FusionSound -CheckFusionSound() -{ - AC_ARG_ENABLE(fusionsound, -[AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [default=no]])], - , enable_fusionsound=no) - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no) - - if test x$fusionsound = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - AC_ARG_ENABLE(fusionsound-shared, -[AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [default=yes]])], - , enable_fusionsound_shared=yes) - fusionsound_shared=no - AC_MSG_CHECKING(for FusionSound dynamic loading support) - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - AC_MSG_RESULT($fusionsound_shared) - - have_audio=yes - fi - fi -} - dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { @@ -3779,12 +3516,6 @@ case "$host" in CheckALSA CheckPipewire CheckPulseAudio - CheckJACK - CheckARTSC - CheckESD - CheckNAS - CheckSNDIO - CheckFusionSound CheckLibSampleRate # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! CheckRPI @@ -3837,24 +3568,12 @@ case "$host" in # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in - sysv5|solaris|hpux) - AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" - SUMMARY_audio="${SUMMARY_audio} sun" - have_audio=yes - ;; netbsd) # Don't use this on OpenBSD, it's busted. AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; - aix) - AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" - SUMMARY_audio="${SUMMARY_audio} paudio" - have_audio=yes - ;; android) AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/android/*.c" @@ -4049,9 +3768,6 @@ case "$host" in fi # Set up files for the audio library if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ]) - SUMMARY_audio="${SUMMARY_audio} winmm" - SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) SUMMARY_audio="${SUMMARY_audio} directsound" diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 41acf1c71..0176b8a8d 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -293,35 +293,20 @@ #cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_OPENSLES @SDL_AUDIO_DRIVER_OPENSLES@ #cmakedefine SDL_AUDIO_DRIVER_AAUDIO @SDL_AUDIO_DRIVER_AAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ #cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ #cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ -#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ -#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ -#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ -#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ -#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE @SDL_AUDIO_DRIVER_PIPEWIRE@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ -#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ #cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index a4756ee7b..1c6fcbdcc 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -279,37 +279,22 @@ #undef SDL_AUDIO_DRIVER_ALSA #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_ARTS -#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC #undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_DISK #undef SDL_AUDIO_DRIVER_DSOUND #undef SDL_AUDIO_DRIVER_DUMMY #undef SDL_AUDIO_DRIVER_EMSCRIPTEN -#undef SDL_AUDIO_DRIVER_ESD -#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC #undef SDL_AUDIO_DRIVER_HAIKU -#undef SDL_AUDIO_DRIVER_JACK -#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC #undef SDL_AUDIO_DRIVER_NACL -#undef SDL_AUDIO_DRIVER_NAS -#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC #undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OPENSLES #undef SDL_AUDIO_DRIVER_OSS -#undef SDL_AUDIO_DRIVER_PAUDIO #undef SDL_AUDIO_DRIVER_PIPEWIRE #undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC #undef SDL_AUDIO_DRIVER_PULSEAUDIO #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_QSA -#undef SDL_AUDIO_DRIVER_SNDIO -#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_SUNAUDIO #undef SDL_AUDIO_DRIVER_WASAPI -#undef SDL_AUDIO_DRIVER_WINMM /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 76395f54f..f40cdd2dc 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -42,51 +42,27 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_ALSA &ALSA_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SNDIO - &SNDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_NETBSD &NETBSDAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_QSA &QSAAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SUNAUDIO - &SUNAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ARTS - &ARTS_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ESD - &ESD_bootstrap, -#endif #if SDL_AUDIO_DRIVER_NACL &NACLAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NAS - &NAS_bootstrap, -#endif #if SDL_AUDIO_DRIVER_WASAPI &WASAPI_bootstrap, #endif #if SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WINMM - &WINMM_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_PAUDIO - &PAUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_HAIKU &HAIKUAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_FUSIONSOUND - &FUSIONSOUND_bootstrap, -#endif #if SDL_AUDIO_DRIVER_AAUDIO &aaudio_bootstrap, #endif @@ -111,9 +87,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_JACK - &JACK_bootstrap, -#endif #if SDL_AUDIO_DRIVER_PIPEWIRE &PIPEWIRE_bootstrap, #endif diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index a76c5c21b..e908986e7 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -184,25 +184,17 @@ typedef struct AudioBootStrap extern AudioBootStrap PIPEWIRE_bootstrap; extern AudioBootStrap PULSEAUDIO_bootstrap; extern AudioBootStrap ALSA_bootstrap; -extern AudioBootStrap JACK_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; extern AudioBootStrap NETBSDAUDIO_bootstrap; extern AudioBootStrap DSP_bootstrap; extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; extern AudioBootStrap NACLAUDIO_bootstrap; -extern AudioBootStrap NAS_bootstrap; extern AudioBootStrap WASAPI_bootstrap; extern AudioBootStrap DSOUND_bootstrap; extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; extern AudioBootStrap HAIKUAUDIO_bootstrap; extern AudioBootStrap COREAUDIO_bootstrap; extern AudioBootStrap DISKAUDIO_bootstrap; extern AudioBootStrap DUMMYAUDIO_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; extern AudioBootStrap aaudio_bootstrap; extern AudioBootStrap openslES_bootstrap; extern AudioBootStrap ANDROIDAUDIO_bootstrap; diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c deleted file mode 100644 index 82d84e320..000000000 --- a/src/audio/arts/SDL_artsaudio.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ARTS - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_artsaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC - -static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; -static void *arts_handle = NULL; - -/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */ -static int (*SDL_NAME(arts_init)) (void); -static void (*SDL_NAME(arts_free)) (void); -static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits, - int channels, - const char *name); -static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s, - arts_parameter_t param, int value); -static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s, - arts_parameter_t param); -static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer, - int count); -static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s); -static int (*SDL_NAME(arts_suspend))(void); -static int (*SDL_NAME(arts_suspended)) (void); -static const char *(*SDL_NAME(arts_error_text)) (int errorcode); - -#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} arts_functions[] = { -/* *INDENT-OFF* */ - SDL_ARTS_SYM(arts_init), - SDL_ARTS_SYM(arts_free), - SDL_ARTS_SYM(arts_play_stream), - SDL_ARTS_SYM(arts_stream_set), - SDL_ARTS_SYM(arts_stream_get), - SDL_ARTS_SYM(arts_write), - SDL_ARTS_SYM(arts_close_stream), - SDL_ARTS_SYM(arts_suspend), - SDL_ARTS_SYM(arts_suspended), - SDL_ARTS_SYM(arts_error_text), -/* *INDENT-ON* */ -}; - -#undef SDL_ARTS_SYM - -static void -UnloadARTSLibrary() -{ - if (arts_handle != NULL) { - SDL_UnloadObject(arts_handle); - arts_handle = NULL; - } -} - -static int -LoadARTSLibrary(void) -{ - int i, retval = -1; - - if (arts_handle == NULL) { - arts_handle = SDL_LoadObject(arts_library); - if (arts_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(arts_functions); ++i) { - *arts_functions[i].func = - SDL_LoadFunction(arts_handle, arts_functions[i].name); - if (!*arts_functions[i].func) { - retval = -1; - UnloadARTSLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadARTSLibrary() -{ - return; -} - -static int -LoadARTSLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -ARTS_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - SDL_OpenedAudioDeviceDisconnected(this); - } - } - } - - /* Use timer for general audio synchronization */ - ticks = - ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ARTS_PlayDevice(_THIS) -{ - /* Write the audio data */ - int written = SDL_NAME(arts_write) (this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixlen); - - /* If timer synchronization is enabled, set the next write frame */ - if (this->hidden->frame_ticks) { - this->hidden->next_frame += this->hidden->frame_ticks; - } - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static Uint8 * -ARTS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -ARTS_CloseDevice(_THIS) -{ - if (this->hidden->stream) { - SDL_NAME(arts_close_stream) (this->hidden->stream); - } - SDL_NAME(arts_free) (); - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static int -ARTS_Suspend(void) -{ - const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */ - while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) { - if ( SDL_NAME(arts_suspend)() ) { - break; - } - } - return SDL_NAME(arts_suspended)(); -} - -static int -ARTS_OpenDevice(_THIS, const char *devname) -{ - int rc = 0; - int bits, frag_spec = 0; - SDL_AudioFormat test_format = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16LSB: - break; - default: - continue; - } - break; - } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "arts"); - } - this->spec.format = test_format; - bits = SDL_AUDIO_BITSIZE(test_format); - - if ((rc = SDL_NAME(arts_init) ()) != 0) { - return SDL_SetError("Unable to initialize ARTS: %s", - SDL_NAME(arts_error_text) (rc)); - } - - if (!ARTS_Suspend()) { - return SDL_SetError("ARTS can not open audio device"); - } - - this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq, - bits, - this->spec.channels, - "SDL"); - - /* Play nothing so we have at least one write (server bug workaround). */ - SDL_NAME(arts_write) (this->hidden->stream, "", 0); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Determine the power of two of the fragment size */ - for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec); - if ((0x01 << frag_spec) != this->spec.size) { - return SDL_SetError("Fragment size must be a power of two"); - } - frag_spec |= 0x00020000; /* two fragments, for low latency */ - -#ifdef ARTS_P_PACKET_SETTINGS - SDL_NAME(arts_stream_set) (this->hidden->stream, - ARTS_P_PACKET_SETTINGS, frag_spec); -#else - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE, - frag_spec & 0xffff); - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT, - frag_spec >> 16); -#endif - this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream, - ARTS_P_PACKET_SIZE); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -ARTS_Deinitialize(void) -{ - UnloadARTSLibrary(); -} - - -static SDL_bool -ARTS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadARTSLibrary() < 0) { - return SDL_FALSE; - } else { - if (SDL_NAME(arts_init) () != NULL) { - UnloadARTSLibrary(); - SDL_SetError("ARTS: arts_init failed (no audio server?)"); - return SDL_FALSE; - } - - /* Play a stream so aRts doesn't crash */ - if (ARTS_Suspend()) { - arts_stream_t stream; - stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL"); - SDL_NAME(arts_write) (stream, "", 0); - SDL_NAME(arts_close_stream) (stream); - } - - SDL_NAME(arts_free) (); - } - - /* Set the function pointers */ - impl->OpenDevice = ARTS_OpenDevice; - impl->PlayDevice = ARTS_PlayDevice; - impl->WaitDevice = ARTS_WaitDevice; - impl->GetDeviceBuf = ARTS_GetDeviceBuf; - impl->CloseDevice = ARTS_CloseDevice; - impl->Deinitialize = ARTS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap ARTS_bootstrap = { - "arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_ARTS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/arts/SDL_artsaudio.h b/src/audio/arts/SDL_artsaudio.h deleted file mode 100644 index 0f6e1693c..000000000 --- a/src/audio/arts/SDL_artsaudio.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_artsaudio_h_ -#define SDL_artsaudio_h_ - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The stream descriptor for the audio device */ - arts_stream_t stream; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer, in addition to SDL_IOReady() */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* SDL_artsaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c deleted file mode 100644 index ccf07916c..000000000 --- a/src/audio/esd/SDL_esdaudio.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ESD - -/* Allow access to an ESD network stream mixing buffer */ - -#include -#include -#include -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_esdaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC - -static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; -static void *esd_handle = NULL; - -static int (*SDL_NAME(esd_open_sound)) (const char *host); -static int (*SDL_NAME(esd_close)) (int esd); -static int (*SDL_NAME(esd_play_stream)) (esd_format_t format, int rate, - const char *host, const char *name); - -#define SDL_ESD_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} const esd_functions[] = { - SDL_ESD_SYM(esd_open_sound), - SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream), -}; - -#undef SDL_ESD_SYM - -static void -UnloadESDLibrary() -{ - if (esd_handle != NULL) { - SDL_UnloadObject(esd_handle); - esd_handle = NULL; - } -} - -static int -LoadESDLibrary(void) -{ - int i, retval = -1; - - if (esd_handle == NULL) { - esd_handle = SDL_LoadObject(esd_library); - if (esd_handle) { - retval = 0; - for (i = 0; i < SDL_arraysize(esd_functions); ++i) { - *esd_functions[i].func = - SDL_LoadFunction(esd_handle, esd_functions[i].name); - if (!*esd_functions[i].func) { - retval = -1; - UnloadESDLibrary(); - break; - } - } - } - } - return retval; -} - -#else - -static void -UnloadESDLibrary() -{ - return; -} - -static int -LoadESDLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */ - - -/* This function waits until it is possible to write a full sound buffer */ -static void -ESD_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - SDL_OpenedAudioDeviceDisconnected(this); - } - } - } - - /* Use timer for general audio synchronization */ - ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ESD_PlayDevice(_THIS) -{ - int written = 0; - - /* Write the audio data, checking for EAGAIN on broken audio drivers */ - do { - written = write(this->hidden->audio_fd, - this->hidden->mixbuf, this->hidden->mixlen); - if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while ((written < 0) && - ((errno == 0) || (errno == EAGAIN) || (errno == EINTR))); - - /* Set the next write frame */ - this->hidden->next_frame += this->hidden->frame_ticks; - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - } -} - -static Uint8 * -ESD_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -ESD_CloseDevice(_THIS) -{ - if (this->hidden->audio_fd >= 0) { - SDL_NAME(esd_close) (this->hidden->audio_fd); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -/* Try to get the name of the program */ -static char * -get_progname(void) -{ - char *progname = NULL; -#ifdef __LINUX__ - FILE *fp; - static char temp[BUFSIZ]; - - SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); - fp = fopen(temp, "r"); - if (fp != NULL) { - if (fgets(temp, sizeof(temp) - 1, fp)) { - progname = SDL_strrchr(temp, '/'); - if (progname == NULL) { - progname = temp; - } else { - progname = progname + 1; - } - } - fclose(fp); - } -#endif - return (progname); -} - - -static int -ESD_OpenDevice(_THIS, const char *devname) -{ - esd_format_t format = (ESD_STREAM | ESD_PLAY); - SDL_AudioFormat test_format = 0; - int found = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - this->hidden->audio_fd = -1; - - /* Convert audio spec to the ESD audio format */ - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !found && test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - found = 1; - switch (test_format) { - case AUDIO_U8: - format |= ESD_BITS8; - break; - case AUDIO_S16SYS: - format |= ESD_BITS16; - break; - default: - found = 0; - break; - } - } - - if (!found) { - return SDL_SetError("Couldn't find any hardware audio formats"); - } - - if (this->spec.channels == 1) { - format |= ESD_MONO; - } else { - format |= ESD_STEREO; - } -#if 0 - this->spec.samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */ -#endif - - /* Open a connection to the ESD audio server */ - this->hidden->audio_fd = - SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL, - get_progname()); - - if (this->hidden->audio_fd < 0) { - return SDL_SetError("Couldn't open ESD connection"); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - this->hidden->frame_ticks = - (float) (this->spec.samples * 1000) / this->spec.freq; - this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks; - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -ESD_Deinitialize(void) -{ - UnloadESDLibrary(); -} - -static SDL_bool -ESD_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadESDLibrary() < 0) { - return SDL_FALSE; - } else { - int connection = 0; - - /* Don't start ESD if it's not running */ - SDL_setenv("ESD_NO_SPAWN", "1", 0); - - connection = SDL_NAME(esd_open_sound) (NULL); - if (connection < 0) { - UnloadESDLibrary(); - SDL_SetError("ESD: esd_open_sound failed (no audio server?)"); - return SDL_FALSE; - } - SDL_NAME(esd_close) (connection); - } - - /* Set the function pointers */ - impl->OpenDevice = ESD_OpenDevice; - impl->PlayDevice = ESD_PlayDevice; - impl->WaitDevice = ESD_WaitDevice; - impl->GetDeviceBuf = ESD_GetDeviceBuf; - impl->CloseDevice = ESD_CloseDevice; - impl->Deinitialize = ESD_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap ESD_bootstrap = { - "esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_ESD */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/esd/SDL_esdaudio.h b/src/audio/esd/SDL_esdaudio.h deleted file mode 100644 index 90b780059..000000000 --- a/src/audio/esd/SDL_esdaudio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_esdaudio_h_ -#define SDL_esdaudio_h_ - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - int audio_fd; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* SDL_esdaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c deleted file mode 100644 index fbe684de8..000000000 --- a/src/audio/fusionsound/SDL_fsaudio.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_FUSIONSOUND - -/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_fsaudio.h" - -#include - -/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */ - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1) -typedef DFBResult DirectResult; -#endif - -/* Buffers to use - more than 2 gives a lot of latency */ -#define FUSION_BUFFERS (2) - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC - -static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC; -static void *fs_handle = NULL; - -static DirectResult (*SDL_NAME(FusionSoundInit)) (int *argc, char *(*argv[])); -static DirectResult (*SDL_NAME(FusionSoundCreate)) (IFusionSound ** - ret_interface); - -#define SDL_FS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} fs_functions[] = { -/* *INDENT-OFF* */ - SDL_FS_SYM(FusionSoundInit), - SDL_FS_SYM(FusionSoundCreate), -/* *INDENT-ON* */ -}; - -#undef SDL_FS_SYM - -static void -UnloadFusionSoundLibrary() -{ - if (fs_handle != NULL) { - SDL_UnloadObject(fs_handle); - fs_handle = NULL; - } -} - -static int -LoadFusionSoundLibrary(void) -{ - int i, retval = -1; - - if (fs_handle == NULL) { - fs_handle = SDL_LoadObject(fs_library); - if (fs_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(fs_functions); ++i) { - *fs_functions[i].func = - SDL_LoadFunction(fs_handle, fs_functions[i].name); - if (!*fs_functions[i].func) { - retval = -1; - UnloadFusionSoundLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadFusionSoundLibrary() -{ - return; -} - -static int -LoadFusionSoundLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -SDL_FS_WaitDevice(_THIS) -{ - this->hidden->stream->Wait(this->hidden->stream, - this->hidden->mixsamples); -} - -static void -SDL_FS_PlayDevice(_THIS) -{ - DirectResult ret; - - ret = this->hidden->stream->Write(this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixsamples); - /* If we couldn't write, assume fatal error for now */ - if (ret) { - SDL_OpenedAudioDeviceDisconnected(this); - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - - -static Uint8 * -SDL_FS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -SDL_FS_CloseDevice(_THIS) -{ - if (this->hidden->stream) { - this->hidden->stream->Release(this->hidden->stream); - } - if (this->hidden->fs) { - this->hidden->fs->Release(this->hidden->fs); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - - -static int -SDL_FS_OpenDevice(_THIS, const char *devname) -{ - int bytes; - SDL_AudioFormat test_format; - FSSampleFormat fs_format; - FSStreamDescription desc; - DirectResult ret; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - fs_format = FSSF_U8; - break; - case AUDIO_S16SYS: - fs_format = FSSF_S16; - break; - case AUDIO_S32SYS: - fs_format = FSSF_S32; - break; - case AUDIO_F32SYS: - fs_format = FSSF_FLOAT; - break; - default: - continue; - } - break; - } - - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "fusionsound"); - } - this->spec.format = test_format; - bytes = SDL_AUDIO_BITSIZE(test_format) / 8; - - /* Retrieve the main sound interface. */ - ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); - if (ret) { - return SDL_SetError("Unable to initialize FusionSound: %d", ret); - } - - this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels; - - /* Fill stream description. */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_PREBUFFER; - desc.samplerate = this->spec.freq; - desc.buffersize = this->spec.size * FUSION_BUFFERS; - desc.channels = this->spec.channels; - desc.prebuffer = 10; - desc.sampleformat = fs_format; - - ret = - this->hidden->fs->CreateStream(this->hidden->fs, &desc, - &this->hidden->stream); - if (ret) { - return SDL_SetError("Unable to create FusionSoundStream: %d", ret); - } - - /* See what we got */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT; - ret = this->hidden->stream->GetDescription(this->hidden->stream, &desc); - - this->spec.freq = desc.samplerate; - this->spec.size = - desc.buffersize / FUSION_BUFFERS * bytes * desc.channels; - this->spec.channels = desc.channels; - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -SDL_FS_Deinitialize(void) -{ - UnloadFusionSoundLibrary(); -} - - -static SDL_bool -SDL_FS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadFusionSoundLibrary() < 0) { - return SDL_FALSE; - } else { - DirectResult ret; - - ret = SDL_NAME(FusionSoundInit) (NULL, NULL); - if (ret) { - UnloadFusionSoundLibrary(); - SDL_SetError - ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)", - ret); - return SDL_FALSE; - } - } - - /* Set the function pointers */ - impl->OpenDevice = SDL_FS_OpenDevice; - impl->PlayDevice = SDL_FS_PlayDevice; - impl->WaitDevice = SDL_FS_WaitDevice; - impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; - impl->CloseDevice = SDL_FS_CloseDevice; - impl->Deinitialize = SDL_FS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap FUSIONSOUND_bootstrap = { - "fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/fusionsound/SDL_fsaudio.h b/src/audio/fusionsound/SDL_fsaudio.h deleted file mode 100644 index 2e7a59bcf..000000000 --- a/src/audio/fusionsound/SDL_fsaudio.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_fsaudio_h_ -#define SDL_fsaudio_h_ - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* Interface */ - IFusionSound *fs; - - /* The stream interface for the audio device */ - IFusionSoundStream *stream; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - int mixsamples; - -}; - -#endif /* SDL_fsaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c deleted file mode 100644 index d6d863232..000000000 --- a/src/audio/nas/SDL_nasaudio.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_NAS - -/* Allow access to a raw mixing buffer */ - -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "SDL_loadso.h" -#include "../SDL_audio_c.h" -#include "SDL_nasaudio.h" - -static void (*NAS_AuCloseServer) (AuServer *); -static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *); -static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *); -static void (*NAS_AuHandleEvents) (AuServer *); -static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *); -static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *); -static void (*NAS_AuSetElements) - (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *); -static void (*NAS_AuWriteElement) - (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *); -static AuUint32 (*NAS_AuReadElement) - (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuStatus *); -static AuServer *(*NAS_AuOpenServer) - (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **); -static AuEventHandlerRec *(*NAS_AuRegisterEventHandler) - (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer); - - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC; -static void *nas_handle = NULL; - -static int -load_nas_sym(const char *fn, void **addr) -{ - *addr = SDL_LoadFunction(nas_handle, fn); - if (*addr == NULL) { - return 0; - } - return 1; -} - -/* cast funcs to char* first, to please GCC's strict aliasing rules. */ -#define SDL_NAS_SYM(x) \ - if (!load_nas_sym(#x, (void **) (char *) &NAS_##x)) return -1 -#else -#define SDL_NAS_SYM(x) NAS_##x = x -#endif - -static int -load_nas_syms(void) -{ - SDL_NAS_SYM(AuCloseServer); - SDL_NAS_SYM(AuNextEvent); - SDL_NAS_SYM(AuDispatchEvent); - SDL_NAS_SYM(AuHandleEvents); - SDL_NAS_SYM(AuCreateFlow); - SDL_NAS_SYM(AuStartFlow); - SDL_NAS_SYM(AuSetElements); - SDL_NAS_SYM(AuWriteElement); - SDL_NAS_SYM(AuReadElement); - SDL_NAS_SYM(AuOpenServer); - SDL_NAS_SYM(AuRegisterEventHandler); - return 0; -} - -#undef SDL_NAS_SYM - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static void -UnloadNASLibrary(void) -{ - if (nas_handle != NULL) { - SDL_UnloadObject(nas_handle); - nas_handle = NULL; - } -} - -static int -LoadNASLibrary(void) -{ - int retval = 0; - if (nas_handle == NULL) { - nas_handle = SDL_LoadObject(nas_library); - if (nas_handle == NULL) { - /* Copy error string so we can use it in a new SDL_SetError(). */ - const char *origerr = SDL_GetError(); - const size_t len = SDL_strlen(origerr) + 1; - char *err = SDL_stack_alloc(char, len); - SDL_strlcpy(err, origerr, len); - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s", nas_library, err); - SDL_stack_free(err); - retval = -1; - } else { - retval = load_nas_syms(); - if (retval < 0) { - UnloadNASLibrary(); - } - } - } - return retval; -} - -#else - -static void -UnloadNASLibrary(void) -{ -} - -static int -LoadNASLibrary(void) -{ - load_nas_syms(); - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -NAS_WaitDevice(_THIS) -{ - while (this->hidden->buf_free < this->hidden->mixlen) { - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } -} - -static void -NAS_PlayDevice(_THIS) -{ - while (this->hidden->mixlen > this->hidden->buf_free) { - /* - * We think the buffer is full? Yikes! Ask the server for events, - * in the hope that some of them is LowWater events telling us more - * of the buffer is free now than what we think. - */ - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } - this->hidden->buf_free -= this->hidden->mixlen; - - /* Write the audio data */ - NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0, - this->hidden->mixlen, this->hidden->mixbuf, AuFalse, - NULL); - - this->hidden->written += this->hidden->mixlen; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - -static Uint8 * -NAS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static int -NAS_CaptureFromDevice(_THIS, void *buffer, int buflen) -{ - struct SDL_PrivateAudioData *h = this->hidden; - int retval; - - while (SDL_TRUE) { - /* just keep the event queue moving and the server chattering. */ - NAS_AuHandleEvents(h->aud); - - retval = (int) NAS_AuReadElement(h->aud, h->flow, 1, buflen, buffer, NULL); - /*printf("read %d capture bytes\n", (int) retval);*/ - if (retval == 0) { - SDL_Delay(10); /* don't burn the CPU if we're waiting for data. */ - } else { - break; - } - } - - return retval; -} - -static void -NAS_FlushCapture(_THIS) -{ - struct SDL_PrivateAudioData *h = this->hidden; - AuUint32 total = 0; - AuUint32 br; - Uint8 buf[512]; - - do { - /* just keep the event queue moving and the server chattering. */ - NAS_AuHandleEvents(h->aud); - br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof (buf), buf, NULL); - /*printf("flushed %d capture bytes\n", (int) br);*/ - total += br; - } while ((br == sizeof (buf)) && (total < this->spec.size)); -} - -static void -NAS_CloseDevice(_THIS) -{ - if (this->hidden->aud) { - NAS_AuCloseServer(this->hidden->aud); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static AuBool -event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) hnd->data; - struct SDL_PrivateAudioData *h = this->hidden; - if (this->iscapture) { - return AuTrue; /* we don't (currently) care about any of this for capture devices */ - } - - switch (ev->type) { - case AuEventTypeElementNotify: - { - AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; - - switch (event->kind) { - case AuElementNotifyKindLowWater: - if (h->buf_free >= 0) { - h->really += event->num_bytes; - gettimeofday(&h->last_tv, 0); - h->buf_free += event->num_bytes; - } else { - h->buf_free = event->num_bytes; - } - break; - case AuElementNotifyKindState: - switch (event->cur_state) { - case AuStatePause: - if (event->reason != AuReasonUser) { - if (h->buf_free >= 0) { - h->really += event->num_bytes; - gettimeofday(&h->last_tv, 0); - h->buf_free += event->num_bytes; - } else { - h->buf_free = event->num_bytes; - } - } - break; - } - } - } - } - return AuTrue; -} - -static AuDeviceID -find_device(_THIS) -{ - /* These "Au" things are all macros, not functions... */ - struct SDL_PrivateAudioData *h = this->hidden; - const unsigned int devicekind = this->iscapture ? AuComponentKindPhysicalInput : AuComponentKindPhysicalOutput; - const int numdevs = AuServerNumDevices(h->aud); - const int nch = this->spec.channels; - int i; - - /* Try to find exact match on channels first... */ - for (i = 0; i < numdevs; i++) { - const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); - if ((AuDeviceKind(dev) == devicekind) && (AuDeviceNumTracks(dev) == nch)) { - return AuDeviceIdentifier(dev); - } - } - - /* Take anything, then... */ - for (i = 0; i < numdevs; i++) { - const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); - if (AuDeviceKind(dev) == devicekind) { - this->spec.channels = AuDeviceNumTracks(dev); - return AuDeviceIdentifier(dev); - } - } - return AuNone; -} - -static int -NAS_OpenDevice(_THIS, const char *devname) -{ - AuElement elms[3]; - int buffer_size; - SDL_bool iscapture = this->iscapture; - SDL_AudioFormat test_format, format = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - switch (test_format) { - case AUDIO_U8: - format = AuFormatLinearUnsigned8; - break; - case AUDIO_S8: - format = AuFormatLinearSigned8; - break; - case AUDIO_U16LSB: - format = AuFormatLinearUnsigned16LSB; - break; - case AUDIO_U16MSB: - format = AuFormatLinearUnsigned16MSB; - break; - case AUDIO_S16LSB: - format = AuFormatLinearSigned16LSB; - break; - case AUDIO_S16MSB: - format = AuFormatLinearSigned16MSB; - break; - default: - continue; - } - break; - } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "nas"); - } - this->spec.format = test_format; - - this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (this->hidden->aud == 0) { - return SDL_SetError("NAS: Couldn't open connection to NAS server"); - } - - this->hidden->dev = find_device(this); - if ((this->hidden->dev == AuNone) - || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) { - return SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); - } - - buffer_size = this->spec.freq; - if (buffer_size < 4096) - buffer_size = 4096; - - if (buffer_size > 32768) - buffer_size = 32768; /* So that the buffer won't get unmanageably big. */ - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - if (iscapture) { - AuMakeElementImportDevice(elms, this->spec.freq, this->hidden->dev, - AuUnlimitedSamples, 0, NULL); - AuMakeElementExportClient(elms + 1, 0, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size, 0, NULL); - } else { - AuMakeElementImportClient(elms, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size / 4, 0, NULL); - AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, - AuUnlimitedSamples, 0, NULL); - } - - NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, - 2, elms, NULL); - - NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, - this->hidden->flow, event_handler, - (AuPointer) this); - - NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); - - /* Allocate mixing buffer */ - if (!iscapture) { - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - } - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -NAS_Deinitialize(void) -{ - UnloadNASLibrary(); -} - -static SDL_bool -NAS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadNASLibrary() < 0) { - return SDL_FALSE; - } else { - AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (aud == NULL) { - SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); - return SDL_FALSE; - } - NAS_AuCloseServer(aud); - } - - /* Set the function pointers */ - impl->OpenDevice = NAS_OpenDevice; - impl->PlayDevice = NAS_PlayDevice; - impl->WaitDevice = NAS_WaitDevice; - impl->GetDeviceBuf = NAS_GetDeviceBuf; - impl->CaptureFromDevice = NAS_CaptureFromDevice; - impl->FlushCapture = NAS_FlushCapture; - impl->CloseDevice = NAS_CloseDevice; - impl->Deinitialize = NAS_Deinitialize; - - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; - impl->HasCaptureSupport = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - -AudioBootStrap NAS_bootstrap = { - "nas", "Network Audio System", NAS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_NAS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nas/SDL_nasaudio.h b/src/audio/nas/SDL_nasaudio.h deleted file mode 100644 index 7c9506d91..000000000 --- a/src/audio/nas/SDL_nasaudio.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 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. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_nasaudio_h_ -#define SDL_nasaudio_h_ - -#ifdef __sgi -#include -#else -#include