sdl12-compat: Added replacement 1.2 headers under the zlib license.

From 8bbb16813a903b4778899ee19e9d2378e4885a71 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 24 May 2021 10:13:32 -0400
Subject: [PATCH] Added replacement 1.2 headers under the zlib license.

These are intentionally cut down to the bare minimum, both to discourage their
use as anything other than a compatibility layer, and because it seems silly
to try to document SDL 1.2's API from scratch at this point.

These headers make an attempt to exist without the need for a configure step;
SDL_config.h is intended to be generic; as such, it makes some assumptions
about the sort of systems that can run SDL2. This might be imperfect and need
patches, and it might not work out in general, but I'm hoping it will.

These files werecreated from a collection of sources: some from-scratch, some
from zlib-licensed SDL2, some from external sources (the 1.2 SDL_opengl.h is
largely under SGI's license), some from lines in 1.2 that I'm confident Sam
or I wrote, and some are "it must be exactly this string of characters and
the Supreme Court just ruled interface copying is Fair Use, shrug."

Fixes #34.
---
 include/SDL/SDL.h           |   43 +-
 include/SDL/SDL_active.h    |   43 +
 include/SDL/SDL_audio.h     |  110 +
 include/SDL/SDL_byteorder.h |   28 +
 include/SDL/SDL_cdrom.h     |   95 +
 include/SDL/SDL_config.h    |  150 +
 include/SDL/SDL_copying.h   |   28 +
 include/SDL/SDL_cpuinfo.h   |   44 +
 include/SDL/SDL_endian.h    |  264 ++
 include/SDL/SDL_error.h     |   54 +
 include/SDL/SDL_events.h    |  241 ++
 include/SDL/SDL_getenv.h    |   29 +
 include/SDL/SDL_joystick.h  |   66 +
 include/SDL/SDL_keyboard.h  |   59 +
 include/SDL/SDL_keysym.h    |  290 ++
 include/SDL/SDL_loadso.h    |   42 +
 include/SDL/SDL_main.h      |   47 +
 include/SDL/SDL_mouse.h     |   72 +
 include/SDL/SDL_mutex.h     |   66 +
 include/SDL/SDL_name.h      |   36 +
 include/SDL/SDL_opengl.h    | 6575 +++++++++++++++++++++++++++++++++++
 include/SDL/SDL_platform.h  |  184 +
 include/SDL/SDL_quit.h      |   35 +
 include/SDL/SDL_rwops.h     |  112 +
 include/SDL/SDL_stdinc.h    |  174 +
 include/SDL/SDL_syswm.h     |  134 +
 include/SDL/SDL_thread.h    |   46 +
 include/SDL/SDL_timer.h     |   52 +
 include/SDL/SDL_types.h     |   29 +
 include/SDL/SDL_version.h   |   60 +
 include/SDL/SDL_video.h     |  266 ++
 include/SDL/begin_code.h    |  138 +
 include/SDL/close_code.h    |   44 +
 33 files changed, 9651 insertions(+), 5 deletions(-)
 create mode 100644 include/SDL/SDL_active.h
 create mode 100644 include/SDL/SDL_audio.h
 create mode 100644 include/SDL/SDL_byteorder.h
 create mode 100644 include/SDL/SDL_cdrom.h
 create mode 100644 include/SDL/SDL_config.h
 create mode 100644 include/SDL/SDL_copying.h
 create mode 100644 include/SDL/SDL_cpuinfo.h
 create mode 100644 include/SDL/SDL_endian.h
 create mode 100644 include/SDL/SDL_error.h
 create mode 100644 include/SDL/SDL_events.h
 create mode 100644 include/SDL/SDL_getenv.h
 create mode 100644 include/SDL/SDL_joystick.h
 create mode 100644 include/SDL/SDL_keyboard.h
 create mode 100644 include/SDL/SDL_keysym.h
 create mode 100644 include/SDL/SDL_loadso.h
 create mode 100644 include/SDL/SDL_main.h
 create mode 100644 include/SDL/SDL_mouse.h
 create mode 100644 include/SDL/SDL_mutex.h
 create mode 100644 include/SDL/SDL_name.h
 create mode 100644 include/SDL/SDL_opengl.h
 create mode 100644 include/SDL/SDL_platform.h
 create mode 100644 include/SDL/SDL_quit.h
 create mode 100644 include/SDL/SDL_rwops.h
 create mode 100644 include/SDL/SDL_stdinc.h
 create mode 100644 include/SDL/SDL_syswm.h
 create mode 100644 include/SDL/SDL_thread.h
 create mode 100644 include/SDL/SDL_timer.h
 create mode 100644 include/SDL/SDL_types.h
 create mode 100644 include/SDL/SDL_version.h
 create mode 100644 include/SDL/SDL_video.h
 create mode 100644 include/SDL/begin_code.h
 create mode 100644 include/SDL/close_code.h

diff --git a/include/SDL/SDL.h b/include/SDL/SDL.h
index f8a850c..f67e482 100644
--- a/include/SDL/SDL.h
+++ b/include/SDL/SDL.h
@@ -19,14 +19,47 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifdef __BUILDING_SDL12_COMPAT__
-#error You should not use these headers to build sdl12-compat. Use the real SDL2 headers instead.
-#endif
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
 
 #ifndef _SDL_H
 #define _SDL_H
 
-#endif
+#include "SDL_main.h"
+#include "SDL_stdinc.h"
+#include "SDL_audio.h"
+#include "SDL_cdrom.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_endian.h"
+#include "SDL_error.h"
+#include "SDL_events.h"
+#include "SDL_loadso.h"
+#include "SDL_mutex.h"
+#include "SDL_rwops.h"
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+#include "SDL_video.h"
+#include "SDL_version.h"
+
+#include "begin_code.h"
+
+#define SDL_INIT_TIMER 0x00000001
+#define SDL_INIT_AUDIO 0x00000010
+#define SDL_INIT_VIDEO 0x00000020
+#define SDL_INIT_CDROM 0x00000100
+#define SDL_INIT_JOYSTICK 0x00000200
+#define SDL_INIT_NOPARACHUTE 0x00100000
+#define SDL_INIT_EVENTTHREAD 0x01000000
+#define SDL_INIT_EVERYTHING 0x0000FFFF
 
-/* vi: set ts=4 sw=4 expandtab: */
+extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
+extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
+extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
+extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
+extern DECLSPEC void SDLCALL SDL_Quit(void);
+
+#include "close_code.h"
+
+#endif
 
diff --git a/include/SDL/SDL_active.h b/include/SDL/SDL_active.h
new file mode 100644
index 0000000..d4d44f0
--- /dev/null
+++ b/include/SDL/SDL_active.h
@@ -0,0 +1,43 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+#ifndef _SDL_active_h
+#define _SDL_active_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+
+#define SDL_APPMOUSEFOCUS 0x01
+#define SDL_APPINPUTFOCUS 0x02
+#define SDL_APPACTIVE 0x04
+
+extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
+
+#include "close_code.h"
+
+#endif
+
diff --git a/include/SDL/SDL_audio.h b/include/SDL/SDL_audio.h
new file mode 100644
index 0000000..19bf4ae
--- /dev/null
+++ b/include/SDL/SDL_audio.h
@@ -0,0 +1,110 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+#ifndef _SDL_audio_h
+#define _SDL_audio_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_endian.h"
+#include "SDL_mutex.h"
+#include "SDL_thread.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+
+typedef struct SDL_AudioSpec {
+    int freq;
+    Uint16 format;
+    Uint8  channels;
+    Uint8  silence;
+    Uint16 samples;
+    Uint16 padding;
+    Uint32 size;
+    void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
+    void  *userdata;
+} SDL_AudioSpec;
+
+#define AUDIO_U8 0x0008
+#define AUDIO_S8 0x8008
+#define AUDIO_U16LSB 0x0010
+#define AUDIO_S16LSB 0x8010
+#define AUDIO_U16MSB 0x1010
+#define AUDIO_S16MSB 0x9010
+#define AUDIO_U16 AUDIO_U16LSB
+#define AUDIO_S16 AUDIO_S16LSB
+
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define AUDIO_U16SYS AUDIO_U16LSB
+#define AUDIO_S16SYS AUDIO_S16LSB
+#else
+#define AUDIO_U16SYS AUDIO_U16MSB
+#define AUDIO_S16SYS AUDIO_S16MSB
+#endif
+
+typedef struct SDL_AudioCVT
+{
+    int needed;
+    Uint16 src_format;
+    Uint16 dst_format;
+    double rate_incr;
+    Uint8 *buf;
+    int len;
+    int len_cvt;
+    int len_mult;
+    double len_ratio;
+    void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
+    int filter_index;
+} SDL_AudioCVT;
+
+typedef enum SDL_audiostatus
+{
+    SDL_AUDIO_STOPPED,
+    SDL_AUDIO_PLAYING,
+    SDL_AUDIO_PAUSED
+} SDL_audiostatus;
+
+#define SDL_MIX_MAXVOLUME 128
+
+extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
+extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
+extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
+extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
+extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
+extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
+extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
+extern DECLSPEC void SDLCALL SDL_LockAudio(void);
+extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
+extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
+extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
+extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate);
+extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
+extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
+
+#define SDL_LoadWAV(file, spec, audio_buf, audio_len) SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
+
+#include "close_code.h"
+
+#endif
diff --git a/include/SDL/SDL_byteorder.h b/include/SDL/SDL_byteorder.h
new file mode 100644
index 0000000..59a8bf3
--- /dev/null
+++ b/include/SDL/SDL_byteorder.h
@@ -0,0 +1,28 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+/* This is just a compatibility header in real 1.2, too. */
+#include "SDL_endian.h"
+
diff --git a/include/SDL/SDL_cdrom.h b/include/SDL/SDL_cdrom.h
new file mode 100644
index 0000000..49205b2
--- /dev/null
+++ b/include/SDL/SDL_cdrom.h
@@ -0,0 +1,95 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+#ifndef _SDL_cdrom_h
+#define _SDL_cdrom_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+
+#define SDL_MAX_TRACKS 99
+
+typedef enum CDstatus
+{
+    CD_TRAYEMPTY,
+    CD_STOPPED,
+    CD_PLAYING,
+    CD_PAUSED,
+    CD_ERROR = -1
+} CDstatus;
+
+typedef struct SDL_CDtrack
+{
+    Uint8 id;
+    Uint8 type;
+    Uint16 unused;
+    Uint32 length;
+    Uint32 offset;
+} SDL_CDtrack;
+
+typedef struct SDL_CD
+{
+    int id;
+    CDstatus status;
+    int numtracks;
+    int cur_track;
+    int cur_frame;
+    SDL_CDtrack track[SDL_MAX_TRACKS+1];
+} SDL_CD;
+
+#define SDL_AUDIO_TRACK 0x00
+#define SDL_DATA_TRACK 0x04
+#define CD_INDRIVE(status) (status > CD_TRAYEMPTY)
+#define CD_FPS 75
+
+#define FRAMES_TO_MSF(f, M,S,F) { \
+    int value = f; \
+    *(F) = value % CD_FPS; \
+    value /= CD_FPS; \
+    *(S) = value % 60; \
+    value /= 60; \
+    *(M) = value; \
+}
+
+#define MSF_TO_FRAMES(M, S, F) ((M) * 60 * CD_FPS + (S) * CD_FPS + (F))
+
+extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
+extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
+extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
+extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
+extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes);
+extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
+extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
+extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
+extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
+extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
+extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
+
+#include "close_code.h"
+
+#endif
+
diff --git a/include/SDL/SDL_config.h b/include/SDL/SDL_config.h
new file mode 100644
index 0000000..3a05424
--- /dev/null
+++ b/include/SDL/SDL_config.h
@@ -0,0 +1,150 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+/* This is all kinda dicey. Just pretend we have most of these no matter what.
+   Hopefully most apps don't actually rely on this. :/  These defines would
+   need to be correct (and usually generated by a configure script) if these
+   headers were to be used to build the real SDL 1.2, but they are only
+   intended for building apps against sdl12-compat. */
+
+#ifndef _SDL_config_h
+#define _SDL_config_h
+
+#include "SDL_platform.h"
+
+/* Make sure that this isn't included by Visual C++ */
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+typedef __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <stdint.h>
+#define HAVE_STDINT_H 1
+#endif
+
+#define SDL_HAS_64BIT_TYPE 1
+
+#include <stdarg.h>
+#define HAVE_STDARG_H 1
+
+#define HAVE_LIBC 1
+#define HAVE_ALLOCA_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_INTTYPES_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+
+#if defined(unix)
+#define HAVE_ICONV_H 1
+#define HAVE_SIGNAL_H 1
+#endif
+
+#if defined(__powerpc__)
+#define HAVE_ALTIVEC_H 1
+#endif
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#ifndef _WIN32  /* SDL 1.2 never defines these for Windows to force SDL's internal implementation. */
+#define HAVE_GETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#endif
+#define HAVE_QSORT 1
+#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_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRDUP 1
+#define HAVE__STRREV 1
+#define HAVE__STRUPR 1
+#define HAVE__STRLWR 1
+#define HAVE_INDEX 1
+#define HAVE_RINDEX 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_ITOA 1
+#define HAVE__LTOA 1
+#define HAVE__UITOA 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__STRTOI64 1
+#define HAVE__STRTOUI64 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__STRNICMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+
+#ifdef unix
+#define HAVE_ICONV 1
+#define HAVE_SIGACTION 1
+#define HAVE_SA_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_GETPAGESIZE 1
+#define HAVE_MPROTECT 1
+#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_GETAUXVAL 1
+#define HAVE_ELF_AUX_INFO 1
+#endif
+
+/* Don't define any of the SDL backend, under the assumption checking for these against the headers won't work anyhow. */
+
+#endif /* _SDL_config_h */
diff --git a/include/SDL/SDL_copying.h b/include/SDL/SDL_copying.h
new file mode 100644
index 0000000..09d52f3
--- /dev/null
+++ b/include/SDL/SDL_copying.h
@@ -0,0 +1,28 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+/* this is just an empty header in SDL 1.2 that shows the copyright, which was
+LGPL 2.1; in sdl12-compat, the library and headers are zlib-licensed. */
+
diff --git a/include/SDL/SDL_cpuinfo.h b/include/SDL/SDL_cpuinfo.h
new file mode 100644
index 0000000..37f3867
--- /dev/null
+++ b/include/SDL/SDL_cpuinfo.h
@@ -0,0 +1,44 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+#ifndef _SDL_cpuinfo_h
+#define _SDL_cpuinfo_h
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+
+extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
+
+#include "close_code.h"
+
+#endif
\ No newline at end of file
diff --git a/include/SDL/SDL_endian.h b/include/SDL/SDL_endian.h
new file mode 100644
index 0000000..9072aaa
--- /dev/null
+++ b/include/SDL/SDL_endian.h
@@ -0,0 +1,264 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
+
+  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.
+*/
+
+/* These headers are from sdl12-compat, and are intended to give just enough
+functionality to let you build an SDL-1.2-based project without having the
+real SDL-1.2 available to you. */
+
+#ifndef _SDL_endian_h
+#define _SDL_endian_h
+
+#include "SDL_stdinc.h"
+
+/* This is all lifted out of SDL2's zlib-licensed headers. */
+
+#define SDL_LIL_ENDIAN	1234
+#define SDL_BIG_ENDIAN	4321
+
+#ifndef SDL_BYTEORDER           /* Not defined in SDL_config.h? */
+#ifdef __linux__
+#include <endian.h>
+#define SDL_BYTEORDER  __BYTE_ORDER
+#elif defined(__OpenBSD__)
+#include <endian.h>
+#define SDL_BYTEORDER  BYTE_ORDER
+#elif defined(__FreeBSD__)
+#include <sys/endian.h>
+#define SDL_BYTEORDER  BYTE_ORDER
+#else
+#if defined(__hppa__) || \
+    defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
+    (defined(__MIPS__) && defined(__MIPSEB__)) || \
+    defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
+    defined(__sparc__)
+#define SDL_BYTEORDER   SDL_BIG_ENDIAN
+#else
+#define SDL_BYTEORDER   SDL_LIL_ENDIAN
+#endif
+#endif /* __linux__ */
+#endif /* !SDL_BYTEORDER */
+
+#include "begin_code.h"
+
+#if (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2))) || \
+    (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
+#define SDL_Swap16(x) __builtin_bswap16(x)
+#elif defined(__GNUC__) && defined(__i386__) && \
+   !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+  __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
+    return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+  __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
+    return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+    int result;
+
+  __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
+    return (Uint16)result;
+}
+#elif defined(__GNUC__) && defined(__aarch64__)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+  __asm__("rev16 %w1, %w0" : "=r"(x) : "r"(x));
+  return x;
+}
+#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+  __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
+    return x;
+}
+#elif defined(_MSC_VER)
+#pragma intrinsic(_byteswap_ushort)
+#define SDL_Swap16(x) _byteswap_ushort(x)
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+  "xchg al, ah" \
+  parm   [ax]   \
+  modify [ax];
+#else
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+    return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
+}
+#endif
+
+#if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \
+    (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#define SDL_Swap32(x) __builtin_bswap32(x)
+#elif defined(__GNUC__) && defined(__i386__) && \
+   !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+  __asm__("bswap %0": "=r"(x):"0"(x));
+    return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+  __asm__("bswapl %0": "=r"(x):"0"(x));
+    return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+    Uint32 result;
+
+  __asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24),  "r"(x));
+  __asm__("rlwimi %0,%2,8,8,15"  : "=&r"(result): "0" (result), "r"(x));
+  __asm__("rlwimi %0,%2,24,0,7"  : "=&r"(result): "0" (result), "r"(x));
+    return result;
+}
+#elif defined(__GNUC__) && defined(__aarch64__)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+  __asm__("rev %w1, %w0": "=r"(x):"r"(x));
+  return x;
+}
+#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+  __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
+    return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#pragma aux SDL_Swap32 = \
+  "bswap eax"  \
+  parm   [eax] \
+  modify [eax];
+#elif defined(_MSC_VER)
+#pragma intrinsic(_byteswap_ulong)
+#define SDL_Swap32(x) _byteswap_ulong(x)
+#else
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+    return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
+                                    ((x >> 8) & 0x0000FF00) | (x >> 24)));
+}
+#endif
+
+#if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \
+    (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#define SDL_Swap64(x) __builtin_bswap64(x)
+#elif defined(__GNUC__) && defined(__i386__) && \
+   !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
+{
+    union {
+        struct {
+            Uint32 a, b;
+        } s;
+        Uint64 u;
+    } v;
+    v.u = x;
+  __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
+          : "=r"(v.s.a), "=r"(v.s.b)
+          : "0" (v.s.a),  "1"(v.s.b));
+    return v.u;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
+{
+  __asm__("bswapq %0": "=r"(x):"0"(x));
+    return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint64 SDL_Swap64(Uint64);
+#pragma aux SDL_Swap64 = \
+  "bswap eax"     \
+  "bswap edx"     \
+  "xchg eax,edx"  \
+  parm [eax edx]  \
+  modify [eax edx];
+#elif defined(_MSC_VER)
+#pragma intrinsic(_byteswap_uint64)
+#define SDL_Swap64(x) _byteswap_uint64(x)
+#else
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
+{
+    Uint32 hi, lo;
+
+    /* Separate into high and low 32-bit values and swap them */
+    lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+    x >>= 32;
+    hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+    x = SDL_Swap32(lo);
+    x <<= 32;
+    x |= SDL_Swap32(hi);
+    return (x);
+}
+#endif
+
+/**
+ *  \name Swap to native
+ *  Byteswap item from the specified endianness to the native endianness.
+ */
+/* @{ */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define SDL_SwapLE16(X)     (X)
+#define SDL_SwapLE32(X)     (X)
+#define SDL_SwapLE64(X)     (X)
+#define SDL_SwapFloatLE(X)  (X)
+#define SDL_SwapBE16(X)     SDL_Swap16(X)
+#define SDL_SwapBE32(X)     SDL_Swap32(X)
+#define SDL_SwapBE64(X)     SDL_Swap64(X)
+#define SDL_SwapFloatBE(X)  SDL_SwapFloat(X)
+#else
+#define SDL_SwapLE16(X)     SDL_Swap16(X)
+#define SDL_SwapLE32(X)     SDL_Swap32(X)
+#define SDL_SwapLE64(X)     SDL_Swap64(X)
+#define SDL_SwapFloatLE(X)  SDL_SwapFloat(X)
+#define SDL_SwapBE16(X)     (X)
+#define SDL_SwapBE32(X)     (X)
+#define SDL_SwapBE64(X)     (X)
+#define SDL_SwapFloatBE(X)  (X)
+#endif
+/*

(Patch may be truncated, please check the link at the top of this post.)