diff --git a/Makefile.mos b/Makefile.mos new file mode 100644 index 0000000000..f8f58a2ab8 --- /dev/null +++ b/Makefile.mos @@ -0,0 +1,115 @@ +# Makefile to build the SDL 2 library +# +# Enable debug with -D__SDL_DEBUG + +CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG +CC = ppc-morphos-gcc-10 -noixemul +AMIGADATE = $(shell date +"%-d.%-m.%Y") +INCLUDE = -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) +AR = ppc-morphos-ar + +ECHE = echo -e +BOLD = \033[1m +NRML = \033[22m + +COMPILING = @$(ECHE) "compiling $(BOLD)$@$(NRML)..." +LINKING = @$(ECHE) "linking $(BOLD)$@$(NRML)..." +STRIPPING = @$(ECHE) "stripping $(BOLD)$@$(NRML)..." +ARCHIVING = @$(ECHE) "archiving $(BOLD)$@$(NRML)..." +HEADERING = @$(ECHE) "creating headers files $(BOLD)$@$(NRML)..." + +TARGET = libSDL2.a +LIBRARY = sdl2.library + +SOURCES = \ + src/*.c \ + src/atomic/*.c \ + src/audio/*.c \ + src/audio/ahi/*.c \ + src/audio/disk/*.c \ + src/audio/dummy/*.c \ + src/cpuinfo/*.c \ + src/events/*.c \ + src/file/*.c \ + src/filesystem/amiga/*.c \ + src/haptic/*.c \ + src/haptic/dummy/*.c \ + src/joystick/*.c \ + src/joystick/amiga/*.c \ + src/joystick/morphos/*.c \ + src/loadso/dlopen/*.c \ + src/power/*.c \ + src/power/morphos/*.c \ + src/render/*.c \ + src/render/software/*.c \ + src/render/opengl/*.c \ + src/sensor/*.c \ + src/sensor/dummy/*.c \ + src/stdlib/*.c \ + src/thread/*.c \ + src/thread/morphos/*.c \ + src/timer/*.c \ + src/timer/amiga/*.c \ + src/video/*.c \ + src/video/amiga/*.c \ + src/video/yuv2rgb/*.c \ + src/misc/*.c \ + src/misc/morphos/*.c \ + src/locale/*.c \ + src/locale/morphos/*.c \ + +CORESOURCES = src/core/morphos/*.c +COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') + +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') + +all: $(LIBRARY) lib + +sdk: $(LIBRARY) + mkdir -p /usr/local/bin + mkdir -p /usr/local/include/SDL2 + mkdir -p /usr/local/lib + mkdir -p /usr/local/lib/libb32 + cp include/*.h /usr/local/include/SDL2 + cp src/core/morphos/devenv/lib/libSDL2.a /usr/local/lib/libSDL2.a + cp src/core/morphos/devenv/lib/libb32/libSDL2.a /usr/local/lib/libb32/libSDL2.a + +headers: + $(HEADERING) + @cvinclude.pl --fd=src/core/morphos/sdk/fd/sdl2_lib.fd --clib=src/core/morphos/sdk/clib/sdl2_protos.h --proto=src/core/morphos/sdk/proto/sdl2.h + @cvinclude.pl --fd=src/core/morphos/sdk/fd/sdl2_lib.fd --clib=src/core/morphos/sdk/clib/sdl2_protos.h --inline=src/core/morphos/sdk/ppcinline/sdl2.h + +lib: + @cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi; + +install: $(LIBRARY) lib + cp $(LIBRARY) Libs: + -flushlib $(LIBRARY) + +src/video/SDL_blit_N.o: src/video/SDL_blit_N.c + $(CC) $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c + +src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.c + $(CC) $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c $^ + +src/core/morphos/SDL_library.o: src/core/morphos/SDL_library.c src/core/morphos/SDL_library.h src/core/morphos/SDL_stubs.h + $(COMPILING) + @$(CC) -mcpu=750 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + +$(TARGET): $(OBJECTS) + $(ARCHIVING) + @$(AR) crvs $@ $^ + +$(LIBRARY): $(TARGET) $(COREOBJECTS) + $(LINKING) + @$(CC) -nostartfiles -mresident32 -Wl,-Map=sdl2.map $(COREOBJECTS) -o $@.db -L. -lSDL2 -lm + $(STRIPPING) + @ppc-morphos-strip -o $@ --remove-section=.comment $@.db + +clean: + rm -f $(LIBRARY) $(TARGET) $(OBJECTS) $(COREOBJECTS) *.db *.s + @cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi; + +dump: + ppc-morphos-objdump --disassemble-all --reloc $(LIBRARY).db >$(LIBRARY).s diff --git a/include/SDL_atomic.h b/include/SDL_atomic.h index e99f1bcc6d..fccf7fb8d4 100644 --- a/include/SDL_atomic.h +++ b/include/SDL_atomic.h @@ -156,8 +156,13 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +#if defined(__MORPHOS__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("sync" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("sync" : : : "memory") +#else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#endif #elif defined(__GNUC__) && defined(__aarch64__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") diff --git a/include/SDL_config.h b/include/SDL_config.h index 3937dbc388..e7abea6940 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -43,6 +43,8 @@ #include "SDL_config_psp.h" #elif defined(__OS2__) #include "SDL_config_os2.h" +#elif defined(__MORPHOS__) +#include "SDL_config_morphos.h" #else /* This is a minimal configuration just to get SDL running on new platforms. */ #include "SDL_config_minimal.h" diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h new file mode 100644 index 0000000000..01c682c968 --- /dev/null +++ b/include/SDL_config_morphos.h @@ -0,0 +1,196 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_morphos_h +#define _SDL_config_morphos_h + +#include "SDL_platform.h" + +/** + * \file SDL_config_morphos.h + * + * This is the MorphOS configuration used to build SDL. + */ + +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDINT_H 1 +#if !defined(BUILD_SDL2_LIBRARY) +#define HAVE_SIGNAL_H 1 +#endif + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +#define SIZEOF_VOIDP sizeof(IPTR) + +/* Useful headers */ +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#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_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_STRTOD 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_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 + +#define HAVE_WCHAR_H 1 +//#define HAVE_ICONV_H 1 +//#define HAVE_ICONV 1 +#define HAVE_STDIO_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_ACOSF 1 +#define HAVE_ASINF 1 +#define HAVE_CEILF 1 +#define HAVE_COPYSIGNF 1 +#define HAVE_FABSF 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POWF 1 +#define HAVE_SCALBNF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 + +#define HAVE_ALTIVEC_H 1 +#define SDL_ENABLE_ALTIVEC_H 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_AHI 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable haptic drivers */ +#define SDL_HAPTIC_DUMMY 1 + +/* Enable SENSOR */ +#define SDL_SENSOR_DUMMY 1 + +/* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ +//#define SDL_JOYSTICK_AMIGA 1 +/* Enable MORPHOS SENSORS JOYSTICK/GAMEPAD */ +#define SDL_JOYSTICK_MORPHOS 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable thread support */ +#define SDL_THREAD_MORPHOS 1 + +/* Enable timer support */ +#define SDL_TIMERS_AMIGA 1 + +/* Enable video driver */ +#define SDL_VIDEO_DRIVER_AMIGA 1 + +/* Enable filesystem driver */ +#define SDL_FILESYSTEM_AMIGA 1 + +/* Enable system power support */ +#define SDL_POWER_MORPHOS 1 + +/* Enable assembly routines */ +#define SDL_ALTIVEC_BLITTERS 1 + +/* Maybe later */ +#ifndef SDL_VIDEO_RENDER_OGL +//#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif + +#if defined(__MORPHOS__) + #if defined(__SDL_DEBUG) + #include + extern struct ExecBase *SysBase; + #define D(fmt, ...) ({((STRPTR (*)(void *, CONST_STRPTR , APTR (*)(APTR, UBYTE), STRPTR , ...))*(void**)((long)(SysBase) - 922))((void*)(SysBase), fmt, (APTR)1, NULL, ##__VA_ARGS__);}) + #else + #define D(fmt, ...) + #endif +#else + #define D(fmt, ...) +#endif + +#endif /* _SDL_config_morphos_h */ diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 96ae3f4c7d..2c489cfd21 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -44,6 +44,12 @@ #include "SDL_opengl_glext.h" +#elif defined(__MORPHOS__) + +#include +#include +#include "SDL_opengl_glext.h" + #else #ifndef __IPHONEOS__ /* No OpenGL on iOS. */ diff --git a/include/SDL_opengl_glext.h b/include/SDL_opengl_glext.h index 6a402b15a2..8e29554738 100644 --- a/include/SDL_opengl_glext.h +++ b/include/SDL_opengl_glext.h @@ -1409,7 +1409,9 @@ typedef unsigned __int64 uint64_t; #include #endif #endif +#ifndef __MORPHOS__ typedef uint64_t GLuint64; +#endif typedef int64_t GLint64; #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 @@ -2597,7 +2599,9 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #ifndef GL_ARB_bindless_texture #define GL_ARB_bindless_texture 1 +#ifndef __MORPHOS__ typedef uint64_t GLuint64EXT; +#endif #define GL_UNSIGNED_INT64_ARB 0x140F typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 2e6225fcbd..ee92bf5984 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -45,7 +45,8 @@ extern "C" { #define SDL_RWOPS_JNIFILE 3U /**< Android asset */ #define SDL_RWOPS_MEMORY 4U /**< Memory stream */ #define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ - +#define SDL_RWOPS_AMIGAFILE 6U /**< Amiga file */ + /** * This is the read/write operation structure -- very basic. */ @@ -91,6 +92,11 @@ typedef struct SDL_RWops int (SDLCALL * close) (struct SDL_RWops * context); Uint32 type; + + #if defined(__MORPHOS__) + void *r13; /* must be at offset 24 and outside union (or change fileop routine accordingly) */ + #endif + union { #if defined(__ANDROID__) @@ -110,6 +116,18 @@ typedef struct SDL_RWops size_t left; } buffer; } windowsio; +#elif defined(__MORPHOS__) + struct + { + Uint8 AppendMode : 1, NoSeek : 1, IsAtEnd : 1, autoclose : 1; + Uint8 Writable : 1, Readable : 1; + + union + { + size_t dos; + void *libc; + } fp; + } amigaio; #endif #ifdef HAVE_STDIO_H @@ -145,7 +163,7 @@ typedef struct SDL_RWops extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, const char *mode); -#ifdef HAVE_STDIO_H +#if defined(HAVE_STDIO_H) && !defined(__MORPHOS__) extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose); #else diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index e4178673f8..28e8478fcc 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -136,6 +136,7 @@ typedef enum SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ SDL_SYSWM_WINRT, SDL_SYSWM_OS4, + SDL_SYSWM_AMIGA, SDL_SYSWM_ANDROID, SDL_SYSWM_VIVANTE, SDL_SYSWM_OS2, @@ -302,6 +303,13 @@ struct SDL_SysWMinfo } os4; #endif +#if defined(SDL_VIDEO_DRIVER_AMIGA) + struct + { + struct Window *window; /**< Intuition window */ + } intui; +#endif + #if defined(SDL_VIDEO_DRIVER_OS2) struct { diff --git a/include/SDL_test.h b/include/SDL_test.h index f3b84f990e..5c2c24671c 100644 --- a/include/SDL_test.h +++ b/include/SDL_test.h @@ -44,6 +44,14 @@ #include "SDL_test_memory.h" #include "SDL_test_random.h" +#if defined(__MORPHOS__) +#ifndef LLONG_MIN +#define LLONG_MIN (-9223372036854775807LL - 1) +#define LLONG_MAX 9223372036854775807LL +#define ULLONG_MAX 18446744073709551615ULL +#endif +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus diff --git a/src/SDL.c b/src/SDL.c index 5f7e4a9f00..6230e01a46 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -83,6 +83,9 @@ SDL_NORETURN void SDL_ExitProcess(int exitcode) exit(exitcode); #elif defined(__HAIKU__) /* Haiku has _Exit, but it's not marked noreturn. */ _exit(exitcode); +#elif defined(__MORPHOS__) + extern void (*morphos_exit)(int exitcode); + morphos_exit(exitcode); #elif defined(HAVE__EXIT) /* Upper case _Exit() */ _Exit(exitcode); #else @@ -541,6 +544,8 @@ SDL_GetPlatform() return "PlayStation Portable"; #elif __AMIGAOS4__ return "AmigaOS 4"; +#elif __MORPHOS__ + return "MorphOS"; #else return "Unknown (see SDL_platform.h)"; #endif diff --git a/src/SDL_error.c b/src/SDL_error.c index 3e5d491b0b..b560c5673b 100644 --- a/src/SDL_error.c +++ b/src/SDL_error.c @@ -28,7 +28,11 @@ #define SDL_ERRBUFIZE 1024 int +#ifdef __MORPHOS__ +SDL_VSetError(const char *fmt, va_list ap) +#else SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +#endif { /* Ignore call if invalid format pointer was passed */ if (fmt != NULL) { @@ -37,9 +41,13 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) error->error = 1; /* mark error as valid */ +#ifndef __MORPHOS__ va_start(ap, fmt); +#endif SDL_vsnprintf(error->str, ERR_MAX_STRLEN, fmt, ap); +#ifndef __MORPHOS__ va_end(ap); +#endif if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { /* If we are in debug mode, print out the error message */ @@ -50,6 +58,19 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) return -1; } +#ifdef __MORPHOS__ +int +SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +{ + int rc; + va_list ap; + va_start(ap, fmt); + rc = SDL_VSetError(fmt, ap); + va_end(ap); + return rc; +} +#endif + /* Available for backwards compatibility */ const char * SDL_GetError(void) diff --git a/src/SDL_log.c b/src/SDL_log.c index 73c4c14a9b..bc5f2a472b 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -37,6 +37,10 @@ #include #endif +#if defined(__MORPHOS__) +#include +#endif + #define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL #define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN #define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO @@ -422,6 +426,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); fclose (pFile); } +#elif defined(__MORPHOS__) + NewRawDoFmt("%s: %s\n", (APTR)1, NULL, SDL_priority_prefixes[priority], message); #endif #if HAVE_STDIO_H fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 34636e1303..ca1ae1d579 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -115,6 +115,9 @@ static const AudioBootStrap *const bootstrap[] = { #endif #if SDL_AUDIO_DRIVER_DUMMY &DUMMYAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_AHI + &AHIAUD_bootstrap, #endif NULL }; diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index 94749c1d40..9b27649f77 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -208,6 +208,7 @@ extern AudioBootStrap ANDROIDAUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; extern AudioBootStrap AMIGAOS4AUDIO_bootstrap; +extern AudioBootStrap AHIAUD_bootstrap; extern AudioBootStrap OS2AUDIO_bootstrap; #endif /* SDL_sysaudio_h_ */ diff --git a/src/audio/ahi/SDL_ahi_audio.c b/src/audio/ahi/SDL_ahi_audio.c new file mode 100644 index 0000000000..f75027cf8e --- /dev/null +++ b/src/audio/ahi/SDL_ahi_audio.c @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_ahi_audio.h" +#include "../../core/morphos/SDL_cpu.h" + +#include +#include + +#include +#include +#include + +static void +AHIAUD_WaitDevice(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + struct AHIRequest *req = &hidden->req[hidden->current_buffer]; + + if (req->ahir_Std.io_Data) + { + WaitIO((struct IORequest *)req); + + req->ahir_Std.io_Data = NULL; + + GetMsg(&hidden->ahiport); + } +} + +static void +AHIAUD_PlayDevice(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + struct AHIRequest *req; + ULONG current, current2; + + current = hidden->current_buffer; + current2 = current ^ 1; + req = &hidden->req[current]; + + req->ahir_Std.io_Data = hidden->buffers[current]; + req->ahir_Std.io_Length = this->spec.size; + req->ahir_Std.io_Offset = 0; + req->ahir_Frequency = this->spec.freq; + req->ahir_Volume = 0x10000; + req->ahir_Type = hidden->sample_format; + req->ahir_Position = 0x8000; + req->ahir_Link = (hidden->playing ? &hidden->req[current2] : NULL); + + hidden->current_buffer = current2; + hidden->playing = 1; + + switch (hidden->convert) + { + case AMIAUD_CONVERT_NONE : break; + case AMIAUD_CONVERT_SWAP16: AMIGA_Swap16(hidden->buffers[current], hidden->buffers[current], this->spec.size / 2); break; + case AMIAUD_CONVERT_SWAP32: AMIGA_Swap32(hidden->buffers[current], hidden->buffers[current], this->spec.size / 2); break; + } + + SendIO((struct IORequest *)req); +} + +static Uint8 * +AHIAUD_GetDeviceBuf(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + return (Uint8 *) hidden->buffers[hidden->current_buffer]; +} + +/*static void +AHIAUD_WaitDone(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + int i; + + for (i = 0; i < 2; i++) + { + struct AHIRequest *req = &hidden->req[i]; + + if (req->ahir_Std.io_Data) + { + WaitIO((struct IORequest *)req); + } + } +}*/ + +static void +AHIAUD_CloseDevice(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + + this->hidden = NULL; + + CloseDevice((struct IORequest *)&hidden->req[0].ahir_Std); + SDL_free(hidden); +} + +static void +AHIAUD_ThreadInit(_THIS) +{ + struct SDL_PrivateAudioData *hidden = this->hidden; + + hidden->ahiport.mp_Node.ln_Pri = 60; + hidden->ahiport.mp_Flags = PA_SIGNAL; + hidden->ahiport.mp_SigBit = SIGBREAKB_CTRL_E; + hidden->ahiport.mp_SigTask = SysBase->ThisTask; + + NEWLIST(&hidden->ahiport.mp_MsgList); + + bcopy(&hidden->req[0], &hidden->req[1], sizeof(hidden->req[1])); +} + +static int +AHIAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + struct SDL_PrivateAudioData *hidden; + SDL_AudioFormat test_format; + int sample_format = -1; + UBYTE convert = AMIAUD_CONVERT_NONE; + + if (iscapture) + return SDL_SetError("Capture not supported."); + + if ((this->spec.format & 0xff) != 8) { + this->spec.format = AUDIO_S16MSB; + } + + + + test_format = SDL_FirstAudioFormat(this->spec.format); + + while (sample_format < 0 && test_format) + { + convert = AMIAUD_CONVERT_NONE; + switch (test_format) + { + case AUDIO_U8: + case AUDIO_S8: + sample_format = this->spec.channels == 1 ? AHIST_M8S : AHIST_S8S; break; + break; + case AUDIO_S16LSB:// convert = AMIAUD_CONVERT_SWAP16; + case AUDIO_S16MSB: sample_format = this->spec.channels == 1 ? AHIST_M16S : AHIST_S16S; break; + + case AUDIO_S32LSB://convert = AMIAUD_CONVERT_SWAP32; + case AUDIO_S32MSB: sample_format = this->spec.channels == 1 ? AHIST_M32S : AHIST_S32S; break; + + default: + D("[%s] unsupported SDL format 0x%ld\n", __FUNCTION__, test_format); + test_format = SDL_NextAudioFormat(); + break; + } + } + + if (sample_format < 0) + return SDL_SetError("Unsupported audio format"); + + D("[%s] AHI sample format is %ld\n", __FUNCTION__, sample_format); + + if (this->spec.channels > 2) + this->spec.channels = 2; + + if (this->spec.samples > 1024) + { + this->spec.samples = MAX(this->spec.freq / 20, 256); + this->spec.samples = (this->spec.samples + 7) & ~7; + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + hidden = (APTR)SDL_malloc(sizeof(*hidden) + this->spec.size * 2); + + if (hidden == NULL) + return SDL_OutOfMemory(); + + hidden->req[0].ahir_Std.io_Message.mn_ReplyPort = &hidden->ahiport; + hidden->req[0].ahir_Std.io_Message.mn_Length = sizeof(struct AHIRequest); + hidden->req[0].ahir_Std.io_Command = CMD_WRITE; + hidden->req[0].ahir_Std.io_Data = NULL; + hidden->req[0].ahir_Version = 6; + + hidden->buffers[0] = &hidden->mixbuf[0]; + hidden->buffers[1] = &hidden->mixbuf[this->spec.size]; + hidden->convert = convert; + hidden->current_buffer = 0; + hidden->sample_format = sample_format; + hidden->playing = 0; + + this->hidden = hidden; + + if (OpenDevice(AHINAME, 0, (struct IORequest *)&hidden->req[0].ahir_Std, 0) != 0) + { + SDL_SetError("Unable to open ahi.device unit 0! Error code %d.\n", hidden->req[0].ahir_Std.io_Error); + SDL_free(hidden); + return -1; + } + return 0; +} + +static int +AHIAUD_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + // TODO + + return 0; +} + +static int +AHIAUD_Init(SDL_AudioDriverImpl * impl) +{ + /* Set the function pointers */ + impl->OpenDevice = AHIAUD_OpenDevice; + impl->ThreadInit = AHIAUD_ThreadInit; + impl->PlayDevice = AHIAUD_PlayDevice; + impl->WaitDevice = AHIAUD_WaitDevice; + //impl->WaitDone = AHIAUD_WaitDone; + impl->CaptureFromDevice = AHIAUD_CaptureFromDevice; + impl->GetDeviceBuf = AHIAUD_GetDeviceBuf; + impl->CloseDevice = AHIAUD_CloseDevice; + + impl->HasCaptureSupport = 0; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 0; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap AHIAUD_bootstrap = { + "ahi", "Amiga AHI audio driver", AHIAUD_Init, 0 +}; diff --git a/src/audio/ahi/SDL_ahi_audio.h b/src/audio/ahi/SDL_ahi_audio.h new file mode 100644 index 0000000000..f1f0861d62 --- /dev/null +++ b/src/audio/ahi/SDL_ahi_audio.h @@ -0,0 +1,54 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_ahi_audio_h +#define _SDL_ahi_audio_h + +#include "../SDL_sysaudio.h" + +#include + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +typedef enum +{ + AMIAUD_CONVERT_NONE, + AMIAUD_CONVERT_SWAP16, + AMIAUD_CONVERT_SWAP32 +} CONVTYPE; + +struct SDL_PrivateAudioData +{ + struct MsgPort ahiport; + struct AHIRequest req[2]; + + APTR buffers[2]; + UBYTE convert; + UBYTE current_buffer; + UBYTE sample_format; + UBYTE playing; + + UBYTE mixbuf[0]; +}; + +#endif /* _SDL_ahi_audio_h */ diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h new file mode 100644 index 0000000000..82ad76180d --- /dev/null +++ b/src/core/morphos/SDL_amigaversion.h @@ -0,0 +1,5 @@ +#define str(s) #s +#define xstr(s) str(s) +#define VERSION 53 +#define REVISION 3 +#define VERSTAG "\0$VER: sdl2.library " xstr(VERSION) "." xstr(REVISION) " (" __AMIGADATE__ ") © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" \ No newline at end of file diff --git a/src/core/morphos/SDL_cpu.c b/src/core/morphos/SDL_cpu.c new file mode 100644 index 0000000000..017a9601cc --- /dev/null +++ b/src/core/morphos/SDL_cpu.c @@ -0,0 +1,263 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_stdinc.h" + +#define USE_ALTIVEC_BLITTERS 1 + +#if USE_ALTIVEC_BLITTERS +#include +#endif +#include + +#include "SDL_library.h" + +void copy_and_swap16_generic(APTR src, APTR dst, LONG size); +asm( +" .section \".text\"\n" +" .align 2\n" +" .type copy_and_swap16_generic,@function\n" +" .globl copy_and_swap16_generic\n" +"copy_and_swap16_generic:\n" +" li 0,0\n" +" andi. 9,4,3\n" +" dcbt 0,3\n" +" li 11,32\n" +" addi 4,4,-2\n" +" beq .was_even\n" +" lhbrx 7,3,0\n" +" addi 5,5,-1\n" +" addi 3,3,2\n" +" sthu 7,2(4)\n" +".was_even:\n" +" cmpwi 5,7\n" +" li 10,4\n" +" ble .tailcopy\n" +" addi 4,4,-2\n" +".loop:\n" +" lwbrx 6,3,0\n" +" addi 5,5,-8\n" +" dcbt 11,3\n" +" lwbrx 7,3,10\n" +" cmpwi 5,7\n" +" rlwimi 6,6,16,0,31\n" +" addi 3,3,8\n" +" rlwimi 7,7,16,0,31\n" +" lwbrx 8,3,0\n" +" stw 6,4(4)\n" +" lwbrx 9,3,10\n" +" rlwimi 8,8,16,0,31\n" +" stw 7,8(4)\n" +" stw 8,12(4)\n" +" rlwimi 9,9,16,0,31\n" +" addi 3,3,8\n" +" stwu 9,16(4)\n" +" bgt .loop\n" +" addi 4,4,2\n" +".tailcopy:\n" +" cmpwi 5,0\n" +" subf 0,4,3\n" +" mtctr 5\n" +" bclr 4,1\n" +".tail:\n" +" lhbrx 6,4,0\n" +" sthu 6,2(4)\n" +" bdnz .tail\n" +" blr\n" +); + +void copy_and_swap32_generic(APTR src, APTR dst, LONG size); +asm( +" .section \".text\"\n" +" .align 2\n" +" .type copy_and_swap32_generic,@function\n" +" .globl copy_and_swap32_generic\n" +"copy_and_swap32_generic:\n" +" li 0,0\n" +" andi. 9,4,3\n" +" dcbt 0,3\n" +" li 11,32\n" +" addi 4,4,-4\n" +" beq .was_even4\n" +" lwbrx 7,3,0\n" +" addi 5,5,-1\n" +" addi 3,3,4\n" +" stwu 7,4(4)\n" +".was_even4:\n" +" cmpwi 5,3\n" +" li 10,4\n" +" ble .tailcopy4\n" +" addi 4,4,-4\n" +".loop4:\n" +" lwbrx 6,3,0\n" /* 0(r3) */ +" addi 5,5,-4\n" +" dcbt 11,3\n" +" lwbrx 7,3,10\n" /* 4(r3) */ +" addi 3,3,8\n" +" cmpwi 5,7\n" +" lwbrx 8,3,0\n" +" stw 6,4(4)\n" +" lwbrx 9,3,10\n" +" stw 7,8(4)\n" +" stw 8,12(4)\n" +" addi 3,3,8\n" +" stwu 9,16(4)\n" +" bgt .loop4\n" +" addi 4,4,4\n" +".tailcopy4:\n" +" cmpwi 5,0\n" +" subf 0,4,3\n" +" mtctr 5\n" +" bclr 4,1\n" +".tail4:\n" +" lwbrx 6,4,0\n" +" stwu 6,4(4)\n" +" bdnz .tail4\n" +" blr\n" +); + +/* AltiVec routines written by Grzegorz Kraszewski + * + * Length is given in pixels (number of M68k UWORDs to swap) + */ + +void AMIGA_Swap16(APTR srcx, APTR destx, LONG units) +{ + #if USE_ALTIVEC_BLITTERS + if (units >= 32 && HasAltiVec) + { + IPTR p1, p2; + + /* Test if the same alignment and not an odd address */ + + p1 = (IPTR)srcx & 0xf; + p2 = (IPTR)destx & 0xf; + + if (p1 == p2 && (!p1 || ((!(p1 & 1)) && units >= 40))) + { + VECTOR_UBYTE pr = (VECTOR_UBYTE)vec_rl((VECTOR_UWORD)vec_lvsl(0, (short*)NULL), vec_splat_u16(8)); //(VECTOR_UBYTE)VEC_VALUE(0x01, 0x00, 0x03, 0x02, 0x05, 0x04, 0x07, 0x06, 0x09, 0x08, 0x0B, 0x0A, 0x0D, 0x0C, 0x0F, 0x0E); + VECTOR_UBYTE lda, ldb, ldc, ldd; + VECTOR_UBYTE *src; + VECTOR_UBYTE *dest; + + if (p1) + { + /* Was not aligned to 16 bytes, copy few bytes first... */ + + ULONG pix = (16 - p1) / 2; + + copy_and_swap16_generic(srcx, destx, pix); + + units -= pix; + srcx = (APTR)((IPTR)srcx + pix * 2); + destx = (APTR)((IPTR)destx + pix * 2); + } + + src = (VECTOR_UBYTE*)srcx; + dest = (VECTOR_UBYTE*)destx; + + do + { + vec_dstt(src + 8, VEC_DST_BLOCKS(320, 1, 320), 0); + lda = *src++; + ldb = *src++; + units -= 32; + ldc = *src++; + *dest++ = vec_perm(lda, lda, pr); + ldd = *src++; + *dest++ = vec_perm(ldb, ldb, pr); + *dest++ = vec_perm(ldc, ldc, pr); + *dest++ = vec_perm(ldd, ldd, pr); + } while (units >= 32); + + srcx = src; + destx = dest; + } + } + #endif + + if (units > 0) + { + copy_and_swap16_generic(srcx, destx, units); + } +} + +void AMIGA_Swap32(APTR srcx, APTR destx, LONG units) +{ + #if USE_ALTIVEC_BLITTERS + if (units >= 32 && HasAltiVec) + { + IPTR p1, p2; + + /* Test if the same alignment and not an odd address */ + + p1 = (IPTR)srcx & 0xf; + p2 = (IPTR)destx & 0xf; + + if (p1 == p2 && (!p1 || ((!(p1 & 3)) && units >= 40))) + { + VECTOR_UBYTE pr = vec_xor(vec_lvsl(0, (short*)NULL), vec_splat_u8(3)); + VECTOR_UBYTE lda, ldb, ldc, ldd; + VECTOR_UBYTE *src; + VECTOR_UBYTE *dest; + + if (p1) + { + /* Was not aligned to 16 bytes, copy few bytes first... */ + + ULONG pix = (16 - p1) / 4; + + copy_and_swap32_generic(srcx, destx, pix); + + units -= pix; + srcx = (APTR)((IPTR)srcx + pix * 4); + destx = (APTR)((IPTR)destx + pix * 4); + } + + src = (VECTOR_UBYTE*)srcx; + dest = (VECTOR_UBYTE*)destx; + + do + { + vec_dstt(src + 8, VEC_DST_BLOCKS(320, 1, 320), 0); + lda = *src++; + ldb = *src++; + units -= 16; + ldc = *src++; + *dest++ = vec_perm(lda, lda, pr); + ldd = *src++; + *dest++ = vec_perm(ldb, ldb, pr); + *dest++ = vec_perm(ldc, ldc, pr); + *dest++ = vec_perm(ldd, ldd, pr); + } while (units >= 16); + + srcx = src; + destx = dest; + } + } + #endif + + if (units > 0) + { + copy_and_swap32_generic(srcx, destx, units); + } +} diff --git a/src/core/morphos/SDL_cpu.h b/src/core/morphos/SDL_cpu.h new file mode 100644 index 0000000000..4ebb7608ea --- /dev/null +++ b/src/core/morphos/SDL_cpu.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_CORE_AMIGA_MISC_H +#define SDL_CORE_AMIGA_MISC_H + +#include "../../SDL_internal.h" + +#ifndef EXEC_TYPES_H +#include +#endif + +extern void AMIGA_Swap16(APTR srcx, APTR destx, LONG units); +extern void AMIGA_Swap32(APTR srcx, APTR destx, LONG units); + +#endif /* SDL_CORE_AMIGA_MISC_H */ diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c new file mode 100644 index 0000000000..27e3c0be6c --- /dev/null +++ b/src/core/morphos/SDL_library.c @@ -0,0 +1,537 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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 + +#include +#include +#include +#include +#include +#include + +#include "SDL_amigaversion.h" +#include "SDL_library.h" +#include "SDL_startup.h" + +STATIC CONST TEXT __TEXTSEGMENT__ verstring[] = VERSTAG; +STATIC CONST TEXT libname[] = "sdl2.library"; + +struct SDL_Library *GlobalBase = NULL; + +struct ExecBase *SysBase = NULL; +struct DosLibrary *DOSBase = NULL; +struct IntuitionBase *IntuitionBase = NULL; +struct GfxBase *GfxBase = NULL; +struct Library *UtilityBase = NULL; +struct Library *CyberGfxBase = NULL; +struct Library *KeymapBase = NULL; +struct Library *WorkbenchBase = NULL; +struct Library *IconBase = NULL; +struct Library *MUIMasterBase = NULL; +struct Library *CxBase = NULL; +struct Library *ScreenNotifyBase = NULL; +struct Library *TimerBase = NULL; +struct Library *LocaleBase = NULL; +struct Library *SensorsBase = NULL; +struct Library *IFFParseBase = NULL; +struct Library *CharsetsBase = NULL; +struct Library *IConvBase = NULL; +struct Library *ThreadPoolBase = NULL; +struct Library *DynLoadBase = NULL; +struct Library *OpenURLBase = NULL; +struct Library *GadToolsBase = NULL; +//SDL_JOYSTICK_AMIGA +// struct Library *LowLevelBase = NULL; + +struct NewMenu SDL_NewMenu[] = +{ + { NM_TITLE, (char *)"Project", 0, 0, 0, (APTR)MID_PROJECT }, + { NM_ITEM , (char *)"About...", (const STRPTR)"A", 0, 0, (APTR)MID_ABOUT }, + { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL }, + { NM_ITEM , (char *)"Hide", (const STRPTR)"H",, 0, 0, (APTR)MID_HIDE }, + { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL }, + { NM_ITEM , (char *)"Quit", (const STRPTR)"Q", 0, 0, (APTR)MID_QUIT} +}; + +struct timerequest GlobalTimeReq; + +u_int32_t DataL1LineSize = 0; +BYTE HasAltiVec = 0; + +/********************************************************************** + LIB_Reserved +**********************************************************************/ + +STATIC ULONG LIB_Reserved(void) +{ + return 0; +} + +/********************************************************************** + comp_ctdt + + Sort constructors/destructors +**********************************************************************/ + +STATIC int comp_ctdt(struct CTDT *a, struct CTDT *b) +{ + if (a->priority == b->priority) + return (0); + if ((unsigned long)a->priority < (unsigned long) b->priority) + return (-1); + + return (1); +} + +STATIC VOID sort_ctdt(struct SDL_Library *LibBase) +{ + extern struct CTDT __ctdtlist; + struct CTDT *ctdtlist = &__ctdtlist; + + struct HunkSegment *seg = (struct HunkSegment *)(((unsigned int)ctdtlist) - sizeof(struct HunkSegment)); + struct CTDT *_last_ctdt = (struct CTDT *)(((unsigned int)seg) + seg->Size); + + qsort((struct CTDT *)ctdtlist, _last_ctdt - ctdtlist, sizeof(*ctdtlist), (int (*)(const void *, const void *))comp_ctdt); + + LibBase->ctdtlist = ctdtlist; + LibBase->last_ctdt = _last_ctdt; +} + +/********************************************************************** + init_system +**********************************************************************/ + +STATIC void init_system(struct SDL_Library *LibBase, struct ExecBase *SysBase) +{ + u_int32_t value; + + NewGetSystemAttrsA(&value, sizeof(value), SYSTEMINFOTYPE_PPC_DCACHEL1LINESIZE, NULL); + + if (value < 32) + value = 32; + + DataL1LineSize = value; + + if (NewGetSystemAttrsA(&value, sizeof(value), SYSTEMINFOTYPE_PPC_ALTIVEC, NULL)) + { + if (value) + { +#if 0 + STATIC CONST IPTR tags[] = { SETFUNCTAG_TYPE, SETFUNCTYPE_SYSTEMV, TAG_DONE }; + #define LVO_copy_and_swap16 -1168 + #define LVO_copy_and_swap32 -1174 + + copy_and_swap16 = (APTR)©_and_swap16_altivec; + copy_and_swap32 = (APTR)©_and_swap32_altivec; + + NewSetFunction((APTR)LibBase, (APTR)©_and_swap16_altivec, LVO_copy_and_swap16, (struct TagItem *)&tags); + NewSetFunction((APTR)LibBase, (APTR)©_and_swap32_altivec, LVO_copy_and_swap32, (struct TagItem *)&tags); +#endif + + HasAltiVec = 1; + } + } +} + +/********************************************************************** + init_libs +**********************************************************************/ + +static int init_libs(struct SDL_Library *base, struct ExecBase *SysBase) +{ + if ((GfxBase = base->MyGfxBase = (APTR)OpenLibrary("graphics.library", 39)) != NULL) + if ((DOSBase = base->MyDOSBase = (APTR)OpenLibrary("dos.library", 36)) != NULL) + if ((IntuitionBase = base->MyIntuiBase = (APTR)OpenLibrary("intuition.library", 39)) != NULL) + if ((UtilityBase = OpenLibrary("utility.library", 36)) != NULL) + if (OpenDevice("timer.device", UNIT_MICROHZ, &GlobalTimeReq.tr_node, 0) == 0) + { + TimerBase = (struct Library *)GlobalTimeReq.tr_node.io_Device; + + sort_ctdt(base); + init_system(base, SysBase); + + return 1; + } + + return 0; +} + +/********************************************************************** + data relocs +**********************************************************************/ + +#define R13_OFFSET 0x8000 + +extern int __datadata_relocs(void); + +STATIC __inline int __dbsize(void) +{ + extern APTR __sdata_size, __sbss_size; + STATIC CONST ULONG size[] = + { + (ULONG)&__sdata_size, (ULONG)&__sbss_size + }; + return size[0] + size[1]; +} + +/********************************************************************** + LIB_Init +**********************************************************************/ + +struct Library *LIB_Init(struct SDL_Library *LibBase, BPTR SegList, struct ExecBase *sysBase) +{ + register char *r13; + + GlobalBase = LibBase; + SysBase = sysBase; + + LibBase->Library.lib_Node.ln_Pri = -5; +#ifndef __MORPHOS__ + LibBase->Library.lib_Revision = COMPILE_REVISION; +#endif + + asm volatile ("lis %0,__r13_init@ha; addi %0,%0,__r13_init@l" : "=r" (r13)); + + LibBase->SegList = SegList; + LibBase->DataSeg = r13 - R13_OFFSET; + LibBase->DataSize = __dbsize(); + LibBase->Parent = NULL; + LibBase->MySysBase = sysBase; + + NEWLIST(&LibBase->TaskContext.TaskList); + + InitSemaphore(&LibBase->Semaphore); + + if (init_libs(LibBase, sysBase) == 0) + { + FreeMem((APTR)((ULONG)(LibBase) - (ULONG)(LibBase->Library.lib_NegSize)), LibBase->Library.lib_NegSize + LibBase->Library.lib_PosSize); + LibBase = NULL; + } + + return (struct Library *)LibBase; +} + +/********************************************************************** + DeleteLib +**********************************************************************/ + +static BPTR DeleteLib(struct SDL_Library *LibBase, struct ExecBase *SysBase) +{ + BPTR SegList = 0; + + if (LibBase->Library.lib_OpenCnt == 0) + { + CloseLibrary((struct Library *)LibBase->MyGfxBase); + CloseLibrary((struct Library *)LibBase->MyDOSBase); + CloseLibrary((struct Library *)LibBase->MyIntuiBase); + CloseLibrary(UtilityBase); + CloseDevice(&GlobalTimeReq.tr_node); + + SegList = LibBase->SegList; + + REMOVE(&LibBase->Library.lib_Node); + FreeMem((APTR)((ULONG)(LibBase) - (ULONG)(LibBase->Library.lib_NegSize)), LibBase->Library.lib_NegSize + LibBase->Library.lib_PosSize); + } + + return SegList; +} + +/********************************************************************** + UserLibClose +**********************************************************************/ + +static void UserLibClose(struct SDL_Library *LibBase, struct ExecBase *SysBase) +{ + CloseLibrary(LibBase->MyCyberGfxBase); + CloseLibrary(LibBase->MyKeymapBase); + CloseLibrary(LibBase->MyWorkbenchBase); + CloseLibrary(LibBase->MyIconBase); + CloseLibrary(LibBase->MyMUIMasterBase); + CloseLibrary(LibBase->MyCxBase); + CloseLibrary(LibBase->MyScreenNotifyBase); + CloseLibrary(LocaleBase); + CloseLibrary(SensorsBase); + CloseLibrary(IFFParseBase); + CloseLibrary(CharsetsBase); + CloseLibrary(IConvBase); + CloseLibrary(ThreadPoolBase); + CloseLibrary(DynLoadBase); + CloseLibrary(OpenURLBase); + CloseLibrary(GadToolsBase); + + CyberGfxBase = LibBase->MyCyberGfxBase = NULL; + KeymapBase = LibBase->MyKeymapBase = NULL; + WorkbenchBase = LibBase->MyWorkbenchBase = NULL; + IconBase = LibBase->MyIconBase = NULL; + MUIMasterBase = LibBase->MyMUIMasterBase = NULL; + CxBase = LibBase->MyCxBase = NULL; + ScreenNotifyBase = LibBase->MyScreenNotifyBase = NULL; + + LocaleBase = NULL; + SensorsBase = NULL; + IFFParseBase = NULL; + CharsetsBase = NULL; + IConvBase = NULL; + ThreadPoolBase = NULL; + DynLoadBase = NULL; + OpenURLBase = NULL; + GadToolsBase = NULL; +} + +/********************************************************************** + LIB_Expunge +**********************************************************************/ + +BPTR LIB_Expunge(void) +{ + struct SDL_Library *LibBase = (struct SDL_Library *)REG_A6; + LibBase->Library.lib_Flags |= LIBF_DELEXP; + return DeleteLib(LibBase, LibBase->MySysBase); +} + +/********************************************************************** + LIB_Close +*********************************************************************/ + +BPTR LIB_Close(void) +{ + struct SDL_Library *LibBase = (struct SDL_Library *)REG_A6; + struct ExecBase *SysBase = LibBase->MySysBase; + BPTR SegList = 0; + + if (LibBase->Parent) + { + struct SDL_Library *ChildBase = LibBase; + + if ((--ChildBase->Library.lib_OpenCnt) > 0) + return 0; + + LibBase = ChildBase->Parent; + + REMOVE(&ChildBase->TaskContext.TaskNode.Node); + + AMIGA_Cleanup(ChildBase); + FreeVecTaskPooled((APTR)((ULONG)(ChildBase) - (ULONG)(ChildBase->Library.lib_NegSize))); + } + + ObtainSemaphore(&LibBase->Semaphore); + + LibBase->Library.lib_OpenCnt--; + + if (LibBase->Library.lib_OpenCnt == 0) + { + LibBase->Alloc = 0; + UserLibClose(LibBase, SysBase); + } + + ReleaseSemaphore(&LibBase->Semaphore); + + if (LibBase->Library.lib_Flags & LIBF_DELEXP) + SegList = DeleteLib(LibBase, SysBase); + + return SegList; +} + +/********************************************************************** + LIB_Open +**********************************************************************/ + +struct Library *LIB_Open(void) +{ + struct SDL_Library *LibBase = (struct SDL_Library *)REG_A6; + struct SDL_Library *newbase, *childbase; + struct ExecBase *SysBase = LibBase->MySysBase; + struct Task *MyTask = SysBase->ThisTask; + struct TaskNode *ChildNode; + ULONG MyBaseSize; + + /* Has this task already opened a child? */ + ForeachNode(&LibBase->TaskContext.TaskList, ChildNode) + { + if (ChildNode->Task == MyTask) + { + /* Yep, return it */ + childbase = (APTR)(((ULONG)ChildNode) - offsetof(struct SDL_Library, TaskContext.TaskNode.Node)); + childbase->Library.lib_Flags &= ~LIBF_DELEXP; + childbase->Library.lib_OpenCnt++; + + return(&childbase->Library); + } + } + + childbase = NULL; + MyBaseSize = LibBase->Library.lib_NegSize + LibBase->Library.lib_PosSize; + LibBase->Library.lib_Flags &= ~LIBF_DELEXP; + LibBase->Library.lib_OpenCnt++; + + ObtainSemaphore(&LibBase->Semaphore); + + if (LibBase->Alloc == 0) + { + if (((IntuitionBase = LibBase->MyIntuiBase = (APTR)OpenLibrary("intuition.library" , 39)) != NULL) + && ((CyberGfxBase = LibBase->MyCyberGfxBase = (APTR)OpenLibrary("cybergraphics.library", 40)) != NULL) + && ((KeymapBase = LibBase->MyKeymapBase = (APTR)OpenLibrary("keymap.library" , 36)) != NULL) + && ((WorkbenchBase = LibBase->MyWorkbenchBase = (APTR)OpenLibrary("workbench.library" , 0)) != NULL) + && ((IconBase = LibBase->MyIconBase = (APTR)OpenLibrary("icon.library" , 0)) != NULL) + && ((MUIMasterBase = LibBase->MyMUIMasterBase = (APTR)OpenLibrary("muimaster.library" , 19)) != NULL) + && ((CxBase = LibBase->MyCxBase = (APTR)OpenLibrary("commodities.library" , 37)) != NULL) + && ((ScreenNotifyBase = LibBase->MyScreenNotifyBase = (APTR)OpenLibrary("screennotify.library" , 0)) != NULL) + && ((LocaleBase = OpenLibrary("locale.library" , 0)) != NULL) + && ((SensorsBase = OpenLibrary("sensors.library" , 53)) != NULL) + && ((IFFParseBase = OpenLibrary("iffparse.library" , 0)) != NULL) + && ((CharsetsBase = OpenLibrary("charsets.library" , 53)) != NULL) + && ((IConvBase = OpenLibrary("iconv.library" , 0)) != NULL) + && ((ThreadPoolBase = OpenLibrary("threadpool.library" , 53)) != NULL) + && ((DynLoadBase = OpenLibrary("dynload.library" , 0)) != NULL) + && ((GadToolsBase = OpenLibrary("gadtools.library" , 0)) != NULL) + && ((OpenURLBase = OpenLibrary("openurl.library" , 0)) != NULL)) + { + LibBase->Alloc = 1; + } + else + { + goto error; + } + } + + if ((newbase = AllocVecTaskPooled(MyBaseSize + LibBase->DataSize + 15)) != NULL) + { + CopyMem((APTR)((ULONG)LibBase - (ULONG)LibBase->Library.lib_NegSize), newbase, MyBaseSize); + + childbase = (APTR)((ULONG)newbase + (ULONG)LibBase->Library.lib_NegSize); + + if (LibBase->DataSize) + { + char *orig = LibBase->DataSeg; + LONG *relocs = (LONG *) __datadata_relocs; + int mem = ((int)newbase + MyBaseSize + 15) & (unsigned int) ~15; + + CopyMem(orig, (char *)mem, LibBase->DataSize); + + if (relocs[0] > 0) + { + int i, num_relocs = relocs[0]; + + for (i = 0, relocs++; i < num_relocs; ++i, ++relocs) + { + *(long *)(mem + *relocs) -= (int)orig - mem; + } + } + + childbase->DataSeg = (char *)mem + R13_OFFSET; + + if (AMIGA_Startup(childbase) == 0) + { + AMIGA_Cleanup(childbase); + FreeVecTaskPooled(newbase); + childbase = 0; + goto error; + } + } + + childbase->Parent = LibBase; + childbase->Library.lib_OpenCnt = 1; + + /* Register which task opened this child */ + childbase->TaskContext.TaskNode.Task = MyTask; + ADDTAIL(&LibBase->TaskContext.TaskList, &childbase->TaskContext.TaskNode.Node); + } + else + { +error: + LibBase->Library.lib_OpenCnt--; + + if (LibBase->Library.lib_OpenCnt == 0) + { + LibBase->Alloc = 0; + UserLibClose(LibBase, SysBase); + } + } + + ReleaseSemaphore(&LibBase->Semaphore); + + return (struct Library *)childbase; +} + +/********************************************************************** + Library data +**********************************************************************/ + +#include "SDL_stubs.h" + +extern void LIB_InitTGL(); +extern void LIB_SetExitPointer(); +extern void LIB_SDL_VSetError(); + +static const APTR FuncTable[] = +{ + (APTR)FUNCARRAY_BEGIN, + (APTR)FUNCARRAY_32BIT_NATIVE, + + (APTR)LIB_Open, + (APTR)LIB_Close, + (APTR)LIB_Expunge, + (APTR)LIB_Reserved, + (APTR)-1, + + (APTR)FUNCARRAY_32BIT_SYSTEMV, + + (APTR)LIB_InitTGL, + (APTR)LIB_SetExitPointer, + (APTR)LIB_SDL_VSetError, + + #define GENERATE_POINTERS + #include "SDL_stubs.h" + + (APTR)-1, + (APTR)FUNCARRAY_END +}; + +static const size_t InitTable[] = +{ + sizeof(struct SDL_Library), + (size_t)FuncTable, + 0, + (size_t)LIB_Init +}; + +const struct Resident __TEXTSEGMENT__ RomTag = +{ + RTC_MATCHWORD, + (struct Resident *)&RomTag, + (struct Resident *)&RomTag+1, + RTF_AUTOINIT | RTF_PPC | RTF_EXTENDED, + VERSION, + NT_LIBRARY, + 0, + (char *)libname, + (char *)&verstring[7], + (APTR)&InitTable[0], + REVISION, NULL +}; + +CONST ULONG __abox__ = 1; +__asm("\n.section \".ctdt\",\"a\",@progbits\n__ctdtlist:\n.long -1,-1\n"); diff --git a/src/core/morphos/SDL_library.h b/src/core/morphos/SDL_library.h new file mode 100644 index 0000000000..196bda2932 --- /dev/null +++ b/src/core/morphos/SDL_library.h @@ -0,0 +1,110 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_CORE_AMIGA_LIBRARY_H +#define SDL_CORE_AMIGA_LIBRARY_H + +#include "../../SDL_internal.h" + +#ifndef DOS_DOS_H +#include +#endif + +#ifndef EXEC_LIBRARIES_H +#include +#endif + +#ifndef EXEC_SEMAPHORES_H +#include +#endif + +#define SAVEDS __saveds + +#if defined(__PPC__) +#define __TEXTSEGMENT__ __attribute__((section(".text"))) +#endif + +enum +{ + MID_PROJECT = 0x0010, + MID_ABOUT, + MID_HIDE, + MID_QUIT +}; + +struct CTDT +{ + int (*fp)(void); + long priority; +}; + +struct HunkSegment +{ + unsigned int Size; + struct HunkSegment *Next; +}; + +struct TaskNode +{ + struct MinNode Node; + struct Task *Task; +}; + +struct SDL_Library +{ + struct Library Library; + UWORD Alloc; + APTR DataSeg; /* DON'T CHANGE POSITION */ + + ULONG DataSize; + struct SDL_Library *Parent; + BPTR SegList; + struct ExecBase *MySysBase; + struct DosLibrary *MyDOSBase; + struct IntuitionBase *MyIntuiBase; + struct GfxBase *MyGfxBase; + struct Library *MyCyberGfxBase; + struct Library *MyKeymapBase; + struct Library *MyWorkbenchBase; + struct Library *MyIconBase; + struct Library *MyMUIMasterBase; + struct Library *MyCxBase; + struct Library *MyScreenNotifyBase; + APTR tglcontext; + struct Library **MyTinyGLBase; + void **MyGLContext; + + union + { + struct MinList TaskList; + struct TaskNode TaskNode; + } TaskContext; + + // library management + + struct SignalSemaphore Semaphore; + APTR ctdtlist; + APTR last_ctdt; +}; + +extern BYTE HasAltiVec; + +#endif /* SDL_CORE_AMIGA_LIBRARY_H */ diff --git a/src/core/morphos/SDL_misc.c b/src/core/morphos/SDL_misc.c new file mode 100644 index 0000000000..77b45e0b96 --- /dev/null +++ b/src/core/morphos/SDL_misc.c @@ -0,0 +1,104 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_stdinc.h" + +#include +#include + +#include + +char * +AMIGA_ConvertText(const char *src, LONG srcmib, LONG dstmib) +{ + size_t dstlen, tags[] = { CST_GetDestBytes, (size_t)&dstlen, TAG_DONE }; + char *dst = NULL; + + ConvertTagList((APTR)src, -1, NULL, -1, srcmib, dstmib, (struct TagItem *)&tags); + + dstlen += 1; + dst = SDL_malloc(dstlen); + + if (dst) + ConvertTagList((APTR)src, -1, dst, dstlen, srcmib, dstmib, NULL); + + return dst; +} + +char * +AMIGA_ConvertPath(const char *fn) +{ + CONST_STRPTR src = fn; + ULONG flen = strlen(fn); + BOOL colon = FALSE; + char *dst, *path = SDL_malloc(flen + 2 + 128); + + dst = path; + + if (*src == '/') + { + /* really depends on filesystem layout, hope for the best */ + colon = 1; + src++; + } + + while ((size_t)src < (size_t)(fn + flen)) + { + const char *end = strchr(src, '/'); + int len; + + if(!end) + end = fn + flen; /* last component */ + + len = (size_t)end - (size_t)src; + + if(len == 0 || (len == 1 && src[0] == '.')) + { + /* remove repeated slashes and . */ + } + else + { + if (len == 1 && colon) + { + *dst++ = ':'; + colon = FALSE; + } + else if (len == 2 && src[0] == '.' && src[1] == '.') + { + /* replace .. with the empty string */ + } + else + { + bcopy((void *)src, (void *)dst, len); + dst += len; + } + + if(end < fn + flen) + *dst++ = '/'; + } + + src = end + 1; + } + + *dst++ = '\0'; + return path; +} diff --git a/src/core/morphos/SDL_misc.h b/src/core/morphos/SDL_misc.h new file mode 100644 index 0000000000..a3794d451a --- /dev/null +++ b/src/core/morphos/SDL_misc.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_CORE_AMIGA_MISC_H +#define SDL_CORE_AMIGA_MISC_H + +#include "../../SDL_internal.h" + +#ifndef EXEC_TYPES_H +#include +#endif + +extern char *AMIGA_ConvertText(const char *src, LONG srcmib, LONG dstmib); +extern char *AMIGA_ConvertPath(const char *fn); + +#endif /* SDL_CORE_AMIGA_MISC_H */ diff --git a/src/core/morphos/SDL_startup.c b/src/core/morphos/SDL_startup.c new file mode 100644 index 0000000000..ecb0955d70 --- /dev/null +++ b/src/core/morphos/SDL_startup.c @@ -0,0 +1,132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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 USE_INLINE_STDARG + +#include +#include + +#include "SDL_library.h" + +/*********************************************************************/ +struct SDL_Library *SDL2Base; +struct Library *TinyGLBase; + +int ThisRequiresConstructorHandling = 0; + +/* This function must preserve all registers except r13 */ +asm +("\n" +" .section \".text\"\n" +" .align 2\n" +" .type __restore_r13, @function\n" +"__restore_r13:\n" +" lwz 13, 36(3)\n" +" blr\n" +"__end__restore_r13:\n" +" .size __restore_r13, __end__restore_r13 - __restore_r13\n" +); + +APTR threadpool; +APTR libnix_mempool; + +/********************************************************************** + Startup/Cleanup +**********************************************************************/ + +int SAVEDS AMIGA_Startup(struct SDL_Library *LibBase) +{ + struct CTDT *ctdt = LibBase->ctdtlist, *last_ctdt = LibBase->last_ctdt; + + SDL2Base = (struct SDL_Library*)&LibBase->Library; + + threadpool = CreateThreadPoolTags(32768, THREADPOOL_Name, (size_t)"SDL2", THREADPOOL_DataSegment, (size_t)LibBase->DataSeg, TAG_DONE); + + if (threadpool == NULL) + return 0; + + // Run constructors + while (ctdt < last_ctdt) + { + if (ctdt->priority >= 0) + { + if (ctdt->fp() != 0) + return 0; + } + + ctdt++; + } + + return 1; +} + +VOID SAVEDS AMIGA_Cleanup(struct SDL_Library *LibBase) +{ + extern void SDL_Quit_REAL(); + struct CTDT *ctdt = LibBase->ctdtlist, *last_ctdt = LibBase->last_ctdt; + + SDL_Quit_REAL(); + + if (threadpool) + DeleteThreadPool(threadpool); + + // Run destructors + while (ctdt < last_ctdt) + { + if (ctdt->priority < 0) + { + if (ctdt->fp != (int (*)(void)) -1) + { + ctdt->fp(); + } + } + + ctdt++; + } +} + +/********************************************************************** + Library setup +**********************************************************************/ + +void (*morphos_exit)(int exitcode); + +void __saveds LIB_SetExitPointer(struct SDL_Library *base, void (*exitfunc)(int)) +{ + morphos_exit = exitfunc; +} + +/********************************************************************** + LIB_InitTGL + + Called from auto-open library only +**********************************************************************/ + +VOID LIB_InitTGL(struct SDL_Library *base, void **glc, struct Library **tgl) +{ + if (base->MyTinyGLBase == NULL) + { + base->MyTinyGLBase = tgl; + base->MyGLContext = glc; + } +} + +void __chkabort(void) { } diff --git a/src/core/morphos/SDL_startup.h b/src/core/morphos/SDL_startup.h new file mode 100644 index 0000000000..d6d8ff9c1a --- /dev/null +++ b/src/core/morphos/SDL_startup.h @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_CORE_AMIGA_STARTUP_H +#define SDL_CORE_AMIGA_STARTUP_H + +extern int AMIGA_Startup(struct SDL_Library *LibBase); +extern VOID AMIGA_Cleanup(struct SDL_Library *LibBase); + +#endif /* SDL_CORE_AMIGA_STARTUP_H */ diff --git a/src/core/morphos/SDL_stubs.c b/src/core/morphos/SDL_stubs.c new file mode 100644 index 0000000000..f77f715b49 --- /dev/null +++ b/src/core/morphos/SDL_stubs.c @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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 + +#define GENERATE_STUBS + +#include "SDL_stubs.h" + +/*********************************************************************/ + +/* This function must preserve all registers except r13 */ +#if 1 +asm +("\n" +" .section \".text\"\n" +" .align 2\n" +" .type __restore_r13, @function\n" +"__restore_r13:\n" +" lwz 13, 36(12)\n" +" blr\n" +"__end__restore_r13:\n" +" .size __restore_r13, __end__restore_r13 - __restore_r13\n" +); +#endif + +int __saveds LIB_SDL_VSetError(const char *fmt, va_list ap) +{ + extern int SDL_VSetError(const char *fmt, va_list ap); + return SDL_VSetError(fmt, ap); +} diff --git a/src/core/morphos/SDL_stubs.h b/src/core/morphos/SDL_stubs.h new file mode 100644 index 0000000000..d90b523023 --- /dev/null +++ b/src/core/morphos/SDL_stubs.h @@ -0,0 +1,770 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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. +*/ + +#undef STUB + +#if defined(GENERATE_STUBS) +#define STUB(name) extern int name##_REAL(); int __saveds LIB_##name() { return name##_REAL(); } +#elif defined(GENERATE_POINTERS) +#define STUB(name) (APTR)&LIB_##name , +#else +#define STUB(name) extern int LIB_##name(); +#endif + + STUB(SDL_GetPlatform) + + STUB(SDL_Init) + STUB(SDL_InitSubSystem) + STUB(SDL_QuitSubSystem) + STUB(SDL_WasInit) + STUB(SDL_Quit) + STUB(SDL_SetMainReady) + + STUB(SDL_malloc) + STUB(SDL_calloc) + STUB(SDL_realloc) + STUB(SDL_free) + STUB(SDL_qsort) + STUB(SDL_abs) + + STUB(SDL_isdigit) + STUB(SDL_isspace) + STUB(SDL_toupper) + STUB(SDL_tolower) + + STUB(SDL_memset) + STUB(SDL_memcpy) + STUB(SDL_memmove) + STUB(SDL_memcmp) + + STUB(SDL_wcslen) + STUB(SDL_wcslcpy) + STUB(SDL_wcslcat) + + STUB(SDL_strlen) + STUB(SDL_strlcpy) + STUB(SDL_utf8strlcpy) + STUB(SDL_strlcat) + STUB(SDL_strdup) + STUB(SDL_strrev) + STUB(SDL_strupr) + STUB(SDL_strlwr) + STUB(SDL_strchr) + STUB(SDL_strrchr) + STUB(SDL_strstr) + + STUB(SDL_itoa) + STUB(SDL_uitoa) + STUB(SDL_ltoa) + STUB(SDL_ultoa) + STUB(SDL_lltoa) + STUB(SDL_ulltoa) + + STUB(SDL_atoi) + STUB(SDL_atof) + STUB(SDL_strtol) + STUB(SDL_strtoul) + STUB(SDL_strtoll) + STUB(SDL_strtoull) + STUB(SDL_strtod) + + STUB(SDL_strcmp) + STUB(SDL_strncmp) + STUB(SDL_strcasecmp) + STUB(SDL_strncasecmp) + +#if 0 +#warning Following calls are available in link lib only +#warning sscanf(...) +#warning snprintf(...) +#warning SDL_SetError(const char *fmt, ...) +#warning SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...) +#warning SDL_Log(const char *fmt, ...) +#warning SDL_LogVerbose(int category, const char *fmt, ...) +#warning SDL_LogDebug(int category, const char *fmt, ...) +#warning SDL_LogInfo(int category, const char *fmt, ...) +#warning SDL_LogWarn(int category, const char *fmt, ...) +#warning SDL_LogError(int category, const char *fmt, ...) +#warning SDL_LogCritical(int category, const char *fmt, ...) + STUB(SDL_SetError(const char *fmt, ...); +#endif + + STUB(SDL_vsscanf) + STUB(SDL_vsnprintf) + STUB(SDL_acos) + STUB(SDL_asin) + STUB(SDL_atan) + STUB(SDL_atan2) + STUB(SDL_ceil) + STUB(SDL_copysign) + STUB(SDL_cos) + STUB(SDL_cosf) + STUB(SDL_fabs) + STUB(SDL_floor) + STUB(SDL_log) + STUB(SDL_pow) + STUB(SDL_scalbn) + STUB(SDL_sin) + STUB(SDL_sinf) + STUB(SDL_sqrt) + STUB(SDL_iconv_open) + STUB(SDL_iconv_close) + STUB(SDL_iconv) + STUB(SDL_iconv_string) + STUB(SDL_ReportAssertion) + STUB(SDL_SetAssertionHandler) + STUB(SDL_GetDefaultAssertionHandler) + STUB(SDL_GetAssertionHandler) + STUB(SDL_GetAssertionReport) + STUB(SDL_ResetAssertionReport) + STUB(SDL_AtomicTryLock) + STUB(SDL_AtomicLock) + STUB(SDL_AtomicUnlock) + STUB(SDL_AtomicCAS) + STUB(SDL_AtomicSet) + STUB(SDL_AtomicGet) + STUB(SDL_AtomicAdd) + STUB(SDL_AtomicCASPtr) + STUB(SDL_AtomicSetPtr) + STUB(SDL_AtomicGetPtr) + STUB(SDL_GetNumAudioDrivers) + STUB(SDL_GetAudioDriver) + STUB(SDL_AudioInit) + STUB(SDL_AudioQuit) + STUB(SDL_GetCurrentAudioDriver) + STUB(SDL_OpenAudio) + STUB(SDL_GetNumAudioDevices) + STUB(SDL_GetAudioDeviceName) + STUB(SDL_OpenAudioDevice) + STUB(SDL_GetAudioStatus) + STUB(SDL_GetAudioDeviceStatus) + STUB(SDL_PauseAudio) + STUB(SDL_PauseAudioDevice) + STUB(SDL_LoadWAV_RW) + STUB(SDL_FreeWAV) + STUB(SDL_BuildAudioCVT) + STUB(SDL_ConvertAudio) + STUB(SDL_MixAudio) + STUB(SDL_MixAudioFormat) + STUB(SDL_LockAudio) + STUB(SDL_LockAudioDevice) + STUB(SDL_UnlockAudio) + STUB(SDL_UnlockAudioDevice) + STUB(SDL_CloseAudio) + STUB(SDL_CloseAudioDevice) + STUB(SDL_SetClipboardText) + STUB(SDL_GetClipboardText) + STUB(SDL_HasClipboardText) + STUB(SDL_GetCPUCount) + STUB(SDL_GetCPUCacheLineSize) + STUB(SDL_HasRDTSC) + STUB(SDL_HasAltiVec) + STUB(SDL_HasMMX) + STUB(SDL_Has3DNow) + STUB(SDL_HasSSE) + STUB(SDL_HasSSE2) + STUB(SDL_HasSSE3) + STUB(SDL_HasSSE41) + STUB(SDL_HasSSE42) + STUB(SDL_HasAVX) + STUB(SDL_GetSystemRAM) + STUB(SDL_GetError) + STUB(SDL_ClearError) + STUB(SDL_Error) + STUB(SDL_PumpEvents) + STUB(SDL_PeepEvents) + STUB(SDL_HasEvent) + STUB(SDL_HasEvents) + STUB(SDL_FlushEvent) + STUB(SDL_FlushEvents) + STUB(SDL_PollEvent) + STUB(SDL_WaitEvent) + STUB(SDL_WaitEventTimeout) + STUB(SDL_PushEvent) + STUB(SDL_SetEventFilter) + STUB(SDL_GetEventFilter) + STUB(SDL_AddEventWatch) + STUB(SDL_DelEventWatch) + STUB(SDL_FilterEvents) + STUB(SDL_EventState) + STUB(SDL_RegisterEvents) + STUB(SDL_GetBasePath) + STUB(SDL_GetPrefPath) + STUB(SDL_NumJoysticks) + STUB(SDL_JoystickNameForIndex) + STUB(SDL_JoystickOpen) + STUB(SDL_JoystickName) + STUB(SDL_JoystickGetDeviceGUID) + STUB(SDL_JoystickGetGUID) + STUB(SDL_JoystickGetGUIDString) + STUB(SDL_JoystickGetGUIDFromString) + STUB(SDL_JoystickGetAttached) + STUB(SDL_JoystickInstanceID) + STUB(SDL_JoystickNumAxes) + STUB(SDL_JoystickNumBalls) + STUB(SDL_JoystickNumHats) + STUB(SDL_JoystickNumButtons) + STUB(SDL_JoystickUpdate) + STUB(SDL_JoystickEventState) + STUB(SDL_JoystickGetAxis) + STUB(SDL_JoystickGetHat) + STUB(SDL_JoystickGetBall) + STUB(SDL_JoystickGetButton) + STUB(SDL_JoystickClose) + STUB(SDL_GameControllerAddMappingsFromRW) + STUB(SDL_GameControllerAddMapping) + STUB(SDL_GameControllerMappingForGUID) + STUB(SDL_GameControllerMapping) + STUB(SDL_IsGameController) + STUB(SDL_GameControllerNameForIndex) + STUB(SDL_GameControllerOpen) + STUB(SDL_GameControllerName) + STUB(SDL_GameControllerGetAttached) + STUB(SDL_GameControllerGetJoystick) + STUB(SDL_GameControllerEventState) + STUB(SDL_GameControllerUpdate) + STUB(SDL_GameControllerGetAxisFromString) + STUB(SDL_GameControllerGetStringForAxis) + STUB(SDL_GameControllerGetBindForAxis) + STUB(SDL_GameControllerGetAxis) + STUB(SDL_GameControllerGetButtonFromString) + STUB(SDL_GameControllerGetStringForButton) + STUB(SDL_GameControllerGetBindForButton) + STUB(SDL_GameControllerGetButton) + STUB(SDL_GameControllerClose) + + STUB(SDL_SetHintWithPriority) + STUB(SDL_SetHint) + STUB(SDL_GetHint) + STUB(SDL_AddHintCallback) + STUB(SDL_DelHintCallback) + STUB(SDL_ClearHints) + STUB(SDL_LoadObject) + STUB(SDL_LoadFunction) + STUB(SDL_UnloadObject) + STUB(SDL_LogSetAllPriority) + STUB(SDL_LogSetPriority) + STUB(SDL_LogGetPriority) + STUB(SDL_LogResetPriorities) + STUB(SDL_LogMessageV) + STUB(SDL_LogGetOutputFunction) + STUB(SDL_LogSetOutputFunction) + STUB(SDL_ShowMessageBox) + STUB(SDL_ShowSimpleMessageBox) + STUB(SDL_CreateMutex) + STUB(SDL_LockMutex) + STUB(SDL_TryLockMutex) + STUB(SDL_UnlockMutex) + STUB(SDL_DestroyMutex) + STUB(SDL_CreateSemaphore) + STUB(SDL_DestroySemaphore) + STUB(SDL_SemWait) + STUB(SDL_SemTryWait) + STUB(SDL_SemWaitTimeout) + STUB(SDL_SemPost) + STUB(SDL_SemValue) + STUB(SDL_CreateCond) + STUB(SDL_DestroyCond) + STUB(SDL_CondSignal) + STUB(SDL_CondBroadcast) + STUB(SDL_CondWait) + STUB(SDL_CondWaitTimeout) + STUB(SDL_GetPowerInfo) + STUB(SDL_GetNumRenderDrivers) + STUB(SDL_GetRenderDriverInfo) + STUB(SDL_CreateWindowAndRenderer) + STUB(SDL_CreateRenderer) + STUB(SDL_CreateSoftwareRenderer) + STUB(SDL_GetRenderer) + STUB(SDL_GetRendererInfo) + STUB(SDL_GetRendererOutputSize) + STUB(SDL_CreateTexture) + STUB(SDL_CreateTextureFromSurface) + STUB(SDL_QueryTexture) + STUB(SDL_SetTextureColorMod) + STUB(SDL_GetTextureColorMod) + STUB(SDL_SetTextureAlphaMod) + STUB(SDL_GetTextureAlphaMod) + STUB(SDL_SetTextureBlendMode) + STUB(SDL_GetTextureBlendMode) + STUB(SDL_UpdateTexture) + STUB(SDL_UpdateYUVTexture) + STUB(SDL_LockTexture) + STUB(SDL_UnlockTexture) + STUB(SDL_RenderTargetSupported) + STUB(SDL_SetRenderTarget) + STUB(SDL_GetRenderTarget) + STUB(SDL_RenderSetLogicalSize) + STUB(SDL_RenderGetLogicalSize) + STUB(SDL_RenderSetViewport) + STUB(SDL_RenderGetViewport) + STUB(SDL_RenderSetClipRect) + STUB(SDL_RenderGetClipRect) + STUB(SDL_RenderSetScale) + STUB(SDL_RenderGetScale) + STUB(SDL_SetRenderDrawColor) + STUB(SDL_GetRenderDrawColor) + STUB(SDL_SetRenderDrawBlendMode) + STUB(SDL_GetRenderDrawBlendMode) + STUB(SDL_RenderClear) + STUB(SDL_RenderDrawPoint) + STUB(SDL_RenderDrawPoints) + STUB(SDL_RenderDrawLine) + STUB(SDL_RenderDrawLines) + STUB(SDL_RenderDrawRect) + STUB(SDL_RenderDrawRects) + STUB(SDL_RenderFillRect) + STUB(SDL_RenderFillRects) + STUB(SDL_RenderCopy) + STUB(SDL_RenderCopyEx) + STUB(SDL_RenderReadPixels) + STUB(SDL_RenderPresent) + STUB(SDL_DestroyTexture) + STUB(SDL_DestroyRenderer) + STUB(SDL_GL_BindTexture) + STUB(SDL_GL_UnbindTexture) + STUB(SDL_RWFromFile) + STUB(SDL_RWFromFP_clib) + STUB(SDL_RWFromMem) + STUB(SDL_RWFromConstMem) + STUB(SDL_AllocRW) + STUB(SDL_FreeRW) + STUB(SDL_ReadU8) + STUB(SDL_ReadLE16) + STUB(SDL_ReadBE16) + STUB(SDL_ReadLE32) + STUB(SDL_ReadBE32) + STUB(SDL_ReadLE64) + STUB(SDL_ReadBE64) + STUB(SDL_WriteU8) + STUB(SDL_WriteLE16) + STUB(SDL_WriteBE16) + STUB(SDL_WriteLE32) + STUB(SDL_WriteBE32) + STUB(SDL_WriteLE64) + STUB(SDL_WriteBE64) + STUB(SDL_CreateThread) + STUB(SDL_GetThreadName) + STUB(SDL_ThreadID) + STUB(SDL_GetThreadID) + STUB(SDL_SetThreadPriority) + STUB(SDL_WaitThread) + STUB(SDL_DetachThread) + STUB(SDL_TLSCreate) + STUB(SDL_TLSGet) + STUB(SDL_TLSSet) + STUB(SDL_GetTicks) + STUB(SDL_GetPerformanceCounter) + STUB(SDL_GetPerformanceFrequency) + STUB(SDL_Delay) + STUB(SDL_AddTimer) + STUB(SDL_RemoveTimer) + STUB(SDL_GetVersion) + STUB(SDL_GetRevision) + STUB(SDL_GetRevisionNumber) + STUB(SDL_GetNumVideoDrivers) + STUB(SDL_GetVideoDriver) + STUB(SDL_VideoInit) + STUB(SDL_VideoQuit) + STUB(SDL_GetCurrentVideoDriver) + STUB(SDL_GetNumVideoDisplays) + STUB(SDL_GetDisplayName) + STUB(SDL_GetDisplayBounds) + STUB(SDL_GetNumDisplayModes) + STUB(SDL_GetDisplayMode) + STUB(SDL_GetDesktopDisplayMode) + STUB(SDL_GetCurrentDisplayMode) + STUB(SDL_GetClosestDisplayMode) + STUB(SDL_GetWindowDisplayIndex) + STUB(SDL_SetWindowDisplayMode) + STUB(SDL_GetWindowDisplayMode) + STUB(SDL_GetWindowPixelFormat) + STUB(SDL_CreateWindow) + STUB(SDL_CreateWindowFrom) + STUB(SDL_GetWindowID) + STUB(SDL_GetWindowFromID) + STUB(SDL_GetWindowFlags) + STUB(SDL_SetWindowTitle) + STUB(SDL_GetWindowTitle) + STUB(SDL_SetWindowIcon) + STUB(SDL_SetWindowData) + STUB(SDL_GetWindowData) + STUB(SDL_SetWindowPosition) + STUB(SDL_GetWindowPosition) + STUB(SDL_SetWindowSize) + STUB(SDL_GetWindowSize) + STUB(SDL_SetWindowMinimumSize) + STUB(SDL_GetWindowMinimumSize) + STUB(SDL_SetWindowMaximumSize) + STUB(SDL_GetWindowMaximumSize) + STUB(SDL_SetWindowBordered) + STUB(SDL_ShowWindow) + STUB(SDL_HideWindow) + STUB(SDL_RaiseWindow) + STUB(SDL_MaximizeWindow) + STUB(SDL_MinimizeWindow) + STUB(SDL_RestoreWindow) + STUB(SDL_SetWindowFullscreen) + STUB(SDL_GetWindowSurface) + STUB(SDL_UpdateWindowSurface) + STUB(SDL_UpdateWindowSurfaceRects) + STUB(SDL_SetWindowGrab) + STUB(SDL_GetWindowGrab) + STUB(SDL_SetWindowBrightness) + STUB(SDL_GetWindowBrightness) + STUB(SDL_SetWindowGammaRamp) + STUB(SDL_GetWindowGammaRamp) + STUB(SDL_DestroyWindow) + STUB(SDL_IsScreenSaverEnabled) + STUB(SDL_EnableScreenSaver) + STUB(SDL_DisableScreenSaver) + + STUB(SDL_GetKeyboardFocus) + STUB(SDL_GetKeyboardState) + STUB(SDL_GetModState) + STUB(SDL_SetModState) + STUB(SDL_GetKeyFromScancode) + STUB(SDL_GetScancodeFromKey) + STUB(SDL_GetScancodeName) + STUB(SDL_GetScancodeFromName) + STUB(SDL_GetKeyName) + STUB(SDL_GetKeyFromName) + STUB(SDL_StartTextInput) + STUB(SDL_IsTextInputActive) + STUB(SDL_StopTextInput) + STUB(SDL_SetTextInputRect) + STUB(SDL_HasScreenKeyboardSupport) + STUB(SDL_IsScreenKeyboardShown) + + STUB(SDL_CreateRGBSurface) + STUB(SDL_CreateRGBSurfaceFrom) + STUB(SDL_FreeSurface) + STUB(SDL_SetSurfacePalette) + STUB(SDL_LockSurface) + STUB(SDL_UnlockSurface) + STUB(SDL_LoadBMP_RW) + STUB(SDL_SaveBMP_RW) + STUB(SDL_SetSurfaceRLE) + STUB(SDL_SetColorKey) + STUB(SDL_GetColorKey) + STUB(SDL_SetSurfaceColorMod) + STUB(SDL_GetSurfaceColorMod) + STUB(SDL_SetSurfaceAlphaMod) + STUB(SDL_GetSurfaceAlphaMod) + STUB(SDL_SetSurfaceBlendMode) + STUB(SDL_GetSurfaceBlendMode) + STUB(SDL_SetClipRect) + STUB(SDL_GetClipRect) + STUB(SDL_ConvertSurface) + STUB(SDL_ConvertSurfaceFormat) + STUB(SDL_ConvertPixels) + STUB(SDL_FillRect) + STUB(SDL_FillRects) + STUB(SDL_UpperBlit) + STUB(SDL_LowerBlit) + STUB(SDL_SoftStretch) + STUB(SDL_UpperBlitScaled) + STUB(SDL_LowerBlitScaled) + + STUB(SDL_GetMouseFocus) + STUB(SDL_GetMouseState) + STUB(SDL_GetRelativeMouseState) + STUB(SDL_WarpMouseInWindow) + STUB(SDL_SetRelativeMouseMode) + STUB(SDL_GetRelativeMouseMode) + STUB(SDL_CreateCursor) + STUB(SDL_CreateColorCursor) + STUB(SDL_CreateSystemCursor) + STUB(SDL_SetCursor) + STUB(SDL_GetCursor) + STUB(SDL_GetDefaultCursor) + STUB(SDL_FreeCursor) + STUB(SDL_ShowCursor) + + STUB(SDL_GetPixelFormatName) + STUB(SDL_PixelFormatEnumToMasks) + STUB(SDL_MasksToPixelFormatEnum) + STUB(SDL_AllocFormat) + STUB(SDL_FreeFormat) + STUB(SDL_AllocPalette) + STUB(SDL_SetPixelFormatPalette) + STUB(SDL_SetPaletteColors) + STUB(SDL_FreePalette) + STUB(SDL_MapRGB) + STUB(SDL_MapRGBA) + STUB(SDL_GetRGB) + STUB(SDL_GetRGBA) + STUB(SDL_CalculateGammaRamp) + + STUB(SDL_HasIntersection) + STUB(SDL_IntersectRect) + STUB(SDL_UnionRect) + STUB(SDL_EnclosePoints) + STUB(SDL_IntersectRectAndLine) + + STUB(SDL_GetWindowWMInfo) + + STUB(SDL_RecordGesture) + STUB(SDL_SaveAllDollarTemplates) + STUB(SDL_SaveDollarTemplate) + STUB(SDL_LoadDollarTemplates) + + STUB(SDL_CreateShapedWindow) + STUB(SDL_IsShapedWindow) + STUB(SDL_SetWindowShape) + STUB(SDL_GetShapedWindowMode) + + STUB(SDL_CaptureMouse) + STUB(SDL_WarpMouseGlobal) + STUB(SDL_GetGlobalMouseState) + STUB(SDL_SetWindowHitTest) + STUB(SDL_GetGrabbedWindow) + STUB(SDL_GetDisplayDPI) + STUB(SDL_RenderIsClipEnabled) + STUB(SDL_GameControllerFromInstanceID) + STUB(SDL_JoystickCurrentPowerLevel) + STUB(SDL_JoystickFromInstanceID) + STUB(SDL_HasAVX2) + STUB(SDL_QueueAudio) + STUB(SDL_GetQueuedAudioSize) + STUB(SDL_ClearQueuedAudio) + STUB(SDL_sqrtf) + STUB(SDL_tan) + STUB(SDL_tanf) + + STUB(SDL_MemoryBarrierReleaseFunction) + STUB(SDL_MemoryBarrierAcquireFunction) + STUB(SDL_DequeueAudio) + STUB(SDL_ComposeCustomBlendMode) + STUB(SDL_HasNEON) + STUB(SDL_GameControllerNumMappings) + STUB(SDL_GameControllerMappingForIndex) + STUB(SDL_GameControllerGetVendor) + STUB(SDL_GameControllerGetProduct) + STUB(SDL_GameControllerGetProductVersion) + STUB(SDL_GetHintBoolean) + STUB(SDL_JoystickGetDeviceVendor) + STUB(SDL_JoystickGetDeviceProduct) + STUB(SDL_JoystickGetDeviceProductVersion) + STUB(SDL_JoystickGetDeviceType) + STUB(SDL_JoystickGetDeviceInstanceID) + STUB(SDL_JoystickGetVendor) + STUB(SDL_JoystickGetProduct) + STUB(SDL_JoystickGetProductVersion) + STUB(SDL_JoystickGetType) + STUB(SDL_JoystickGetAxisInitialState) + STUB(SDL_GetDisplayUsableBounds) + STUB(SDL_GetWindowBordersSize) + STUB(SDL_SetWindowResizable) + STUB(SDL_SetWindowOpacity) + STUB(SDL_GetWindowOpacity) + STUB(SDL_SetWindowModalFor) + STUB(SDL_SetWindowInputFocus) + STUB(SDL_CreateRGBSurfaceWithFormat) + STUB(SDL_CreateRGBSurfaceWithFormatFrom) + STUB(SDL_DuplicateSurface) + STUB(SDL_wcscmp) + STUB(SDL_utf8strlen) + STUB(SDL_LoadFile_RW) + STUB(SDL_RenderSetIntegerScale) + STUB(SDL_RenderGetIntegerScale) + + STUB(SDL_NewAudioStream) + STUB(SDL_AudioStreamPut) + STUB(SDL_AudioStreamGet) + STUB(SDL_AudioStreamAvailable) + STUB(SDL_AudioStreamFlush) + STUB(SDL_AudioStreamClear) + STUB(SDL_FreeAudioStream) + STUB(SDL_LockJoysticks) + STUB(SDL_UnlockJoysticks) + + STUB(SDL_GetMemoryFunctions) + STUB(SDL_SetMemoryFunctions) + STUB(SDL_GetNumAllocations) + + STUB(SDL_RenderGetMetalLayer) + STUB(SDL_RenderGetMetalCommandEncoder) + STUB(SDL_acosf) + STUB(SDL_asinf) + STUB(SDL_atanf) + STUB(SDL_atan2f) + STUB(SDL_ceilf) + STUB(SDL_copysignf) + STUB(SDL_fabsf) + STUB(SDL_floorf) + STUB(SDL_fmod) + STUB(SDL_fmodf) + STUB(SDL_logf) + STUB(SDL_log10) + STUB(SDL_log10f) + STUB(SDL_powf) + STUB(SDL_scalbnf) + STUB(SDL_SetYUVConversionMode) + STUB(SDL_GetYUVConversionMode) + STUB(SDL_GetYUVConversionModeForResolution) + + STUB(SDL_HasAVX512F) + STUB(SDL_GameControllerMappingForDeviceIndex) + STUB(SDL_GameControllerGetPlayerIndex) + STUB(SDL_GameControllerRumble) + STUB(SDL_JoystickGetDevicePlayerIndex) + STUB(SDL_JoystickGetPlayerIndex) + STUB(SDL_JoystickRumble) + STUB(SDL_wcsdup) + STUB(SDL_exp) + STUB(SDL_expf) + STUB(SDL_HasColorKey) + STUB(SDL_IsTablet) + STUB(SDL_CreateThreadWithStackSize) + STUB(SDL_GetDisplayOrientation) + + STUB(SDL_SIMDGetAlignment) + STUB(SDL_SIMDAlloc) + STUB(SDL_SIMDFree) + STUB(SDL_RenderDrawPointF) + STUB(SDL_RenderDrawPointsF) + STUB(SDL_RenderDrawLineF) + STUB(SDL_RenderDrawLinesF) + STUB(SDL_RenderDrawRectF) + STUB(SDL_RenderDrawRectsF) + STUB(SDL_RenderFillRectF) + STUB(SDL_RenderFillRectsF) + STUB(SDL_RenderCopyF) + STUB(SDL_RenderCopyExF) + STUB(SDL_RenderFlush) + STUB(SDL_RWsize) + STUB(SDL_RWseek) + STUB(SDL_RWtell) + STUB(SDL_RWread) + STUB(SDL_RWwrite) + STUB(SDL_RWclose) + STUB(SDL_LoadFile) + STUB(SDL_GetTouchDeviceType) + + STUB(SDL_HasARMSIMD) + STUB(SDL_GameControllerTypeForIndex) + STUB(SDL_GameControllerFromPlayerIndex) + STUB(SDL_GameControllerGetType) + STUB(SDL_GameControllerSetPlayerIndex) + STUB(SDL_JoystickFromPlayerIndex) + STUB(SDL_JoystickSetPlayerIndex) + STUB(SDL_SetTextureScaleMode) + STUB(SDL_GetTextureScaleMode) + STUB(SDL_LockTextureToSurface) + STUB(SDL_wcsstr) + STUB(SDL_wcsncmp) + STUB(SDL_strtokr) + + STUB(SDL_GL_LoadLibrary) + STUB(SDL_GL_GetProcAddress) + STUB(SDL_GL_UnloadLibrary) + STUB(SDL_GL_ExtensionSupported) + STUB(SDL_GL_ResetAttributes) + STUB(SDL_GL_SetAttribute) + STUB(SDL_GL_GetAttribute) + STUB(SDL_GL_CreateContext) + STUB(SDL_GL_MakeCurrent) + STUB(SDL_GL_GetCurrentWindow) + STUB(SDL_GL_GetCurrentContext) + STUB(SDL_GL_GetDrawableSize) + STUB(SDL_GL_SetSwapInterval) + STUB(SDL_GL_GetSwapInterval) + STUB(SDL_GL_SwapWindow) + STUB(SDL_GL_DeleteContext) + + /* Haptic */ + STUB(SDL_NumHaptics) + STUB(SDL_HapticName) + STUB(SDL_HapticOpen) + STUB(SDL_HapticOpened) + STUB(SDL_HapticIndex) + STUB(SDL_MouseIsHaptic) + STUB(SDL_HapticOpenFromMouse) + STUB(SDL_JoystickIsHaptic) + STUB(SDL_HapticOpenFromJoystick) + STUB(SDL_HapticClose) + STUB(SDL_HapticNumEffects) + STUB(SDL_HapticNumEffectsPlaying) + STUB(SDL_HapticQuery) + STUB(SDL_HapticNumAxes) + STUB(SDL_HapticEffectSupported) + STUB(SDL_HapticNewEffect) + STUB(SDL_HapticUpdateEffect) + STUB(SDL_HapticRunEffect) + STUB(SDL_HapticStopEffect) + STUB(SDL_HapticDestroyEffect) + STUB(SDL_HapticGetEffectStatus) + STUB(SDL_HapticSetGain) + STUB(SDL_HapticSetAutocenter) + STUB(SDL_HapticPause) + STUB(SDL_HapticUnpause) + STUB(SDL_HapticStopAll) + STUB(SDL_HapticRumbleSupported) + STUB(SDL_HapticRumbleInit) + STUB(SDL_HapticRumblePlay) + STUB(SDL_HapticRumbleStop) + STUB(SDL_isupper) + STUB(SDL_islower) + + STUB(SDL_JoystickAttachVirtual) + STUB(SDL_JoystickDetachVirtual) + STUB(SDL_JoystickIsVirtual) + STUB(SDL_JoystickSetVirtualAxis) + STUB(SDL_JoystickSetVirtualButton) + STUB(SDL_JoystickSetVirtualHat) + STUB(SDL_GetErrorMsg) + STUB(SDL_LockSensors) + STUB(SDL_UnlockSensors) + STUB(SDL_Metal_GetLayer) + STUB(SDL_Metal_GetDrawableSize) + STUB(SDL_trunc) + STUB(SDL_truncf) + STUB(SDL_GetPreferredLocales) + STUB(SDL_SIMDRealloc) + + STUB(SDL_OpenURL) + STUB(SDL_HasSurfaceRLE) + STUB(SDL_GameControllerHasLED) + STUB(SDL_GameControllerSetLED) + STUB(SDL_JoystickHasLED) + STUB(SDL_JoystickSetLED) + STUB(SDL_GameControllerRumbleTriggers) + STUB(SDL_JoystickRumbleTriggers) + STUB(SDL_GameControllerHasAxis) + STUB(SDL_GameControllerHasButton) + STUB(SDL_GameControllerGetNumTouchpads) + STUB(SDL_GameControllerGetNumTouchpadFingers) + STUB(SDL_GameControllerGetTouchpadFinger) + STUB(SDL_GetNumTouchDevices) + STUB(SDL_GetTouchDevice) + STUB(SDL_GetNumTouchFingers) + STUB(SDL_GetTouchFinger) + + STUB(SDL_crc32) + STUB(SDL_GameControllerGetSerial) + STUB(SDL_JoystickGetSerial) + STUB(SDL_GameControllerHasSensor) + STUB(SDL_GameControllerSetSensorEnabled) + STUB(SDL_GameControllerIsSensorEnabled) + STUB(SDL_GameControllerGetSensorData) + STUB(SDL_wcscasecmp) + STUB(SDL_wcsncasecmp) diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile new file mode 100644 index 0000000000..594072dc74 --- /dev/null +++ b/src/core/morphos/devenv/Makefile @@ -0,0 +1,73 @@ +# Makefile to build the SDL 2 Library + +CC = ppc-morphos-gcc-10 -noixemul +INCLUDE = -I../../../../include -I../sdk +CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE +AR = ppc-morphos-ar + +ECHE = echo -e +BOLD = \033[1m +NRML = \033[22m + +COMPILING = @$(ECHE) "compiling $(BOLD)$@$(NRML)..." +LINKING = @$(ECHE) "linking $(BOLD)$@$(NRML)..." +STRIPPING = @$(ECHE) "stripping $(BOLD)$@$(NRML)..." +ARCHIVING = @$(ECHE) "archiving $(BOLD)$@$(NRML)..." + +all: lib/libSDL2.a lib/libb32/libSDL2.a lib/libb32/libSDL2-nc.a + +lib: all + +install: all +install-iso: all + +sdl-startup.o: sdl-startup.c sdl-stubs.c + $(COMPILING) + @$(CC) $(CFLAGS) -o $@ -c sdl-startup.c + +SDL_amigagl_wrapper.o: ../../../video/amiga/SDL_amigagl_wrapper.c + $(COMPILING) + @$(CC) $(CFLAGS) -o $@ -c $< + +sdl-startup-brel.o: sdl-startup.c sdl-stubs.c + $(COMPILING) + @$(CC) $(CFLAGS) -mresident32 -o $@ -c sdl-startup.c + +SDL_amigagl_wrapper-brel.o: ../../../video/amiga/SDL_amigagl_wrapper.c + $(COMPILING) + @$(CC) $(CFLAGS) -mresident32 -o $@ -c $< + +sdl-startup-brel-nc.o: sdl-startup.c sdl-stubs.c + $(COMPILING) + @$(CC) $(CFLAGS) -mresident32 -o $@ -c sdl-startup.c -D__NO_SDL_CONSTRUCTORS + +SDL_amigagl_wrapper-nc.o: ../../../video/amiga/SDL_amigagl_wrapper.c + $(COMPILING) + @$(CC) $(CFLAGS) -mresident32 -o $@ -c $< -D__NO_SDL_CONSTRUCTORS + +lib/libSDL2.a: sdl-startup.o SDL_amigagl_wrapper.o ../sdk/fd/sdl2_lib.fd + $(ARCHIVING) + @mkdir -p lib + @-rm -f $@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --gluelib=$@ + @$(AR) crus $@ sdl-startup.o SDL_amigagl_wrapper.o + +lib/libb32/libSDL2.a: sdl-startup-brel.o SDL_amigagl_wrapper-brel.o ../sdk/fd/sdl2_lib.fd + $(ARCHIVING) + @mkdir -p lib/libb32 + @-rm -f $@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --brelgluelib=$@ + @$(AR) crus $@ sdl-startup-brel.o SDL_amigagl_wrapper-brel.o + +lib/libb32/libSDL2-nc.a: sdl-startup-brel-nc.o SDL_amigagl_wrapper-nc.o ../sdk/fd/sdl2_lib.fd + $(ARCHIVING) + @mkdir -p lib/libb32 + @-rm -f $@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --brelgluelib=$@ + @$(AR) crus $@ sdl-startup-brel-nc.o SDL_amigagl_wrapper-nc.o + +clean: + @-rm -rf lib *.s *.o + +dump: + ppc-morphos-objdump --disassemble-all --reloc lib/libSDL2.a >lib/libSDL2.s diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c new file mode 100644 index 0000000000..2f9d213c27 --- /dev/null +++ b/src/core/morphos/devenv/sdl-startup.c @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2004-2017 MorphOS Development Team + * + * $Id: sdl-startup.c,v 1.2 2017/11/25 21:56:56 itix Exp $ + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include "SDL_error.h" +#include "SDL_rwops.h" + +#include "../SDL_amigaversion.h" + +#if defined(__NO_SDL_CONSTRUCTORS) +extern struct Library *SDL2Base; +#else +int _INIT_4_SDL2Base(void) __attribute__((alias("__CSTP_init_SDL2Base"))); +void _EXIT_4_SDL2Base(void) __attribute__((alias("__DSTP_cleanup_SDL2Base"))); +//void _INIT_4_TinyGLBase(void) __attribute__((alias("__CSTP_init_TinyGLBase"))); +//void _EXIT_4_TinyGLBase(void) __attribute__((alias("__DSTP_cleanup_TinyGLBase"))); + +struct Library *SDL2Base; +struct Library *TinyGLBase; +GLContext *__tglContext; + +void __SDL2_OpenLibError(ULONG version, const char *name) +{ + struct Library *MUIMasterBase = OpenLibrary("muimaster.library", 0); + + if (MUIMasterBase) + { + size_t args[2] = { version, (size_t)name }; + MUI_RequestA(NULL, NULL, 0, "SDL 2 startup message", "Abort", "Need version %.10ld of %s.", &args); + CloseLibrary(MUIMasterBase); + } +} + +static const char libname[] = "sdl2.library"; +static BPTR OldLock, NewLock; + +/*static CONSTRUCTOR_P(init_TinyGLBase, 101) +{ + CONST_STRPTR tglname = "tinygl.library"; + + TinyGLBase = OpenLibrary(tglname, 50); + + if (TinyGLBase) + SDL_InitTGL((void **) &__tglContext, (struct Library **) &TinyGLBase); + else + __SDL2_OpenLibError(50, tglname); + + return (TinyGLBase == NULL); +}*/ + +static CONSTRUCTOR_P(init_SDL2Base, 100) +{ + struct Library *base = (void *) OpenLibrary((STRPTR)libname, VERSION); + + if (base) + { + NewLock = Lock("PROGDIR:", ACCESS_READ); /* we let libauto open doslib */ + + if(NewLock) + { + SDL2Base = base; + SDL_InitTGL((void **) &__tglContext, (struct Library **) &TinyGLBase); + OldLock = CurrentDir(NewLock); + } + else + { + CloseLibrary(base); + } + } + else + { + __SDL2_OpenLibError(VERSION, libname); + } + + return (base == NULL); +} + +static DESTRUCTOR_P(cleanup_SDL2Base, 100) +{ + struct Library *base = SDL2Base; + + if (base) + { + if (NewLock) + { + //CurrentDir(OldLock); + //UnLock(NewLock); + UnLock(CurrentDir(OldLock)); + } + + CloseLibrary(base); + } +} +#endif + +#include "sdl-stubs.c" + +/* + * Custom getenv(), catches HOME requests and creates+returns PROGDIR:home + */ +#include + +char *_getenv(const char *) __attribute__((alias("SDL_getenv"))); + +static const char home[] = "PROGDIR:home"; + +char *SDL_getenv(const char *name) +{ + char *var = NULL; + char dummy[2]; + size_t len; + + /* "portability" hack++ */ + if (strcmp(name, "HOME") == 0) + { + BPTR MyLock = Lock(home, ACCESS_READ); + + if (MyLock) + { + struct FileInfoBlock MyFIB; + + if (Examine(MyLock, &MyFIB)) + { + if (MyFIB.fib_DirEntryType > 0) + { + var = (char *)home; + } + } + + UnLock(MyLock); + } + else + { + MyLock = CreateDir(home); + if (MyLock) + { + UnLock(MyLock); + var = (char *)home; + } + } + + return var; + } + + if (GetVar((char *)name, dummy, sizeof(dummy), GVF_BINARY_VAR) == -1) + { + /* no var */ + return NULL; + } + + len = IoErr() + 1; + + if ((var = SDL_malloc(len))) + { + if (GetVar((char *)name, var, len, GVF_BINARY_VAR) == -1) + { + /* should not happen */ + SDL_free(var); + var = NULL; + } + } + + return var; +} + +int SDL_setenv(const char *name, const char *value, int overwrite) +{ + char dummy[2]; + + if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { + return (-1); + } + + if (!overwrite && GetVar(name, dummy, sizeof(dummy), GVF_BINARY_VAR) != -1) { + return 0; + } + // TODO make these global? + if (!SetVar(name, value, -1, LV_VAR /*| GVF_GLOBAL_ONLY | GVF_SAVE_VAR*/)) { + return -1; + } + + return 0; +} + +/* SDL_RWops() replacement + * + * Functions to read/write stdio file pointers. Will link with libc stdio. + */ + +static Sint64 stdio_size(struct SDL_RWops *context) +{ + Sint64 size, offset; + + offset = ftello64(context->hidden.amigaio.fp.libc); + fseeko64(context->hidden.amigaio.fp.libc, 0, SEEK_END); + size = ftello64(context->hidden.amigaio.fp.libc); + fseeko64(context->hidden.amigaio.fp.libc, offset, SEEK_SET); + + return size; +} + +static Sint64 stdio_seek(SDL_RWops *context, Sint64 offset, int whence) +{ + if (fseeko64(context->hidden.amigaio.fp.libc, offset, whence) == 0 ) + { + return ftello64(context->hidden.amigaio.fp.libc); + } + else + { + SDL_Error(SDL_EFSEEK); + return -1; + } +} +static size_t stdio_read(SDL_RWops *context, void *ptr, size_t size, size_t maxnum) +{ + size_t nread = fread(ptr, size, maxnum, context->hidden.amigaio.fp.libc); + + if (nread == 0 && ferror((FILE *)context->hidden.amigaio.fp.libc) ) + { + SDL_Error(SDL_EFREAD); + } + + return nread; +} +static size_t stdio_write(SDL_RWops *context, const void *ptr, size_t size, size_t num) +{ + size_t nwrote = fwrite(ptr, size, num, context->hidden.amigaio.fp.libc); + + if (nwrote == 0 && ferror((FILE *)context->hidden.amigaio.fp.libc) ) + { + SDL_Error(SDL_EFWRITE); + } + + return nwrote; +} +static int stdio_close(struct SDL_RWops *context) +{ + if ( context ) + { + if ( context->hidden.amigaio.autoclose ) + { + /* WARNING: Check the return value here! */ + fclose(context->hidden.amigaio.fp.libc); + } + SDL_FreeRW(context); + } + return 0; +} + +SDL_RWops *SDL_RWFromFP(void *fp, SDL_bool autoclose) +{ + return SDL_RWFromFP_clib(fp, autoclose, stdio_size, stdio_seek, stdio_read, stdio_write, stdio_close); +} + +extern void *AmiGetGLProc(const char *proc); +void *SDL_GL_GetProcAddress(const char *proc) +{ + void *func = NULL; + + func = AmiGetGLProc(proc); + + D("[%s] proc %s func 0x%08lx\n", __FUNCTION__, proc, func); + + return func; +} diff --git a/src/core/morphos/devenv/sdl-stubs.c b/src/core/morphos/devenv/sdl-stubs.c new file mode 100644 index 0000000000..5ed30aa3b3 --- /dev/null +++ b/src/core/morphos/devenv/sdl-stubs.c @@ -0,0 +1,124 @@ +#include + +#include + +/* SDL_string.c */ + +int +SDL_sscanf(const char *text, const char *fmt, ...) +{ + int rc; + va_list ap; + va_start(ap, fmt); + rc = SDL_vsscanf(text, fmt, ap); + va_end(ap); + return rc; +} + +int +SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) +{ + va_list ap; + int retval; + + va_start(ap, fmt); + retval = SDL_vsnprintf(text, maxlen, fmt, ap); + va_end(ap); + + return retval; +} + +/* SDL_error.c */ + +int +SDL_SetError(const char *fmt, ...) +{ + int rc; + va_list ap; + va_start(ap, fmt); + rc = SDL_VSetError(fmt, ap); + va_end(ap); + return rc; +} + +/* SDL_log.c */ + +void +SDL_Log(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); + va_end(ap); +} + +void +SDL_LogVerbose(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap); + va_end(ap); +} + +void +SDL_LogDebug(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap); + va_end(ap); +} + +void +SDL_LogInfo(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap); + va_end(ap); +} + +void +SDL_LogWarn(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap); + va_end(ap); +} + +void +SDL_LogError(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap); + va_end(ap); +} + +void +SDL_LogCritical(int category, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap); + va_end(ap); +} + +void +SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, priority, fmt, ap); + va_end(ap); +} diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h new file mode 100644 index 0000000000..547f438549 --- /dev/null +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -0,0 +1,774 @@ +#ifndef CLIB_SDL2_PROTOS_H +#define CLIB_SDL2_PROTOS_H + +/* + Simple DirectMedia Layer + Copyright (C) 1997-2016 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. +*/ + +/* + * Collection of SDL 2 functions. + */ + +#ifndef _SDL_H +#include +#endif + +struct Library; + +void SDL_InitTGL(void **glc, struct Library **tgl); +void SDL_SetExitPointer(void (*exitfunc)(int)); +SDL_RWops *SDL_RWFromFP_clib(void *fp, int autoclose, Sint64 (*size)(struct SDL_RWops *), Sint64 (*seek)(struct SDL_RWops *, Sint64, int), size_t (*read)(struct SDL_RWops *, void *, size_t, size_t), size_t (*write)(struct SDL_RWops *, const void *, size_t, size_t), int (*close)(struct SDL_RWops *)); +int SDL_VSetError(const char *fmt, va_list ap); + +#if 0 +const char *SDL_GetPlatform(void); + +int SDL_Init(Uint32 flags); +int SDL_InitSubSystem(Uint32 flags); +void SDL_QuitSubSystem(Uint32 flags); +Uint32 SDL_WasInit(Uint32 flags); +void SDL_Quit(void); + +void SDL_SetMainReady(void); +void *SDL_malloc(size_t size); +void *SDL_calloc(size_t nmemb, size_t size); +void *SDL_realloc(void *mem, size_t size); +void SDL_free(void *mem); + +//char *SDL_getenv(const char *name); +//int SDL_setenv(const char *name, const char *value, int overwrite); + +void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); + +int SDL_abs(int x); +int SDL_isdigit(int x); +int SDL_isspace(int x); +int SDL_toupper(int x); +int SDL_tolower(int x); + +void *SDL_memset(void *dst, int c, size_t len); +void *SDL_memcpy(void *dst, const void *src, size_t len); +void *SDL_memmove(void *dst, const void *src, size_t len); +int SDL_memcmp(const void *s1, const void *s2, size_t len); +size_t SDL_wcslen(const wchar_t *wstr); +size_t SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); +size_t SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); +size_t SDL_strlen(const char *str); +size_t SDL_strlcpy(char *dst, const char *src, size_t maxlen); +size_t SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); +size_t SDL_strlcat(char *dst, const char *src, size_t maxlen); +char *SDL_strdup(const char *str); +char *SDL_strrev(char *str); +char *SDL_strupr(char *str); +char *SDL_strlwr(char *str); +char *SDL_strchr(const char *str, int c); +char *SDL_strrchr(const char *str, int c); +char *SDL_strstr(const char *haystack, const char *needle); +char *SDL_itoa(int value, char *str, int radix); +char *SDL_uitoa(unsigned int value, char *str, int radix); +char *SDL_ltoa(long value, char *str, int radix); +char *SDL_ultoa(unsigned long value, char *str, int radix); +char *SDL_lltoa(Sint64 value, char *str, int radix); +char *SDL_ulltoa(Uint64 value, char *str, int radix); +int SDL_atoi(const char *str); +double SDL_atof(const char *str); +long SDL_strtol(const char *str, char **endp, int base); +unsigned long SDL_strtoul(const char *str, char **endp, int base); +Sint64 SDL_strtoll(const char *str, char **endp, int base); +Uint64 SDL_strtoull(const char *str, char **endp, int base); +double SDL_strtod(const char *str, char **endp); +int SDL_strcmp(const char *str1, const char *str2); +int SDL_strncmp(const char *str1, const char *str2, size_t maxlen); +int SDL_strcasecmp(const char *str1, const char *str2); +int SDL_strncasecmp(const char *str1, const char *str2, size_t len); +int SDL_vsscanf(const char *text, const char *fmt, va_list ap); +int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); +double SDL_acos(double x); +double SDL_asin(double x); +double SDL_atan(double x); +double SDL_atan2(double x, double y); +double SDL_ceil(double x); +double SDL_copysign(double x, double y); +double SDL_cos(double x); +float SDL_cosf(float x); +double SDL_fabs(double x); +double SDL_floor(double x); +double SDL_log(double x); +double SDL_pow(double x, double y); +double SDL_scalbn(double x, int n); +double SDL_sin(double x); +float SDL_sinf(float x); +double SDL_sqrt(double x); + +SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode); +int SDL_iconv_close(SDL_iconv_t cd); +size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); +char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); + +SDL_AssertData SDL_ReportAssertion(SDL_AssertData *, const char *, const char *, int); +void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata); + +SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void); +SDL_AssertionHandler SDL_GetAssertionHandler(void **puserdata); +const SDL_AssertData * SDL_GetAssertionReport(void); +void SDL_ResetAssertionReport(void); +SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock); +void SDL_AtomicLock(SDL_SpinLock *lock); +void SDL_AtomicUnlock(SDL_SpinLock *lock); +SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); +int SDL_AtomicSet(SDL_atomic_t *a, int v); +int SDL_AtomicGet(SDL_atomic_t *a); +int SDL_AtomicAdd(SDL_atomic_t *a, int v); +SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval); +void* SDL_AtomicSetPtr(void **a, void* v); +void* SDL_AtomicGetPtr(void **a); +int SDL_GetNumAudioDrivers(void); +const char *SDL_GetAudioDriver(int index); +int SDL_AudioInit(const char *driver_name); +void SDL_AudioQuit(void); +const char *SDL_GetCurrentAudioDriver(void); +int SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained); +int SDL_GetNumAudioDevices(int iscapture); +const char *SDL_GetAudioDeviceName(int index, int iscapture); +SDL_AudioDeviceID SDL_OpenAudioDevice(const char *device, int iscapture, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained, int allowed_changes); +SDL_AudioStatus SDL_GetAudioStatus(void); +SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); +void SDL_PauseAudio(int pause_on); +void SDL_PauseAudioDevice(SDL_AudioDeviceID dev, int pause_on); +SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len); +void SDL_FreeWAV(Uint8 * audio_buf); +int SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_format, Uint8 dst_channels, int dst_rate); +int SDL_ConvertAudio(SDL_AudioCVT * cvt); +void SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume); +void SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 len, int volume); +void SDL_LockAudio(void); +void SDL_LockAudioDevice(SDL_AudioDeviceID dev); +void SDL_UnlockAudio(void); +void SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); +void SDL_CloseAudio(void); +void SDL_CloseAudioDevice(SDL_AudioDeviceID dev); +int SDL_SetClipboardText(const char *text); +char * SDL_GetClipboardText(void); +SDL_bool SDL_HasClipboardText(void); +int SDL_GetCPUCount(void); +int SDL_GetCPUCacheLineSize(void); +SDL_bool SDL_HasRDTSC(void); +SDL_bool SDL_HasAltiVec(void); +SDL_bool SDL_HasMMX(void); +SDL_bool SDL_Has3DNow(void); +SDL_bool SDL_HasSSE(void); +SDL_bool SDL_HasSSE2(void); +SDL_bool SDL_HasSSE3(void); +SDL_bool SDL_HasSSE41(void); +SDL_bool SDL_HasSSE42(void); +SDL_bool SDL_HasAVX(void); +int SDL_GetSystemRAM(void); +const char *SDL_GetError(void); +void SDL_ClearError(void); +int SDL_Error(SDL_errorcode code); +void SDL_PumpEvents(void); +int SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType); +SDL_bool SDL_HasEvent(Uint32 type); +SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType); +void SDL_FlushEvent(Uint32 type); +void SDL_FlushEvents(Uint32 minType, Uint32 maxType); +int SDL_PollEvent(SDL_Event * event); +int SDL_WaitEvent(SDL_Event * event); +int SDL_WaitEventTimeout(SDL_Event * event, int timeout); +int SDL_PushEvent(SDL_Event * event); +void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata); +SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata); +void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata); +void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata); +void SDL_FilterEvents(SDL_EventFilter filter, void *userdata); +Uint8 SDL_EventState(Uint32 type, int state); +Uint32 SDL_RegisterEvents(int numevents); +char *SDL_GetBasePath(void); +char *SDL_GetPrefPath(const char *org, const char *app); +int SDL_NumJoysticks(void); +const char *SDL_JoystickNameForIndex(int device_index); +SDL_Joystick *SDL_JoystickOpen(int device_index); +const char *SDL_JoystickName(SDL_Joystick * joystick); +SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index); +SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick); +void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); +SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID); +SDL_bool SDL_JoystickGetAttached(SDL_Joystick * joystick); +SDL_JoystickID SDL_JoystickInstanceID(SDL_Joystick * joystick); +int SDL_JoystickNumAxes(SDL_Joystick * joystick); +int SDL_JoystickNumBalls(SDL_Joystick * joystick); +int SDL_JoystickNumHats(SDL_Joystick * joystick); +int SDL_JoystickNumButtons(SDL_Joystick * joystick); +void SDL_JoystickUpdate(void); +int SDL_JoystickEventState(int state); +Sint16 SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); +Uint8 SDL_JoystickGetHat(SDL_Joystick * joystick, int hat); +int SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy); +Uint8 SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +void SDL_JoystickClose(SDL_Joystick * joystick); +int SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); +int SDL_GameControllerAddMapping( const char* mappingString ); +char * SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); +char * SDL_GameControllerMapping( SDL_GameController * gamecontroller ); +SDL_bool SDL_IsGameController(int joystick_index); +const char *SDL_GameControllerNameForIndex(int joystick_index); +SDL_GameController *SDL_GameControllerOpen(int joystick_index); +const char *SDL_GameControllerName(SDL_GameController *gamecontroller); +SDL_bool SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); +SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); +int SDL_GameControllerEventState(int state); +void SDL_GameControllerUpdate(void); +SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString); +const char* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); +SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); +Sint16 SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); +SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString); +const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); +SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +Uint8 SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +void SDL_GameControllerClose(SDL_GameController *gamecontroller); +int SDL_NumHaptics(void); +const char *SDL_HapticName(int device_index); +SDL_Haptic *SDL_HapticOpen(int device_index); +int SDL_HapticOpened(int device_index); +int SDL_HapticIndex(SDL_Haptic * haptic); +int SDL_MouseIsHaptic(void); +SDL_Haptic *SDL_HapticOpenFromMouse(void); +int SDL_JoystickIsHaptic(SDL_Joystick * joystick); +SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); +void SDL_HapticClose(SDL_Haptic * haptic); +int SDL_HapticNumEffects(SDL_Haptic * haptic); +int SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); +unsigned int SDL_HapticQuery(SDL_Haptic * haptic); +int SDL_HapticNumAxes(SDL_Haptic * haptic); +int SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect); +int SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect); +int SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect, SDL_HapticEffect * data); +int SDL_HapticRunEffect(SDL_Haptic * haptic, int effect, Uint32 iterations); +int SDL_HapticStopEffect(SDL_Haptic * haptic, int effect); +void SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect); +int SDL_HapticGetEffectStatus(SDL_Haptic * haptic, int effect); +int SDL_HapticSetGain(SDL_Haptic * haptic, int gain); +int SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter); +int SDL_HapticPause(SDL_Haptic * haptic); +int SDL_HapticUnpause(SDL_Haptic * haptic); +int SDL_HapticStopAll(SDL_Haptic * haptic); +int SDL_HapticRumbleSupported(SDL_Haptic * haptic); +int SDL_HapticRumbleInit(SDL_Haptic * haptic); +int SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); +int SDL_HapticRumbleStop(SDL_Haptic * haptic); +SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority); +SDL_bool SDL_SetHint(const char *name, const char *value); +const char * SDL_GetHint(const char *name); +void SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); +void SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata); +void SDL_ClearHints(void); +void *SDL_LoadObject(const char *sofile); +void *SDL_LoadFunction(void *handle, const char *name); +void SDL_UnloadObject(void *handle); +void SDL_LogSetAllPriority(SDL_LogPriority priority); +void SDL_LogSetPriority(int category, SDL_LogPriority priority); +SDL_LogPriority SDL_LogGetPriority(int category); +void SDL_LogResetPriorities(void); +void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap); +void SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); +void SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); +int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); +int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); +SDL_mutex *SDL_CreateMutex(void); +int SDL_LockMutex(SDL_mutex * mutex); +int SDL_TryLockMutex(SDL_mutex * mutex); +int SDL_UnlockMutex(SDL_mutex * mutex); +void SDL_DestroyMutex(SDL_mutex * mutex); +SDL_sem *SDL_CreateSemaphore(Uint32 initial_value); +void SDL_DestroySemaphore(SDL_sem * sem); +int SDL_SemWait(SDL_sem * sem); +int SDL_SemTryWait(SDL_sem * sem); +int SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); +int SDL_SemPost(SDL_sem * sem); +Uint32 SDL_SemValue(SDL_sem * sem); +SDL_cond *SDL_CreateCond(void); +void SDL_DestroyCond(SDL_cond * cond); +int SDL_CondSignal(SDL_cond * cond); +int SDL_CondBroadcast(SDL_cond * cond); +int SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); +int SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms); +SDL_PowerState SDL_GetPowerInfo(int *secs, int *pct); +int SDL_GetNumRenderDrivers(void); +int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info); +int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer); +SDL_Renderer * SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags); +SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface * surface); +SDL_Renderer * SDL_GetRenderer(SDL_Window * window); +int SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info); +int SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h); +SDL_Texture * SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h); +SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); +int SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, int *w, int *h); +int SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b); +int SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b); +int SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha); +int SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha); +int SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode); +int SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode); +int SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); +int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); +int SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); +void SDL_UnlockTexture(SDL_Texture * texture); +SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer); +int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture); +SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer); +int SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); +void SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); +int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect); +void SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect); +int SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect); +void SDL_RenderGetClipRect(SDL_Renderer * renderer, SDL_Rect * rect); +int SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY); +void SDL_RenderGetScale(SDL_Renderer * renderer, float *scaleX, float *scaleY); +int SDL_SetRenderDrawColor(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +int SDL_GetRenderDrawColor(SDL_Renderer * renderer, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a); +int SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); +int SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode *blendMode); +int SDL_RenderClear(SDL_Renderer * renderer); +int SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y); +int SDL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count); +int SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2); +int SDL_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count); +int SDL_RenderDrawRect(SDL_Renderer * renderer, const SDL_Rect * rect); +int SDL_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); +int SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect); +int SDL_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); +int SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect); +int SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip); +int SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void *pixels, int pitch); +void SDL_RenderPresent(SDL_Renderer * renderer); +void SDL_DestroyTexture(SDL_Texture * texture); +void SDL_DestroyRenderer(SDL_Renderer * renderer); +int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); +int SDL_GL_UnbindTexture(SDL_Texture *texture); +SDL_RWops *SDL_RWFromFile(const char *file, const char *mode); +//SDL_RWops *SDL_RWFromFP(FILE * fp, SDL_bool autoclose); +SDL_RWops *SDL_RWFromMem(void *mem, int size); +SDL_RWops *SDL_RWFromConstMem(const void *mem, int size); +SDL_RWops *SDL_AllocRW(void); +void SDL_FreeRW(SDL_RWops * area); +Uint8 SDL_ReadU8(SDL_RWops * src); +Uint16 SDL_ReadLE16(SDL_RWops * src); +Uint16 SDL_ReadBE16(SDL_RWops * src); +Uint32 SDL_ReadLE32(SDL_RWops * src); +Uint32 SDL_ReadBE32(SDL_RWops * src); +Uint64 SDL_ReadLE64(SDL_RWops * src); +Uint64 SDL_ReadBE64(SDL_RWops * src); +size_t SDL_WriteU8(SDL_RWops * dst, Uint8 value); +size_t SDL_WriteLE16(SDL_RWops * dst, Uint16 value); +size_t SDL_WriteBE16(SDL_RWops * dst, Uint16 value); +size_t SDL_WriteLE32(SDL_RWops * dst, Uint32 value); +size_t SDL_WriteBE32(SDL_RWops * dst, Uint32 value); +size_t SDL_WriteLE64(SDL_RWops * dst, Uint64 value); +size_t SDL_WriteBE64(SDL_RWops * dst, Uint64 value); +SDL_Thread *SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +const char *SDL_GetThreadName(SDL_Thread *thread); +SDL_threadID SDL_ThreadID(void); +SDL_threadID SDL_GetThreadID(SDL_Thread * thread); +int SDL_SetThreadPriority(SDL_ThreadPriority priority); +void SDL_WaitThread(SDL_Thread * thread, int *status); +void SDL_DetachThread(SDL_Thread * thread); +SDL_TLSID SDL_TLSCreate(void); +void * SDL_TLSGet(SDL_TLSID id); +int SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); +Uint32 SDL_GetTicks(void); +Uint64 SDL_GetPerformanceCounter(void); +Uint64 SDL_GetPerformanceFrequency(void); +void SDL_Delay(Uint32 ms); +SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param); +SDL_bool SDL_RemoveTimer(SDL_TimerID id); +void SDL_GetVersion(SDL_version * ver); +const char *SDL_GetRevision(void); +int SDL_GetRevisionNumber(void); +int SDL_GetNumVideoDrivers(void); +const char *SDL_GetVideoDriver(int index); +int SDL_VideoInit(const char *driver_name); +void SDL_VideoQuit(void); +const char *SDL_GetCurrentVideoDriver(void); +int SDL_GetNumVideoDisplays(void); +const char * SDL_GetDisplayName(int displayIndex); +int SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); +int SDL_GetNumDisplayModes(int displayIndex); +int SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode * mode); +int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); +int SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); +SDL_DisplayMode * SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); +int SDL_GetWindowDisplayIndex(SDL_Window * window); +int SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode); +int SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode); +Uint32 SDL_GetWindowPixelFormat(SDL_Window * window); +SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags); +SDL_Window * SDL_CreateWindowFrom(const void *data); +Uint32 SDL_GetWindowID(SDL_Window * window); +SDL_Window * SDL_GetWindowFromID(Uint32 id); +Uint32 SDL_GetWindowFlags(SDL_Window * window); +void SDL_SetWindowTitle(SDL_Window * window, const char *title); +const char *SDL_GetWindowTitle(SDL_Window * window); +void SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon); +void* SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata); +void *SDL_GetWindowData(SDL_Window * window, const char *name); +void SDL_SetWindowPosition(SDL_Window * window, int x, int y); +void SDL_GetWindowPosition(SDL_Window * window, int *x, int *y); +void SDL_SetWindowSize(SDL_Window * window, int w, int h); +void SDL_GetWindowSize(SDL_Window * window, int *w, int *h); +void SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h); +void SDL_GetWindowMinimumSize(SDL_Window * window, int *w, int *h); +void SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h); +void SDL_GetWindowMaximumSize(SDL_Window * window, int *w, int *h); +void SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered); +void SDL_ShowWindow(SDL_Window * window); +void SDL_HideWindow(SDL_Window * window); +void SDL_RaiseWindow(SDL_Window * window); +void SDL_MaximizeWindow(SDL_Window * window); +void SDL_MinimizeWindow(SDL_Window * window); +void SDL_RestoreWindow(SDL_Window * window); +int SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags); +SDL_Surface * SDL_GetWindowSurface(SDL_Window * window); +int SDL_UpdateWindowSurface(SDL_Window * window); +int SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, int numrects); +void SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed); +SDL_bool SDL_GetWindowGrab(SDL_Window * window); +int SDL_SetWindowBrightness(SDL_Window * window, float brightness); +float SDL_GetWindowBrightness(SDL_Window * window); +int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue); +int SDL_GetWindowGammaRamp(SDL_Window * window, Uint16 * red, Uint16 * green, Uint16 * blue); +void SDL_DestroyWindow(SDL_Window * window); +SDL_bool SDL_IsScreenSaverEnabled(void); +void SDL_EnableScreenSaver(void); +void SDL_DisableScreenSaver(void); +SDL_Window *SDL_GetKeyboardFocus(void); +const Uint8 *SDL_GetKeyboardState(int *numkeys); +SDL_Keymod SDL_GetModState(void); +void SDL_SetModState(SDL_Keymod modstate); +SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode); +SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key); +const char *SDL_GetScancodeName(SDL_Scancode scancode); +SDL_Scancode SDL_GetScancodeFromName(const char *name); +const char *SDL_GetKeyName(SDL_Keycode key); +SDL_Keycode SDL_GetKeyFromName(const char *name); +void SDL_StartTextInput(void); +SDL_bool SDL_IsTextInputActive(void); +void SDL_StopTextInput(void); +void SDL_SetTextInputRect(SDL_Rect *rect); +SDL_bool SDL_HasScreenKeyboardSupport(void); +SDL_bool SDL_IsScreenKeyboardShown(SDL_Window *window); + +SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +void SDL_FreeSurface(SDL_Surface * surface); +int SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette); +int SDL_LockSurface(SDL_Surface * surface); +void SDL_UnlockSurface(SDL_Surface * surface); +SDL_Surface *SDL_LoadBMP_RW(SDL_RWops * src, int freesrc); +int SDL_SaveBMP_RW(SDL_Surface * surface, SDL_RWops * dst, int freedst); +int SDL_SetSurfaceRLE(SDL_Surface * surface, int flag); +int SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +int SDL_GetColorKey(SDL_Surface * surface, Uint32 * key); +int SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b); +int SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b); +int SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha); +int SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha); +int SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode); +int SDL_GetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode *blendMode); +SDL_bool SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect); +void SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); +SDL_Surface *SDL_ConvertSurface(SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags); +SDL_Surface *SDL_ConvertSurfaceFormat(SDL_Surface * src, Uint32 pixel_format, Uint32 flags); +int SDL_ConvertPixels(int width, int height, Uint32 src_format, const void * src, int src_pitch, Uint32 dst_format, void * dst, int dst_pitch); +int SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color); +int SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); +int SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +int SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +int SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, const SDL_Rect * dstrect); +int SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +int SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); + +SDL_Window *SDL_GetMouseFocus(void); +Uint32 SDL_GetMouseState(int *x, int *y); +Uint32 SDL_GetRelativeMouseState(int *x, int *y); +void SDL_WarpMouseInWindow(SDL_Window * window, int x, int y); +int SDL_SetRelativeMouseMode(SDL_bool enabled); +SDL_bool SDL_GetRelativeMouseMode(void); +SDL_Cursor *SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y); +SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y); +SDL_Cursor *SDL_CreateSystemCursor(SDL_SystemCursor id); +void SDL_SetCursor(SDL_Cursor * cursor); +SDL_Cursor *SDL_GetCursor(void); +SDL_Cursor *SDL_GetDefaultCursor(void); +void SDL_FreeCursor(SDL_Cursor * cursor); +int SDL_ShowCursor(int toggle); + +const char *SDL_GetPixelFormatName(Uint32 format); +SDL_bool SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask); +Uint32 SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +SDL_PixelFormat *SDL_AllocFormat(Uint32 pixel_format); +void SDL_FreeFormat(SDL_PixelFormat *format); +SDL_Palette *SDL_AllocPalette(int ncolors); +int SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette); +int SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors, int firstcolor, int ncolors); +void SDL_FreePalette(SDL_Palette * palette); +Uint32 SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b); +Uint32 SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b); +void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a); +void SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); + +SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B); +SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); +void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); +SDL_bool SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, SDL_Rect * result); +SDL_bool SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int *Y2); + +SDL_bool SDL_GetWindowWMInfo(SDL_Window * window, SDL_SysWMinfo * info); + +int SDL_RecordGesture(SDL_TouchID touchId); +int SDL_SaveAllDollarTemplates(SDL_RWops *dst); +int SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); +int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); + +SDL_Window *SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); +SDL_bool SDL_IsShapedWindow(const SDL_Window *window); +int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); +int SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); + +int SDL_GL_LoadLibrary(const char *path); +//void *SDL_GL_GetProcAddress(const char *proc); +void SDL_GL_UnloadLibrary(void); +SDL_bool SDL_GL_ExtensionSupported(const char *extension); +void SDL_GL_ResetAttributes(void); +int SDL_GL_SetAttribute(SDL_GLattr attr, int value); +int SDL_GL_GetAttribute(SDL_GLattr attr, int *value); +SDL_GLContext SDL_GL_CreateContext(SDL_Window *window); +int SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context); +SDL_Window* SDL_GL_GetCurrentWindow(void); +SDL_GLContext SDL_GL_GetCurrentContext(void); +void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h); +int SDL_GL_SetSwapInterval(int interval); +int SDL_GL_GetSwapInterval(void); +void SDL_GL_SwapWindow(SDL_Window * window); +void SDL_GL_DeleteContext(SDL_GLContext context); + +/* 2.0.4 */ +float SDL_sqrtf(float x); +double SDL_tan(double x); +float SDL_tanf(float x); +int SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); +Uint32 SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); +void SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); +SDL_bool SDL_HasAVX2(void); +SDL_Joystick *SDL_JoystickFromInstanceID(SDL_JoystickID joyid); +SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick); +SDL_GameController SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); +SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer * renderer); +int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); +int SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *callback_data); +SDL_Window *SDL_GetGrabbedWindow(void); +int SDL_WarpMouseGlobal(int x, int y); +int SDL_CaptureMouse(SDL_bool enabled); +Uint32 SDL_GetGlobalMouseState(int *x, int *y); + +/* 2.06 */ +void SDL_MemoryBarrierReleaseFunction(void); +void SDL_MemoryBarrierAcquireFunction(void); +Uint32 SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); +SDL_BlendMode SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation); +SDL_bool SDL_HasNEON(void); +int SDL_GameControllerNumMappings(void); +char *SDL_GameControllerMappingForIndex(int mapping_index); +Uint16 SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); +Uint16 SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); +Uint16 SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); +SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value); +Uint16 SDL_JoystickGetDeviceVendor(int device_index); +Uint16 SDL_JoystickGetDeviceProduct(int device_index); +Uint16 SDL_JoystickGetDeviceProductVersion(int device_index); +SDL_JoystickType SDL_JoystickGetDeviceType(int device_index); +SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index); +Uint16 SDL_JoystickGetVendor(SDL_Joystick * joystick); +Uint16 SDL_JoystickGetProduct(SDL_Joystick * joystick); +Uint16 SDL_JoystickGetProductVersion(SDL_Joystick * joystick); +SDL_JoystickType SDL_JoystickGetType(SDL_Joystick * joystick); +SDL_bool SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,int axis, Sint16 *state); + +int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); +int SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right); +void SDL_SetWindowResizable(SDL_Window * window, SDL_bool resizable); +int SDL_SetWindowOpacity(SDL_Window * window, float opacity); +int SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); +int SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); +int SDL_SetWindowInputFocus(SDL_Window * window); + +SDL_Surface * SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format); +SDL_Surface * SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format); +SDL_Surface * SDL_DuplicateSurface(SDL_Surface * surface); + +int SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); +size_t SDL_utf8strlen(const char *str); + +void * SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc); + +int SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable); +SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer * renderer); + +/* 2.0.7 */ +void SDL_LockJoysticks(void); +void SDL_UnlockJoysticks(void); +SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate); +int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); +int SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); +int SDL_AudioStreamAvailable(SDL_AudioStream *stream); +int SDL_AudioStreamFlush(SDL_AudioStream *stream); +void SDL_AudioStreamClear(SDL_AudioStream *stream); +void SDL_FreeAudioStream(SDL_AudioStream *stream); +void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func); +int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func); +int SDL_GetNumAllocations(void); + +/* 2.0.8 */ +void *SDL_RenderGetMetalLayer(SDL_Renderer * renderer); +void *SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); +float SDL_acosf(float x); +float SDL_asinf(float x); +float SDL_atanf(float x); +float SDL_atan2f(float x, float y); +float SDL_ceilf(float x); +float SDL_copysignf(float x, float y); +float SDL_fabsf(float x); +float SDL_floorf(float x); +double SDL_fmod(double x, double y); +float SDL_fmodf(float x, float y); +float SDL_logf(float x); +double SDL_log10(double x); +float SDL_log10f(float x); +float SDL_powf(float x, float y); +float SDL_scalbnf(float x, int n); +void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode(void); +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height); + +/* 2.0.9 */ +SDL_bool SDL_HasAVX512F(void); +char *SDL_GameControllerMappingForDeviceIndex(int joystick_index); +int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); +int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +int SDL_JoystickGetDevicePlayerIndex(int device_index); +int SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); +int SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +wchar_t *SDL_wcsdup(const wchar_t *wstr); +double SDL_exp(double x); +float SDL_expf(float x); +SDL_bool SDL_HasColorKey(SDL_Surface * surface); +SDL_bool SDL_IsTablet(void); +SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); +SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex); + +/* 2.0.10 */ +size_t SDL_SIMDGetAlignment(void); +void * SDL_SIMDAlloc(const size_t len); +void SDL_SIMDFree(void *ptr); +int SDL_RenderDrawPointF(SDL_Renderer * renderer, float x, float y); +int SDL_RenderDrawPointsF(SDL_Renderer * renderer, const SDL_FPoint * points, int count); +int SDL_RenderDrawLineF(SDL_Renderer * renderer, float x1, float y1, float x2, float y2); +int SDL_RenderDrawLinesF(SDL_Renderer * renderer, const SDL_FPoint * points, int count); +int SDL_RenderDrawRectF(SDL_Renderer * renderer, const SDL_FRect * rect); +int SDL_RenderDrawRectsF(SDL_Renderer * renderer, const SDL_FRect * rects, int count); +int SDL_RenderFillRectF(SDL_Renderer * renderer, const SDL_FRect * rect); +int SDL_RenderFillRectsF(SDL_Renderer * renderer, const SDL_FRect * rects, int count); +int SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect); +int SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); +int SDL_RenderFlush(SDL_Renderer * renderer); +Sint64 SDL_RWsize(SDL_RWops *context); +Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence); +Sint64 SDL_RWtell(SDL_RWops *context); +size_t SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum); +size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num); +int SDL_RWclose(SDL_RWops *context); +void *SDL_LoadFile(const char *file, size_t *datasize); +SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); + +/* 2.0.12 */ +SDL_bool SDL_HasARMSIMD(void); +SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); +SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); +SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller); +void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); +SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index); +SDL_Joystick *SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); +int SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode); +int SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode); +int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface); +wchar_t *SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle); +int SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); +char *SDL_strtokr(char *s1, const char *s2, char **saveptr); +int SDL_isupper(int x); +int SDL_islower(int x); + +/* 2.0.13 - 2.0.14 */ +int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, int nhats); +int SDL_JoystickDetachVirtual(int device_index); +SDL_bool SDL_JoystickIsVirtual(int device_index); +int SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value); +int SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value); +int SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value); +char *SDL_GetErrorMsg(char *errstr, int maxlen); +void SDL_LockSensors(void); +void SDL_UnlockSensors(void); +double SDL_trunc(double x); +float SDL_truncf(float x); +void *SDL_Metal_GetLayer(SDL_MetalView view); +void SDL_Metal_GetDrawableSize(SDL_Window* window, int *w, int *h); +SDL_Locale * SDL_GetPreferredLocales(void); +void * SDL_SIMDRealloc(void *mem, const size_t len); +int SDL_OpenURL(const char *url); +SDL_bool SDL_HasSurfaceRLE(SDL_Surface * surface); +SDL_bool SDL_GameControllerHasLED(SDL_GameController *gamecontroller); +int SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue); +SDL_bool SDL_JoystickHasLED(SDL_Joystick * joystick); +int SDL_JoystickSetLED(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 blue); +int SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); +int SDL_JoystickRumbleTriggers(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); +SDL_bool SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); +SDL_bool SDL_GameControllerHasButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +int SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller); +int SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad); +int SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure); +/* add support TouchDevice */ +int SDL_GetNumTouchDevices(void); +SDL_TouchID SDL_GetTouchDevice(int index); +int SDL_GetNumTouchFingers(SDL_TouchID touchID); +SDL_Finger * SDL_GetTouchFinger(SDL_TouchID touchID, int index); +Uint32 SDL_crc32(Uint32 crc, const void *data, size_t len); +const char * SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); +const char * SDL_JoystickGetSerial(SDL_Joystick *joystick); +SDL_bool SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type); +int SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled); +SDL_bool SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type); +int SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); +int SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2); +int SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len); +#endif + +#endif /* CLIB_SDL2_PROTOS_H */ diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd new file mode 100644 index 0000000000..60ffa6fc90 --- /dev/null +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -0,0 +1,700 @@ +##base _SDL2Base +##bias 30 +* The SDL interface +##public +* general +SDL_InitTGL(glcptr,tglptr)(base,sysv) +SDL_SetExitPointer(exitfunc)(base,sysv) +SDL_VSetError(fmt,va_list)(sysv,r12base) +SDL_GetPlatform()(sysv,r12base) +SDL_Init(flags)(sysv,r12base) +SDL_InitSubSystem(flags)(sysv,r12base) +SDL_QuitSubSystem(flags)(sysv,r12base) +SDL_WasInit(flags)(sysv,r12base) +SDL_Quit()(sysv,r12base) +SDL_SetMainReady()(sysv,r12base) +SDL_malloc(size)(sysv,r12base) +SDL_calloc(nmemb,size)(sysv,r12base) +SDL_realloc(mem,size)(sysv,r12base) +SDL_free(mem)(sysv,r12base) +SDL_qsort(base,nmemb,size,compare)(sysv,r12base) +SDL_abs(x)(sysv,r12base) +SDL_isdigit(x)(sysv,r12base) +SDL_isspace(x)(sysv,r12base) +SDL_toupper(x)(sysv,r12base) +SDL_tolower(x)(sysv,r12base) +SDL_memset(dst,c,len)(sysv,r12base) +SDL_memcpy(dst,src,len)(sysv,r12base) +SDL_memmove(dst,src,len)(sysv,r12base) +SDL_memcmp(s1,s2,len)(sysv,r12base) +SDL_wcslen(wstr)(sysv,r12base) +SDL_wcslcpy(dst,src,maxlen)(sysv,r12base) +SDL_wcslcat(dst,src,maxlen)(sysv,r12base) +SDL_strlen(str)(sysv,r12base) +SDL_strlcpy(dst,src,maxlen)(sysv,r12base) +SDL_utf8strlcpy(dst,src,dst_bytes)(sysv,r12base) +SDL_strlcat(dst,src,maxlen)(sysv,r12base) +SDL_strdup(str)(sysv,r12base) +SDL_strrev(str)(sysv,r12base) +SDL_strupr(str)(sysv,r12base) +SDL_strlwr(str)(sysv,r12base) +SDL_strchr(str,c)(sysv,r12base) +SDL_strrchr(str,c)(sysv,r12base) +SDL_strstr(haystack,needle)(sysv,r12base) +SDL_itoa(value,str,radix)(sysv,r12base) +SDL_uitoa(value,str,radix)(sysv,r12base) +SDL_ltoa(value,str,radix)(sysv,r12base) +SDL_ultoa(value,str,radix)(sysv,r12base) +SDL_lltoa(Sint64value,str,radix)(sysv,r12base) +SDL_ulltoa(value,str,radix)(sysv,r12base) +SDL_atoi(str)(sysv,r12base) +SDL_atof(str)(sysv,r12base) +SDL_strtol(str,endp,base)(sysv,r12base) +SDL_strtoul(str,endp,base)(sysv,r12base) +SDL_strtoll(str,endp,base)(sysv,r12base) +SDL_strtoull(str,endp,base)(sysv,r12base) +SDL_strtod(str,endp)(sysv,r12base) +SDL_strcmp(str1,str2)(sysv,r12base) +SDL_strncmp(str1,str2,maxlen)(sysv,r12base) +SDL_strcasecmp(str1,str2)(sysv,r12base) +SDL_strncasecmp(str1,str2,len)(sysv,r12base) +SDL_vsscanf(text,fmt,ap)(sysv,r12base) +SDL_vsnprintf(text,maxlen,fmt,ap)(sysv,r12base) +SDL_acos(x)(sysv,r12base) +SDL_asin(x)(sysv,r12base) +SDL_atan(x)(sysv,r12base) +SDL_atan2(x,y)(sysv,r12base) +SDL_ceil(x)(sysv,r12base) +SDL_copysign(x,y)(sysv,r12base) +SDL_cos(x)(sysv,r12base) +SDL_cosf(x)(sysv,r12base) +SDL_fabs(x)(sysv,r12base) +SDL_floor(x)(sysv,r12base) +SDL_log(x)(sysv,r12base) +SDL_pow(x,y)(sysv,r12base) +SDL_scalbn(x,n)(sysv,r12base) +SDL_sin(x)(sysv,r12base) +SDL_sinf(x)(sysv,r12base) +SDL_sqrt(x)(sysv,r12base) +SDL_iconv_open(tocode,fromcode)(sysv,r12base) +SDL_iconv_close(cd)(sysv,r12base) +SDL_iconv(cd,inbuf,inbytesleft,outbuf,outbytesleft)(sysv,r12base) +SDL_iconv_string(tocode,fromcode,inbuf,inbytesleft)(sysv,r12base) +SDL_ReportAssertion(a,b,c,d)(sysv,r12base) +SDL_SetAssertionHandler(handler,userdata)(sysv,r12base) +SDL_GetDefaultAssertionHandler()(sysv,r12base) +SDL_GetAssertionHandler(puserdata)(sysv,r12base) +SDL_GetAssertionReport()(sysv,r12base) +SDL_ResetAssertionReport()(sysv,r12base) +SDL_AtomicTryLock(lock)(sysv,r12base) +SDL_AtomicLock(lock)(sysv,r12base) +SDL_AtomicUnlock(lock)(sysv,r12base) +SDL_AtomicCAS(a,oldval,newval)(sysv,r12base) +SDL_AtomicSet(a,v)(sysv,r12base) +SDL_AtomicGet(a)(sysv,r12base) +SDL_AtomicAdd(a,v)(sysv,r12base) +SDL_AtomicCASPtr(a,oldval,newval)(sysv,r12base) +SDL_AtomicSetPtr(a,voidv)(sysv,r12base) +SDL_AtomicGetPtr(a)(sysv,r12base) +SDL_GetNumAudioDrivers()(sysv,r12base) +SDL_GetAudioDriver(index)(sysv,r12base) +SDL_AudioInit(driver_name)(sysv,r12base) +SDL_AudioQuit()(sysv,r12base) +SDL_GetCurrentAudioDriver()(sysv,r12base) +SDL_OpenAudio(desired,obtained)(sysv,r12base) +SDL_GetNumAudioDevices(iscapture)(sysv,r12base) +SDL_GetAudioDeviceName(index,iscapture)(sysv,r12base) +SDL_OpenAudioDevice(device,iscapture,desired,obtained,allowed_changes)(sysv,r12base) +SDL_GetAudioStatus()(sysv,r12base) +SDL_GetAudioDeviceStatus(dev)(sysv,r12base) +SDL_PauseAudio(pause_on)(sysv,r12base) +SDL_PauseAudioDevice(dev,pause_on)(sysv,r12base) +SDL_LoadWAV_RW(src,freesrc,spec,audio_buf,audio_len)(sysv,r12base) +SDL_FreeWAV(audio_buf)(sysv,r12base) +SDL_BuildAudioCVT(cvt,src_format,src_channels,src_rate,dst_format,dst_channels,dst_rate)(sysv,r12base) +SDL_ConvertAudio(cvt)(sysv,r12base) +SDL_MixAudio(dst,src,len,volume)(sysv,r12base) +SDL_MixAudioFormat(dst,src,format,len,volume)(sysv,r12base) +SDL_LockAudio()(sysv,r12base) +SDL_LockAudioDevice(SDL_AudioDeviceIDdev)(sysv,r12base) +SDL_UnlockAudio()(sysv,r12base) +SDL_UnlockAudioDevice(SDL_AudioDeviceIDdev)(sysv,r12base) +SDL_CloseAudio()(sysv,r12base) +SDL_CloseAudioDevice(SDL_AudioDeviceIDdev)(sysv,r12base) +SDL_SetClipboardText(text)(sysv,r12base) +SDL_GetClipboardText()(sysv,r12base) +SDL_HasClipboardText()(sysv,r12base) +SDL_GetCPUCount()(sysv,r12base) +SDL_GetCPUCacheLineSize()(sysv,r12base) +SDL_HasRDTSC()(sysv,r12base) +SDL_HasAltiVec()(sysv,r12base) +SDL_HasMMX()(sysv,r12base) +SDL_Has3DNow()(sysv,r12base) +SDL_HasSSE()(sysv,r12base) +SDL_HasSSE2()(sysv,r12base) +SDL_HasSSE3()(sysv,r12base) +SDL_HasSSE41()(sysv,r12base) +SDL_HasSSE42()(sysv,r12base) +SDL_HasAVX()(sysv,r12base) +SDL_GetSystemRAM()(sysv,r12base) +SDL_GetError()(sysv,r12base) +SDL_ClearError()(sysv,r12base) +SDL_Error(code)(sysv,r12base) +SDL_PumpEvents()(sysv,r12base) +SDL_PeepEvents(events,numevents,SDL_eventactionaction,minType,maxType)(sysv,r12base) +SDL_HasEvent(type)(sysv,r12base) +SDL_HasEvents(minType,maxType)(sysv,r12base) +SDL_FlushEvent(type)(sysv,r12base) +SDL_FlushEvents(minType,maxType)(sysv,r12base) +SDL_PollEvent(event)(sysv,r12base) +SDL_WaitEvent(event)(sysv,r12base) +SDL_WaitEventTimeout(event,timeout)(sysv,r12base) +SDL_PushEvent(event)(sysv,r12base) +SDL_SetEventFilter(filter,userdata)(sysv,r12base) +SDL_GetEventFilter(filter,userdata)(sysv,r12base) +SDL_AddEventWatch(filter,userdata)(sysv,r12base) +SDL_DelEventWatch(filter,userdata)(sysv,r12base) +SDL_FilterEvents(filter,userdata)(sysv,r12base) +SDL_EventState(type,state)(sysv,r12base) +SDL_RegisterEvents(numevents)(sysv,r12base) +SDL_GetBasePath()(sysv,r12base) +SDL_GetPrefPath(org,app)(sysv,r12base) +SDL_NumJoysticks()(sysv,r12base) +SDL_JoystickNameForIndex(device_index)(sysv,r12base) +SDL_JoystickOpen(device_index)(sysv,r12base) +SDL_JoystickName(joystick)(sysv,r12base) +SDL_JoystickGetDeviceGUID(device_index)(sysv,r12base) +SDL_JoystickGetGUID(joystick)(sysv,r12base) +SDL_JoystickGetGUIDString(guid,pszGUID,cbGUID)(sysv,r12base) +SDL_JoystickGetGUIDFromString(pchGUID)(sysv,r12base) +SDL_JoystickGetAttached(joystick)(sysv,r12base) +SDL_JoystickInstanceID(joystick)(sysv,r12base) +SDL_JoystickNumAxes(joystick)(sysv,r12base) +SDL_JoystickNumBalls(joystick)(sysv,r12base) +SDL_JoystickNumHats(joystick)(sysv,r12base) +SDL_JoystickNumButtons(joystick)(sysv,r12base) +SDL_JoystickUpdate()(sysv,r12base) +SDL_JoystickEventState(state)(sysv,r12base) +SDL_JoystickGetAxis(joystick,axis)(sysv,r12base) +SDL_JoystickGetHat(joystick,hat)(sysv,r12base) +SDL_JoystickGetBall(joystick,ball,dx,dy)(sysv,r12base) +SDL_JoystickGetButton(joystick,button)(sysv,r12base) +SDL_JoystickClose(joystick)(sysv,r12base) +SDL_GameControllerAddMappingsFromRW(rw,freerw)(sysv,r12base) +SDL_GameControllerAddMapping(mappingString)(sysv,r12base) +SDL_GameControllerMappingForGUID(guid)(sysv,r12base) +SDL_GameControllerMapping(gamecontroller)(sysv,r12base) +SDL_IsGameController(joystick_index)(sysv,r12base) +SDL_GameControllerNameForIndex(joystick_index)(sysv,r12base) +SDL_GameControllerOpen(joystick_index)(sysv,r12base) +SDL_GameControllerName(gamecontroller)(sysv,r12base) +SDL_GameControllerGetAttached(gamecontroller)(sysv,r12base) +SDL_GameControllerGetJoystick(gamecontroller)(sysv,r12base) +SDL_GameControllerEventState(state)(sysv,r12base) +SDL_GameControllerUpdate()(sysv,r12base) +SDL_GameControllerGetAxisFromString(pchString)(sysv,r12base) +SDL_GameControllerGetStringForAxis(axis)(sysv,r12base) +SDL_GameControllerGetBindForAxis(gamecontroller,axis)(sysv,r12base) +SDL_GameControllerGetAxis(gamecontroller,axis)(sysv,r12base) +SDL_GameControllerGetButtonFromString(pchString)(sysv,r12base) +SDL_GameControllerGetStringForButton(button)(sysv,r12base) +SDL_GameControllerGetBindForButton(gamecontroller,button)(sysv,r12base) +SDL_GameControllerGetButton(gamecontroller,button)(sysv,r12base) +SDL_GameControllerClose(gamecontroller)(sysv,r12base) +SDL_SetHintWithPriority(name,value,priority)(sysv,r12base) +SDL_SetHint(name,value)(sysv,r12base) +SDL_GetHint(name)(sysv,r12base) +SDL_AddHintCallback(name,callback,userdata)(sysv,r12base) +SDL_DelHintCallback(name,callback,userdata)(sysv,r12base) +SDL_ClearHints()(sysv,r12base) +SDL_LoadObject(sofile)(sysv,r12base) +SDL_LoadFunction(handle,name)(sysv,r12base) +SDL_UnloadObject(handle)(sysv,r12base) +SDL_LogSetAllPriority(priority)(sysv,r12base) +SDL_LogSetPriority(category,priority)(sysv,r12base) +SDL_LogGetPriority(category)(sysv,r12base) +SDL_LogResetPriorities()(sysv,r12base) +SDL_LogMessageV(category,priority,fmt,ap)(sysv,r12base) +SDL_LogGetOutputFunction(callback,userdata)(sysv,r12base) +SDL_LogSetOutputFunction(callback,userdata)(sysv,r12base) +SDL_ShowMessageBox(messageboxdata,buttonid)(sysv,r12base) +SDL_ShowSimpleMessageBox(flags,title,message,window)(sysv,r12base) +SDL_CreateMutex()(sysv,r12base) +SDL_LockMutex(mutex)(sysv,r12base) +SDL_TryLockMutex(mutex)(sysv,r12base) +SDL_UnlockMutex(mutex)(sysv,r12base) +SDL_DestroyMutex(mutex)(sysv,r12base) +SDL_CreateSemaphore(initial_value)(sysv,r12base) +SDL_DestroySemaphore(sem)(sysv,r12base) +SDL_SemWait(sem)(sysv,r12base) +SDL_SemTryWait(sem)(sysv,r12base) +SDL_SemWaitTimeout(sem,ms)(sysv,r12base) +SDL_SemPost(sem)(sysv,r12base) +SDL_SemValue(sem)(sysv,r12base) +SDL_CreateCond()(sysv,r12base) +SDL_DestroyCond(cond)(sysv,r12base) +SDL_CondSignal(cond)(sysv,r12base) +SDL_CondBroadcast(cond)(sysv,r12base) +SDL_CondWait(cond,mutex)(sysv,r12base) +SDL_CondWaitTimeout(cond,mutex,ms)(sysv,r12base) +SDL_GetPowerInfo(secs,pct)(sysv,r12base) +SDL_GetNumRenderDrivers()(sysv,r12base) +SDL_GetRenderDriverInfo(index,info)(sysv,r12base) +SDL_CreateWindowAndRenderer(width,height,window_flags,window,renderer)(sysv,r12base) +SDL_CreateRenderer(window,index,flags)(sysv,r12base) +SDL_CreateSoftwareRenderer(surface)(sysv,r12base) +SDL_GetRenderer(window)(sysv,r12base) +SDL_GetRendererInfo(renderer,info)(sysv,r12base) +SDL_GetRendererOutputSize(renderer,w,h)(sysv,r12base) +SDL_CreateTexture(renderer,format,access,w,h)(sysv,r12base) +SDL_CreateTextureFromSurface(renderer,surface)(sysv,r12base) +SDL_QueryTexture(texture,format,access,w,h)(sysv,r12base) +SDL_SetTextureColorMod(texture,r,g,b)(sysv,r12base) +SDL_GetTextureColorMod(texture,r,g,b)(sysv,r12base) +SDL_SetTextureAlphaMod(texture,alpha)(sysv,r12base) +SDL_GetTextureAlphaMod(texture,alpha)(sysv,r12base) +SDL_SetTextureBlendMode(texture,blendMode)(sysv,r12base) +SDL_GetTextureBlendMode(texture,blendMode)(sysv,r12base) +SDL_UpdateTexture(texture,rect,pixels,pitch)(sysv,r12base) +SDL_UpdateYUVTexture(texture,rect,Yplane,Ypitch,Uplane,Upitch,Vplane,Vpitch)(sysv,r12base) +SDL_LockTexture(texture,rect,pixels,pitch)(sysv,r12base) +SDL_UnlockTexture(texture)(sysv,r12base) +SDL_RenderTargetSupported(renderer)(sysv,r12base) +SDL_SetRenderTarget(renderer,texture)(sysv,r12base) +SDL_GetRenderTarget(renderer)(sysv,r12base) +SDL_RenderSetLogicalSize(renderer,w,h)(sysv,r12base) +SDL_RenderGetLogicalSize(renderer,w,h)(sysv,r12base) +SDL_RenderSetViewport(renderer,rect)(sysv,r12base) +SDL_RenderGetViewport(renderer,rect)(sysv,r12base) +SDL_RenderSetClipRect(renderer,rect)(sysv,r12base) +SDL_RenderGetClipRect(renderer,rect)(sysv,r12base) +SDL_RenderSetScale(renderer,scaleX,scaleY)(sysv,r12base) +SDL_RenderGetScale(renderer,scaleX,scaleY)(sysv,r12base) +SDL_SetRenderDrawColor(renderer,r,g,b,a)(sysv,r12base) +SDL_GetRenderDrawColor(renderer,r,g,b,a)(sysv,r12base) +SDL_SetRenderDrawBlendMode(renderer,blendMode)(sysv,r12base) +SDL_GetRenderDrawBlendMode(renderer,blendMode)(sysv,r12base) +SDL_RenderClear(renderer)(sysv,r12base) +SDL_RenderDrawPoint(renderer,x,y)(sysv,r12base) +SDL_RenderDrawPoints(renderer,points,count)(sysv,r12base) +SDL_RenderDrawLine(renderer,x1,y1,x2,y2)(sysv,r12base) +SDL_RenderDrawLines(renderer,points,count)(sysv,r12base) +SDL_RenderDrawRect(renderer,rect)(sysv,r12base) +SDL_RenderDrawRects(renderer,rects,count)(sysv,r12base) +SDL_RenderFillRect(renderer,rect)(sysv,r12base) +SDL_RenderFillRects(renderer,rects,count)(sysv,r12base) +SDL_RenderCopy(renderer,texture,srcrect,dstrect)(sysv,r12base) +SDL_RenderCopyEx(renderer,texture,srcrect,dstrect,angle,center,flip)(sysv,r12base) +SDL_RenderReadPixels(renderer,rect,format,pixels,pitch)(sysv,r12base) +SDL_RenderPresent(renderer)(sysv,r12base) +SDL_DestroyTexture(texture)(sysv,r12base) +SDL_DestroyRenderer(renderer)(sysv,r12base) +SDL_GL_BindTexture(texture,texw,texh)(sysv,r12base) +SDL_GL_UnbindTexture(texture)(sysv,r12base) +SDL_RWFromFile(file,mode)(sysv,r12base) +SDL_RWFromFP_clib(fp,autoclose,size,seek,read,write,close)(sysv,r12base) +SDL_RWFromMem(mem,size)(sysv,r12base) +SDL_RWFromConstMem(mem,size)(sysv,r12base) +SDL_AllocRW()(sysv,r12base) +SDL_FreeRW(area)(sysv,r12base) +SDL_ReadU8(src)(sysv,r12base) +SDL_ReadLE16(src)(sysv,r12base) +SDL_ReadBE16(src)(sysv,r12base) +SDL_ReadLE32(src)(sysv,r12base) +SDL_ReadBE32(src)(sysv,r12base) +SDL_ReadLE64(src)(sysv,r12base) +SDL_ReadBE64(src)(sysv,r12base) +SDL_WriteU8(dst,svalue)(sysv,r12base) +SDL_WriteLE16(dst,value)(sysv,r12base) +SDL_WriteBE16(dst,value)(sysv,r12base) +SDL_WriteLE32(dst,value)(sysv,r12base) +SDL_WriteBE32(dst,value)(sysv,r12base) +SDL_WriteLE64(dst,value)(sysv,r12base) +SDL_WriteBE64(dst,value)(sysv,r12base) +SDL_CreateThread(fn,name,data)(sysv,r12base) +SDL_GetThreadName(thread)(sysv,r12base) +SDL_ThreadID()(sysv,r12base) +SDL_GetThreadID(thread)(sysv,r12base) +SDL_SetThreadPriority(priority)(sysv,r12base) +SDL_WaitThread(thread,status)(sysv,r12base) +SDL_DetachThread(thread)(sysv,r12base) +SDL_TLSCreate()(sysv,r12base) +SDL_TLSGet(id)(sysv,r12base) +SDL_TLSSet(id,value,destructor)(sysv,r12base) +SDL_GetTicks()(sysv,r12base) +SDL_GetPerformanceCounter()(sysv,r12base) +SDL_GetPerformanceFrequency()(sysv,r12base) +SDL_Delay(ms)(sysv,r12base) +SDL_AddTimer(interval,callback,param)(sysv,r12base) +SDL_RemoveTimer(id)(sysv,r12base) +SDL_GetVersion(ver)(sysv,r12base) +SDL_GetRevision()(sysv,r12base) +SDL_GetRevisionNumber()(sysv,r12base) +SDL_GetNumVideoDrivers()(sysv,r12base) +SDL_GetVideoDriver(index)(sysv,r12base) +SDL_VideoInit(driver_name)(sysv,r12base) +SDL_VideoQuit()(sysv,r12base) +SDL_GetCurrentVideoDriver()(sysv,r12base) +SDL_GetNumVideoDisplays()(sysv,r12base) +SDL_GetDisplayName(displayIndex)(sysv,r12base) +SDL_GetDisplayBounds(displayIndex,rect)(sysv,r12base) +SDL_GetNumDisplayModes(displayIndex)(sysv,r12base) +SDL_GetDisplayMode(displayIndex,modeIndex,mode)(sysv,r12base) +SDL_GetDesktopDisplayMode(displayIndex,mode)(sysv,r12base) +SDL_GetCurrentDisplayMode(displayIndex,mode)(sysv,r12base) +SDL_GetClosestDisplayMode(displayIndex,mode,closest)(sysv,r12base) +SDL_GetWindowDisplayIndex(window)(sysv,r12base) +SDL_SetWindowDisplayMode(window,SDL_DisplayModemode)(sysv,r12base) +SDL_GetWindowDisplayMode(window,SDL_DisplayModemode)(sysv,r12base) +SDL_GetWindowPixelFormat(window)(sysv,r12base) +SDL_CreateWindow(title,x,y,w,h,flags)(sysv,r12base) +SDL_CreateWindowFrom(data)(sysv,r12base) +SDL_GetWindowID(window)(sysv,r12base) +SDL_GetWindowFromID(id)(sysv,r12base) +SDL_GetWindowFlags(window)(sysv,r12base) +SDL_SetWindowTitle(window,title)(sysv,r12base) +SDL_GetWindowTitle(window)(sysv,r12base) +SDL_SetWindowIcon(window,icon)(sysv,r12base) +SDL_SetWindowData(window,name,userdata)(sysv,r12base) +SDL_GetWindowData(window,name)(sysv,r12base) +SDL_SetWindowPosition(window,x,y)(sysv,r12base) +SDL_GetWindowPosition(window,x,y)(sysv,r12base) +SDL_SetWindowSize(window,w,h)(sysv,r12base) +SDL_GetWindowSize(window,w,h)(sysv,r12base) +SDL_SetWindowMinimumSize(window,min_w,min_h)(sysv,r12base) +SDL_GetWindowMinimumSize(window,w,h)(sysv,r12base) +SDL_SetWindowMaximumSize(window,max_w,max_h)(sysv,r12base) +SDL_GetWindowMaximumSize(window,w,h)(sysv,r12base) +SDL_SetWindowBordered(window,bordered)(sysv,r12base) +SDL_ShowWindow(window)(sysv,r12base) +SDL_HideWindow(window)(sysv,r12base) +SDL_RaiseWindow(window)(sysv,r12base) +SDL_MaximizeWindow(window)(sysv,r12base) +SDL_MinimizeWindow(window)(sysv,r12base) +SDL_RestoreWindow(window)(sysv,r12base) +SDL_SetWindowFullscreen(window,flags)(sysv,r12base) +SDL_GetWindowSurface(window)(sysv,r12base) +SDL_UpdateWindowSurface(window)(sysv,r12base) +SDL_UpdateWindowSurfaceRects(window,rects,numrects)(sysv,r12base) +SDL_SetWindowGrab(window,grabbed)(sysv,r12base) +SDL_GetWindowGrab(window)(sysv,r12base) +SDL_SetWindowBrightness(window,brightness)(sysv,r12base) +SDL_GetWindowBrightness(window)(sysv,r12base) +SDL_SetWindowGammaRamp(window,red,green,blue)(sysv,r12base) +SDL_GetWindowGammaRamp(window,red,green,blue)(sysv,r12base) +SDL_DestroyWindow(window)(sysv,r12base) +SDL_IsScreenSaverEnabled()(sysv,r12base) +SDL_EnableScreenSaver()(sysv,r12base) +SDL_DisableScreenSaver()(sysv,r12base) +SDL_GetKeyboardFocus()(sysv,r12base) +SDL_GetKeyboardState(numkeys)(sysv,r12base) +SDL_GetModState()(sysv,r12base) +SDL_SetModState(modstate)(sysv,r12base) +SDL_GetKeyFromScancode(scancode)(sysv,r12base) +SDL_GetScancodeFromKey(key)(sysv,r12base) +SDL_GetScancodeName(scancode)(sysv,r12base) +SDL_GetScancodeFromName(name)(sysv,r12base) +SDL_GetKeyName(key)(sysv,r12base) +SDL_GetKeyFromName(name)(sysv,r12base) +SDL_StartTextInput()(sysv,r12base) +SDL_IsTextInputActive()(sysv,r12base) +SDL_StopTextInput()(sysv,r12base) +SDL_SetTextInputRect(rect)(sysv,r12base) +SDL_HasScreenKeyboardSupport()(sysv,r12base) +SDL_IsScreenKeyboardShown(window)(sysv,r12base) +SDL_CreateRGBSurface(flags,width,height,depth,Rmask,Gmask,Bmask,Amask)(sysv,r12base) +SDL_CreateRGBSurfaceFrom(pixels,width,height,depth,pitch,Rmask,Gmask,Bmask,Amask)(sysv,r12base) +SDL_FreeSurface(surface)(sysv,r12base) +SDL_SetSurfacePalette(surface,palette)(sysv,r12base) +SDL_LockSurface(surface)(sysv,r12base) +SDL_UnlockSurface(surface)(sysv,r12base) +SDL_LoadBMP_RW(src,freesrc)(sysv,r12base) +SDL_SaveBMP_RW(surface,dst,freedst)(sysv,r12base) +SDL_SetSurfaceRLE(surface,flag)(sysv,r12base) +SDL_SetColorKey(surface,flag,key)(sysv,r12base) +SDL_GetColorKey(surface,key)(sysv,r12base) +SDL_SetSurfaceColorMod(surface,r,g,b)(sysv,r12base) +SDL_GetSurfaceColorMod(surface,r,g,b)(sysv,r12base) +SDL_SetSurfaceAlphaMod(surface,alpha)(sysv,r12base) +SDL_GetSurfaceAlphaMod(surface,alpha)(sysv,r12base) +SDL_SetSurfaceBlendMode(surface,blendMode)(sysv,r12base) +SDL_GetSurfaceBlendMode(surface,blendMode)(sysv,r12base) +SDL_SetClipRect(surface,rect)(sysv,r12base) +SDL_GetClipRect(surface,rect)(sysv,r12base) +SDL_ConvertSurface(src,fmt,flags)(sysv,r12base) +SDL_ConvertSurfaceFormat(src,pixel_format,flags)(sysv,r12base) +SDL_ConvertPixels(width,height,src_format,src,src_pitch,dst_format,dst,dst_pitch)(sysv,r12base) +SDL_FillRect(dst,rect,color)(sysv,r12base) +SDL_FillRects(dst,rects,count,color)(sysv,r12base) +SDL_UpperBlit(src,srcrect,dst,dstrect)(sysv,r12base) +SDL_LowerBlit(src,srcrect,dst,dstrect)(sysv,r12base) +SDL_SoftStretch(src,srcrect,dst,dstrect)(sysv,r12base) +SDL_UpperBlitScaled(src,srcrect,dst,dstrect)(sysv,r12base) +SDL_LowerBlitScaled(src,srcrect,dst,dstrect)(sysv,r12base) +SDL_GetMouseFocus()(sysv,r12base) +SDL_GetMouseState(x,y)(sysv,r12base) +SDL_GetRelativeMouseState(x,y)(sysv,r12base) +SDL_WarpMouseInWindow(window,x,y)(sysv,r12base) +SDL_SetRelativeMouseMode(enabled)(sysv,r12base) +SDL_GetRelativeMouseMode()(sysv,r12base) +SDL_CreateCursor(data,mask,w,h,hot_x,hot_y)(sysv,r12base) +SDL_CreateColorCursor(surface,hot_x,hot_y)(sysv,r12base) +SDL_CreateSystemCursor(id)(sysv,r12base) +SDL_SetCursor(cursor)(sysv,r12base) +SDL_GetCursor()(sysv,r12base) +SDL_GetDefaultCursor()(sysv,r12base) +SDL_FreeCursor(cursor)(sysv,r12base) +SDL_ShowCursor(toggle)(sysv,r12base) +SDL_GetPixelFormatName(format)(sysv,r12base) +SDL_PixelFormatEnumToMasks(format,bpp,Rmask,Gmask,Bmask,Amask)(sysv,r12base) +SDL_MasksToPixelFormatEnum(bpp,Rmask,Gmask,Bmask,Amask)(sysv,r12base) +SDL_AllocFormat(pixel_format)(sysv,r12base) +SDL_FreeFormat(format)(sysv,r12base) +SDL_AllocPalette(ncolors)(sysv,r12base) +SDL_SetPixelFormatPalette(format,palette)(sysv,r12base) +SDL_SetPaletteColors(palette,colors,firstcolor,ncolors)(sysv,r12base) +SDL_FreePalette(palette)(sysv,r12base) +SDL_MapRGB(format,r,g,b)(sysv,r12base) +SDL_MapRGBA(format,r,g,b,a)(sysv,r12base) +SDL_GetRGB(pixel,format,r,g,b)(sysv,r12base) +SDL_GetRGBA(pixel,format,r,g,b,a)(sysv,r12base) +SDL_CalculateGammaRamp(gamma,ramp)(sysv,r12base) +SDL_HasIntersection(A,B)(sysv,r12base) +SDL_IntersectRect(A,B,result)(sysv,r12base) +SDL_UnionRect(A,B,result)(sysv,r12base) +SDL_EnclosePoints(points,count,clip,result)(sysv,r12base) +SDL_IntersectRectAndLine(rect,X1,Y1,X2,Y2)(sysv,r12base) +SDL_GetWindowWMInfo(window,info)(sysv,r12base) +SDL_RecordGesture(touchId)(sysv,r12base) +SDL_SaveAllDollarTemplates(dst)(sysv,r12base) +SDL_SaveDollarTemplate(gestureId,dst)(sysv,r12base) +SDL_LoadDollarTemplates(touchId,src)(sysv,r12base) +SDL_CreateShapedWindow(title,x,y,w,h,flags)(sysv,r12base) +SDL_IsShapedWindow(window)(sysv,r12base) +SDL_SetWindowShape(window,shape,shape_mode)(sysv,r12base) +SDL_GetShapedWindowMode(window,shape_mode)(sysv,r12base) +SDL_CaptureMouse(enabled)(sysv,r12base) +SDL_WarpMouseGlobal(x,y)(sysv,r12base) +SDL_GetGlobalMouseState(x,y)(sysv,r12base) +SDL_SetWindowHitTest(window,callback,calback_data)(sysv,r12base) +SDL_GetGrabbedWindow()(sysv,r12base) +SDL_GetDisplayDPI(displayindex,ddpi,hdpi,vdpi)(sysv,r12base) +SDL_RenderIsClipEnabled(renderer)(sysv,r12base) +SDL_GameControllerFromInstanceID(joystick)(sysv,r12base) +SDL_JoystickCurrentPowerLevel(joystick)(sysv,r12base) +SDL_JoystickFromInstanceID(joystick)(sysv,r12base) +SDL_HasAVX2()(sysv,r12base) +SDL_QueueAudio(dev,data,len)(sysv,r12base) +SDL_GetQueuedAudioSize(dev)(sysv,r12base) +SDL_ClearQueuedAudio(dev)(sysv,r12base) +SDL_sqrtf(x)(sysv,r12base) +SDL_tan(x)(sysv,r12base) +SDL_tanf(x)(sysv,r12base) +SDL_MemoryBarrierReleaseFunction()(sysv,r12base) +SDL_MemoryBarrierAcquireFunction()(sysv,r12base) +SDL_DequeueAudio(dev,data,len)(sysv,r12base) +SDL_ComposeCustomBlendMode(srcColorFactor,dstColorFactor,colorOperation,srcAlphaFactor,dstAlphaFactor,alphaOperation)(sysv,r12base) +SDL_HasNEON()(sysv,r12base) +SDL_GameControllerNumMappings()(sysv,r12base) +SDL_GameControllerMappingForIndex(mapping_index)(sysv,r12base) +SDL_GameControllerGetVendor(gamecontroller)(sysv,r12base) +SDL_GameControllerGetProduct(gamecontroller)(sysv,r12base) +SDL_GameControllerGetProductVersion(gamecontroller)(sysv,r12base) +SDL_GetHintBoolean(name,default_value)(sysv,r12base) +SDL_JoystickGetDeviceVendor(device_index)(sysv,r12base) +SDL_JoystickGetDeviceProduct(device_index)(sysv,r12base) +SDL_JoystickGetDeviceProductVersion(device_index)(sysv,r12base) +SDL_JoystickGetDeviceType(device_index)(sysv,r12base) +SDL_JoystickGetDeviceInstanceID(device_index)(sysv,r12base) +SDL_JoystickGetVendor(joystick)(sysv,r12base) +SDL_JoystickGetProduct(joystick)(sysv,r12base) +SDL_JoystickGetProductVersion(joystick)(sysv,r12base) +SDL_JoystickGetType(joystick)(sysv,r12base) +SDL_JoystickGetAxisInitialState(joystick,axis,state)(sysv,r12base) +SDL_GetDisplayUsableBounds(displayIndex,rect)(sysv,r12base) +SDL_GetWindowBordersSize(window,top,left,bottom,right)(sysv,r12base) +SDL_SetWindowResizable(window,resizable)(sysv,r12base) +SDL_SetWindowOpacity(window,opacity)(sysv,r12base) +SDL_GetWindowOpacity(window,out_opacity)(sysv,r12base) +SDL_SetWindowModalFor(modal_window,parent_window)(sysv,r12base) +SDL_SetWindowInputFocus(window)(sysv,r12base) +SDL_CreateRGBSurfaceWithFormat(flags,width,height,depth,format)(sysv,r12base) +SDL_CreateRGBSurfaceWithFormatFrom(pixels,width,height,depth,pitch,format)(sysv,r12base) +SDL_DuplicateSurface(surface)(sysv,r12base) +SDL_wcscmp(str1,str2)(sysv,r12base) +SDL_utf8strlen(str)(sysv,r12base) +SDL_LoadFile_RW(src,datasize,freesrc)(sysv,r12base) +SDL_RenderSetIntegerScale(renderer,enable)(sysv,r12base) +SDL_RenderGetIntegerScale(renderer)(sysv,r12base) +SDL_NewAudioStream(src_format,src_channels,dst_format,dst_channels,dst_rate)(sysv,r12base) +SDL_AudioStreamPut(stream,buf,len)(sysv,r12base) +SDL_AudioStreamGet(stream,buf,len)(sysv,r12base) +SDL_AudioStreamAvailable(stream)(sysv,r12base) +SDL_AudioStreamFlush(stream)(sysv,r12base) +SDL_AudioStreamClear(stream)(sysv,r12base) +SDL_FreeAudioStream(stream)(sysv,r12base) +SDL_LockJoysticks()(sysv,r12base) +SDL_UnlockJoysticks()(sysv,r12base) +SDL_GetMemoryFunctions(malloc_func,calloc_func,realloc_func,free_func)(sysv,r12base) +SDL_SetMemoryFunctions(malloc_func,calloc_func,realloc_func,free_func)(sysv,r12base) +SDL_GetNumAllocations()(sysv,r12base) +SDL_RenderGetMetalLayer(renderer)(sysv,r12base) +SDL_RenderGetMetalCommandEncoder(renderer)(sysv,r12base) +SDL_acosf(x)(sysv,r12base) +SDL_asinf(x)(sysv,r12base) +SDL_atanf(x)(sysv,r12base) +SDL_atan2f(x,y)(sysv,r12base) +SDL_ceilf(x)(sysv,r12base) +SDL_copysignf(x,y)(sysv,r12base) +SDL_fabsf(x)(sysv,r12base) +SDL_floorf(x)(sysv,r12base) +SDL_fmod(x,y)(sysv,r12base) +SDL_fmodf(x,y)(sysv,r12base) +SDL_logf(x)(sysv,r12base) +SDL_log10(x)(sysv,r12base) +SDL_log10f(x)(sysv,r12base) +SDL_powf(x,y)(sysv,r12base) +SDL_scalbnf(x,n)(sysv,r12base) +SDL_SetYUVConversionMode(mode)(sysv,r12base) +SDL_GetYUVConversionMode()(sysv,r12base) +SDL_GetYUVConversionModeForResolution(width,height)(sysv,r12base) +SDL_HasAVX512F()(sysv,r12base) +SDL_GameControllerMappingForDeviceIndex(joystick_index)(sysv,r12base) +SDL_GameControllerGetPlayerIndex(gamecontroller)(sysv,r12base) +SDL_GameControllerRumble(gamecontroller,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) +SDL_JoystickGetDevicePlayerIndex(device_index)(sysv,r12base) +SDL_JoystickGetPlayerIndex(joystick)(sysv,r12base) +SDL_JoystickRumble(joystick,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) +SDL_wcsdup(wstr)(sysv,r12base) +SDL_exp(x)(sysv,r12base) +SDL_expf(x)(sysv,r12base) +SDL_HasColorKey(surface)(sysv,r12base) +SDL_IsTablet()(sysv,r12base) +SDL_CreateThreadWithStackSize(fn,name,stacksize,data,pfnBeginThread,pfnEndThread)(sysv,r12base) +SDL_GetDisplayOrientation(displayIndex)(sysv,r12base) +SDL_SIMDGetAlignment()(sysv,r12base) +SDL_SIMDAlloc(len)(sysv,r12base) +SDL_SIMDFree(ptr)(sysv,r12base) +SDL_RenderDrawPointF(renderer,x,y)(sysv,r12base) +SDL_RenderDrawPointsF(renderer,points,count)(sysv,r12base) +SDL_RenderDrawLineF(renderer,x1,y1,x2,y2)(sysv,r12base) +SDL_RenderDrawLinesF(renderer,points,count)(sysv,r12base) +SDL_RenderDrawRectF(renderer,rect)(sysv,r12base) +SDL_RenderDrawRectsF(renderer,rects,count)(sysv,r12base) +SDL_RenderFillRectF(renderer,rect)(sysv,r12base) +SDL_RenderFillRectsF(renderer,rects,count)(sysv,r12base) +SDL_RenderCopyF(renderer,texture,srcrect,dstrect)(sysv,r12base) +SDL_RenderCopyExF(renderer,texture,srcrect,dstrect,angle,center,flip)(sysv,r12base) +SDL_RenderFlush(renderer)(sysv,r12base) +SDL_RWsize(context)(sysv,r12base) +SDL_RWseek(context,offset,whence)(sysv,r12base) +SDL_RWtell(context)(sysv,r12base) +SDL_RWread(context,ptr,size,maxnum)(sysv,r12base) +SDL_RWwrite(context,ptr,size,num)(sysv,r12base) +SDL_RWclose(context)(sysv,r12base) +SDL_LoadFile(file,datasize)(sysv,r12base) +SDL_GetTouchDeviceType(touchID)(sysv,r12base) +SDL_HasARMSIMD()(sysv,r12base) +SDL_GameControllerTypeForIndex(joystick_index)(sysv,r12base) +SDL_GameControllerFromPlayerIndex(player_index)(sysv,r12base) +SDL_GameControllerGetType(gamecontroller)(sysv,r12base) +SDL_GameControllerSetPlayerIndex(gamecontroller,player_index)(sysv,r12base) +SDL_JoystickFromPlayerIndex(player_index)(sysv,r12base) +SDL_JoystickSetPlayerIndex(joystick,player_index)(sysv,r12base) +SDL_SetTextureScaleMode(texture,scaleMode)(sysv,r12base) +SDL_GetTextureScaleMode(texture,scaleMode)(sysv,r12base) +SDL_LockTextureToSurface(texture,rect,surface)(sysv,r12base) +SDL_wcsstr(*haystack,needle)(sysv,r12base) +SDL_wcsncmp(str1,str2,maxlen)(sysv,r12base) +SDL_strtokr(s1,s2,saveptr)(sysv,r12base) +SDL_GL_LoadLibrary(path)(sysv,r12base) +##private +private1()() +##public +SDL_GL_UnloadLibrary()(sysv,r12base) +SDL_GL_ExtensionSupported(extension)(sysv,r12base) +SDL_GL_ResetAttributes()(sysv,r12base) +SDL_GL_SetAttribute(attr,value)(sysv,r12base) +SDL_GL_GetAttribute(attr,value)(sysv,r12base) +SDL_GL_CreateContext(window)(sysv,r12base) +SDL_GL_MakeCurrent(window,context)(sysv,r12base) +SDL_GL_GetCurrentWindow()(sysv,r12base) +SDL_GL_GetCurrentContext()(sysv,r12base) +SDL_GL_GetDrawableSize(window,w,h)(sysv,r12base) +SDL_GL_SetSwapInterval(interval)(sysv,r12base) +SDL_GL_GetSwapInterval()(sysv,r12base) +SDL_GL_SwapWindow(window)(sysv,r12base) +SDL_GL_DeleteContext(context)(sysv,r12base) +SDL_NumHaptics()(sysv,r12base) +SDL_HapticName(device_index)(sysv,r12base) +SDL_HapticOpen(device_index)(sysv,r12base) +SDL_HapticOpened(device_index)(sysv,r12base) +SDL_HapticIndex(haptic)(sysv,r12base) +SDL_MouseIsHaptic()(sysv,r12base) +SDL_HapticOpenFromMouse()(sysv,r12base) +SDL_JoystickIsHaptic(joystick)(sysv,r12base) +SDL_HapticOpenFromJoystick(joystick)(sysv,r12base) +SDL_HapticClose(haptic)(sysv,r12base) +SDL_HapticNumEffects(haptic)(sysv,r12base) +SDL_HapticNumEffectsPlaying(haptic)(sysv,r12base) +SDL_HapticQuery(haptic)(sysv,r12base) +SDL_HapticNumAxes(haptic)(sysv,r12base) +SDL_HapticEffectSupported(haptic,effect)(sysv,r12base) +SDL_HapticNewEffect(haptic,effect)(sysv,r12base) +SDL_HapticUpdateEffect(haptic,effect,data)(sysv,r12base) +SDL_HapticRunEffect(haptic,effect,iterations)(sysv,r12base) +SDL_HapticStopEffect(haptic,effect)(sysv,r12base) +SDL_HapticDestroyEffect(haptic,effect)(sysv,r12base) +SDL_HapticGetEffectStatus(haptic,effect)(sysv,r12base) +SDL_HapticSetGain(haptic,gain)(sysv,r12base) +SDL_HapticSetAutocenter(haptic,autocenter)(sysv,r12base) +SDL_HapticPause(haptic)(sysv,r12base) +SDL_HapticUnpause(haptic)(sysv,r12base) +SDL_HapticStopAll(haptic)(sysv,r12base) +SDL_HapticRumbleSupported(haptic)(sysv,r12base) +SDL_HapticRumbleInit(haptic)(sysv,r12base) +SDL_HapticRumblePlay(haptic,strength,length)(sysv,r12base) +SDL_HapticRumbleStop(haptic)(sysv,r12base) +SDL_isupper(x)(sysv,r12base) +SDL_islower(x)(sysv,r12base) +SDL_JoystickAttachVirtual(type,naxes,nbuttons,nhats)(sysv,r12base) +SDL_JoystickDetachVirtual(device_index)(sysv,r12base) +SDL_JoystickIsVirtual(device_index)(sysv,r12base) +SDL_JoystickSetVirtualAxis(joystick,axis,value)(sysv,r12base) +SDL_JoystickSetVirtualButton(joystick,button,value)(sysv,r12base) +SDL_JoystickSetVirtualHat(joystick,hat,value)(sysv,r12base) +SDL_GetErrorMsg(errstr,maxlen)(sysv,r12base) +SDL_LockSensors()(sysv,r12base) +SDL_UnlockSensors()(sysv,r12base) +SDL_Metal_GetLayer(view)(sysv,r12base) +SDL_Metal_GetDrawableSize(window,w,h)(sysv,r12base) +SDL_trunc(x)(sysv,r12base) +SDL_truncf(x)(sysv,r12base) +SDL_GetPreferredLocales()(sysv,r12base) +SDL_SIMDRealloc(mem,len)(sysv,r12base) +SDL_OpenURL(url)(sysv,r12base) +SDL_HasSurfaceRLE(surface)(sysv,r12base) +SDL_GameControllerHasLED(gamecontroller)(sysv,r12base) +SDL_GameControllerSetLED(gamecontroller,red,green,blue)(sysv,r12base) +SDL_JoystickHasLED(joystick)(sysv,r12base) +SDL_JoystickSetLED(joystick,red,green,blue)(sysv,r12base) +SDL_GameControllerRumbleTriggers(gamecontroller,left_rumble,right_rumble,duration_ms)(sysv,r12base) +SDL_JoystickRumbleTriggers(joystick,left_rumble,right_rumble,duration_ms)(sysv,r12base) +SDL_GameControllerHasAxis(gamecontroller,axis)(sysv,r12base) +SDL_GameControllerHasButton(gamecontroller,button)(sysv,r12base) +SDL_GameControllerGetNumTouchpads(gamecontroller)(sysv,r12base) +SDL_GameControllerGetNumTouchpadFingers(gamecontroller,touchpad)(sysv,r12base) +SDL_GameControllerGetTouchpadFinger(gamecontroller,touchpad,finger,state,x,y,pressure)(sysv,r12base) +SDL_GetNumTouchDevices()(sysv,r12base) +SDL_GetTouchDevice(index)(sysv,r12base) +SDL_GetNumTouchFingers(touchID)(sysv,r12base) +SDL_GetTouchFinger(touchID,index)(sysv,r12base) +SDL_crc32(crc,data,len)(sysv,r12base) +SDL_GameControllerGetSerial(gamecontroller)(sysv,r12base) +SDL_JoystickGetSerial(joystick)(sysv,r12base) +SDL_GameControllerHasSensor(gamecontroller,type)(sysv,r12base) +SDL_GameControllerSetSensorEnabled(gamecontroller,type,enabled)(sysv,r12base) +SDL_GameControllerIsSensorEnabled(gamecontroller,type)(sysv,r12base) +SDL_GameControllerGetSensorData(gamecontroller,type,data,num_values)(sysv,r12base) +SDL_wcscasecmp(str1,str2)(sysv,r12base) +SDL_wcsncasecmp(str1,str2,len)(sysv,r12base) \ No newline at end of file diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h new file mode 100644 index 0000000000..fc441ffde2 --- /dev/null +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -0,0 +1,6078 @@ +/* Automatically generated header! Do not edit! */ + +#ifndef _PPCINLINE_SDL2_H +#define _PPCINLINE_SDL2_H + +#ifndef __PPCINLINE_MACROS_H +#include +#endif /* !__PPCINLINE_MACROS_H */ + +#ifndef SDL2_BASE_NAME +#define SDL2_BASE_NAME SDL2Base +#endif /* !SDL2_BASE_NAME */ + +#define SDL_InitTGL(__p0, __p1) \ + (((void (*)(void *, void **, struct Library **))*(void**)((long)(SDL2_BASE_NAME) - 28))((void*)(SDL2_BASE_NAME), __p0, __p1)) + +#define SDL_SetExitPointer(__p0) \ + (((void (*)(void *, void (*)(int)))*(void**)((long)(SDL2_BASE_NAME) - 34))((void*)(SDL2_BASE_NAME), __p0)) + +#define SDL_RWFromFP_clib(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ + ({ \ + void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Sint64 (* __t__p2)(struct SDL_RWops *) = __p2;\ + Sint64 (* __t__p3)(struct SDL_RWops *, Sint64, int) = __p3;\ + size_t (* __t__p4)(struct SDL_RWops *, void *, size_t, size_t) = __p4;\ + size_t (* __t__p5)(struct SDL_RWops *, const void *, size_t, size_t) = __p5;\ + int (* __t__p6)(struct SDL_RWops *) = __p6;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_RWops *(*)(void *, int , Sint64 (*)(struct SDL_RWops *), Sint64 (*)(struct SDL_RWops *, Sint64, int), size_t (*)(struct SDL_RWops *, void *, size_t, size_t), size_t (*)(struct SDL_RWops *, const void *, size_t, size_t), int (*)(struct SDL_RWops *)))*(void**)(__base - 1762))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + }) + +#define SDL_VSetError(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, va_list ))*(void**)(__base - 40))(__t__p0, __p1));\ + }) + +#define SDL_GetPlatform() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(void))*(void**)(__base - 46))());\ + }) + +#define SDL_Init(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(Uint32 ))*(void**)(__base - 52))(__t__p0));\ + }) + +#define SDL_InitSubSystem(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(Uint32 ))*(void**)(__base - 58))(__t__p0));\ + }) + +#define SDL_QuitSubSystem(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 ))*(void**)(__base - 64))(__t__p0));\ + }) + +#define SDL_WasInit(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(Uint32 ))*(void**)(__base - 70))(__t__p0));\ + }) + +#define SDL_Quit() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 76))());\ + }) + +#define SDL_SetMainReady() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 82))());\ + }) + +#define SDL_malloc(__p0) \ + ({ \ + size_t __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(size_t ))*(void**)(__base - 88))(__t__p0));\ + }) + +#define SDL_calloc(__p0, __p1) \ + ({ \ + size_t __t__p0 = __p0;\ + size_t __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(size_t , size_t ))*(void**)(__base - 94))(__t__p0, __t__p1));\ + }) + +#define SDL_realloc(__p0, __p1) \ + ({ \ + void * __t__p0 = __p0;\ + size_t __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, size_t ))*(void**)(__base - 100))(__t__p0, __t__p1));\ + }) + +#define SDL_free(__p0) \ + ({ \ + void * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void *))*(void**)(__base - 106))(__t__p0));\ + }) + +#define SDL_qsort(__p0, __p1, __p2, __p3) \ + ({ \ + void * __t__p0 = __p0;\ + size_t __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + int (* __t__p3) (const void *, const void *) = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void *, size_t , size_t , int (*) (const void *, const void *)))*(void**)(__base - 112))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_abs(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 118))(__t__p0));\ + }) + +#define SDL_isdigit(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 124))(__t__p0));\ + }) + +#define SDL_isspace(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 130))(__t__p0));\ + }) + +#define SDL_toupper(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 136))(__t__p0));\ + }) + +#define SDL_tolower(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 142))(__t__p0));\ + }) + +#define SDL_memset(__p0, __p1, __p2) \ + ({ \ + void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, int , size_t ))*(void**)(__base - 148))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_memcpy(__p0, __p1, __p2) \ + ({ \ + void * __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, const void *, size_t ))*(void**)(__base - 154))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_memmove(__p0, __p1, __p2) \ + ({ \ + void * __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, const void *, size_t ))*(void**)(__base - 160))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_memcmp(__p0, __p1, __p2) \ + ({ \ + const void * __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const void *, const void *, size_t ))*(void**)(__base - 166))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_wcslen(__p0) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(const wchar_t *))*(void**)(__base - 172))(__t__p0));\ + }) + +#define SDL_wcslcpy(__p0, __p1, __p2) \ + ({ \ + wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 178))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_wcslcat(__p0, __p1, __p2) \ + ({ \ + wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 184))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strlen(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(const char *))*(void**)(__base - 190))(__t__p0));\ + }) + +#define SDL_strlcpy(__p0, __p1, __p2) \ + ({ \ + char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(char *, const char *, size_t ))*(void**)(__base - 196))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_utf8strlcpy(__p0, __p1, __p2) \ + ({ \ + char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(char *, const char *, size_t ))*(void**)(__base - 202))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strlcat(__p0, __p1, __p2) \ + ({ \ + char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(char *, const char *, size_t ))*(void**)(__base - 208))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strdup(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *))*(void**)(__base - 214))(__t__p0));\ + }) + +#define SDL_strrev(__p0) \ + ({ \ + char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(char *))*(void**)(__base - 220))(__t__p0));\ + }) + +#define SDL_strupr(__p0) \ + ({ \ + char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(char *))*(void**)(__base - 226))(__t__p0));\ + }) + +#define SDL_strlwr(__p0) \ + ({ \ + char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(char *))*(void**)(__base - 232))(__t__p0));\ + }) + +#define SDL_strchr(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *, int ))*(void**)(__base - 238))(__t__p0, __t__p1));\ + }) + +#define SDL_strrchr(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *, int ))*(void**)(__base - 244))(__t__p0, __t__p1));\ + }) + +#define SDL_strstr(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *, const char *))*(void**)(__base - 250))(__t__p0, __t__p1));\ + }) + +#define SDL_itoa(__p0, __p1, __p2) \ + ({ \ + int __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(int , char *, int ))*(void**)(__base - 256))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_uitoa(__p0, __p1, __p2) \ + ({ \ + unsigned int __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(unsigned int , char *, int ))*(void**)(__base - 262))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ltoa(__p0, __p1, __p2) \ + ({ \ + long __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(long , char *, int ))*(void**)(__base - 268))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ultoa(__p0, __p1, __p2) \ + ({ \ + unsigned long __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(unsigned long , char *, int ))*(void**)(__base - 274))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_lltoa(__p0, __p1, __p2) \ + ({ \ + Sint64 __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(Sint64 , char *, int ))*(void**)(__base - 280))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ulltoa(__p0, __p1, __p2) \ + ({ \ + Uint64 __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(Uint64 , char *, int ))*(void**)(__base - 286))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_atoi(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 292))(__t__p0));\ + }) + +#define SDL_atof(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(const char *))*(void**)(__base - 298))(__t__p0));\ + }) + +#define SDL_strtol(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + char ** __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((long (*)(const char *, char **, int ))*(void**)(__base - 304))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strtoul(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + char ** __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((unsigned long (*)(const char *, char **, int ))*(void**)(__base - 310))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strtoll(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + char ** __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint64 (*)(const char *, char **, int ))*(void**)(__base - 316))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strtoull(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + char ** __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint64 (*)(const char *, char **, int ))*(void**)(__base - 322))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strtod(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + char ** __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(const char *, char **))*(void**)(__base - 328))(__t__p0, __t__p1));\ + }) + +#define SDL_strcmp(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, const char *))*(void**)(__base - 334))(__t__p0, __t__p1));\ + }) + +#define SDL_strncmp(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, const char *, size_t ))*(void**)(__base - 340))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strcasecmp(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, const char *))*(void**)(__base - 346))(__t__p0, __t__p1));\ + }) + +#define SDL_strncasecmp(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, const char *, size_t ))*(void**)(__base - 352))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_vsscanf(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, const char *, va_list ))*(void**)(__base - 358))(__t__p0, __t__p1, __p2));\ + }) + +#define SDL_vsnprintf(__p0, __p1, __p2, __p3) \ + ({ \ + char * __t__p0 = __p0;\ + size_t __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(char *, size_t , const char *, va_list ))*(void**)(__base - 364))(__t__p0, __t__p1, __t__p2, __p3));\ + }) + +#define SDL_acos(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 370))(__t__p0));\ + }) + +#define SDL_asin(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 376))(__t__p0));\ + }) + +#define SDL_atan(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 382))(__t__p0));\ + }) + +#define SDL_atan2(__p0, __p1) \ + ({ \ + double __t__p0 = __p0;\ + double __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double , double ))*(void**)(__base - 388))(__t__p0, __t__p1));\ + }) + +#define SDL_ceil(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 394))(__t__p0));\ + }) + +#define SDL_copysign(__p0, __p1) \ + ({ \ + double __t__p0 = __p0;\ + double __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double , double ))*(void**)(__base - 400))(__t__p0, __t__p1));\ + }) + +#define SDL_cos(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 406))(__t__p0));\ + }) + +#define SDL_cosf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 412))(__t__p0));\ + }) + +#define SDL_fabs(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 418))(__t__p0));\ + }) + +#define SDL_floor(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 424))(__t__p0));\ + }) + +#define SDL_log(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 430))(__t__p0));\ + }) + +#define SDL_pow(__p0, __p1) \ + ({ \ + double __t__p0 = __p0;\ + double __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double , double ))*(void**)(__base - 436))(__t__p0, __t__p1));\ + }) + +#define SDL_scalbn(__p0, __p1) \ + ({ \ + double __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double , int ))*(void**)(__base - 442))(__t__p0, __t__p1));\ + }) + +#define SDL_sin(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 448))(__t__p0));\ + }) + +#define SDL_sinf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 454))(__t__p0));\ + }) + +#define SDL_sqrt(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 460))(__t__p0));\ + }) + +#define SDL_iconv_open(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_iconv_t (*)(const char *, const char *))*(void**)(__base - 466))(__t__p0, __t__p1));\ + }) + +#define SDL_iconv_close(__p0) \ + ({ \ + SDL_iconv_t __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_iconv_t ))*(void**)(__base - 472))(__t__p0));\ + }) + +#define SDL_iconv(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_iconv_t __t__p0 = __p0;\ + const char ** __t__p1 = __p1;\ + size_t * __t__p2 = __p2;\ + char ** __t__p3 = __p3;\ + size_t * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_iconv_t , const char **, size_t *, char **, size_t *))*(void**)(__base - 478))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_iconv_string(__p0, __p1, __p2, __p3) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + size_t __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *, const char *, const char *, size_t ))*(void**)(__base - 484))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_ReportAssertion(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_AssertData * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AssertData (*)(SDL_AssertData *, const char *, const char *, int ))*(void**)(__base - 490))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SetAssertionHandler(__p0, __p1) \ + ({ \ + SDL_AssertionHandler __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AssertionHandler , void *))*(void**)(__base - 496))(__t__p0, __t__p1));\ + }) + +#define SDL_GetDefaultAssertionHandler() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AssertionHandler (*)(void))*(void**)(__base - 502))());\ + }) + +#define SDL_GetAssertionHandler(__p0) \ + ({ \ + void ** __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AssertionHandler (*)(void **))*(void**)(__base - 508))(__t__p0));\ + }) + +#define SDL_GetAssertionReport() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const SDL_AssertData *(*)(void))*(void**)(__base - 514))());\ + }) + +#define SDL_ResetAssertionReport() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 520))());\ + }) + +#define SDL_AtomicTryLock(__p0) \ + ({ \ + SDL_SpinLock * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_SpinLock *))*(void**)(__base - 526))(__t__p0));\ + }) + +#define SDL_AtomicLock(__p0) \ + ({ \ + SDL_SpinLock * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_SpinLock *))*(void**)(__base - 532))(__t__p0));\ + }) + +#define SDL_AtomicUnlock(__p0) \ + ({ \ + SDL_SpinLock * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_SpinLock *))*(void**)(__base - 538))(__t__p0));\ + }) + +#define SDL_AtomicCAS(__p0, __p1, __p2) \ + ({ \ + SDL_atomic_t * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_atomic_t *, int , int ))*(void**)(__base - 544))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_AtomicSet(__p0, __p1) \ + ({ \ + SDL_atomic_t * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_atomic_t *, int ))*(void**)(__base - 550))(__t__p0, __t__p1));\ + }) + +#define SDL_AtomicGet(__p0) \ + ({ \ + SDL_atomic_t * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_atomic_t *))*(void**)(__base - 556))(__t__p0));\ + }) + +#define SDL_AtomicAdd(__p0, __p1) \ + ({ \ + SDL_atomic_t * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_atomic_t *, int ))*(void**)(__base - 562))(__t__p0, __t__p1));\ + }) + +#define SDL_AtomicCASPtr(__p0, __p1, __p2) \ + ({ \ + void ** __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void **, void *, void *))*(void**)(__base - 568))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_AtomicSetPtr(__p0, __p1) \ + ({ \ + void ** __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void **, void *))*(void**)(__base - 574))(__t__p0, __t__p1));\ + }) + +#define SDL_AtomicGetPtr(__p0) \ + ({ \ + void ** __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void **))*(void**)(__base - 580))(__t__p0));\ + }) + +#define SDL_GetNumAudioDrivers() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 586))());\ + }) + +#define SDL_GetAudioDriver(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 592))(__t__p0));\ + }) + +#define SDL_AudioInit(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 598))(__t__p0));\ + }) + +#define SDL_AudioQuit() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 604))());\ + }) + +#define SDL_GetCurrentAudioDriver() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(void))*(void**)(__base - 610))());\ + }) + +#define SDL_OpenAudio(__p0, __p1) \ + ({ \ + SDL_AudioSpec * __t__p0 = __p0;\ + SDL_AudioSpec * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioSpec *, SDL_AudioSpec *))*(void**)(__base - 616))(__t__p0, __t__p1));\ + }) + +#define SDL_GetNumAudioDevices(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 622))(__t__p0));\ + }) + +#define SDL_GetAudioDeviceName(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int , int ))*(void**)(__base - 628))(__t__p0, __t__p1));\ + }) + +#define SDL_OpenAudioDevice(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + const char * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + const SDL_AudioSpec * __t__p2 = __p2;\ + SDL_AudioSpec * __t__p3 = __p3;\ + int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioDeviceID (*)(const char *, int , const SDL_AudioSpec *, SDL_AudioSpec *, int ))*(void**)(__base - 634))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_GetAudioStatus() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioStatus (*)(void))*(void**)(__base - 640))());\ + }) + +#define SDL_GetAudioDeviceStatus(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioStatus (*)(SDL_AudioDeviceID ))*(void**)(__base - 646))(__t__p0));\ + }) + +#define SDL_PauseAudio(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(int ))*(void**)(__base - 652))(__t__p0));\ + }) + +#define SDL_PauseAudioDevice(__p0, __p1) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioDeviceID , int ))*(void**)(__base - 658))(__t__p0, __t__p1));\ + }) + +#define SDL_LoadWAV_RW(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + SDL_AudioSpec * __t__p2 = __p2;\ + Uint8 ** __t__p3 = __p3;\ + Uint32 * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioSpec *(*)(SDL_RWops *, int , SDL_AudioSpec *, Uint8 **, Uint32 *))*(void**)(__base - 664))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_FreeWAV(__p0) \ + ({ \ + Uint8 * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint8 *))*(void**)(__base - 670))(__t__p0));\ + }) + +#define SDL_BuildAudioCVT(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ + ({ \ + SDL_AudioCVT * __t__p0 = __p0;\ + SDL_AudioFormat __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + int __t__p3 = __p3;\ + SDL_AudioFormat __t__p4 = __p4;\ + Uint8 __t__p5 = __p5;\ + int __t__p6 = __p6;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioCVT *, SDL_AudioFormat , Uint8 , int , SDL_AudioFormat , Uint8 , int ))*(void**)(__base - 676))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + }) + +#define SDL_ConvertAudio(__p0) \ + ({ \ + SDL_AudioCVT * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioCVT *))*(void**)(__base - 682))(__t__p0));\ + }) + +#define SDL_MixAudio(__p0, __p1, __p2, __p3) \ + ({ \ + Uint8 * __t__p0 = __p0;\ + const Uint8 * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint8 *, const Uint8 *, Uint32 , int ))*(void**)(__base - 688))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_MixAudioFormat(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + Uint8 * __t__p0 = __p0;\ + const Uint8 * __t__p1 = __p1;\ + SDL_AudioFormat __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint8 *, const Uint8 *, SDL_AudioFormat , Uint32 , int ))*(void**)(__base - 694))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_LockAudio() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 700))());\ + }) + +#define SDL_LockAudioDevice(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioDeviceID ))*(void**)(__base - 706))(__t__p0));\ + }) + +#define SDL_UnlockAudio() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 712))());\ + }) + +#define SDL_UnlockAudioDevice(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioDeviceID ))*(void**)(__base - 718))(__t__p0));\ + }) + +#define SDL_CloseAudio() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 724))());\ + }) + +#define SDL_CloseAudioDevice(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioDeviceID ))*(void**)(__base - 730))(__t__p0));\ + }) + +#define SDL_SetClipboardText(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 736))(__t__p0));\ + }) + +#define SDL_GetClipboardText() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(void))*(void**)(__base - 742))());\ + }) + +#define SDL_HasClipboardText() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 748))());\ + }) + +#define SDL_GetCPUCount() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 754))());\ + }) + +#define SDL_GetCPUCacheLineSize() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 760))());\ + }) + +#define SDL_HasRDTSC() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 766))());\ + }) + +#define SDL_HasAltiVec() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 772))());\ + }) + +#define SDL_HasMMX() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 778))());\ + }) + +#define SDL_Has3DNow() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 784))());\ + }) + +#define SDL_HasSSE() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 790))());\ + }) + +#define SDL_HasSSE2() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 796))());\ + }) + +#define SDL_HasSSE3() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 802))());\ + }) + +#define SDL_HasSSE41() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 808))());\ + }) + +#define SDL_HasSSE42() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 814))());\ + }) + +#define SDL_HasAVX() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 820))());\ + }) + +#define SDL_GetSystemRAM() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 826))());\ + }) + +#define SDL_GetError() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(void))*(void**)(__base - 832))());\ + }) + +#define SDL_ClearError() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 838))());\ + }) + +#define SDL_Error(__p0) \ + ({ \ + SDL_errorcode __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_errorcode ))*(void**)(__base - 844))(__t__p0));\ + }) + +#define SDL_PumpEvents() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 850))());\ + }) + +#define SDL_PeepEvents(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Event * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + SDL_eventaction __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + Uint32 __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Event *, int , SDL_eventaction , Uint32 , Uint32 ))*(void**)(__base - 856))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_HasEvent(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(Uint32 ))*(void**)(__base - 862))(__t__p0));\ + }) + +#define SDL_HasEvents(__p0, __p1) \ + ({ \ + Uint32 __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(Uint32 , Uint32 ))*(void**)(__base - 868))(__t__p0, __t__p1));\ + }) + +#define SDL_FlushEvent(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 ))*(void**)(__base - 874))(__t__p0));\ + }) + +#define SDL_FlushEvents(__p0, __p1) \ + ({ \ + Uint32 __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 , Uint32 ))*(void**)(__base - 880))(__t__p0, __t__p1));\ + }) + +#define SDL_PollEvent(__p0) \ + ({ \ + SDL_Event * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Event *))*(void**)(__base - 886))(__t__p0));\ + }) + +#define SDL_WaitEvent(__p0) \ + ({ \ + SDL_Event * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Event *))*(void**)(__base - 892))(__t__p0));\ + }) + +#define SDL_WaitEventTimeout(__p0, __p1) \ + ({ \ + SDL_Event * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Event *, int ))*(void**)(__base - 898))(__t__p0, __t__p1));\ + }) + +#define SDL_PushEvent(__p0) \ + ({ \ + SDL_Event * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Event *))*(void**)(__base - 904))(__t__p0));\ + }) + +#define SDL_SetEventFilter(__p0, __p1) \ + ({ \ + SDL_EventFilter __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_EventFilter , void *))*(void**)(__base - 910))(__t__p0, __t__p1));\ + }) + +#define SDL_GetEventFilter(__p0, __p1) \ + ({ \ + SDL_EventFilter * __t__p0 = __p0;\ + void ** __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_EventFilter *, void **))*(void**)(__base - 916))(__t__p0, __t__p1));\ + }) + +#define SDL_AddEventWatch(__p0, __p1) \ + ({ \ + SDL_EventFilter __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_EventFilter , void *))*(void**)(__base - 922))(__t__p0, __t__p1));\ + }) + +#define SDL_DelEventWatch(__p0, __p1) \ + ({ \ + SDL_EventFilter __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_EventFilter , void *))*(void**)(__base - 928))(__t__p0, __t__p1));\ + }) + +#define SDL_FilterEvents(__p0, __p1) \ + ({ \ + SDL_EventFilter __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_EventFilter , void *))*(void**)(__base - 934))(__t__p0, __t__p1));\ + }) + +#define SDL_EventState(__p0, __p1) \ + ({ \ + Uint32 __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint8 (*)(Uint32 , int ))*(void**)(__base - 940))(__t__p0, __t__p1));\ + }) + +#define SDL_RegisterEvents(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(int ))*(void**)(__base - 946))(__t__p0));\ + }) + +#define SDL_GetBasePath() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(void))*(void**)(__base - 952))());\ + }) + +#define SDL_GetPrefPath(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(const char *, const char *))*(void**)(__base - 958))(__t__p0, __t__p1));\ + }) + +#define SDL_NumJoysticks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 964))());\ + }) + +#define SDL_JoystickNameForIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 970))(__t__p0));\ + }) + +#define SDL_JoystickOpen(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Joystick *(*)(int ))*(void**)(__base - 976))(__t__p0));\ + }) + +#define SDL_JoystickName(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Joystick *))*(void**)(__base - 982))(__t__p0));\ + }) + +#define SDL_JoystickGetDeviceGUID(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickGUID (*)(int ))*(void**)(__base - 988))(__t__p0));\ + }) + +#define SDL_JoystickGetGUID(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickGUID (*)(SDL_Joystick *))*(void**)(__base - 994))(__t__p0));\ + }) + +#define SDL_JoystickGetGUIDString(__p0, __p1, __p2) \ + ({ \ + SDL_JoystickGUID __t__p0 = __p0;\ + char * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_JoystickGUID , char *, int ))*(void**)(__base - 1000))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_JoystickGetGUIDFromString(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickGUID (*)(const char *))*(void**)(__base - 1006))(__t__p0));\ + }) + +#define SDL_JoystickGetAttached(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Joystick *))*(void**)(__base - 1012))(__t__p0));\ + }) + +#define SDL_JoystickInstanceID(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickID (*)(SDL_Joystick *))*(void**)(__base - 1018))(__t__p0));\ + }) + +#define SDL_JoystickNumAxes(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 1024))(__t__p0));\ + }) + +#define SDL_JoystickNumBalls(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 1030))(__t__p0));\ + }) + +#define SDL_JoystickNumHats(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 1036))(__t__p0));\ + }) + +#define SDL_JoystickNumButtons(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 1042))(__t__p0));\ + }) + +#define SDL_JoystickUpdate() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 1048))());\ + }) + +#define SDL_JoystickEventState(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 1054))(__t__p0));\ + }) + +#define SDL_JoystickGetAxis(__p0, __p1) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint16 (*)(SDL_Joystick *, int ))*(void**)(__base - 1060))(__t__p0, __t__p1));\ + }) + +#define SDL_JoystickGetHat(__p0, __p1) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint8 (*)(SDL_Joystick *, int ))*(void**)(__base - 1066))(__t__p0, __t__p1));\ + }) + +#define SDL_JoystickGetBall(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + int * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, int , int *, int *))*(void**)(__base - 1072))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_JoystickGetButton(__p0, __p1) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint8 (*)(SDL_Joystick *, int ))*(void**)(__base - 1078))(__t__p0, __t__p1));\ + }) + +#define SDL_JoystickClose(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Joystick *))*(void**)(__base - 1084))(__t__p0));\ + }) + +#define SDL_GameControllerAddMappingsFromRW(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_RWops *, int ))*(void**)(__base - 1090))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerAddMapping(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 1096))(__t__p0));\ + }) + +#define SDL_GameControllerMappingForGUID(__p0) \ + ({ \ + SDL_JoystickGUID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(SDL_JoystickGUID ))*(void**)(__base - 1102))(__t__p0));\ + }) + +#define SDL_GameControllerMapping(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(SDL_GameController *))*(void**)(__base - 1108))(__t__p0));\ + }) + +#define SDL_IsGameController(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(int ))*(void**)(__base - 1114))(__t__p0));\ + }) + +#define SDL_GameControllerNameForIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 1120))(__t__p0));\ + }) + +#define SDL_GameControllerOpen(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameController *(*)(int ))*(void**)(__base - 1126))(__t__p0));\ + }) + +#define SDL_GameControllerName(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_GameController *))*(void**)(__base - 1132))(__t__p0));\ + }) + +#define SDL_GameControllerGetAttached(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *))*(void**)(__base - 1138))(__t__p0));\ + }) + +#define SDL_GameControllerGetJoystick(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Joystick *(*)(SDL_GameController *))*(void**)(__base - 1144))(__t__p0));\ + }) + +#define SDL_GameControllerEventState(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 1150))(__t__p0));\ + }) + +#define SDL_GameControllerUpdate() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 1156))());\ + }) + +#define SDL_GameControllerGetAxisFromString(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerAxis (*)(const char *))*(void**)(__base - 1162))(__t__p0));\ + }) + +#define SDL_GameControllerGetStringForAxis(__p0) \ + ({ \ + SDL_GameControllerAxis __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_GameControllerAxis ))*(void**)(__base - 1168))(__t__p0));\ + }) + +#define SDL_GameControllerGetBindForAxis(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerAxis __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerButtonBind (*)(SDL_GameController *, SDL_GameControllerAxis ))*(void**)(__base - 1174))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetAxis(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerAxis __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint16 (*)(SDL_GameController *, SDL_GameControllerAxis ))*(void**)(__base - 1180))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetButtonFromString(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerButton (*)(const char *))*(void**)(__base - 1186))(__t__p0));\ + }) + +#define SDL_GameControllerGetStringForButton(__p0) \ + ({ \ + SDL_GameControllerButton __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_GameControllerButton ))*(void**)(__base - 1192))(__t__p0));\ + }) + +#define SDL_GameControllerGetBindForButton(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerButton __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerButtonBind (*)(SDL_GameController *, SDL_GameControllerButton ))*(void**)(__base - 1198))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetButton(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerButton __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint8 (*)(SDL_GameController *, SDL_GameControllerButton ))*(void**)(__base - 1204))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerClose(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_GameController *))*(void**)(__base - 1210))(__t__p0));\ + }) + +#define SDL_NumHaptics() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 3748))());\ + }) + +#define SDL_HapticName(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 3754))(__t__p0));\ + }) + +#define SDL_HapticOpen(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Haptic *(*)(int ))*(void**)(__base - 3760))(__t__p0));\ + }) + +#define SDL_HapticOpened(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3766))(__t__p0));\ + }) + +#define SDL_HapticIndex(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3772))(__t__p0));\ + }) + +#define SDL_MouseIsHaptic() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 3778))());\ + }) + +#define SDL_HapticOpenFromMouse() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Haptic *(*)(void))*(void**)(__base - 3784))());\ + }) + +#define SDL_JoystickIsHaptic(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 3790))(__t__p0));\ + }) + +#define SDL_HapticOpenFromJoystick(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Haptic *(*)(SDL_Joystick *))*(void**)(__base - 3796))(__t__p0));\ + }) + +#define SDL_HapticClose(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Haptic *))*(void**)(__base - 3802))(__t__p0));\ + }) + +#define SDL_HapticNumEffects(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3808))(__t__p0));\ + }) + +#define SDL_HapticNumEffectsPlaying(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3814))(__t__p0));\ + }) + +#define SDL_HapticQuery(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((unsigned int (*)(SDL_Haptic *))*(void**)(__base - 3820))(__t__p0));\ + }) + +#define SDL_HapticNumAxes(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3826))(__t__p0));\ + }) + +#define SDL_HapticEffectSupported(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + SDL_HapticEffect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, SDL_HapticEffect *))*(void**)(__base - 3832))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticNewEffect(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + SDL_HapticEffect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, SDL_HapticEffect *))*(void**)(__base - 3838))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticUpdateEffect(__p0, __p1, __p2) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + SDL_HapticEffect * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int , SDL_HapticEffect *))*(void**)(__base - 3844))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_HapticRunEffect(__p0, __p1, __p2) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int , Uint32 ))*(void**)(__base - 3850))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_HapticStopEffect(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int ))*(void**)(__base - 3856))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticDestroyEffect(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Haptic *, int ))*(void**)(__base - 3862))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticGetEffectStatus(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int ))*(void**)(__base - 3868))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticSetGain(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int ))*(void**)(__base - 3874))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticSetAutocenter(__p0, __p1) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, int ))*(void**)(__base - 3880))(__t__p0, __t__p1));\ + }) + +#define SDL_HapticPause(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3886))(__t__p0));\ + }) + +#define SDL_HapticUnpause(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3892))(__t__p0));\ + }) + +#define SDL_HapticStopAll(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3898))(__t__p0));\ + }) + +#define SDL_HapticRumbleSupported(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3904))(__t__p0));\ + }) + +#define SDL_HapticRumbleInit(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3910))(__t__p0));\ + }) + +#define SDL_HapticRumblePlay(__p0, __p1, __p2) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *, float , Uint32 ))*(void**)(__base - 3916))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_HapticRumbleStop(__p0) \ + ({ \ + SDL_Haptic * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Haptic *))*(void**)(__base - 3922))(__t__p0));\ + }) + +#define SDL_SetHintWithPriority(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + SDL_HintPriority __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const char *, const char *, SDL_HintPriority ))*(void**)(__base - 1216))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetHint(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const char *, const char *))*(void**)(__base - 1222))(__t__p0, __t__p1));\ + }) + +#define SDL_GetHint(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(const char *))*(void**)(__base - 1228))(__t__p0));\ + }) + +#define SDL_AddHintCallback(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + SDL_HintCallback __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(const char *, SDL_HintCallback , void *))*(void**)(__base - 1234))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_DelHintCallback(__p0, __p1, __p2) \ + ({ \ + const char * __t__p0 = __p0;\ + SDL_HintCallback __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(const char *, SDL_HintCallback , void *))*(void**)(__base - 1240))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ClearHints() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 1246))());\ + }) + +#define SDL_LoadObject(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(const char *))*(void**)(__base - 1252))(__t__p0));\ + }) + +#define SDL_LoadFunction(__p0, __p1) \ + ({ \ + void * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, const char *))*(void**)(__base - 1258))(__t__p0, __t__p1));\ + }) + +#define SDL_UnloadObject(__p0) \ + ({ \ + void * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void *))*(void**)(__base - 1264))(__t__p0));\ + }) + +#define SDL_LogSetAllPriority(__p0) \ + ({ \ + SDL_LogPriority __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_LogPriority ))*(void**)(__base - 1270))(__t__p0));\ + }) + +#define SDL_LogSetPriority(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_LogPriority __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(int , SDL_LogPriority ))*(void**)(__base - 1276))(__t__p0, __t__p1));\ + }) + +#define SDL_LogGetPriority(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_LogPriority (*)(int ))*(void**)(__base - 1282))(__t__p0));\ + }) + +#define SDL_LogResetPriorities() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 1288))());\ + }) + +#define SDL_LogMessageV(__p0, __p1, __p2, __p3) \ + ({ \ + int __t__p0 = __p0;\ + SDL_LogPriority __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(int , SDL_LogPriority , const char *, va_list ))*(void**)(__base - 1294))(__t__p0, __t__p1, __t__p2, __p3));\ + }) + +#define SDL_LogGetOutputFunction(__p0, __p1) \ + ({ \ + SDL_LogOutputFunction * __t__p0 = __p0;\ + void ** __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_LogOutputFunction *, void **))*(void**)(__base - 1300))(__t__p0, __t__p1));\ + }) + +#define SDL_LogSetOutputFunction(__p0, __p1) \ + ({ \ + SDL_LogOutputFunction __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_LogOutputFunction , void *))*(void**)(__base - 1306))(__t__p0, __t__p1));\ + }) + +#define SDL_ShowMessageBox(__p0, __p1) \ + ({ \ + const SDL_MessageBoxData * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const SDL_MessageBoxData *, int *))*(void**)(__base - 1312))(__t__p0, __t__p1));\ + }) + +#define SDL_ShowSimpleMessageBox(__p0, __p1, __p2, __p3) \ + ({ \ + Uint32 __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + SDL_Window * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(Uint32 , const char *, const char *, SDL_Window *))*(void**)(__base - 1318))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_CreateMutex() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_mutex *(*)(void))*(void**)(__base - 1324))());\ + }) + +#define SDL_LockMutex(__p0) \ + ({ \ + SDL_mutex * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_mutex *))*(void**)(__base - 1330))(__t__p0));\ + }) + +#define SDL_TryLockMutex(__p0) \ + ({ \ + SDL_mutex * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_mutex *))*(void**)(__base - 1336))(__t__p0));\ + }) + +#define SDL_UnlockMutex(__p0) \ + ({ \ + SDL_mutex * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_mutex *))*(void**)(__base - 1342))(__t__p0));\ + }) + +#define SDL_DestroyMutex(__p0) \ + ({ \ + SDL_mutex * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_mutex *))*(void**)(__base - 1348))(__t__p0));\ + }) + +#define SDL_CreateSemaphore(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_sem *(*)(Uint32 ))*(void**)(__base - 1354))(__t__p0));\ + }) + +#define SDL_DestroySemaphore(__p0) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_sem *))*(void**)(__base - 1360))(__t__p0));\ + }) + +#define SDL_SemWait(__p0) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_sem *))*(void**)(__base - 1366))(__t__p0));\ + }) + +#define SDL_SemTryWait(__p0) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_sem *))*(void**)(__base - 1372))(__t__p0));\ + }) + +#define SDL_SemWaitTimeout(__p0, __p1) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_sem *, Uint32 ))*(void**)(__base - 1378))(__t__p0, __t__p1));\ + }) + +#define SDL_SemPost(__p0) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_sem *))*(void**)(__base - 1384))(__t__p0));\ + }) + +#define SDL_SemValue(__p0) \ + ({ \ + SDL_sem * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_sem *))*(void**)(__base - 1390))(__t__p0));\ + }) + +#define SDL_CreateCond() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_cond *(*)(void))*(void**)(__base - 1396))());\ + }) + +#define SDL_DestroyCond(__p0) \ + ({ \ + SDL_cond * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_cond *))*(void**)(__base - 1402))(__t__p0));\ + }) + +#define SDL_CondSignal(__p0) \ + ({ \ + SDL_cond * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_cond *))*(void**)(__base - 1408))(__t__p0));\ + }) + +#define SDL_CondBroadcast(__p0) \ + ({ \ + SDL_cond * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_cond *))*(void**)(__base - 1414))(__t__p0));\ + }) + +#define SDL_CondWait(__p0, __p1) \ + ({ \ + SDL_cond * __t__p0 = __p0;\ + SDL_mutex * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_cond *, SDL_mutex *))*(void**)(__base - 1420))(__t__p0, __t__p1));\ + }) + +#define SDL_CondWaitTimeout(__p0, __p1, __p2) \ + ({ \ + SDL_cond * __t__p0 = __p0;\ + SDL_mutex * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_cond *, SDL_mutex *, Uint32 ))*(void**)(__base - 1426))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetPowerInfo(__p0, __p1) \ + ({ \ + int * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_PowerState (*)(int *, int *))*(void**)(__base - 1432))(__t__p0, __t__p1));\ + }) + +#define SDL_GetNumRenderDrivers() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 1438))());\ + }) + +#define SDL_GetRenderDriverInfo(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_RendererInfo * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , SDL_RendererInfo *))*(void**)(__base - 1444))(__t__p0, __t__p1));\ + }) + +#define SDL_CreateWindowAndRenderer(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + SDL_Window ** __t__p3 = __p3;\ + SDL_Renderer ** __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , int , Uint32 , SDL_Window **, SDL_Renderer **))*(void**)(__base - 1450))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_CreateRenderer(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Renderer *(*)(SDL_Window *, int , Uint32 ))*(void**)(__base - 1456))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_CreateSoftwareRenderer(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Renderer *(*)(SDL_Surface *))*(void**)(__base - 1462))(__t__p0));\ + }) + +#define SDL_GetRenderer(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Renderer *(*)(SDL_Window *))*(void**)(__base - 1468))(__t__p0));\ + }) + +#define SDL_GetRendererInfo(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_RendererInfo * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_RendererInfo *))*(void**)(__base - 1474))(__t__p0, __t__p1));\ + }) + +#define SDL_GetRendererOutputSize(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, int *, int *))*(void**)(__base - 1480))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_CreateTexture(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Texture *(*)(SDL_Renderer *, Uint32 , int , int , int ))*(void**)(__base - 1486))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_CreateTextureFromSurface(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Surface * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Texture *(*)(SDL_Renderer *, SDL_Surface *))*(void**)(__base - 1492))(__t__p0, __t__p1));\ + }) + +#define SDL_QueryTexture(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + Uint32 * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + int * __t__p3 = __p3;\ + int * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, Uint32 *, int *, int *, int *))*(void**)(__base - 1498))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_SetTextureColorMod(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 1504))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetTextureColorMod(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + Uint8 * __t__p1 = __p1;\ + Uint8 * __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, Uint8 *, Uint8 *, Uint8 *))*(void**)(__base - 1510))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SetTextureAlphaMod(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, Uint8 ))*(void**)(__base - 1516))(__t__p0, __t__p1));\ + }) + +#define SDL_GetTextureAlphaMod(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + Uint8 * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, Uint8 *))*(void**)(__base - 1522))(__t__p0, __t__p1));\ + }) + +#define SDL_SetTextureBlendMode(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + SDL_BlendMode __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, SDL_BlendMode ))*(void**)(__base - 1528))(__t__p0, __t__p1));\ + }) + +#define SDL_GetTextureBlendMode(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + SDL_BlendMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, SDL_BlendMode *))*(void**)(__base - 1534))(__t__p0, __t__p1));\ + }) + +#define SDL_UpdateTexture(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + const void * __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, const SDL_Rect *, const void *, int ))*(void**)(__base - 1540))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_UpdateYUVTexture(__p0, __p1, __p2, __p3, __p4, __p5, __p6, __p7) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + const Uint8 * __t__p2 = __p2;\ + int __t__p3 = __p3;\ + const Uint8 * __t__p4 = __p4;\ + int __t__p5 = __p5;\ + const Uint8 * __t__p6 = __p6;\ + int __t__p7 = __p7;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, const SDL_Rect *, const Uint8 *, int , const Uint8 *, int , const Uint8 *, int ))*(void**)(__base - 1546))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6, __t__p7));\ + }) + +#define SDL_LockTexture(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + void ** __t__p2 = __p2;\ + int * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, const SDL_Rect *, void **, int *))*(void**)(__base - 1552))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_UnlockTexture(__p0) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Texture *))*(void**)(__base - 1558))(__t__p0));\ + }) + +#define SDL_RenderTargetSupported(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Renderer *))*(void**)(__base - 1564))(__t__p0));\ + }) + +#define SDL_SetRenderTarget(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Texture * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_Texture *))*(void**)(__base - 1570))(__t__p0, __t__p1));\ + }) + +#define SDL_GetRenderTarget(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Texture *(*)(SDL_Renderer *))*(void**)(__base - 1576))(__t__p0));\ + }) + +#define SDL_RenderSetLogicalSize(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, int , int ))*(void**)(__base - 1582))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderGetLogicalSize(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *, int *, int *))*(void**)(__base - 1588))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderSetViewport(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *))*(void**)(__base - 1594))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderGetViewport(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *, SDL_Rect *))*(void**)(__base - 1600))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderSetClipRect(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *))*(void**)(__base - 1606))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderGetClipRect(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *, SDL_Rect *))*(void**)(__base - 1612))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderSetScale(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + float __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, float , float ))*(void**)(__base - 1618))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderGetScale(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + float * __t__p1 = __p1;\ + float * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *, float *, float *))*(void**)(__base - 1624))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetRenderDrawColor(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + Uint8 __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, Uint8 , Uint8 , Uint8 , Uint8 ))*(void**)(__base - 1630))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_GetRenderDrawColor(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + Uint8 * __t__p1 = __p1;\ + Uint8 * __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + Uint8 * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, Uint8 *, Uint8 *, Uint8 *, Uint8 *))*(void**)(__base - 1636))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_SetRenderDrawBlendMode(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_BlendMode __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_BlendMode ))*(void**)(__base - 1642))(__t__p0, __t__p1));\ + }) + +#define SDL_GetRenderDrawBlendMode(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_BlendMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_BlendMode *))*(void**)(__base - 1648))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderClear(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *))*(void**)(__base - 1654))(__t__p0));\ + }) + +#define SDL_RenderDrawPoint(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, int , int ))*(void**)(__base - 1660))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawPoints(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Point * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Point *, int ))*(void**)(__base - 1666))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawLine(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, int , int , int , int ))*(void**)(__base - 1672))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_RenderDrawLines(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Point * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Point *, int ))*(void**)(__base - 1678))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawRect(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *))*(void**)(__base - 1684))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderDrawRects(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *, int ))*(void**)(__base - 1690))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderFillRect(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *))*(void**)(__base - 1696))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderFillRects(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *, int ))*(void**)(__base - 1702))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderCopy(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Texture * __t__p1 = __p1;\ + const SDL_Rect * __t__p2 = __p2;\ + const SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_Texture *, const SDL_Rect *, const SDL_Rect *))*(void**)(__base - 1708))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_RenderCopyEx(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Texture * __t__p1 = __p1;\ + const SDL_Rect * __t__p2 = __p2;\ + const SDL_Rect * __t__p3 = __p3;\ + const double __t__p4 = __p4;\ + const SDL_Point * __t__p5 = __p5;\ + const SDL_RendererFlip __t__p6 = __p6;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_Texture *, const SDL_Rect *, const SDL_Rect *, const double , const SDL_Point *, const SDL_RendererFlip ))*(void**)(__base - 1714))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + }) + +#define SDL_RenderReadPixels(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + void * __t__p3 = __p3;\ + int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_Rect *, Uint32 , void *, int ))*(void**)(__base - 1720))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_RenderPresent(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *))*(void**)(__base - 1726))(__t__p0));\ + }) + +#define SDL_DestroyTexture(__p0) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Texture *))*(void**)(__base - 1732))(__t__p0));\ + }) + +#define SDL_DestroyRenderer(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Renderer *))*(void**)(__base - 1738))(__t__p0));\ + }) + +#define SDL_GL_BindTexture(__p0, __p1, __p2) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + float * __t__p1 = __p1;\ + float * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, float *, float *))*(void**)(__base - 1744))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GL_UnbindTexture(__p0) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *))*(void**)(__base - 1750))(__t__p0));\ + }) + +#define SDL_RWFromFile(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_RWops *(*)(const char *, const char *))*(void**)(__base - 1756))(__t__p0, __t__p1));\ + }) + +#define SDL_RWFromMem(__p0, __p1) \ + ({ \ + void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_RWops *(*)(void *, int ))*(void**)(__base - 1768))(__t__p0, __t__p1));\ + }) + +#define SDL_RWFromConstMem(__p0, __p1) \ + ({ \ + const void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_RWops *(*)(const void *, int ))*(void**)(__base - 1774))(__t__p0, __t__p1));\ + }) + +#define SDL_AllocRW() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_RWops *(*)(void))*(void**)(__base - 1780))());\ + }) + +#define SDL_FreeRW(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_RWops *))*(void**)(__base - 1786))(__t__p0));\ + }) + +#define SDL_ReadU8(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint8 (*)(SDL_RWops *))*(void**)(__base - 1792))(__t__p0));\ + }) + +#define SDL_ReadLE16(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_RWops *))*(void**)(__base - 1798))(__t__p0));\ + }) + +#define SDL_ReadBE16(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_RWops *))*(void**)(__base - 1804))(__t__p0));\ + }) + +#define SDL_ReadLE32(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_RWops *))*(void**)(__base - 1810))(__t__p0));\ + }) + +#define SDL_ReadBE32(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_RWops *))*(void**)(__base - 1816))(__t__p0));\ + }) + +#define SDL_ReadLE64(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint64 (*)(SDL_RWops *))*(void**)(__base - 1822))(__t__p0));\ + }) + +#define SDL_ReadBE64(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint64 (*)(SDL_RWops *))*(void**)(__base - 1828))(__t__p0));\ + }) + +#define SDL_WriteU8(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint8 ))*(void**)(__base - 1834))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteLE16(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint16 ))*(void**)(__base - 1840))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteBE16(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint16 ))*(void**)(__base - 1846))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteLE32(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint32 ))*(void**)(__base - 1852))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteBE32(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint32 ))*(void**)(__base - 1858))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteLE64(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint64 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint64 ))*(void**)(__base - 1864))(__t__p0, __t__p1));\ + }) + +#define SDL_WriteBE64(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Uint64 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, Uint64 ))*(void**)(__base - 1870))(__t__p0, __t__p1));\ + }) + +#define SDL_CreateThread(__p0, __p1, __p2) \ + ({ \ + SDL_ThreadFunction __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Thread *(*)(SDL_ThreadFunction , const char *, void *))*(void**)(__base - 1876))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetThreadName(__p0) \ + ({ \ + SDL_Thread * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Thread *))*(void**)(__base - 1882))(__t__p0));\ + }) + +#define SDL_ThreadID() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_threadID (*)(void))*(void**)(__base - 1888))());\ + }) + +#define SDL_GetThreadID(__p0) \ + ({ \ + SDL_Thread * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_threadID (*)(SDL_Thread *))*(void**)(__base - 1894))(__t__p0));\ + }) + +#define SDL_SetThreadPriority(__p0) \ + ({ \ + SDL_ThreadPriority __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_ThreadPriority ))*(void**)(__base - 1900))(__t__p0));\ + }) + +#define SDL_WaitThread(__p0, __p1) \ + ({ \ + SDL_Thread * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Thread *, int *))*(void**)(__base - 1906))(__t__p0, __t__p1));\ + }) + +#define SDL_DetachThread(__p0) \ + ({ \ + SDL_Thread * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Thread *))*(void**)(__base - 1912))(__t__p0));\ + }) + +#define SDL_TLSCreate() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_TLSID (*)(void))*(void**)(__base - 1918))());\ + }) + +#define SDL_TLSGet(__p0) \ + ({ \ + SDL_TLSID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_TLSID ))*(void**)(__base - 1924))(__t__p0));\ + }) + +#define SDL_TLSSet(__p0, __p1, __p2) \ + ({ \ + SDL_TLSID __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + void (* __t__p2)(void*) = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_TLSID , const void *, void (*)(void*)))*(void**)(__base - 1930))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetTicks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(void))*(void**)(__base - 1936))());\ + }) + +#define SDL_GetPerformanceCounter() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint64 (*)(void))*(void**)(__base - 1942))());\ + }) + +#define SDL_GetPerformanceFrequency() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint64 (*)(void))*(void**)(__base - 1948))());\ + }) + +#define SDL_Delay(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 ))*(void**)(__base - 1954))(__t__p0));\ + }) + +#define SDL_AddTimer(__p0, __p1, __p2) \ + ({ \ + Uint32 __t__p0 = __p0;\ + SDL_TimerCallback __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_TimerID (*)(Uint32 , SDL_TimerCallback , void *))*(void**)(__base - 1960))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RemoveTimer(__p0) \ + ({ \ + SDL_TimerID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_TimerID ))*(void**)(__base - 1966))(__t__p0));\ + }) + +#define SDL_GetVersion(__p0) \ + ({ \ + SDL_version * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_version *))*(void**)(__base - 1972))(__t__p0));\ + }) + +#define SDL_GetRevision() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(void))*(void**)(__base - 1978))());\ + }) + +#define SDL_GetRevisionNumber() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 1984))());\ + }) + +#define SDL_GetNumVideoDrivers() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 1990))());\ + }) + +#define SDL_GetVideoDriver(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 1996))(__t__p0));\ + }) + +#define SDL_VideoInit(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 2002))(__t__p0));\ + }) + +#define SDL_VideoQuit() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2008))());\ + }) + +#define SDL_GetCurrentVideoDriver() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(void))*(void**)(__base - 2014))());\ + }) + +#define SDL_GetNumVideoDisplays() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 2020))());\ + }) + +#define SDL_GetDisplayName(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(int ))*(void**)(__base - 2026))(__t__p0));\ + }) + +#define SDL_GetDisplayBounds(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , SDL_Rect *))*(void**)(__base - 2032))(__t__p0, __t__p1));\ + }) + +#define SDL_GetNumDisplayModes(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 2038))(__t__p0));\ + }) + +#define SDL_GetDisplayMode(__p0, __p1, __p2) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + SDL_DisplayMode * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , int , SDL_DisplayMode *))*(void**)(__base - 2044))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetDesktopDisplayMode(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_DisplayMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , SDL_DisplayMode *))*(void**)(__base - 2050))(__t__p0, __t__p1));\ + }) + +#define SDL_GetCurrentDisplayMode(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_DisplayMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , SDL_DisplayMode *))*(void**)(__base - 2056))(__t__p0, __t__p1));\ + }) + +#define SDL_GetClosestDisplayMode(__p0, __p1, __p2) \ + ({ \ + int __t__p0 = __p0;\ + const SDL_DisplayMode * __t__p1 = __p1;\ + SDL_DisplayMode * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_DisplayMode *(*)(int , const SDL_DisplayMode *, SDL_DisplayMode *))*(void**)(__base - 2062))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowDisplayIndex(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *))*(void**)(__base - 2068))(__t__p0));\ + }) + +#define SDL_SetWindowDisplayMode(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const SDL_DisplayMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, const SDL_DisplayMode *))*(void**)(__base - 2074))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowDisplayMode(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_DisplayMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_DisplayMode *))*(void**)(__base - 2080))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowPixelFormat(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_Window *))*(void**)(__base - 2086))(__t__p0));\ + }) + +#define SDL_CreateWindow(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + const char * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(const char *, int , int , int , int , Uint32 ))*(void**)(__base - 2092))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_CreateWindowFrom(__p0) \ + ({ \ + const void * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(const void *))*(void**)(__base - 2098))(__t__p0));\ + }) + +#define SDL_GetWindowID(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_Window *))*(void**)(__base - 2104))(__t__p0));\ + }) + +#define SDL_GetWindowFromID(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(Uint32 ))*(void**)(__base - 2110))(__t__p0));\ + }) + +#define SDL_GetWindowFlags(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_Window *))*(void**)(__base - 2116))(__t__p0));\ + }) + +#define SDL_SetWindowTitle(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, const char *))*(void**)(__base - 2122))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowTitle(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Window *))*(void**)(__base - 2128))(__t__p0));\ + }) + +#define SDL_SetWindowIcon(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_Surface * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, SDL_Surface *))*(void**)(__base - 2134))(__t__p0, __t__p1));\ + }) + +#define SDL_SetWindowData(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_Window *, const char *, void *))*(void**)(__base - 2140))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowData(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_Window *, const char *))*(void**)(__base - 2146))(__t__p0, __t__p1));\ + }) + +#define SDL_SetWindowPosition(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int , int ))*(void**)(__base - 2152))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowPosition(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 2158))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetWindowSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int , int ))*(void**)(__base - 2164))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 2170))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetWindowMinimumSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int , int ))*(void**)(__base - 2176))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowMinimumSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 2182))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetWindowMaximumSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int , int ))*(void**)(__base - 2188))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetWindowMaximumSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 2194))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetWindowBordered(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_bool __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, SDL_bool ))*(void**)(__base - 2200))(__t__p0, __t__p1));\ + }) + +#define SDL_ShowWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2206))(__t__p0));\ + }) + +#define SDL_HideWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2212))(__t__p0));\ + }) + +#define SDL_RaiseWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2218))(__t__p0));\ + }) + +#define SDL_MaximizeWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2224))(__t__p0));\ + }) + +#define SDL_MinimizeWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2230))(__t__p0));\ + }) + +#define SDL_RestoreWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2236))(__t__p0));\ + }) + +#define SDL_SetWindowFullscreen(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, Uint32 ))*(void**)(__base - 2242))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowSurface(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(SDL_Window *))*(void**)(__base - 2248))(__t__p0));\ + }) + +#define SDL_UpdateWindowSurface(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *))*(void**)(__base - 2254))(__t__p0));\ + }) + +#define SDL_UpdateWindowSurfaceRects(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, const SDL_Rect *, int ))*(void**)(__base - 2260))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetWindowGrab(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_bool __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, SDL_bool ))*(void**)(__base - 2266))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowGrab(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Window *))*(void**)(__base - 2272))(__t__p0));\ + }) + +#define SDL_SetWindowBrightness(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, float ))*(void**)(__base - 2278))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowBrightness(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(SDL_Window *))*(void**)(__base - 2284))(__t__p0));\ + }) + +#define SDL_SetWindowGammaRamp(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + const Uint16 * __t__p1 = __p1;\ + const Uint16 * __t__p2 = __p2;\ + const Uint16 * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, const Uint16 *, const Uint16 *, const Uint16 *))*(void**)(__base - 2290))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetWindowGammaRamp(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + Uint16 * __t__p1 = __p1;\ + Uint16 * __t__p2 = __p2;\ + Uint16 * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, Uint16 *, Uint16 *, Uint16 *))*(void**)(__base - 2296))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_DestroyWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 2302))(__t__p0));\ + }) + +#define SDL_IsScreenSaverEnabled() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2308))());\ + }) + +#define SDL_EnableScreenSaver() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2314))());\ + }) + +#define SDL_DisableScreenSaver() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2320))());\ + }) + +#define SDL_GetKeyboardFocus() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(void))*(void**)(__base - 2326))());\ + }) + +#define SDL_GetKeyboardState(__p0) \ + ({ \ + int * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const Uint8 *(*)(int *))*(void**)(__base - 2332))(__t__p0));\ + }) + +#define SDL_GetModState() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Keymod (*)(void))*(void**)(__base - 2338))());\ + }) + +#define SDL_SetModState(__p0) \ + ({ \ + SDL_Keymod __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Keymod ))*(void**)(__base - 2344))(__t__p0));\ + }) + +#define SDL_GetKeyFromScancode(__p0) \ + ({ \ + SDL_Scancode __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Keycode (*)(SDL_Scancode ))*(void**)(__base - 2350))(__t__p0));\ + }) + +#define SDL_GetScancodeFromKey(__p0) \ + ({ \ + SDL_Keycode __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Scancode (*)(SDL_Keycode ))*(void**)(__base - 2356))(__t__p0));\ + }) + +#define SDL_GetScancodeName(__p0) \ + ({ \ + SDL_Scancode __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Scancode ))*(void**)(__base - 2362))(__t__p0));\ + }) + +#define SDL_GetScancodeFromName(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Scancode (*)(const char *))*(void**)(__base - 2368))(__t__p0));\ + }) + +#define SDL_GetKeyName(__p0) \ + ({ \ + SDL_Keycode __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Keycode ))*(void**)(__base - 2374))(__t__p0));\ + }) + +#define SDL_GetKeyFromName(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Keycode (*)(const char *))*(void**)(__base - 2380))(__t__p0));\ + }) + +#define SDL_StartTextInput() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2386))());\ + }) + +#define SDL_IsTextInputActive() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2392))());\ + }) + +#define SDL_StopTextInput() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2398))());\ + }) + +#define SDL_SetTextInputRect(__p0) \ + ({ \ + SDL_Rect * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Rect *))*(void**)(__base - 2404))(__t__p0));\ + }) + +#define SDL_HasScreenKeyboardSupport() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2410))());\ + }) + +#define SDL_IsScreenKeyboardShown(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Window *))*(void**)(__base - 2416))(__t__p0));\ + }) + +#define SDL_CreateRGBSurface(__p0, __p1, __p2, __p3, __p4, __p5, __p6, __p7) \ + ({ \ + Uint32 __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + Uint32 __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + Uint32 __t__p6 = __p6;\ + Uint32 __t__p7 = __p7;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(Uint32 , int , int , int , Uint32 , Uint32 , Uint32 , Uint32 ))*(void**)(__base - 2422))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6, __t__p7));\ + }) + +#define SDL_CreateRGBSurfaceFrom(__p0, __p1, __p2, __p3, __p4, __p5, __p6, __p7, __p8) \ + ({ \ + void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + Uint32 __t__p6 = __p6;\ + Uint32 __t__p7 = __p7;\ + Uint32 __t__p8 = __p8;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(void *, int , int , int , int , Uint32 , Uint32 , Uint32 , Uint32 ))*(void**)(__base - 2428))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6, __t__p7, __t__p8));\ + }) + +#define SDL_FreeSurface(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Surface *))*(void**)(__base - 2434))(__t__p0));\ + }) + +#define SDL_SetSurfacePalette(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_Palette * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_Palette *))*(void**)(__base - 2440))(__t__p0, __t__p1));\ + }) + +#define SDL_LockSurface(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *))*(void**)(__base - 2446))(__t__p0));\ + }) + +#define SDL_UnlockSurface(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Surface *))*(void**)(__base - 2452))(__t__p0));\ + }) + +#define SDL_LoadBMP_RW(__p0, __p1) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(SDL_RWops *, int ))*(void**)(__base - 2458))(__t__p0, __t__p1));\ + }) + +#define SDL_SaveBMP_RW(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_RWops * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_RWops *, int ))*(void**)(__base - 2464))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetSurfaceRLE(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, int ))*(void**)(__base - 2470))(__t__p0, __t__p1));\ + }) + +#define SDL_SetColorKey(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, int , Uint32 ))*(void**)(__base - 2476))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetColorKey(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint32 * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, Uint32 *))*(void**)(__base - 2482))(__t__p0, __t__p1));\ + }) + +#define SDL_SetSurfaceColorMod(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 2488))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetSurfaceColorMod(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint8 * __t__p1 = __p1;\ + Uint8 * __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, Uint8 *, Uint8 *, Uint8 *))*(void**)(__base - 2494))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SetSurfaceAlphaMod(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, Uint8 ))*(void**)(__base - 2500))(__t__p0, __t__p1));\ + }) + +#define SDL_GetSurfaceAlphaMod(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint8 * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, Uint8 *))*(void**)(__base - 2506))(__t__p0, __t__p1));\ + }) + +#define SDL_SetSurfaceBlendMode(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_BlendMode __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_BlendMode ))*(void**)(__base - 2512))(__t__p0, __t__p1));\ + }) + +#define SDL_GetSurfaceBlendMode(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_BlendMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_BlendMode *))*(void**)(__base - 2518))(__t__p0, __t__p1));\ + }) + +#define SDL_SetClipRect(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Surface *, const SDL_Rect *))*(void**)(__base - 2524))(__t__p0, __t__p1));\ + }) + +#define SDL_GetClipRect(__p0, __p1) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Surface *, SDL_Rect *))*(void**)(__base - 2530))(__t__p0, __t__p1));\ + }) + +#define SDL_ConvertSurface(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_PixelFormat * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(SDL_Surface *, const SDL_PixelFormat *, Uint32 ))*(void**)(__base - 2536))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ConvertSurfaceFormat(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(SDL_Surface *, Uint32 , Uint32 ))*(void**)(__base - 2542))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ConvertPixels(__p0, __p1, __p2, __p3, __p4, __p5, __p6, __p7) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + const void * __t__p3 = __p3;\ + int __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + void * __t__p6 = __p6;\ + int __t__p7 = __p7;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , int , Uint32 , const void *, int , Uint32 , void *, int ))*(void**)(__base - 2548))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6, __t__p7));\ + }) + +#define SDL_FillRect(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, const SDL_Rect *, Uint32 ))*(void**)(__base - 2554))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_FillRects(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, const SDL_Rect *, int , Uint32 ))*(void**)(__base - 2560))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_UpperBlit(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Surface * __t__p2 = __p2;\ + SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, const SDL_Rect *, SDL_Surface *, SDL_Rect *))*(void**)(__base - 2566))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_LowerBlit(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + SDL_Surface * __t__p2 = __p2;\ + SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_Rect *, SDL_Surface *, SDL_Rect *))*(void**)(__base - 2572))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SoftStretch(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Surface * __t__p2 = __p2;\ + const SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, const SDL_Rect *, SDL_Surface *, const SDL_Rect *))*(void**)(__base - 2578))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_UpperBlitScaled(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Surface * __t__p2 = __p2;\ + SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, const SDL_Rect *, SDL_Surface *, SDL_Rect *))*(void**)(__base - 2584))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_LowerBlitScaled(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + SDL_Surface * __t__p2 = __p2;\ + SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Surface *, SDL_Rect *, SDL_Surface *, SDL_Rect *))*(void**)(__base - 2590))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetMouseFocus() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(void))*(void**)(__base - 2596))());\ + }) + +#define SDL_GetMouseState(__p0, __p1) \ + ({ \ + int * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(int *, int *))*(void**)(__base - 2602))(__t__p0, __t__p1));\ + }) + +#define SDL_GetRelativeMouseState(__p0, __p1) \ + ({ \ + int * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(int *, int *))*(void**)(__base - 2608))(__t__p0, __t__p1));\ + }) + +#define SDL_WarpMouseInWindow(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int , int ))*(void**)(__base - 2614))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_SetRelativeMouseMode(__p0) \ + ({ \ + SDL_bool __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_bool ))*(void**)(__base - 2620))(__t__p0));\ + }) + +#define SDL_GetRelativeMouseMode() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2626))());\ + }) + +#define SDL_CreateCursor(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + const Uint8 * __t__p0 = __p0;\ + const Uint8 * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + int __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Cursor *(*)(const Uint8 *, const Uint8 *, int , int , int , int ))*(void**)(__base - 2632))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_CreateColorCursor(__p0, __p1, __p2) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Cursor *(*)(SDL_Surface *, int , int ))*(void**)(__base - 2638))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_CreateSystemCursor(__p0) \ + ({ \ + SDL_SystemCursor __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Cursor *(*)(SDL_SystemCursor ))*(void**)(__base - 2644))(__t__p0));\ + }) + +#define SDL_SetCursor(__p0) \ + ({ \ + SDL_Cursor * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Cursor *))*(void**)(__base - 2650))(__t__p0));\ + }) + +#define SDL_GetCursor() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Cursor *(*)(void))*(void**)(__base - 2656))());\ + }) + +#define SDL_GetDefaultCursor() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Cursor *(*)(void))*(void**)(__base - 2662))());\ + }) + +#define SDL_FreeCursor(__p0) \ + ({ \ + SDL_Cursor * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Cursor *))*(void**)(__base - 2668))(__t__p0));\ + }) + +#define SDL_ShowCursor(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 2674))(__t__p0));\ + }) + +#define SDL_GetPixelFormatName(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(Uint32 ))*(void**)(__base - 2680))(__t__p0));\ + }) + +#define SDL_PixelFormatEnumToMasks(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + Uint32 __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + Uint32 * __t__p2 = __p2;\ + Uint32 * __t__p3 = __p3;\ + Uint32 * __t__p4 = __p4;\ + Uint32 * __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(Uint32 , int *, Uint32 *, Uint32 *, Uint32 *, Uint32 *))*(void**)(__base - 2686))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_MasksToPixelFormatEnum(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + int __t__p0 = __p0;\ + Uint32 __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + Uint32 __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(int , Uint32 , Uint32 , Uint32 , Uint32 ))*(void**)(__base - 2692))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_AllocFormat(__p0) \ + ({ \ + Uint32 __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_PixelFormat *(*)(Uint32 ))*(void**)(__base - 2698))(__t__p0));\ + }) + +#define SDL_FreeFormat(__p0) \ + ({ \ + SDL_PixelFormat * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_PixelFormat *))*(void**)(__base - 2704))(__t__p0));\ + }) + +#define SDL_AllocPalette(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Palette *(*)(int ))*(void**)(__base - 2710))(__t__p0));\ + }) + +#define SDL_SetPixelFormatPalette(__p0, __p1) \ + ({ \ + SDL_PixelFormat * __t__p0 = __p0;\ + SDL_Palette * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_PixelFormat *, SDL_Palette *))*(void**)(__base - 2716))(__t__p0, __t__p1));\ + }) + +#define SDL_SetPaletteColors(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Palette * __t__p0 = __p0;\ + const SDL_Color * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Palette *, const SDL_Color *, int , int ))*(void**)(__base - 2722))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_FreePalette(__p0) \ + ({ \ + SDL_Palette * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Palette *))*(void**)(__base - 2728))(__t__p0));\ + }) + +#define SDL_MapRGB(__p0, __p1, __p2, __p3) \ + ({ \ + const SDL_PixelFormat * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(const SDL_PixelFormat *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 2734))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_MapRGBA(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + const SDL_PixelFormat * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + Uint8 __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(const SDL_PixelFormat *, Uint8 , Uint8 , Uint8 , Uint8 ))*(void**)(__base - 2740))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_GetRGB(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + Uint32 __t__p0 = __p0;\ + const SDL_PixelFormat * __t__p1 = __p1;\ + Uint8 * __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + Uint8 * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 , const SDL_PixelFormat *, Uint8 *, Uint8 *, Uint8 *))*(void**)(__base - 2746))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_GetRGBA(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + Uint32 __t__p0 = __p0;\ + const SDL_PixelFormat * __t__p1 = __p1;\ + Uint8 * __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + Uint8 * __t__p4 = __p4;\ + Uint8 * __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(Uint32 , const SDL_PixelFormat *, Uint8 *, Uint8 *, Uint8 *, Uint8 *))*(void**)(__base - 2752))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_CalculateGammaRamp(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + Uint16 * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(float , Uint16 *))*(void**)(__base - 2758))(__t__p0, __t__p1));\ + }) + +#define SDL_HasIntersection(__p0, __p1) \ + ({ \ + const SDL_Rect * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const SDL_Rect *, const SDL_Rect *))*(void**)(__base - 2764))(__t__p0, __t__p1));\ + }) + +#define SDL_IntersectRect(__p0, __p1, __p2) \ + ({ \ + const SDL_Rect * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Rect * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const SDL_Rect *, const SDL_Rect *, SDL_Rect *))*(void**)(__base - 2770))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_UnionRect(__p0, __p1, __p2) \ + ({ \ + const SDL_Rect * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Rect * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(const SDL_Rect *, const SDL_Rect *, SDL_Rect *))*(void**)(__base - 2776))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_EnclosePoints(__p0, __p1, __p2, __p3) \ + ({ \ + const SDL_Point * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + const SDL_Rect * __t__p2 = __p2;\ + SDL_Rect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const SDL_Point *, int , const SDL_Rect *, SDL_Rect *))*(void**)(__base - 2782))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_IntersectRectAndLine(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + const SDL_Rect * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + int * __t__p3 = __p3;\ + int * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const SDL_Rect *, int *, int *, int *, int *))*(void**)(__base - 2788))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_GetWindowWMInfo(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_SysWMinfo * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Window *, SDL_SysWMinfo *))*(void**)(__base - 2794))(__t__p0, __t__p1));\ + }) + +#define SDL_RecordGesture(__p0) \ + ({ \ + SDL_TouchID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_TouchID ))*(void**)(__base - 2800))(__t__p0));\ + }) + +#define SDL_SaveAllDollarTemplates(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_RWops *))*(void**)(__base - 2806))(__t__p0));\ + }) + +#define SDL_SaveDollarTemplate(__p0, __p1) \ + ({ \ + SDL_GestureID __t__p0 = __p0;\ + SDL_RWops * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GestureID , SDL_RWops *))*(void**)(__base - 2812))(__t__p0, __t__p1));\ + }) + +#define SDL_LoadDollarTemplates(__p0, __p1) \ + ({ \ + SDL_TouchID __t__p0 = __p0;\ + SDL_RWops * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_TouchID , SDL_RWops *))*(void**)(__base - 2818))(__t__p0, __t__p1));\ + }) + +#define SDL_CreateShapedWindow(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + const char * __t__p0 = __p0;\ + unsigned int __t__p1 = __p1;\ + unsigned int __t__p2 = __p2;\ + unsigned int __t__p3 = __p3;\ + unsigned int __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(const char *, unsigned int , unsigned int , unsigned int , unsigned int , Uint32 ))*(void**)(__base - 2824))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_IsShapedWindow(__p0) \ + ({ \ + const SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const SDL_Window *))*(void**)(__base - 2830))(__t__p0));\ + }) + +#define SDL_SetWindowShape(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_Surface * __t__p1 = __p1;\ + SDL_WindowShapeMode * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_Surface *, SDL_WindowShapeMode *))*(void**)(__base - 2836))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetShapedWindowMode(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_WindowShapeMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_WindowShapeMode *))*(void**)(__base - 2842))(__t__p0, __t__p1));\ + }) + +#define SDL_GL_LoadLibrary(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 3652))(__t__p0));\ + }) + +#define SDL_GL_UnloadLibrary() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3664))());\ + }) + +#define SDL_GL_ExtensionSupported(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const char *))*(void**)(__base - 3670))(__t__p0));\ + }) + +#define SDL_GL_ResetAttributes() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3676))());\ + }) + +#define SDL_GL_SetAttribute(__p0, __p1) \ + ({ \ + SDL_GLattr __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GLattr , int ))*(void**)(__base - 3682))(__t__p0, __t__p1));\ + }) + +#define SDL_GL_GetAttribute(__p0, __p1) \ + ({ \ + SDL_GLattr __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GLattr , int *))*(void**)(__base - 3688))(__t__p0, __t__p1));\ + }) + +#define SDL_GL_CreateContext(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GLContext (*)(SDL_Window *))*(void**)(__base - 3694))(__t__p0));\ + }) + +#define SDL_GL_MakeCurrent(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_GLContext __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_GLContext ))*(void**)(__base - 3700))(__t__p0, __t__p1));\ + }) + +#define SDL_GL_GetCurrentWindow() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(void))*(void**)(__base - 3706))());\ + }) + +#define SDL_GL_GetCurrentContext() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GLContext (*)(void))*(void**)(__base - 3712))());\ + }) + +#define SDL_GL_GetDrawableSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 3718))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GL_SetSwapInterval(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3724))(__t__p0));\ + }) + +#define SDL_GL_GetSwapInterval() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 3730))());\ + }) + +#define SDL_GL_SwapWindow(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *))*(void**)(__base - 3736))(__t__p0));\ + }) + +#define SDL_GL_DeleteContext(__p0) \ + ({ \ + SDL_GLContext __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_GLContext ))*(void**)(__base - 3742))(__t__p0));\ + }) + +#define SDL_sqrtf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 2932))(__t__p0));\ + }) + +#define SDL_tan(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 2938))(__t__p0));\ + }) + +#define SDL_tanf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 2944))(__t__p0));\ + }) + +#define SDL_QueueAudio(__p0, __p1, __p2) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioDeviceID , const void *, Uint32 ))*(void**)(__base - 2914))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetQueuedAudioSize(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_AudioDeviceID ))*(void**)(__base - 2920))(__t__p0));\ + }) + +#define SDL_ClearQueuedAudio(__p0) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioDeviceID ))*(void**)(__base - 2926))(__t__p0));\ + }) + +#define SDL_HasAVX2() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2908))());\ + }) + +#define SDL_JoystickFromInstanceID(__p0) \ + ({ \ + SDL_JoystickID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Joystick *(*)(SDL_JoystickID ))*(void**)(__base - 2902))(__t__p0));\ + }) + +#define SDL_JoystickCurrentPowerLevel(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickPowerLevel (*)(SDL_Joystick *))*(void**)(__base - 2896))(__t__p0));\ + }) + +#define SDL_GameControllerFromInstanceID(__p0) \ + ({ \ + SDL_JoystickID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameController (*)(SDL_JoystickID ))*(void**)(__base - 2890))(__t__p0));\ + }) + +#define SDL_RenderIsClipEnabled(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Renderer *))*(void**)(__base - 2884))(__t__p0));\ + }) + +#define SDL_GetDisplayDPI(__p0, __p1, __p2, __p3) \ + ({ \ + int __t__p0 = __p0;\ + float * __t__p1 = __p1;\ + float * __t__p2 = __p2;\ + float * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , float *, float *, float *))*(void**)(__base - 2878))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SetWindowHitTest(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_HitTest __t__p1 = __p1;\ + void * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_HitTest , void *))*(void**)(__base - 2866))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetGrabbedWindow() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Window *(*)(void))*(void**)(__base - 2872))());\ + }) + +#define SDL_WarpMouseGlobal(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , int ))*(void**)(__base - 2854))(__t__p0, __t__p1));\ + }) + +#define SDL_CaptureMouse(__p0) \ + ({ \ + SDL_bool __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_bool ))*(void**)(__base - 2848))(__t__p0));\ + }) + +#define SDL_GetGlobalMouseState(__p0, __p1) \ + ({ \ + int * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(int *, int *))*(void**)(__base - 2860))(__t__p0, __t__p1));\ + }) + +#define SDL_MemoryBarrierReleaseFunction() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2950))());\ + }) + +#define SDL_MemoryBarrierAcquireFunction() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 2956))());\ + }) + +#define SDL_DequeueAudio(__p0, __p1, __p2) \ + ({ \ + SDL_AudioDeviceID __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + Uint32 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(SDL_AudioDeviceID , void *, Uint32 ))*(void**)(__base - 2962))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_ComposeCustomBlendMode(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + SDL_BlendFactor __t__p0 = __p0;\ + SDL_BlendFactor __t__p1 = __p1;\ + SDL_BlendOperation __t__p2 = __p2;\ + SDL_BlendFactor __t__p3 = __p3;\ + SDL_BlendFactor __t__p4 = __p4;\ + SDL_BlendOperation __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_BlendMode (*)(SDL_BlendFactor , SDL_BlendFactor , SDL_BlendOperation , SDL_BlendFactor , SDL_BlendFactor , SDL_BlendOperation ))*(void**)(__base - 2968))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_HasNEON() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 2974))());\ + }) + +#define SDL_GameControllerNumMappings() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 2980))());\ + }) + +#define SDL_GameControllerMappingForIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(int ))*(void**)(__base - 2986))(__t__p0));\ + }) + +#define SDL_GameControllerGetVendor(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_GameController *))*(void**)(__base - 2992))(__t__p0));\ + }) + +#define SDL_GameControllerGetProduct(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_GameController *))*(void**)(__base - 2998))(__t__p0));\ + }) + +#define SDL_GameControllerGetProductVersion(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_GameController *))*(void**)(__base - 3004))(__t__p0));\ + }) + +#define SDL_GetHintBoolean(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + SDL_bool __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(const char *, SDL_bool ))*(void**)(__base - 3010))(__t__p0, __t__p1));\ + }) + +#define SDL_JoystickGetDeviceVendor(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(int ))*(void**)(__base - 3016))(__t__p0));\ + }) + +#define SDL_JoystickGetDeviceProduct(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(int ))*(void**)(__base - 3022))(__t__p0));\ + }) + +#define SDL_JoystickGetDeviceProductVersion(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(int ))*(void**)(__base - 3028))(__t__p0));\ + }) + +#define SDL_JoystickGetDeviceType(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickType (*)(int ))*(void**)(__base - 3034))(__t__p0));\ + }) + +#define SDL_JoystickGetDeviceInstanceID(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickID (*)(int ))*(void**)(__base - 3040))(__t__p0));\ + }) + +#define SDL_JoystickGetVendor(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_Joystick *))*(void**)(__base - 3046))(__t__p0));\ + }) + +#define SDL_JoystickGetProduct(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_Joystick *))*(void**)(__base - 3052))(__t__p0));\ + }) + +#define SDL_JoystickGetProductVersion(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint16 (*)(SDL_Joystick *))*(void**)(__base - 3058))(__t__p0));\ + }) + +#define SDL_JoystickGetType(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_JoystickType (*)(SDL_Joystick *))*(void**)(__base - 3064))(__t__p0));\ + }) + +#define SDL_JoystickGetAxisInitialState(__p0, __p1, __p2) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Sint16 * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Joystick *, int , Sint16 *))*(void**)(__base - 3070))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetDisplayUsableBounds(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + SDL_Rect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int , SDL_Rect *))*(void**)(__base - 3076))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowBordersSize(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + int * __t__p3 = __p3;\ + int * __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, int *, int *, int *, int *))*(void**)(__base - 3082))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_SetWindowResizable(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_bool __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, SDL_bool ))*(void**)(__base - 3088))(__t__p0, __t__p1));\ + }) + +#define SDL_SetWindowOpacity(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, float ))*(void**)(__base - 3094))(__t__p0, __t__p1));\ + }) + +#define SDL_GetWindowOpacity(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + float * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, float *))*(void**)(__base - 3100))(__t__p0, __t__p1));\ + }) + +#define SDL_SetWindowModalFor(__p0, __p1) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + SDL_Window * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *, SDL_Window *))*(void**)(__base - 3106))(__t__p0, __t__p1));\ + }) + +#define SDL_SetWindowInputFocus(__p0) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Window *))*(void**)(__base - 3112))(__t__p0));\ + }) + +#define SDL_CreateRGBSurfaceWithFormat(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + Uint32 __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + Uint32 __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(Uint32 , int , int , int , Uint32 ))*(void**)(__base - 3118))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_CreateRGBSurfaceWithFormatFrom(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + void * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + int __t__p4 = __p4;\ + Uint32 __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(void *, int , int , int , int , Uint32 ))*(void**)(__base - 3124))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#define SDL_DuplicateSurface(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Surface *(*)(SDL_Surface *))*(void**)(__base - 3130))(__t__p0));\ + }) + +#define SDL_wcscmp(__p0, __p1) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const wchar_t *, const wchar_t *))*(void**)(__base - 3136))(__t__p0, __t__p1));\ + }) + +#define SDL_utf8strlen(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(const char *))*(void**)(__base - 3142))(__t__p0));\ + }) + +#define SDL_LoadFile_RW(__p0, __p1, __p2) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + size_t * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_RWops *, size_t *, int ))*(void**)(__base - 3148))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderSetIntegerScale(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_bool __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_bool ))*(void**)(__base - 3154))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderGetIntegerScale(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Renderer *))*(void**)(__base - 3160))(__t__p0));\ + }) + +#define SDL_LockJoysticks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3208))());\ + }) + +#define SDL_UnlockJoysticks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3214))());\ + }) + +#define SDL_NewAudioStream(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + const SDL_AudioFormat __t__p0 = __p0;\ + const Uint8 __t__p1 = __p1;\ + const SDL_AudioFormat __t__p2 = __p2;\ + const Uint8 __t__p3 = __p3;\ + const int __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioStream *(*)(const SDL_AudioFormat , const Uint8 , const SDL_AudioFormat , const Uint8 , const int ))*(void**)(__base - 3166))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_AudioStreamPut(__p0, __p1, __p2) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioStream *, const void *, int ))*(void**)(__base - 3172))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_AudioStreamGet(__p0, __p1, __p2) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioStream *, void *, int ))*(void**)(__base - 3178))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_AudioStreamAvailable(__p0) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioStream *))*(void**)(__base - 3184))(__t__p0));\ + }) + +#define SDL_AudioStreamFlush(__p0) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_AudioStream *))*(void**)(__base - 3190))(__t__p0));\ + }) + +#define SDL_AudioStreamClear(__p0) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioStream *))*(void**)(__base - 3196))(__t__p0));\ + }) + +#define SDL_FreeAudioStream(__p0) \ + ({ \ + SDL_AudioStream * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_AudioStream *))*(void**)(__base - 3202))(__t__p0));\ + }) + +#define SDL_GetMemoryFunctions(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_malloc_func * __t__p0 = __p0;\ + SDL_calloc_func * __t__p1 = __p1;\ + SDL_realloc_func * __t__p2 = __p2;\ + SDL_free_func * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_malloc_func *, SDL_calloc_func *, SDL_realloc_func *, SDL_free_func *))*(void**)(__base - 3220))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_SetMemoryFunctions(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_malloc_func __t__p0 = __p0;\ + SDL_calloc_func __t__p1 = __p1;\ + SDL_realloc_func __t__p2 = __p2;\ + SDL_free_func __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_malloc_func , SDL_calloc_func , SDL_realloc_func , SDL_free_func ))*(void**)(__base - 3226))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetNumAllocations() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 3232))());\ + }) + +#define SDL_RenderGetMetalLayer(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_Renderer *))*(void**)(__base - 3238))(__t__p0));\ + }) + +#define SDL_RenderGetMetalCommandEncoder(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_Renderer *))*(void**)(__base - 3244))(__t__p0));\ + }) + +#define SDL_acosf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3250))(__t__p0));\ + }) + +#define SDL_asinf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3256))(__t__p0));\ + }) + +#define SDL_atanf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3262))(__t__p0));\ + }) + +#define SDL_atan2f(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float , float ))*(void**)(__base - 3268))(__t__p0, __t__p1));\ + }) + +#define SDL_ceilf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3274))(__t__p0));\ + }) + +#define SDL_copysignf(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float , float ))*(void**)(__base - 3280))(__t__p0, __t__p1));\ + }) + +#define SDL_fabsf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3286))(__t__p0));\ + }) + +#define SDL_floorf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3292))(__t__p0));\ + }) + +#define SDL_fmod(__p0, __p1) \ + ({ \ + double __t__p0 = __p0;\ + double __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double , double ))*(void**)(__base - 3298))(__t__p0, __t__p1));\ + }) + +#define SDL_fmodf(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float , float ))*(void**)(__base - 3304))(__t__p0, __t__p1));\ + }) + +#define SDL_logf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3310))(__t__p0));\ + }) + +#define SDL_log10(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 3316))(__t__p0));\ + }) + +#define SDL_log10f(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3322))(__t__p0));\ + }) + +#define SDL_powf(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float , float ))*(void**)(__base - 3328))(__t__p0, __t__p1));\ + }) + +#define SDL_scalbnf(__p0, __p1) \ + ({ \ + float __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float , int ))*(void**)(__base - 3334))(__t__p0, __t__p1));\ + }) + +#define SDL_SetYUVConversionMode(__p0) \ + ({ \ + SDL_YUV_CONVERSION_MODE __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_YUV_CONVERSION_MODE ))*(void**)(__base - 3340))(__t__p0));\ + }) + +#define SDL_GetYUVConversionMode() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_YUV_CONVERSION_MODE (*)(void))*(void**)(__base - 3346))());\ + }) + +#define SDL_GetYUVConversionModeForResolution(__p0, __p1) \ + ({ \ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_YUV_CONVERSION_MODE (*)(int , int ))*(void**)(__base - 3352))(__t__p0, __t__p1));\ + }) + +#define SDL_HasAVX512F() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 3358))());\ + }) + +#define SDL_GameControllerMappingForDeviceIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(int ))*(void**)(__base - 3364))(__t__p0));\ + }) + +#define SDL_GameControllerGetPlayerIndex(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *))*(void**)(__base - 3370))(__t__p0));\ + }) + +#define SDL_GameControllerRumble(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + Uint16 __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3376))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_JoystickGetDevicePlayerIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3382))(__t__p0));\ + }) + +#define SDL_JoystickGetPlayerIndex(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 3388))(__t__p0));\ + }) + +#define SDL_JoystickRumble(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + Uint16 __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3394))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_wcsdup(__p0) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((wchar_t *(*)(const wchar_t *))*(void**)(__base - 3400))(__t__p0));\ + }) + +#define SDL_exp(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 3406))(__t__p0));\ + }) + +#define SDL_expf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 3412))(__t__p0));\ + }) + +#define SDL_HasColorKey(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Surface *))*(void**)(__base - 3418))(__t__p0));\ + }) + +#define SDL_IsTablet() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 3424))());\ + }) + +#define SDL_CreateThreadWithStackSize(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_ThreadFunction __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + const size_t __t__p2 = __p2;\ + void * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Thread *(*)(SDL_ThreadFunction , const char *, const size_t , void *))*(void**)(__base - 3430))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GetDisplayOrientation(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_DisplayOrientation (*)(int ))*(void**)(__base - 3436))(__t__p0));\ + }) + +#define SDL_SIMDGetAlignment() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(void))*(void**)(__base - 3442))());\ + }) + +#define SDL_SIMDAlloc(__p0) \ + ({ \ + const size_t __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(const size_t ))*(void**)(__base - 3448))(__t__p0));\ + }) + +#define SDL_SIMDFree(__p0) \ + ({ \ + void * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void *))*(void**)(__base - 3454))(__t__p0));\ + }) + +#define SDL_RenderDrawPointF(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + float __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, float , float ))*(void**)(__base - 3460))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawPointsF(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FPoint * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FPoint *, int ))*(void**)(__base - 3466))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawLineF(__p0, __p1, __p2, __p3, __p4) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + float __t__p1 = __p1;\ + float __t__p2 = __p2;\ + float __t__p3 = __p3;\ + float __t__p4 = __p4;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, float , float , float , float ))*(void**)(__base - 3472))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + }) + +#define SDL_RenderDrawLinesF(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FPoint * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FPoint *, int ))*(void**)(__base - 3478))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderDrawRectF(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FRect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FRect *))*(void**)(__base - 3484))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderDrawRectsF(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FRect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3490))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderFillRectF(__p0, __p1) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FRect * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FRect *))*(void**)(__base - 3496))(__t__p0, __t__p1));\ + }) + +#define SDL_RenderFillRectsF(__p0, __p1, __p2) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + const SDL_FRect * __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3502))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RenderCopyF(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Texture * __t__p1 = __p1;\ + const SDL_Rect * __t__p2 = __p2;\ + const SDL_FRect * __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_Texture *, const SDL_Rect *, const SDL_FRect *))*(void**)(__base - 3508))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_RenderCopyExF(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + SDL_Texture * __t__p1 = __p1;\ + const SDL_Rect * __t__p2 = __p2;\ + const SDL_FRect * __t__p3 = __p3;\ + const double __t__p4 = __p4;\ + const SDL_FPoint * __t__p5 = __p5;\ + const SDL_RendererFlip __t__p6 = __p6;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *, SDL_Texture *, const SDL_Rect *, const SDL_FRect *, const double , const SDL_FPoint *, const SDL_RendererFlip ))*(void**)(__base - 3514))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + }) + +#define SDL_RenderFlush(__p0) \ + ({ \ + SDL_Renderer * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Renderer *))*(void**)(__base - 3520))(__t__p0));\ + }) + +#define SDL_RWsize(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3526))(__t__p0));\ + }) + +#define SDL_RWseek(__p0, __p1, __p2) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + Sint64 __t__p1 = __p1;\ + int __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint64 (*)(SDL_RWops *, Sint64 , int ))*(void**)(__base - 3532))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_RWtell(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3538))(__t__p0));\ + }) + +#define SDL_RWread(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + size_t __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, void *, size_t , size_t ))*(void**)(__base - 3544))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_RWwrite(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + size_t __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(SDL_RWops *, const void *, size_t , size_t ))*(void**)(__base - 3550))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_RWclose(__p0) \ + ({ \ + SDL_RWops * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_RWops *))*(void**)(__base - 3556))(__t__p0));\ + }) + +#define SDL_LoadFile(__p0, __p1) \ + ({ \ + const char * __t__p0 = __p0;\ + size_t * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(const char *, size_t *))*(void**)(__base - 3562))(__t__p0, __t__p1));\ + }) + +#define SDL_GetTouchDeviceType(__p0) \ + ({ \ + SDL_TouchID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_TouchDeviceType (*)(SDL_TouchID ))*(void**)(__base - 3568))(__t__p0));\ + }) + +#define SDL_HasARMSIMD() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 3574))());\ + }) + +#define SDL_GameControllerTypeForIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerType (*)(int ))*(void**)(__base - 3580))(__t__p0));\ + }) + +#define SDL_GameControllerFromPlayerIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameController *(*)(int ))*(void**)(__base - 3586))(__t__p0));\ + }) + +#define SDL_GameControllerGetType(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_GameControllerType (*)(SDL_GameController *))*(void**)(__base - 3592))(__t__p0));\ + }) + +#define SDL_GameControllerSetPlayerIndex(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_GameController *, int ))*(void**)(__base - 3598))(__t__p0, __t__p1));\ + }) + +#define SDL_JoystickFromPlayerIndex(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Joystick *(*)(int ))*(void**)(__base - 3604))(__t__p0));\ + }) + +#define SDL_JoystickSetPlayerIndex(__p0, __p1) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Joystick *(*)(SDL_Joystick *, int ))*(void**)(__base - 3610))(__t__p0, __t__p1));\ + }) + +#define SDL_SetTextureScaleMode(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + SDL_ScaleMode __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, SDL_ScaleMode ))*(void**)(__base - 3616))(__t__p0, __t__p1));\ + }) + +#define SDL_GetTextureScaleMode(__p0, __p1) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + SDL_ScaleMode * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, SDL_ScaleMode *))*(void**)(__base - 3622))(__t__p0, __t__p1));\ + }) + +#define SDL_LockTextureToSurface(__p0, __p1, __p2) \ + ({ \ + SDL_Texture * __t__p0 = __p0;\ + const SDL_Rect * __t__p1 = __p1;\ + SDL_Surface ** __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Texture *, const SDL_Rect *, SDL_Surface **))*(void**)(__base - 3628))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_wcsstr(__p0, __p1) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((wchar_t *(*)(const wchar_t *, const wchar_t *))*(void**)(__base - 3634))(__t__p0, __t__p1));\ + }) + +#define SDL_wcsncmp(__p0, __p1, __p2) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 3640))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_strtokr(__p0, __p1, __p2) \ + ({ \ + char * __t__p0 = __p0;\ + const char * __t__p1 = __p1;\ + char ** __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(char *, const char *, char **))*(void**)(__base - 3646))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_isupper(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3928))(__t__p0));\ + }) + +#define SDL_islower(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3934))(__t__p0));\ + }) + +#define SDL_JoystickAttachVirtual(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_JoystickType __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_JoystickType , int , int , int ))*(void**)(__base - 3940))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_JoystickDetachVirtual(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(int ))*(void**)(__base - 3946))(__t__p0));\ + }) + +#define SDL_JoystickIsVirtual(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(int ))*(void**)(__base - 3952))(__t__p0));\ + }) + +#define SDL_JoystickSetVirtualAxis(__p0, __p1, __p2) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Sint16 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, int , Sint16 ))*(void**)(__base - 3958))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_JoystickSetVirtualButton(__p0, __p1, __p2) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, int , Uint8 ))*(void**)(__base - 3964))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_JoystickSetVirtualHat(__p0, __p1, __p2) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, int , Uint8 ))*(void**)(__base - 3970))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetErrorMsg(__p0, __p1) \ + ({ \ + char * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((char *(*)(char *, int ))*(void**)(__base - 3976))(__t__p0, __t__p1));\ + }) + +#define SDL_LockSensors() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3982))());\ + }) + +#define SDL_UnlockSensors() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3988))());\ + }) + +#define SDL_trunc(__p0) \ + ({ \ + double __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((double (*)(double ))*(void**)(__base - 4006))(__t__p0));\ + }) + +#define SDL_truncf(__p0) \ + ({ \ + float __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((float (*)(float ))*(void**)(__base - 4012))(__t__p0));\ + }) + +#define SDL_Metal_GetLayer(__p0) \ + ({ \ + SDL_MetalView __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(SDL_MetalView ))*(void**)(__base - 3994))(__t__p0));\ + }) + +#define SDL_Metal_GetDrawableSize(__p0, __p1, __p2) \ + ({ \ + SDL_Window * __t__p0 = __p0;\ + int * __t__p1 = __p1;\ + int * __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(SDL_Window *, int *, int *))*(void**)(__base - 4000))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GetPreferredLocales() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Locale *(*)(void))*(void**)(__base - 4018))());\ + }) + +#define SDL_SIMDRealloc(__p0, __p1) \ + ({ \ + void * __t__p0 = __p0;\ + const size_t __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void *(*)(void *, const size_t ))*(void**)(__base - 4024))(__t__p0, __t__p1));\ + }) + +#define SDL_OpenURL(__p0) \ + ({ \ + const char * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *))*(void**)(__base - 4030))(__t__p0));\ + }) + +#define SDL_HasSurfaceRLE(__p0) \ + ({ \ + SDL_Surface * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Surface *))*(void**)(__base - 4036))(__t__p0));\ + }) + +#define SDL_GameControllerHasLED(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *))*(void**)(__base - 4042))(__t__p0));\ + }) + +#define SDL_GameControllerSetLED(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 4048))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_JoystickHasLED(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_Joystick *))*(void**)(__base - 4054))(__t__p0));\ + }) + +#define SDL_JoystickSetLED(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + Uint8 __t__p1 = __p1;\ + Uint8 __t__p2 = __p2;\ + Uint8 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 4060))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GameControllerRumbleTriggers(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + Uint16 __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 4066))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_JoystickRumbleTriggers(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + Uint16 __t__p1 = __p1;\ + Uint16 __t__p2 = __p2;\ + Uint32 __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_Joystick *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 4072))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_GameControllerHasAxis(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerAxis __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *, SDL_GameControllerAxis ))*(void**)(__base - 4078))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerHasButton(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_GameControllerButton __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *, SDL_GameControllerButton ))*(void**)(__base - 4084))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetNumTouchpads(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *))*(void**)(__base - 4090))(__t__p0));\ + }) + +#define SDL_GameControllerGetNumTouchpadFingers(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, int ))*(void**)(__base - 4096))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetTouchpadFinger(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + int __t__p1 = __p1;\ + int __t__p2 = __p2;\ + Uint8 * __t__p3 = __p3;\ + float * __t__p4 = __p4;\ + float * __t__p5 = __p5;\ + float * __t__p6 = __p6;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, int , int , Uint8 *, float *, float *, float *))*(void**)(__base - 4102))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + }) + +#define SDL_GetNumTouchDevices() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(void))*(void**)(__base - 4108))());\ + }) + +#define SDL_GetTouchDevice(__p0) \ + ({ \ + int __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_TouchID (*)(int ))*(void**)(__base - 4114))(__t__p0));\ + }) + +#define SDL_GetNumTouchFingers(__p0) \ + ({ \ + SDL_TouchID __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_TouchID ))*(void**)(__base - 4120))(__t__p0));\ + }) + +#define SDL_GetTouchFinger(__p0, __p1) \ + ({ \ + SDL_TouchID __t__p0 = __p0;\ + int __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Finger *(*)(SDL_TouchID , int ))*(void**)(__base - 4126))(__t__p0, __t__p1));\ + }) + +#define SDL_crc32(__p0, __p1, __p2) \ + ({ \ + Uint32 __t__p0 = __p0;\ + const void * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((Uint32 (*)(Uint32 , const void *, size_t ))*(void**)(__base - 4132))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GameControllerGetSerial(__p0) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_GameController *))*(void**)(__base - 4138))(__t__p0));\ + }) + +#define SDL_JoystickGetSerial(__p0) \ + ({ \ + SDL_Joystick * __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((const char *(*)(SDL_Joystick *))*(void**)(__base - 4144))(__t__p0));\ + }) + +#define SDL_GameControllerHasSensor(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_SensorType __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *, SDL_SensorType ))*(void**)(__base - 4150))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerSetSensorEnabled(__p0, __p1, __p2) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_SensorType __t__p1 = __p1;\ + SDL_bool __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, SDL_SensorType , SDL_bool ))*(void**)(__base - 4156))(__t__p0, __t__p1, __t__p2));\ + }) + +#define SDL_GameControllerIsSensorEnabled(__p0, __p1) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_SensorType __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(SDL_GameController *, SDL_SensorType ))*(void**)(__base - 4162))(__t__p0, __t__p1));\ + }) + +#define SDL_GameControllerGetSensorData(__p0, __p1, __p2, __p3) \ + ({ \ + SDL_GameController * __t__p0 = __p0;\ + SDL_SensorType __t__p1 = __p1;\ + float * __t__p2 = __p2;\ + int __t__p3 = __p3;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(SDL_GameController *, SDL_SensorType , float *, int ))*(void**)(__base - 4168))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_wcscasecmp(__p0, __p1) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const wchar_t *, const wchar_t *))*(void**)(__base - 4174))(__t__p0, __t__p1));\ + }) + +#define SDL_wcsncasecmp(__p0, __p1, __p2) \ + ({ \ + const wchar_t * __t__p0 = __p0;\ + const wchar_t * __t__p1 = __p1;\ + size_t __t__p2 = __p2;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 4180))(__t__p0, __t__p1, __t__p2));\ + }) + +#endif /* !_PPCINLINE_SDL2_H */ diff --git a/src/core/morphos/sdk/proto/sdl2.h b/src/core/morphos/sdk/proto/sdl2.h new file mode 100644 index 0000000000..3299580da2 --- /dev/null +++ b/src/core/morphos/sdk/proto/sdl2.h @@ -0,0 +1,33 @@ +/* Automatically generated header! Do not edit! */ + +#ifndef PROTO_SDL2_H +#define PROTO_SDL2_H + +#ifndef __NOLIBBASE__ +extern struct Library * +#ifdef __CONSTLIBBASEDECL__ +__CONSTLIBBASEDECL__ +#endif /* __CONSTLIBBASEDECL__ */ +SDL2Base; +#endif /* !__NOLIBBASE__ */ + +#include + +#ifdef __GNUC__ +#ifdef __PPC__ +#ifndef _NO_PPCINLINE +#include +#endif /* _NO_PPCINLINE */ +#else +#ifndef _NO_INLINE +#include +#endif /* _NO_INLINE */ +#endif /* __PPC__ */ +#elif defined(__VBCC__) +#include +#else +#include +#endif /* __GNUC__ */ + +#endif /* !PROTO_SDL2_H */ + diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index c27503d2d1..a36a7e96e0 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -63,6 +63,12 @@ #include #include #endif +#ifdef __MORPHOS__ +#include +#include +#include +#include +#endif #if defined(__QNXNTO__) #include @@ -120,7 +126,7 @@ #define CPU_HAS_AVX512F (1 << 12) #define CPU_HAS_ARM_SIMD (1 << 13) -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ +#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__MORPHOS__ /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ @@ -344,6 +350,13 @@ CPU_haveAltiVec(void) IExec->GetCPUInfoTags(GCIT_VectorUnit, &vec_unit, TAG_DONE); altivec = (vec_unit == VECTORTYPE_ALTIVEC); } +#elif defined(__MORPHOS__) + ULONG has_altivec; + if (NewGetSystemAttrs(&has_altivec, sizeof(has_altivec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE)) + { + if(has_altivec) + altivec = 1; + } #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP void (*handler) (int sig); handler = signal(SIGILL, illegal_instruction); @@ -599,6 +612,9 @@ SDL_GetCPUCount(void) &SDL_CPUCount, sizeof(SDL_CPUCount) ); } #endif +#ifdef __MORPHOS__ + NewGetSystemAttrs(&SDL_CPUCount, sizeof(SDL_CPUCount), SYSTEMINFOTYPE_CPUCOUNT, TAG_DONE); +#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -738,6 +754,9 @@ SDL_GetCPUCacheLineSize(void) IExec->GetCPUInfoTags(GCIT_CacheLineSize, &size, TAG_DONE); return size; +#eifdef __MORPHOS__ + extern u_int32_t DataL1LineSize; + return DataL1LineSize; #else /* Just make a guess here... */ return SDL_CACHELINE_SIZE; @@ -961,6 +980,11 @@ SDL_GetSystemRAM(void) } } #endif +#ifdef __MORPHOS__ + if (SDL_SystemRAM <= 0) { + SDL_SystemRAM = AvailMem(MEMF_TOTAL) / (1024 * 1024); + } +#endif #endif } return SDL_SystemRAM; diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index a7d66dfd12..0f0e76b662 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -66,6 +66,28 @@ #include "nacl_io/nacl_io.h" #endif +#ifdef __MORPHOS__ +#include "../core/morphos/SDL_library.h" +#include "../core/morphos/SDL_misc.h" +#include + +#undef SDLCALL +#define SDLCALL __saveds + +/* This function must preserve all registers except r13 */ +asm +("\n" +" .section \".text\"\n" +" .align 2\n" +" .type __restore_r13, @function\n" +"__restore_r13:\n" +" lwz 13, 24(3)\n" +" blr\n" +"__end__restore_r13:\n" +" .size __restore_r13, __end__restore_r13 - __restore_r13\n" +); +#endif + #ifdef __WIN32__ /* Functions to read/write Win32 API file pointers */ @@ -309,7 +331,213 @@ windows_file_close(SDL_RWops * context) } #endif /* __WIN32__ */ -#ifdef HAVE_STDIO_H +#if defined(AMIGA) +static int +amiga_file_open(SDL_RWops *context, const char *filename, const char *mode) +{ + int flag_r, flag_w, flag_p, flag_a; + int rc = -1; + + /* "r" = reading, file must exist */ + /* "w" = writing, truncate existing, file may not exist */ + /* "r+"= reading or writing, file must exist */ + /* "a" = writing, append file may not exist */ + /* "a+"= append + read, file may not exist */ + /* "w+" = read, write, truncate. file may not exist */ + + flag_r = strchr(mode, 'r') ? 1 : 0; + flag_w = strchr(mode, 'w') ? 1 : 0; + flag_p = strchr(mode, '+') ? 1 : 0; + flag_a = strchr(mode, 'a') ? 1 : 0; + + if (flag_r || flag_w || flag_a) + { + size_t mode = MODE_OLDFILE; + BPTR fh; + + if (flag_a) + { + mode = MODE_READWRITE; + } + else if (flag_w) + { + mode = MODE_NEWFILE; + } + + fh = Open(filename, mode); + + context->hidden.amigaio.Writable = (flag_w || flag_a || flag_p) ? 1 : 0; + context->hidden.amigaio.Readable = (flag_r || flag_p) ? 1 : 0; + + context->hidden.amigaio.autoclose = 1; + context->hidden.amigaio.fp.dos = fh; + + if (fh) + { + rc = 0; + + context->hidden.amigaio.AppendMode = 0; + context->hidden.amigaio.NoSeek = 0; + context->hidden.amigaio.IsAtEnd = 0; + + if (flag_a) + { + context->hidden.amigaio.AppendMode = 1; + + if (!flag_p) + { + context->hidden.amigaio.NoSeek = 1; + context->hidden.amigaio.IsAtEnd = 1; + Seek(fh, 0, OFFSET_END); + } + } + } + } + + return rc; +} + +static Sint64 SDLCALL +amiga_file_size(SDL_RWops * context) +{ + struct FileInfoBlock fib; + + if (ExamineFH64(context->hidden.amigaio.fp.dos, &fib, TAG_DONE)) + return fib.fib_Size64; + + return -1; +} + +static Sint64 SDLCALL +amiga_file_seek(SDL_RWops *context, Sint64 offset, int whence) +{ + Sint64 rc = -1; + + if (!context->hidden.amigaio.NoSeek) + { + LONG how = OFFSET_BEGINNING; + + switch (whence) + { + case RW_SEEK_SET: how = OFFSET_BEGINNING; break; + case RW_SEEK_CUR: how = OFFSET_CURRENT; break; + case RW_SEEK_END: how = OFFSET_END; break; + + default: return SDL_SetError("Unknown value for 'whence'"); + } + + context->hidden.amigaio.IsAtEnd = 0; + + if (Seek64(context->hidden.amigaio.fp.dos, offset, how) == -1) + { + SDL_Error(SDL_EFSEEK); + } + else + { + if (how == OFFSET_END && offset == 0) + context->hidden.amigaio.IsAtEnd = 1; + + rc = Seek64(context->hidden.amigaio.fp.dos, 0, OFFSET_CURRENT); + } + } + + return rc; +} + +static size_t SDLCALL +amiga_file_read(SDL_RWops *context, void *ptr, size_t size, size_t maxnum) +{ + size_t rsize = size * maxnum, result; + //D("[%s]\n", __FUNCTION__); + + if (context->hidden.amigaio.Readable) + { + if ((result = Read(context->hidden.amigaio.fp.dos, ptr, rsize)) != rsize) + { + SDL_Error(SDL_EFWRITE); + } + } + else + { + result = 0; + } + + return result / size; +} + +static size_t SDLCALL +amiga_file_write(SDL_RWops *context, const void *ptr, size_t size, size_t num) +{ + size_t wnum = 0; + //D("[%s]\n", __FUNCTION__); + + if (context->hidden.amigaio.Writable) + { + size_t wsize, result; + + if (context->hidden.amigaio.AppendMode && !context->hidden.amigaio.IsAtEnd) + { + if (Seek(context->hidden.amigaio.fp.dos, 0, OFFSET_END) == -1) + { + SDL_Error(SDL_EFWRITE); + return 0; + } + + context->hidden.amigaio.IsAtEnd = 1; + } + + wsize = size * num; + + if ((result = Write(context->hidden.amigaio.fp.dos, (APTR)ptr, wsize)) != wsize) + { + SDL_Error(SDL_EFWRITE); + } + + wnum = result / size; + } + + return wnum; +} + +static int SDLCALL +amiga_file_close(SDL_RWops *context) +{ + if (context->hidden.amigaio.fp.dos != 0) + { + if (context->hidden.amigaio.autoclose) + Close(context->hidden.amigaio.fp.dos); + + SDL_FreeRW(context); + } + + return(0); +} + +SDL_RWops * SDL_RWFromFP_clib_REAL(void *fp, + int autoclose, + Sint64 (*size)(struct SDL_RWops *), + Sint64 (*seek)(struct SDL_RWops *, Sint64, int), + size_t (*read)(struct SDL_RWops *, void *, size_t, size_t), + size_t (*write)(struct SDL_RWops *, const void *, size_t, size_t), + int (*close)(struct SDL_RWops *)) +{ + SDL_RWops *rwops; + D("[%s]\n", __FUNCTION__); + + rwops = SDL_AllocRW(); + if ( rwops != NULL ) { + rwops->size = size; + rwops->seek = seek; + rwops->read = read; + rwops->write = write; + rwops->close = close; + rwops->type = SDL_RWOPS_STDFILE; + rwops->hidden.amigaio.fp.libc = fp; + rwops->hidden.amigaio.autoclose = autoclose; + } + return(rwops); +} +#elif defined(HAVE_STDIO_H) #ifdef HAVE_FOPEN64 #define fopen fopen64 @@ -599,7 +827,33 @@ SDL_RWFromFile(const char *file, const char *mode) rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; + +#elif defined(__MORPHOS__) + rwops = SDL_AllocRW(); + if (!rwops) + return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ + + rwops->size = amiga_file_size; + rwops->seek = amiga_file_seek; + rwops->read = amiga_file_read; + rwops->write = amiga_file_write; + rwops->close = amiga_file_close; + rwops->type = SDL_RWOPS_AMIGAFILE; + char *mpath = AMIGA_ConvertPath(file); + int rc = -1; + + if (mpath) + { + rc = amiga_file_open(rwops,file,mode); + SDL_free(mpath); + } + + if (rc < 0) + { + SDL_FreeRW(rwops); + return NULL; + } #elif HAVE_STDIO_H { #ifdef __APPLE__ @@ -623,7 +877,7 @@ SDL_RWFromFile(const char *file, const char *mode) return rwops; } -#ifdef HAVE_STDIO_H +#if defined(HAVE_STDIO_H) && !defined(__MORPHOS__) SDL_RWops * SDL_RWFromFP(FILE * fp, SDL_bool autoclose) { @@ -716,6 +970,11 @@ SDL_AllocRW(void) if (area == NULL) { SDL_OutOfMemory(); } else { + #if defined(__MORPHOS__) + register APTR DataSeg __asm("r13"); + + area->r13 = DataSeg; + #endif area->type = SDL_RWOPS_UNKNOWN; } return area; diff --git a/src/filesystem/amiga/SDL_sysfilesystem.c b/src/filesystem/amiga/SDL_sysfilesystem.c new file mode 100644 index 0000000000..74b3424646 --- /dev/null +++ b/src/filesystem/amiga/SDL_sysfilesystem.c @@ -0,0 +1,141 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_AMIGA + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* System dependent filesystem routines */ + +#include "SDL_error.h" +#include "SDL_filesystem.h" + +#include "../../core/morphos/SDL_misc.h" + +#include +#include + +char * +SDL_GetBasePath(void) +{ + BPTR lock = Lock("PROGDIR:", ACCESS_READ); + char *path = NULL; + + D("[%s]\n", __FUNCTION__); + + if (lock) + { + size_t len = 128; + + for (;;) + { + char *tmp = SDL_malloc(len); + + if (NameFromLock(lock, tmp, len)) + { + path = AMIGA_ConvertText(tmp, MIBENUM_SYSTEM, MIBENUM_UTF_8); + SDL_free(tmp); + break; + } + + SDL_free(tmp); + + len *= 2; + + if (IoErr() != ERROR_LINE_TOO_LONG) + break; + } + + UnLock(lock); + } + + return path; +} + +static char * +SDL_RemoveInvalidChars(const char *src) +{ + char *s = SDL_strdup(src); + char *p = s; + + if (s) + { + char c; + + while ((c = *p)) + { + if (c == '/' || c == ':') + *p = ' '; + + p++; + } + } + + return s; +} + +char * +SDL_GetPrefPath(const char *org, const char *app) +{ + char *p1 = SDL_RemoveInvalidChars(org); + char *path = NULL; + + if (p1) + { + char *p2 = SDL_RemoveInvalidChars(app); + + if (p2) + { + int len = sizeof("ENVARC:") + strlen(p1) + strlen(p2) + 8; + char *tmp = SDL_malloc(len); + + if (tmp) + { + BPTR lock; + + strcpy(tmp, "ENVARC:"); + AddPart(tmp, p1, len); + + if ((lock = CreateDir(tmp))) + UnLock(lock); + + AddPart(tmp, p2, len); + + if ((lock = CreateDir(tmp))) + UnLock(lock); + + path = AMIGA_ConvertText(tmp, MIBENUM_SYSTEM, MIBENUM_UTF_8); + + SDL_free(tmp); + } + + SDL_free(p2); + } + + SDL_free(p1); + } + + return path; +} + +#endif /* SDL_FILESYSTEM_AMIGA */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 7c2907b1f4..d408e94f0b 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -862,6 +862,9 @@ static const char *s_ControllerMappings [] = "4c6f6769746563682052756d626c6550,Logitech RumblePad 2 USB,platform:AmigaOS 4,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", "4c6f6769746563682852292050726563,Logitech(R) Precision(TM) Gamepad,platform:AmigaOS 4,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,lefttrigger:b6,righttrigger:b7,", #endif +#if defined(__MORPHOS__) + "030000004c050000c405000000000000,PlayStation 4 Dualshock Controller,platform:MorphOS,a:b6,b:b7,x:b4,y:b5,back:b3,start:b2,leftstick:b8,rightstick:b9,leftshoulder:b0,rightshoulder:b1,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:+a4,righttrigger:+a5,", +#endif NULL }; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index dfcec876b6..8723131907 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -89,6 +89,12 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #if defined(SDL_JOYSTICK_AMIGAINPUT) &SDL_AMIGAINPUT_JoystickDriver, #endif +#ifdef SDL_JOYSTICK_MORPHOS + &SDL_MORPHOS_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_AMIGA + &SDL_AMIGA_JoystickDriver, +#endif #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) &SDL_DUMMY_JoystickDriver #endif @@ -870,7 +876,11 @@ SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h /* Just update the expiration */ result = 0; } else { + #ifdef __MORPHOS__ + result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); + #else result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); + #endif } /* Save the rumble value regardless of success, so we don't spam the driver */ @@ -1613,10 +1623,18 @@ void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *prod /* guid16[6] is product version */ ) { if (vendor) { + #ifdef __MORPHOS__ + *vendor = SDL_SwapLE16(guid16[2]); + #else *vendor = guid16[2]; + #endif } if (product) { + #ifdef __MORPHOS__ + *product = SDL_SwapLE16(guid16[4]); + #else *product = guid16[4]; + #endif } if (version) { *version = guid16[6]; diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index f95eb65fa3..5014f6fe12 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -159,8 +159,12 @@ typedef struct _SDL_JoystickDriver int (*Open)(SDL_Joystick *joystick, int device_index); /* Rumble functionality */ - int (*Rumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); - int (*RumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble); + #ifdef __MORPHOS__ + int (*Rumble)(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + #else + int (*Rumble)(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); + #endif + int (*RumbleTriggers)(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble); /* LED functionality */ SDL_bool (*HasLED)(SDL_Joystick *joystick); @@ -205,6 +209,8 @@ extern SDL_JoystickDriver SDL_LINUX_JoystickDriver; extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; extern SDL_JoystickDriver SDL_WGI_JoystickDriver; extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver; +extern SDL_JoystickDriver SDL_MORPHOS_JoystickDriver; +extern SDL_JoystickDriver SDL_AMIGA_JoystickDriver; #endif /* SDL_sysjoystick_h_ */ diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c new file mode 100644 index 0000000000..cde48a3f23 --- /dev/null +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -0,0 +1,480 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_AMIGA + +#include "SDL_joystick.h" +#include "SDL_timer.h" +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" + +#define USE_INLINE_STDARG +#include +#ifndef NO_LOWLEVEL_EXT +#include +#endif + +#include +#include +#include +#include + +#include "SDL_events.h" + +/* The maximum number of joysticks we'll detect */ +#define MAX_JOYSTICKS 4 /* lowlevel.library is limited to 4 ports */ + +static const ULONG joybut[] = +{ + JPF_BUTTON_RED, + JPF_BUTTON_BLUE, + JPF_BUTTON_GREEN, + JPF_BUTTON_YELLOW, + JPF_BUTTON_PLAY, + JPF_BUTTON_FORWARD, + JPF_BUTTON_REVERSE +}; + +struct joystick_hwdata +{ + ULONG joystate; +#ifndef NO_LOWLEVEL_EXT + ULONG joystate_ext; + ULONG supports_analog; +#endif +}; + +static int PortIndex(int index) +{ + switch(index) + { + case 0: + return 1; + break; + case 1: + return 0; + break; + default: + break; + } + return index; +} + +#define MAX_JOY_NAME 64 +static char SDL_JoyNames[MAX_JOYSTICKS * MAX_JOY_NAME]; + +static Uint8 SDL_numjoysticks = 0; + +static int SDL_SYS_JoystickGetCount(void) +{ + D("[%s]\n", __FUNCTION__); + return SDL_numjoysticks; +} + +static void SDL_SYS_JoystickDetect() +{ + //D("[%s]\n", __FUNCTION__); +} + +static int SDL_SYS_JoystickInit(void) +{ + int numjoysticks = 0; + ULONG joyflag = 0; + + D("[%s]\n", __FUNCTION__); + + if (SDL_numjoysticks == 0) + { + if(LowLevelBase) { + CloseLibrary(LowLevelBase); + LowLevelBase = NULL; + } + + if ((LowLevelBase = OpenLibrary("lowlevel.library",37))) + { + numjoysticks = 0; + + while (numjoysticks < MAX_JOYSTICKS) + { + int index = PortIndex(numjoysticks); + joyflag = ReadJoyPort(index); + + if((joyflag&JP_TYPE_MASK) == JP_TYPE_NOTAVAIL) + { + break; + } + + numjoysticks++; + } + + SDL_numjoysticks = numjoysticks; + return numjoysticks; + } + else + { + /* failed to open lowlevel.library! */ + SDL_SetError("Unable to open lowlevel.library"); + return 0; + } + } + else + { + return SDL_numjoysticks; + } +} + +static const char *SDL_SYS_JoystickGetDeviceName(int device_index) +{ + const char *name = NULL; + + D("[%s] device_index %d\n", __FUNCTION__, device_index); + + if (LowLevelBase && device_index < MAX_JOYSTICKS) + { + ULONG joyflag; + + joyflag = ReadJoyPort(PortIndex(device_index)); + + if (!(joyflag&JP_TYPE_MASK) == JP_TYPE_NOTAVAIL) + { + const char *type; + + switch (joyflag & JP_TYPE_MASK) + { + case JP_TYPE_GAMECTLR: + type ="a Game Controller"; + break; + + case JP_TYPE_MOUSE: + type ="a Mouse"; + break; + + case JP_TYPE_JOYSTK: + type ="a Joystick"; + break; + + default: + case JP_TYPE_UNKNOWN: + type ="an unknown device"; + break; + } + + name = &SDL_JoyNames[device_index * MAX_JOY_NAME]; + + NewRawDoFmt("Port %ld is %s", NULL, (STRPTR)name, device_index, type); + } + } + else + { + SDL_SetError("No joystick available with that index"); + } + + return name; +} + + +static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +{ + ULONG temp; + + D("[%s] joystick 0x%08lx device_index %d\n", __FUNCTION__, joystick, device_index); + + if(!LowLevelBase) + { + if(SDL_SYS_JoystickInit() < 1) + { + SDL_SetError("Initialize Joysticks first!"); + return -1; + } + } + + joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata)); + + if ( joystick->hwdata == NULL ) + { + SDL_OutOfMemory(); + return -1; + } + + SetJoyPortAttrs(PortIndex(joystick->instance_id), SJA_Type, SJA_TYPE_GAMECTLR, TAG_END); + + temp = ReadJoyPort(PortIndex(joystick->instance_id)); + + if((temp & JP_TYPE_MASK)==JP_TYPE_GAMECTLR) + { + joystick->nbuttons = 7; + joystick->nhats = 1; + } + else if((temp & JP_TYPE_MASK) == JP_TYPE_JOYSTK) + { + joystick->nbuttons = 3; + joystick->nhats = 1; + } + else if((temp & JP_TYPE_MASK) == JP_TYPE_MOUSE) + { + joystick->nbuttons = 3; + joystick->nhats = 0; + } + else if((temp & JP_TYPE_MASK) == JP_TYPE_UNKNOWN) + { + joystick->nbuttons = 3; + joystick->nhats = 1; + } + else if((temp & JP_TYPE_MASK) == JP_TYPE_NOTAVAIL) + { + joystick->nbuttons = 0; + joystick->nhats = 0; + } else { + // Default, same as + joystick->nbuttons = 3; + joystick->nhats = 1; + } + + joystick->nballs = 0; + joystick->naxes = 0; + joystick->hwdata->joystate = 0L; +#ifndef NO_LOWLEVEL_EXT + joystick->hwdata->joystate_ext = 0L; + joystick->hwdata->supports_analog = 0; + + if (LowLevelBase->lib_Version > 50 || (LowLevelBase->lib_Version >= 50 && LowLevelBase->lib_Revision >= 17)) { + joystick->hwdata->supports_analog = 1; + joystick->naxes = 2; + } +#endif + + return 0; +} + + +static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) +{ + ULONG data; +#ifndef NO_LOWLEVEL_EXT + ULONG data_ext = 0; +#endif + int i, index; + + /*if(!LowLevelBase) + { + if(SDL_JoystickInit() < 1) + { + D("Initialize Joysticks first!\n"); + return; + } + }*/ + + index = PortIndex(joystick->instance_id); + + data = ReadJoyPort(index); +#ifndef NO_LOWLEVEL_EXT + if (joystick->hwdata->supports_analog) + data_ext = ReadJoyPort(index + JP_ANALOGUE_PORT_MAGIC); +#endif + + //D("[%s] joystick 0x%08lx index %d data 0x%08lx data_ext 0x%08lx\n", __FUNCTION__, joystick, index, data, data_ext); + + /* only send an event when something changed */ + + /* hats */ + if((joystick->hwdata->joystate & JP_DIRECTION_MASK) != (data & JP_DIRECTION_MASK)) + { + if(joystick->nhats) + { + Uint8 value_hat = SDL_HAT_CENTERED; + + if(data & JPF_JOY_DOWN) + { + value_hat |= SDL_HAT_DOWN; + } + else if(data & JPF_JOY_UP) + { + value_hat |= SDL_HAT_UP; + } + + if(data & JPF_JOY_LEFT) + { + value_hat |= SDL_HAT_LEFT; + } + else if(data & JPF_JOY_RIGHT) + { + value_hat |= SDL_HAT_RIGHT; + } + + SDL_PrivateJoystickHat(joystick, 0, value_hat); + } + } + + /* axes */ +#ifndef NO_LOWLEVEL_EXT + if (joystick->hwdata->supports_analog && data_ext & JP_TYPE_ANALOGUE) + { + if((joystick->hwdata->joystate_ext & JP_XAXIS_MASK) != (data_ext & JP_XAXIS_MASK)) + { + Sint16 value; + + value = (data_ext & JP_XAXIS_MASK) * 2*32767 / 255 - 32767; + SDL_PrivateJoystickAxis(joystick, 0, value); + } + + if((joystick->hwdata->joystate_ext & JP_YAXIS_MASK) != (data_ext & JP_YAXIS_MASK)) + { + Sint16 value; + + value = ((data_ext & JP_YAXIS_MASK)>>8) * 2*32767 / 255 - 32767; + SDL_PrivateJoystickAxis(joystick, 1, value); + } + } +#endif + + /* Joy buttons */ + for(i = 0; i < joystick->nbuttons; i++) + { + if( (data & joybut[i]) ) + { + /* + if(i == 1) + { + data &= ~(joybut[2]); + } + */ + + if(!(joystick->hwdata->joystate & joybut[i])) + { + SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED); + } + } + else if(joystick->hwdata->joystate & joybut[i]) + { + SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED); + } + } + + joystick->hwdata->joystate = data; +#ifndef NO_LOWLEVEL_EXT + joystick->hwdata->joystate_ext = data_ext; +#endif +} + +static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) +{ + D("[%s] joystick 0x%08lx\n", __FUNCTION__, joystick); + + if(LowLevelBase) /* ne to reinitialize */ + { + //int index = PortIndex(joystick->instance_id); + //SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); + } + + if(joystick->hwdata) + { + SDL_free(joystick->hwdata); + } + + return; +} + +/* Function to perform any system-specific joystick related cleanup */ +static void SDL_SYS_JoystickQuit(void) +{ + D("[%s]\n", __FUNCTION__); + + if(LowLevelBase) + { + CloseLibrary(LowLevelBase); + LowLevelBase = NULL; + } + + return; +} + +static int SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) +{ + D("[%s] device_index %d\n", __FUNCTION__, device_index); + + return device_index; +} + +static void SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) +{ + D("[%s] Not implemented\n", __FUNCTION__); +} + +static SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index) +{ + D("[%s] device_index %d\n", __FUNCTION__, device_index); + + SDL_JoystickGUID guid; + const char *name = SDL_SYS_JoystickGetDeviceName(device_index); + SDL_zero(guid); + SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name))); + return guid; +} + +static SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) +{ + D("[%s] device_index %d\n", __FUNCTION__, device_index); + return device_index; +} + +static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + D("[%s] joystick 0x%08lx low %d high %d\n", __FUNCTION__, joystick, low_frequency_rumble, high_frequency_rumble); + + if (!LowLevelBase) { + return SDL_Unsupported(); + } + +#ifndef NO_LOWLEVEL_EXT + if (joystick) { + int index = PortIndex(joystick->instance_id); + + if (low_frequency_rumble > 0 || high_frequency_rumble > 0) { + SetJoyPortAttrs(index, SJA_RumbleSetSlowMotor, low_frequency_rumble >> 8, SJA_RumbleSetFastMotor, low_frequency_rumble >> 8, TAG_END); + } else { + SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); + } + } +#endif + + return 0; +} + +SDL_JoystickDriver SDL_AMIGA_JoystickDriver = +{ + SDL_SYS_JoystickInit, + SDL_SYS_JoystickGetCount, + SDL_SYS_JoystickDetect, + SDL_SYS_JoystickGetDeviceName, + SDL_SYS_JoystickGetDevicePlayerIndex, + SDL_SYS_JoystickSetDevicePlayerIndex, + SDL_SYS_JoystickGetDeviceGUID, + SDL_SYS_JoystickGetDeviceInstanceID, + SDL_SYS_JoystickOpen, + SDL_SYS_JoystickRumble, + SDL_SYS_JoystickUpdate, + SDL_SYS_JoystickClose, + SDL_SYS_JoystickQuit, +}; + +#endif diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c new file mode 100644 index 0000000000..f16b7a794a --- /dev/null +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -0,0 +1,528 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_sysjoystick_c.h" + +#ifdef SDL_JOYSTICK_MORPHOS + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" +#include "SDL_endian.h" +#include "SDL_joystick.h" + +#include +#include +#include +#include +#include +#define USE_INLINE_STDARG +#include +#undef USE_INLINE_STDARG +#include +#include + +// SDL2 deadzone is around 409, we need 1638 +#define DEADZONE_MIN (-0.05) +#define DEADZONE_MAX (0.05) + +#define JOYSTICK_MIN -1.0 +#define JOYSTICK_MAX 1.0 + +#define CLAMP(val) \ + (((val) <= (DEADZONE_MAX) && (val) >= (DEADZONE_MIN)) ? (0) : \ + ((val) > (JOYSTICK_MAX)) ? (JOYSTICK_MAX) : (((val) < (JOYSTICK_MIN)) ? (JOYSTICK_MIN) : (val))) +//#define HOT_PLUG +#define MAX_JOYSTICKS 32 + +APTR sensorlist; +APTR JoySensor[MAX_JOYSTICKS]; +int joystick_count; + +static int SDL_SYS_JoystickGetCount(void) +{ + return joystick_count; +} + +/* Function to scan the system for joysticks. + * It should return 0, or -1 on an unrecoverable fatal error. + */ +static int +SDL_SYS_JoystickInit(void) +{ + int rc = -1; + + APTR sensor = NULL; + ULONG count = 0; + + D("[%s] Obtain sensor list...\n", __FUNCTION__); + sensorlist = ObtainSensorsListTags(SENSORS_Class, SensorClass_HID, /*SENSORS_Type, SensorType_HID_Gamepad,*/ TAG_DONE); + while ((sensor = NextSensor(sensor, sensorlist, NULL)) && count < MAX_JOYSTICKS) + { + JoySensor[count++] = sensor; + } + + D("[%s] Found %ld joysticks...\n", __FUNCTION__, count); + joystick_count = count; + rc = count; + return rc; +} + +static void +SDL_SYS_JoystickDetect(void) +{ +} + +/* Function to get the device-dependent name of a joystick */ +static const char * +SDL_SYS_JoystickGetDeviceName(int device_index) +{ + APTR sensor = JoySensor[device_index]; + const char *name = NULL; + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + return name; +} + +/* Function to perform the mapping from device index to the instance id for this index */ +static +SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) +{ + return device_index; +} + +/* Function to sort Sensors */ +/*static int +SortSensorFunc(const void *a, const void *b) +{ + LONG ida = 0; + LONG idb = 0; + GetSensorAttrTags((APTR)a, SENSORS_HIDInput_ID, (IPTR)&ida, TAG_DONE); + GetSensorAttrTags((APTR)b, SENSORS_HIDInput_ID, (IPTR)&idb, TAG_DONE); + if (ida < idb) + return -1; + if (ida > idb) + return 1; + return 0; +}*/ + +/* Function to open a joystick for use. + The joystick to open is specified by the index field of the joystick. + This should fill the nbuttons and naxes fields of the joystick structure. + It returns 0, or -1 if there is an error. + */ +static int +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +{ + D("[%s]\n", __FUNCTION__); + APTR sensor = JoySensor[device_index]; + int rc = -1; + + if (sensor) { + size_t buttons = 0, naxes = 0, nhats = 0, nsticks = 0, nrumbles=0; + CONST_STRPTR name = ""; + //ULONG id; + struct joystick_hwdata *hwdata = SDL_calloc(1, sizeof(*hwdata)); + + hwdata->main_sensor = sensor; + + hwdata->child_sensors = ObtainSensorsListTags( + SENSORS_Parent, (IPTR)hwdata->main_sensor, + SENSORS_Class, SensorClass_HID, + TAG_DONE); + + sensor = NULL; + while ((sensor = NextSensor(sensor, hwdata->child_sensors, NULL))) { + ULONG type = SensorType_HIDInput_Unknown, Limb, color; + /*GetSensorAttrTags(sensor, + SENSORS_HIDInput_ID, (IPTR)&id, + SENSORS_HIDInput_Name, (IPTR)&name, + SENSORS_HIDInput_Limb, (IPTR)&Limb, + SENSORS_HIDInput_Color, (IPTR)&color, + TAG_DONE); + D("[%s] sensor id: %d name: %s Limb:%d LimbName:%s color:%d\n", __FUNCTION__, id, name, Limb, color); */ + + if (GetSensorAttrTags(sensor, SENSORS_Type, (IPTR)&type, TAG_DONE)) { + switch (type) { + case SensorType_HIDInput_Trigger: + if (buttons < MAX_BUTTONS) { + hwdata->button[buttons++] = sensor; + } + break; + case SensorType_HIDInput_Stick: + if (nhats < MAX_HATS) { + hwdata->hat[nhats++] = sensor; + } + break; + case SensorType_HIDInput_Analog: + case SensorType_HIDInput_AnalogStick: + case SensorType_HIDInput_3DStick: + if (nsticks < MAX_STICKS) { + hwdata->stick[nsticks] = sensor; + hwdata->stickType[nsticks] = type; + nsticks++; + if (type == SensorType_HIDInput_AnalogStick) + naxes += 2; + else if (type == SensorType_HIDInput_3DStick) + naxes += 4; + else + naxes++; + } + break; + case SensorType_HIDInput_Rumble: + if (nrumbles < MAX_RUMBLE) { + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Rumble SensorName: %s\n", __FUNCTION__, name); + hwdata->rumble[nrumbles] = sensor; + nrumbles++; + } + break; + case SensorType_HIDInput_Battery: + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Battery SensorName: %s\n", __FUNCTION__, name); + // Force "Xbox360 Controller" (WIRED) to use SDL_JOYSTICK_POWER_WIRED + if (strcmp((const char *)SDL_SYS_JoystickGetDeviceName(device_index),(const char *)"Xbox360 Controller") == 0) { + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); + hwdata->battery = NULL; + } else { + hwdata->battery = sensor; + } + break; + case SensorType_HIDInput_Knob: + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Knob SensorType: %d\n", __FUNCTION__, name); + break; + case SensorType_HIDInput_Wheel: + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Wheel SensorType: %d\n", __FUNCTION__, name); + break; + default: + D("[%s] unknown SensorType: %d\n", __FUNCTION__, type); + continue; + } + } + } + +#ifdef HOT_PLUG + if ((hwdata->notifyPort = CreateMsgPort())) { + hwdata->sensorsNotify = StartSensorNotifyTags(sensor, + SENSORS_Notification_Destination, (IPTR)hwdata->notifyPort, + SENSORS_Notification_UserData, (IPTR)SDL_SYS_JoystickGetDeviceInstanceID(device_index), + SENSORS_Notification_Removed, TRUE, + TAG_DONE); + } +#endif + + joystick->naxes = naxes; + joystick->nhats = nhats; + joystick->nbuttons = buttons; + //SDL_qsort(hwdata->button, joystick->nbuttons, sizeof(APTR), SortSensorFunc); + hwdata->numSticks = nsticks; + hwdata->numRumbles = nrumbles; + joystick->hwdata = hwdata; + joystick->name = (char *)SDL_SYS_JoystickGetDeviceName(device_index); + rc = 0; + } + return rc; +} + +static void +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + int i, j; + Sint16 sval; + double btn_value, bt_value, x_value, y_value, z_value, ns_value, ew_value, z_rotation; + + for (i = 0; i < joystick->nbuttons; i++) { + GetSensorAttrTags(hwdata->button[i], SENSORS_HIDInput_Value, (IPTR)&btn_value, TAG_DONE); + if ((joystick->buttons[i] && btn_value == 0.0) || (joystick->buttons[i] == 0 && btn_value > 0.0)) { + SDL_PrivateJoystickButton(joystick, i, btn_value == 0.0 ? 0 : 1); + } + } + + for (i = 0; i < joystick->nhats; i++) { + GetSensorAttrTags(hwdata->hat[i], + SENSORS_HIDInput_EW_Value, (IPTR)&ew_value, + SENSORS_HIDInput_NS_Value, (IPTR)&ns_value, + TAG_DONE); + Uint8 value_hat = SDL_HAT_CENTERED; + if (ns_value >= 1.0) { + value_hat |= SDL_HAT_DOWN; + } else if (ns_value <= -1.0) { + value_hat |= SDL_HAT_UP; + } + if (ew_value >= 1.0) { + value_hat |= SDL_HAT_RIGHT; + } else if (ew_value <= -1.0) { + value_hat |= SDL_HAT_LEFT; + } + SDL_PrivateJoystickHat(joystick, i, value_hat); + } + + j = 0; + for (i = 0; i < hwdata->numSticks; i++) { + switch (hwdata->stickType[i]) { + case SensorType_HIDInput_3DStick: + GetSensorAttrTags(hwdata->stick[i], + SENSORS_HIDInput_X_Index, (IPTR)&x_value, + SENSORS_HIDInput_Y_Index, (IPTR)&y_value, + SENSORS_HIDInput_Z_Index, (IPTR)&z_value, + SENSORS_HIDInput_Z_Rotation, (IPTR)&z_rotation, + TAG_DONE); + + sval = (Sint16)(CLAMP(x_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); + + sval = (Sint16)(CLAMP(y_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); + + sval = (Sint16)(CLAMP(z_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+2, sval); + + sval = (Sint16)(CLAMP(z_rotation) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+3, sval); + + j += 4; + break; + + case SensorType_HIDInput_Analog: + GetSensorAttrTags(hwdata->stick[i], SENSORS_HIDInput_Value, (IPTR)&btn_value, TAG_DONE); + + sval = (Sint16)(btn_value * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); + + j++; + break; + + case SensorType_HIDInput_AnalogStick: + GetSensorAttrTags(hwdata->stick[i], + SENSORS_HIDInput_EW_Value, (IPTR)&ew_value, + SENSORS_HIDInput_NS_Value, (IPTR)&ns_value, + TAG_DONE); + + sval = (Sint16)(CLAMP(ew_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); + + sval = (Sint16)(CLAMP(ns_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); + + j += 2; + break; + } + } + + if (hwdata->battery) { + SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; + GetSensorAttrTags(hwdata->battery, + SENSORS_HIDInput_Value, (IPTR)&bt_value, + TAG_DONE); + ULONG level = bt_value*100; + switch (level) + { + case 0 ... 5: + ePowerLevel = SDL_JOYSTICK_POWER_EMPTY; + break; + case 6 ... 20: + ePowerLevel = SDL_JOYSTICK_POWER_LOW; + break; + case 21 ... 70: + ePowerLevel = SDL_JOYSTICK_POWER_MEDIUM; + break; + case 71 ... 100: + ePowerLevel = SDL_JOYSTICK_POWER_FULL; + break; + } + SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel); + } + +#ifdef HOT_PLUG + if (hwdata->notifyPort) { + struct SensorsNotificationMessage *notifyMsg; + while ((notifyMsg = (struct SensorsNotificationMessage *)GetMsg(hwdata->notifyPort))) { + if (GetTagData(SENSORS_Notification_Removed, FALSE, notifyMsg->Notifications)) { + SDL_PrivateJoystickRemoved((SDL_JoystickID)notifyMsg->UserData); + } + ReplyMsg(notifyMsg); + } + } +#endif +} + +/* Function to close a joystick after use */ +void +SDL_SYS_JoystickClose(SDL_Joystick * joystick) +{ + D("[%s]\n", __FUNCTION__); + struct joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata) { +#ifdef HOT_PLUG + if (hwdata->sensorsNotify) { + EndSensorNotify(hwdata->sensorsNotify, NULL); + } + if (hwdata->notifyPort) { + struct Message *notifyMsg; + while ((notifyMsg = GetMsg(hwdata->notifyPort))) + ReplyMsg(notifyMsg); + DeleteMsgPort(hwdata->notifyPort); + } +#endif + ReleaseSensorsList(hwdata->child_sensors, NULL); + SDL_free(hwdata); + joystick->hwdata = NULL; + } +} + +/* Function to perform any system-specific joystick related cleanup */ +static void +SDL_SYS_JoystickQuit(void) +{ + D("[%s]\n", __FUNCTION__); + if (sensorlist) + ReleaseSensorsList(sensorlist, NULL); +} + +static SDL_JoystickGUID +SDL_SYS_JoystickGetDeviceGUID( int device_index ) +{ + SDL_JoystickGUID guid; + APTR sensor = JoySensor[device_index]; + Uint16 *guid16 = (Uint16 *)guid.data; + const char *name = NULL; + + ULONG product, vendor; + + GetSensorAttrTags(sensor, + SENSORS_HID_Name, (IPTR)&name, + SENSORS_HID_Product, (IPTR)&product, + SENSORS_HID_Vendor, (IPTR)&vendor, + TAG_DONE); + + SDL_zero(guid); + SDL_memset(guid.data, 0, sizeof(guid.data)); + + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB); + *guid16++ = 0; + + if (vendor && product) { + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = 0; + *guid16++ = 0; + } else { + SDL_strlcpy((char*)guid16, name, sizeof(guid.data) - 4); + } + + return guid; +} + +/* + Rumble experimental + Add duration in function, impossible to stop rumble in progress, so SDL2 can't stop it +*/ +static int +SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata) { + if (hwdata->numRumbles) { + DOUBLE lpower=(DOUBLE)(low_frequency_rumble/65535), hpower=(DOUBLE)(high_frequency_rumble/65535); + ULONG duration = duration_ms; + if (duration != 0 && (lpower > 0.0 || hpower > 0.0)) { + D("[%s] SetSensorAttrTags lpower=%f - hpower=%f - duration=%d\n", __FUNCTION__,lpower, hpower, duration); + SetSensorAttrTags(hwdata->rumble[0], + SENSORS_HIDInput_Rumble_Power, (IPTR)&lpower, + SENSORS_HIDInput_Rumble_Duration, duration, + TAG_DONE); + SetSensorAttrTags(hwdata->rumble[1], + SENSORS_HIDInput_Rumble_Power , (IPTR)&hpower, + SENSORS_HIDInput_Rumble_Duration, duration, + TAG_DONE); + } + } + } + return 0; +} + +static int +SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) +{ + return device_index; +} + +static void +SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) +{ +} + +static SDL_bool +SDL_SYS_GetGamepadMapping(int device_index, SDL_GamepadMapping * out) +{ + return SDL_FALSE; +} + +static int +SDL_SYS_JoystickRumbleTriggers(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble) +{ + return SDL_Unsupported(); +} + +static SDL_bool +SDL_SYS_JoystickHasLED(SDL_Joystick * joystick) +{ + return SDL_FALSE; +} + +static int +SDL_SYS_JoystickSetLED(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + return SDL_Unsupported(); +} + +static int +SDL_SYS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) +{ + return SDL_Unsupported(); +} + +SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = +{ + SDL_SYS_JoystickInit, + SDL_SYS_JoystickGetCount, + SDL_SYS_JoystickDetect, + SDL_SYS_JoystickGetDeviceName, + SDL_SYS_JoystickGetDevicePlayerIndex, + SDL_SYS_JoystickSetDevicePlayerIndex, + SDL_SYS_JoystickGetDeviceGUID, + SDL_SYS_JoystickGetDeviceInstanceID, + SDL_SYS_JoystickOpen, + SDL_SYS_JoystickRumble, + SDL_SYS_JoystickRumbleTriggers, + SDL_SYS_JoystickHasLED, + SDL_SYS_JoystickSetLED, + SDL_SYS_JoystickSetSensorsEnabled, + SDL_SYS_JoystickUpdate, + SDL_SYS_JoystickClose, + SDL_SYS_JoystickQuit, + SDL_SYS_GetGamepadMapping +}; + +#endif diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h new file mode 100644 index 0000000000..bf34d3223f --- /dev/null +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -0,0 +1,53 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_MORPHOS + +#include +#include "SDL_joystick.h" + +#define MAX_BUTTONS 16 +#define MAX_HATS 8 +#define MAX_STICKS 8 +#define MAX_RUMBLE 2 + +struct joystick_hwdata +{ + APTR main_sensor; // Main HID sensor + APTR child_sensors; // List of specific sub-sensor entries + APTR button[MAX_BUTTONS]; // SensorType_HIDInput_Trigger + APTR hat[MAX_HATS]; // SensorType_HIDInput_Stick + APTR stick[MAX_STICKS]; // SensorType_HIDInput_Analog, SensorType_HIDInput_AnalogStick, SensorType_HIDInput_3DStick + APTR battery; // SensorType_HIDInput_Battery + APTR rumble[MAX_RUMBLE]; // SensorType_HIDInput_Rumble + + ULONG stickType[MAX_STICKS]; + int numSticks; + int numRumbles; + + // hot plug support + struct MsgPort *notifyPort; + APTR sensorsNotify; +}; + +#endif \ No newline at end of file diff --git a/src/locale/morphos/SDL_syslocale.c b/src/locale/morphos/SDL_syslocale.c new file mode 100644 index 0000000000..3809c34f37 --- /dev/null +++ b/src/locale/morphos/SDL_syslocale.c @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_syslocale.h" + +void +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) +{ + D("[%s]\n", __FUNCTION__); + /* dummy implementation. Caller already zero'd out buffer. */ + SDL_Unsupported(); +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/src/misc/morphos/SDL_sysurl.c b/src/misc/morphos/SDL_sysurl.c new file mode 100644 index 0000000000..300a40f319 --- /dev/null +++ b/src/misc/morphos/SDL_sysurl.c @@ -0,0 +1,44 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_sysurl.h" +#include "../../SDL_internal.h" + +#include + +int +SDL_SYS_OpenURL(const char *url) +{ + SDL_Log("[%s] url=%s\n", __FUNCTION__, url); + static const struct TagItem URLTags[] = {{TAG_DONE, (ULONG) NULL}}; + if (OpenURLBase) { + if(!URL_OpenA((STRPTR)url, (struct TagItem*) URLTags)) { + SDL_SetError("URL open failed"); + return SDL_Unsupported(); + } + } else { + return SDL_Unsupported(); + } + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/src/power/SDL_power.c b/src/power/SDL_power.c index ca19d44927..5c73d40531 100644 --- a/src/power/SDL_power.c +++ b/src/power/SDL_power.c @@ -74,7 +74,10 @@ static SDL_GetPowerInfo_Impl implementations[] = { #ifdef SDL_POWER_EMSCRIPTEN /* handles Emscripten */ SDL_GetPowerInfo_Emscripten, #endif - +#ifdef SDL_POWER_MORPHOS /* handles MorphOS */ + SDL_GetPowerInfo_MorphOS, +#endif + #ifdef SDL_POWER_HARDWIRED SDL_GetPowerInfo_Hardwired, #endif diff --git a/src/power/SDL_syspower.h b/src/power/SDL_syspower.h index f28cc982b9..7a1cbf01a2 100644 --- a/src/power/SDL_syspower.h +++ b/src/power/SDL_syspower.h @@ -40,6 +40,7 @@ SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_MorphOS(SDL_PowerState *, int *, int *); /* this one is static in SDL_power.c */ /* SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);*/ diff --git a/src/power/morphos/SDL_syspower.c b/src/power/morphos/SDL_syspower.c new file mode 100644 index 0000000000..b435d9794e --- /dev/null +++ b/src/power/morphos/SDL_syspower.c @@ -0,0 +1,101 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_POWER_DISABLED +#ifdef SDL_POWER_MORPHOS + +#include +#include + +#include "SDL_power.h" + +SDL_bool +SDL_GetPowerInfo_MorphOS(SDL_PowerState *state, int *seconds, int *percent) +{ + static const size_t battery_sensortags[] = { SENSORS_Type, SensorType_Battery, TAG_DONE }; + + APTR sensorlist = ObtainSensorsList((struct TagItem *)&battery_sensortags); + APTR sensor = NULL; + ssize_t maxcap = 0, totcap = 0, val, charging = 0, totsecs = 0; + SDL_PowerState st = SDL_POWERSTATE_NO_BATTERY; + + //D("[%s]\n", __FUNCTION__); + + while ((sensor = NextSensor(sensor, sensorlist, NULL))) + { + ssize_t capacity, max_capacity, is_batt_present, is_batt_charging, secs_remaining; + + struct TagItem battags[6] = + { + { SENSORS_Battery_Capacity, (size_t)&capacity }, + { SENSORS_Battery_MaxCapacity, (size_t)&max_capacity }, + { SENSORS_Battery_Present, (size_t)&is_batt_present }, + { SENSORS_Battery_Charging, (size_t)&is_batt_charging }, + { SENSORS_Battery_Remaining, (size_t)&secs_remaining }, + { TAG_DONE } + }; + + if (GetSensorAttr(sensor, battags) >= 5 && is_batt_present) + { + maxcap += max_capacity; + totcap += capacity; + + if (secs_remaining != SENSORS_Battery_Remaining_Calculating) + totsecs += secs_remaining; + + if (is_batt_charging && secs_remaining != SENSORS_Battery_Remaining_Charged) + charging++; + } + } + + ReleaseSensorsList(sensorlist, NULL); + + if (charging) + { + st = SDL_POWERSTATE_CHARGING; + } + else if (maxcap > 0) + { + if (totcap < maxcap) + st = SDL_POWERSTATE_ON_BATTERY; + else + st = SDL_POWERSTATE_CHARGED; + } + + *state = st; + *seconds = totsecs == 0 ? -1 : totsecs; + val = -1; + + if (maxcap > 0) + { + val = (totcap * 100) / maxcap; + val = val > 100 ? 100 : val; + } + + *percent = val; + + return SDL_TRUE; +} + +#endif /* SDL_POWER_MORPHOS */ +#endif /* SDL_POWER_DISABLED */ + diff --git a/src/render/opengl/SDL_glfuncs.h b/src/render/opengl/SDL_glfuncs.h index 8c7fefffca..b6351d71e3 100644 --- a/src/render/opengl/SDL_glfuncs.h +++ b/src/render/opengl/SDL_glfuncs.h @@ -36,7 +36,7 @@ SDL_PROC_UNUSED(void, glBitmap, (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) SDL_PROC(void, glBlendEquation, (GLenum)) -#ifdef __AMIGAOS4__ +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) #else SDL_PROC_UNUSED(void, glBlendFunc, (GLenum, GLenum)) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 805cf5c029..dc6e51e1d5 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -23,6 +23,12 @@ #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED #include "SDL_hints.h" +#include "SDL_assert.h" + +#ifdef __MORPHOS__ +#define _NO_PPCINLINE +#endif + #include "SDL_opengl.h" #include "../SDL_sysrender.h" #include "SDL_shaders_gl.h" @@ -31,13 +37,16 @@ #include #endif -/* To prevent unnecessary window recreation, - * these should match the defaults selected in SDL_GL_ResetAttributes +/* To prevent unnecessary window recreation, + * these should match the defaults selected in SDL_GL_ResetAttributes */ #ifdef __AMIGAOS4__ #define RENDERER_CONTEXT_MAJOR 1 #define RENDERER_CONTEXT_MINOR 3 +#elif __MORPHOS__ +#define RENDERER_CONTEXT_MAJOR 1 +#define RENDERER_CONTEXT_MINOR 2 #else #define RENDERER_CONTEXT_MAJOR 2 #define RENDERER_CONTEXT_MINOR 1 @@ -238,7 +247,7 @@ GL_LoadFunctions(GL_RenderData * data) #define SDL_PROC(ret,func,params) data->func=func; #else int retval = 0; -#ifdef __AMIGAOS4__ +#if defined(__AMIGAOS4__) //|| defined(__MORPHOS__) #define SDL_PROC(ret,func,params) \ do { \ data->func = SDL_GL_GetProcAddress(#func); \ @@ -1024,6 +1033,8 @@ GL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te return 0; } +#if defined(__AMIGAOS4__) +/* Hack: this is due to missing functionnality in MinGL / Warp3D / TinyGL */ static void GlBlendModeHack(GL_RenderData * data, const SDL_BlendMode mode) { @@ -1046,6 +1057,7 @@ GlBlendModeHack(GL_RenderData * data, const SDL_BlendMode mode) break; } } +#endif static void SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader shader) @@ -1089,22 +1101,20 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } if (blend != data->drawstate.blend) { - - if (data->glBlendFuncSeparate && data->glBlendEquation) { - if (blend == SDL_BLENDMODE_NONE) { - data->glDisable(GL_BLEND); - } else { - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blend)), - GetBlendFunc(SDL_GetBlendModeDstColorFactor(blend)), - GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blend)), - GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blend))); - data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blend))); - } +#if defined(__AMIGAOS4__) //|| defined(__MORPHOS__) + GlBlendModeHack(data, blend); +#else + if (blend == SDL_BLENDMODE_NONE) { + data->glDisable(GL_BLEND); } else { - GlBlendModeHack(data, blend); + data->glEnable(GL_BLEND); + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blend)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blend)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blend)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blend))); + data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blend))); } - +#endif data->drawstate.blend = blend; } @@ -1208,6 +1218,9 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } data->drawstate.target = renderer->target; + #ifdef __MORPHOS__ + data->glEnable(GL_TEXTURE_2D); + #endif if (!data->drawstate.target) { SDL_GL_GetDrawableSize(renderer->window, &data->drawstate.drawablew, &data->drawstate.drawableh); } diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index db20ea17e5..8cf263499a 100644 --- a/src/render/opengl/SDL_shaders_gl.c +++ b/src/render/opengl/SDL_shaders_gl.c @@ -23,6 +23,11 @@ #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED #include "SDL_stdinc.h" + +#ifdef __MORPHOS__ +#define _NO_PPCINLINE +#endif + #include "SDL_opengl.h" #include "SDL_video.h" #include "SDL_shaders_gl.h" diff --git a/src/test/SDL_test_imageBlit.c b/src/test/SDL_test_imageBlit.c index 1f54a0372f..b690be5e48 100644 --- a/src/test/SDL_test_imageBlit.c +++ b/src/test/SDL_test_imageBlit.c @@ -550,7 +550,11 @@ SDL_Surface *SDLTest_ImageBlit() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ @@ -1043,7 +1047,11 @@ SDL_Surface *SDLTest_ImageBlitColor() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ @@ -1565,7 +1573,11 @@ SDL_Surface *SDLTest_ImageBlitAlpha() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ diff --git a/src/test/SDL_test_imageBlitBlend.c b/src/test/SDL_test_imageBlitBlend.c index 2bdc9c2425..42d53715f6 100644 --- a/src/test/SDL_test_imageBlitBlend.c +++ b/src/test/SDL_test_imageBlitBlend.c @@ -1550,7 +1550,11 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ @@ -2373,7 +2377,11 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ diff --git a/src/test/SDL_test_imagePrimitives.c b/src/test/SDL_test_imagePrimitives.c index 8a7f012466..46fb717ea2 100644 --- a/src/test/SDL_test_imagePrimitives.c +++ b/src/test/SDL_test_imagePrimitives.c @@ -500,7 +500,11 @@ SDL_Surface *SDLTest_ImagePrimitives() 0x00ff0000, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ 0x000000ff, /* Blue bit mask. */ - 0x00000000 /* Alpha bit mask. Surface is 24-bit so don't define */ + #if defined(__MORPHOS__) || defined(__AMIGAOS4__) + 0x00000000 /* Alpha bit mask. Our surface is 24-bit, so don't define */ + #else + 0x000000ff /* Alpha bit mask. */ + #endif #else 0x000000ff, /* Red bit mask. */ 0x0000ff00, /* Green bit mask. */ diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index f2751937ee..8ac05b52c8 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -36,6 +36,8 @@ #include "psp/SDL_systhread_c.h" #elif SDL_THREAD_STDCPP #include "stdcpp/SDL_systhread_c.h" +#elif SDL_THREAD_MORPHOS +#include "morphos/SDL_systhread_c.h" #elif SDL_THREAD_AMIGAOS4 #include "amigaos4/SDL_systhread_c.h" #elif SDL_THREAD_OS2 diff --git a/src/thread/morphos/SDL_syscond.c b/src/thread/morphos/SDL_syscond.c new file mode 100644 index 0000000000..5cd97457a2 --- /dev/null +++ b/src/thread/morphos/SDL_syscond.c @@ -0,0 +1,220 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" + +/* An implementation of condition variables using semaphores and mutexes */ +/* + This implementation borrows heavily from the BeOS condition variable + implementation, written by Christopher Tate and Owen Smith. Thanks! + */ + +#include "SDL_thread.h" + +struct SDL_cond +{ + SDL_mutex *lock; + int waiting; + int signals; + SDL_sem *wait_sem; + SDL_sem *wait_done; +}; + +/* Create a condition variable */ +SDL_cond * +SDL_CreateCond(void) +{ + SDL_cond *cond; + + cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); + if (cond) { + cond->lock = SDL_CreateMutex(); + cond->wait_sem = SDL_CreateSemaphore(0); + cond->wait_done = SDL_CreateSemaphore(0); + cond->waiting = cond->signals = 0; + if (!cond->lock || !cond->wait_sem || !cond->wait_done) { + SDL_DestroyCond(cond); + cond = NULL; + } + } else { + SDL_OutOfMemory(); + } + return (cond); +} + +/* Destroy a condition variable */ +void +SDL_DestroyCond(SDL_cond * cond) +{ + if (cond) { + if (cond->wait_sem) { + SDL_DestroySemaphore(cond->wait_sem); + } + if (cond->wait_done) { + SDL_DestroySemaphore(cond->wait_done); + } + if (cond->lock) { + SDL_DestroyMutex(cond->lock); + } + 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"); + } + + /* If there are waiting threads not already signalled, then + signal the condition and wait for the thread to respond. + */ + SDL_LockMutex(cond->lock); + if (cond->waiting > cond->signals) { + ++cond->signals; + SDL_SemPost(cond->wait_sem); + SDL_UnlockMutex(cond->lock); + SDL_SemWait(cond->wait_done); + } else { + SDL_UnlockMutex(cond->lock); + } + + 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"); + } + + /* If there are waiting threads not already signalled, then + signal the condition and wait for the thread to respond. + */ + SDL_LockMutex(cond->lock); + if (cond->waiting > cond->signals) { + int i, num_waiting; + + num_waiting = (cond->waiting - cond->signals); + cond->signals = cond->waiting; + for (i = 0; i < num_waiting; ++i) { + SDL_SemPost(cond->wait_sem); + } + /* Now all released threads are blocked here, waiting for us. + Collect them all (and win fabulous prizes!) :-) + */ + SDL_UnlockMutex(cond->lock); + for (i = 0; i < num_waiting; ++i) { + SDL_SemWait(cond->wait_done); + } + } else { + SDL_UnlockMutex(cond->lock); + } + + 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) +{ + int retval; + + if (!cond) { + return SDL_SetError("Passed a NULL condition variable"); + } + + /* Obtain the protection mutex, and increment the number of waiters. + This allows the signal mechanism to only perform a signal if there + are waiting threads. + */ + SDL_LockMutex(cond->lock); + ++cond->waiting; + SDL_UnlockMutex(cond->lock); + + /* Unlock the mutex, as is required by condition variable semantics */ + SDL_UnlockMutex(mutex); + + /* Wait for a signal */ + if (ms == SDL_MUTEX_MAXWAIT) { + retval = SDL_SemWait(cond->wait_sem); + } else { + retval = SDL_SemWaitTimeout(cond->wait_sem, ms); + } + + /* Let the signaler know we have completed the wait, otherwise + the signaler can race ahead and get the condition semaphore + if we are stopped between the mutex unlock and semaphore wait, + giving a deadlock. See the following URL for details: + http://web.archive.org/web/20010914175514/http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html#Workshop + */ + SDL_LockMutex(cond->lock); + if (cond->signals > 0) { + /* If we timed out, we need to eat a condition signal */ + if (retval > 0) { + SDL_SemWait(cond->wait_sem); + } + /* We always notify the signal thread that we are done */ + SDL_SemPost(cond->wait_done); + + /* Signal handshake complete */ + --cond->signals; + } + --cond->waiting; + SDL_UnlockMutex(cond->lock); + + /* Lock the mutex, as is required by condition variable semantics */ + SDL_LockMutex(mutex); + + return retval; +} + +/* Wait on the condition variable forever */ +int +SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex) +{ + return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_sysmutex.c b/src/thread/morphos/SDL_sysmutex.c new file mode 100644 index 0000000000..20426b63c7 --- /dev/null +++ b/src/thread/morphos/SDL_sysmutex.c @@ -0,0 +1,110 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" + +/* An implementation of mutexes using semaphores */ + +#include "SDL_thread.h" +#include "SDL_systhread_c.h" + +#include + + +struct SDL_mutex +{ + struct SignalSemaphore sem; +}; + +/* Create a mutex */ +SDL_mutex * +SDL_CreateMutex(void) +{ + SDL_mutex *mutex; + + /* Allocate mutex memory */ + mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); + if (mutex) { + /* Create the mutex semaphore, with initial value 1 */ + memset(&mutex->sem, 0, sizeof(mutex->sem)); + InitSemaphore(&mutex->sem); + } 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 SDL_THREADS_DISABLED + return 0; +#else + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + ObtainSemaphore(&mutex->sem); + return 0; +#endif /* SDL_THREADS_DISABLED */ +} + +/* try Lock the mutex */ +int +SDL_TryLockMutex(SDL_mutex * mutex) +{ +#if SDL_THREADS_DISABLED + return 0; +#else + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + return AttemptSemaphore(&mutex->sem) ? 0 : SDL_MUTEX_TIMEDOUT; +#endif /* SDL_THREADS_DISABLED */ +} + +/* Unlock the mutex */ +int +SDL_mutexV(SDL_mutex * mutex) +{ +#if SDL_THREADS_DISABLED + return 0; +#else + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + ReleaseSemaphore(&mutex->sem); + return 0; +#endif /* SDL_THREADS_DISABLED */ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_sysmutex_c.h b/src/thread/morphos/SDL_sysmutex_c.h new file mode 100644 index 0000000000..2f88359373 --- /dev/null +++ b/src/thread/morphos/SDL_sysmutex_c.h @@ -0,0 +1,22 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_syssem.c b/src/thread/morphos/SDL_syssem.c new file mode 100644 index 0000000000..b527498dd9 --- /dev/null +++ b/src/thread/morphos/SDL_syssem.c @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" + +/* An implementation of semaphores using mutexes and condition variables */ + +#include "SDL_timer.h" +#include "SDL_thread.h" +#include "SDL_systhread_c.h" + +#include +#include +#include +#include + + +#if SDL_THREADS_DISABLED + +SDL_sem * +SDL_CreateSemaphore(Uint32 initial_value) +{ + SDL_SetError("SDL not built with thread support"); + return (SDL_sem *) 0; +} + +void +SDL_DestroySemaphore(SDL_sem * sem) +{ +} + +int +SDL_SemTryWait(SDL_sem * sem) +{ + return SDL_SetError("SDL not built with thread support"); +} + +int +SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) +{ + return SDL_SetError("SDL not built with thread support"); +} + +int +SDL_SemWait(SDL_sem * sem) +{ + return SDL_SetError("SDL not built with thread support"); +} + +Uint32 +SDL_SemValue(SDL_sem * sem) +{ + return 0; +} + +int +SDL_SemPost(SDL_sem * sem) +{ + return SDL_SetError("SDL not built with thread support"); +} + +#else + +struct waitnode +{ + struct Message msg; + struct MsgPort port; +}; + +struct SDL_semaphore +{ + Uint32 sem_value; + struct MinList waitlist; + struct SignalSemaphore sem; +}; + +extern void InitQPort(struct MsgPort *port); + +static +void mywaitinit(struct timerequest *r, Uint32 timeout, struct waitnode *wn) +{ + extern struct timerequest GlobalTimeReq; + struct timerequest *req = &GlobalTimeReq; + + r->tr_node.io_Message.mn_Node.ln_Type = NT_REPLYMSG; + r->tr_node.io_Message.mn_ReplyPort = &wn->port; + r->tr_node.io_Device = req->tr_node.io_Device; + r->tr_node.io_Unit = req->tr_node.io_Unit; +} + +SDL_sem * +SDL_CreateSemaphore(Uint32 initial_value) +{ + SDL_sem *sem; + + sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); + if (!sem) { + SDL_OutOfMemory(); + return NULL; + } + + sem->sem_value = initial_value; + + NEWLIST(&sem->waitlist); + memset(&sem->sem, 0, sizeof(sem->sem)); + InitSemaphore(&sem->sem); + + return sem; +} + +/* WARNING: + You cannot call this function when another thread is using the semaphore. +*/ +void +SDL_DestroySemaphore(SDL_sem * sem) +{ + if (sem) + { + ObtainSemaphore(&sem->sem); + + sem->sem_value = (Uint32)-1; + + while (!IsListEmpty((struct List *) &sem->waitlist)) + { + struct waitnode *wn; + + for (wn = (struct waitnode *) sem->waitlist.mlh_Head; wn->msg.mn_Node.ln_Succ; wn = (struct waitnode *) wn->msg.mn_Node.ln_Succ) + ReplyMsg(&wn->msg); + + if (SDL_SemWaitTimeout(sem, 10) < 0) + break; + } + + ReleaseSemaphore(&sem->sem); + + SDL_free(sem); + } +} + +int +SDL_SemTryWait(SDL_sem * sem) +{ + int retval = SDL_MUTEX_TIMEDOUT; + + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + + if (sem->sem_value > 0) + { + ObtainSemaphore(&sem->sem); + + if (sem->sem_value > 0) + { + --sem->sem_value; + retval = 0; + } + + ReleaseSemaphore(&sem->sem); + } + + return retval; +} + +int +SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) +{ + int retval = SDL_MUTEX_TIMEDOUT; + struct waitnode wn; + + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + + /* Try semaphore */ + ObtainSemaphore(&sem->sem); + + if (sem->sem_value > 0) + { + --sem->sem_value; + retval = 0; + } + else if (timeout > 0) + { + InitQPort(&wn.port); + wn.msg.mn_Node.ln_Type = NT_MESSAGE; + wn.msg.mn_ReplyPort = &wn.port; + ADDTAIL(&sem->waitlist, &wn); + } + + ReleaseSemaphore(&sem->sem); + + /* Sem not available and we have timeout */ + if (retval == SDL_MUTEX_TIMEDOUT && timeout > 0) + { + struct timerequest req; + struct Message *msg; + + mywaitinit(&req, timeout, &wn); + + req.tr_node.io_Command = TR_ADDREQUEST; + req.tr_time.tv_secs = timeout / 1000; + req.tr_time.tv_micro = (timeout % 1000) * 1000; + SendIO((struct IORequest *) &req); + + msg = WaitPort(&wn.port); + retval = 0; + + if (msg != &wn.msg) + { + ObtainSemaphore(&sem->sem); + REMOVE(&wn); + retval = wn.msg.mn_Node.ln_Type == NT_REPLYMSG ? 0 : SDL_MUTEX_TIMEDOUT; + ReleaseSemaphore(&sem->sem); + } + + AbortIO((struct IORequest *) &req); + WaitIO((struct IORequest *) &req); + } + + return retval; +} + +int +SDL_SemWait(SDL_sem * sem) +{ + return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); +} + +Uint32 +SDL_SemValue(SDL_sem * sem) +{ + if (!sem) + { + SDL_SetError("Passed a NULL semaphore"); + return -1; + } + + return sem->sem_value; +} + +int +SDL_SemPost(SDL_sem * sem) +{ + struct waitnode *wn; + + if (!sem) { + return SDL_SetError("Passed a NULL semaphore"); + } + + ObtainSemaphore(&sem->sem); + + sem->sem_value++; + + /* Wake whatever task happens to be first in the waitlist */ + if ((wn = (APTR)REMHEAD(&sem->waitlist))) + { + sem->sem_value--; + ReplyMsg(&wn->msg); + } + + ReleaseSemaphore(&sem->sem); + + return 0; +} + +#endif /* SDL_THREADS_DISABLED */ +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_systhread.c b/src/thread/morphos/SDL_systhread.c new file mode 100644 index 0000000000..5a0f2f9e75 --- /dev/null +++ b/src/thread/morphos/SDL_systhread.c @@ -0,0 +1,104 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" + +/* Thread management routines for SDL */ + +#include "SDL_thread.h" +#include "../SDL_systhread.h" + +#include +#include +#include +#include + +extern APTR threadpool; + +static void +RunThread(APTR data, struct MsgPort *port) +{ + SDL_Thread *thread = data; + + BPTR lock = thread->status; + thread->status = 0; + BPTR oldDir = CurrentDir(lock); + SDL_RunThread(data); + UnLock(CurrentDir(oldDir)); +} + +int +SDL_SYS_CreateThread(SDL_Thread * thread) +{ + thread->status = Lock("", SHARED_LOCK); + thread->handle = QueueWorkItem(threadpool, (APTR)RunThread, thread); + return thread->handle == WORKITEM_INVALID ? -1 : 0; +} + +void +SDL_SYS_SetupThread(const char *name) +{ + struct Task *t = SysBase->ThisTask; + t->tc_Node.ln_Name = (STRPTR)name; +} + +SDL_threadID +SDL_ThreadID(void) +{ + return GetCurrentWorkItem(threadpool); +} + +int +SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) +{ + ssize_t pri = 0; + + switch (priority) { + case SDL_THREAD_PRIORITY_LOW: + pri = -5; + break; + case SDL_THREAD_PRIORITY_HIGH: + pri = 5; + break; + case SDL_THREAD_PRIORITY_TIME_CRITICAL: + pri = 10; + break; + default: + pri = 0; + break; + } + + SetTaskPri(SysBase->ThisTask, pri); + return 0; +} + +void +SDL_SYS_WaitThread(SDL_Thread * thread) +{ + WaitWorkItem(threadpool, thread->handle); +} + +void +SDL_SYS_DetachThread(SDL_Thread * thread) +{ + thread->handle = WORKITEM_INVALID; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_systhread_c.h b/src/thread/morphos/SDL_systhread_c.h new file mode 100644 index 0000000000..a13ed777d3 --- /dev/null +++ b/src/thread/morphos/SDL_systhread_c.h @@ -0,0 +1,25 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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 ssize_t SYS_ThreadHandle; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/morphos/SDL_systls.c b/src/thread/morphos/SDL_systls.c new file mode 100644 index 0000000000..73df5b0edd --- /dev/null +++ b/src/thread/morphos/SDL_systls.c @@ -0,0 +1,97 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_MORPHOS + +#include +#include +#define AROS_ALMOST_COMPATIBLE 1 +#include + +#include "../SDL_thread_c.h" +#undef D +#define D(fmt, ...) ({((STRPTR (*)(void *, CONST_STRPTR , APTR (*)(APTR, UBYTE), STRPTR , ...))*(void**)((long)(*((APTR *)4)) - 922))((void*)(*((APTR *)4)), fmt, (APTR)1, NULL, ##__VA_ARGS__);}) + +#define TLS_MAGICID "SDL2TLS" + +struct tlsmagic +{ + UBYTE magicid[sizeof(TLS_MAGICID)]; + APTR tlsptr; +}; + +SDL_TLSData * +SDL_SYS_GetTLSData() +{ + struct MemList *ml; + + ForeachNode(&SysBase->ThisTask->tc_MemEntry, ml) + { + if (ml->ml_NumEntries == 1 && + ml->ml_Node.ln_Name == (char *) ml->ml_ME[0].me_Addr && + !strcmp(ml->ml_Node.ln_Name, TLS_MAGICID)) + { + struct tlsmagic *tm = ml->ml_ME[0].me_Addr; + return tm->tlsptr; + } + } + + return NULL; +} + +static const struct MemList stml = {{0,0,0,0,0}, 1, {{{MEMF_ANY}, sizeof(struct tlsmagic)}}}; + +int +SDL_SYS_SetTLSData(SDL_TLSData *data) +{ + struct Task *t = SysBase->ThisTask; + struct MemList *ml; + struct tlsmagic *tm; + + ForeachNode(&t->tc_MemEntry, ml) + { + if (ml->ml_NumEntries == 1 && + ml->ml_Node.ln_Name == (char *) ml->ml_ME[0].me_Addr && + !strcmp(ml->ml_Node.ln_Name, TLS_MAGICID)) + { + tm = ml->ml_ME[0].me_Addr; + tm->tlsptr = data; + return 0; + } + } + + ml = AllocEntry((struct MemList *) &stml); + if ((ULONG) ml & 0x80000000) + return 1; + + tm = ml->ml_ME[0].me_Addr; + ml->ml_Node.ln_Name = tm->magicid; + memcpy(tm->magicid, TLS_MAGICID, sizeof(TLS_MAGICID)); + tm->tlsptr = data; + ADDHEAD(&t->tc_MemEntry, &ml->ml_Node); + return 0; +} + +#endif /* SDL_THREAD_MORPHOS */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/timer/amiga/SDL_systimer.c b/src/timer/amiga/SDL_systimer.c new file mode 100644 index 0000000000..2433c56994 --- /dev/null +++ b/src/timer/amiga/SDL_systimer.c @@ -0,0 +1,112 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_timer.h" + +#include +#include +#include + +extern struct timerequest GlobalTimeReq; + +static SDL_bool ticks_started = SDL_FALSE; +static struct timeval basetime; + +void +SDL_TicksInit(void) +{ + if (ticks_started) + return; + + ticks_started = SDL_TRUE; + GetSysTime(&basetime); +} + +void +SDL_TicksQuit(void) +{ + ticks_started = SDL_FALSE; +} + +Uint32 +SDL_GetTicks(void) +{ + struct timeval tv; + + if (!ticks_started) + SDL_TicksInit(); + + GetSysTime(&tv); + + if (basetime.tv_micro > tv.tv_micro) + { + tv.tv_secs--; + tv.tv_micro += 1000000; + } + + return ((tv.tv_secs - basetime.tv_secs) * 1000) + ((tv.tv_micro - basetime.tv_micro)/1000); +} + +Uint64 +SDL_GetPerformanceCounter(void) +{ + Uint64 val; + ReadCPUClock(&val); + return val; +} + +Uint64 +SDL_GetPerformanceFrequency(void) +{ + Uint64 val; + return ReadCPUClock(&val); +} + +void +InitQPort(struct MsgPort *port) +{ + port->mp_SigBit = SIGB_SINGLE; + port->mp_Flags = PA_SIGNAL; + port->mp_SigTask = SysBase->ThisTask; + NEWLIST(&port->mp_MsgList); +} + +void +SDL_Delay(Uint32 ms) +{ + struct timerequest req; + struct MsgPort port; + + InitQPort(&port); + + req.tr_node.io_Message.mn_Node.ln_Type = 0; + req.tr_node.io_Message.mn_ReplyPort = &port; + req.tr_node.io_Device = GlobalTimeReq.tr_node.io_Device; + req.tr_node.io_Unit = GlobalTimeReq.tr_node.io_Unit; + req.tr_node.io_Command = TR_ADDREQUEST; + req.tr_time.tv_secs = ms / 1000; + req.tr_time.tv_micro = (ms % 1000) * 1000; + + DoIO((struct IORequest *)&req); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 5199abe1d8..14e95e5aff 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -67,6 +67,24 @@ GetL3CacheSize(void) return result; } +#elif defined(__MORPHOS__) +#include +#include + +static size_t +SDL_IsG5(void) +{ + size_t is_g5 = 0; + char *cpu_family; + + if (NewGetSystemAttrsA(&cpu_family, sizeof(cpu_family), SYSTEMINFOTYPE_CPUFAMILYNAME, NULL)) + { + if (cpu_family && stricmp(cpu_family, "G5") == 0) + is_g5 = 1; + } + + return is_g5; +} #else static size_t GetL3CacheSize(void) @@ -76,7 +94,7 @@ GetL3CacheSize(void) } #endif /* __MACOSX__ */ -#if (defined(__MACOSX__) && (__GNUC__ < 4)) +#if ((defined(__MACOSX__) || defined(__MORPHOS__)) && (__GNUC__ < 4)) #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p ) #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \ @@ -921,8 +939,12 @@ GetBlitFeatures(void) /* Feature 2 is has-AltiVec */ | ((SDL_HasAltiVec())? BLIT_FEATURE_HAS_ALTIVEC : 0) /* Feature 4 is dont-use-prefetch */ +#if defined(__MORPHOS__) + | (SDL_IsG5() ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0) +#else /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */ | ((GetL3CacheSize() == 0) ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0) +#endif ); } } diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index ad4fd67886..3412904e1b 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -438,6 +438,7 @@ extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; +extern VideoBootStrap AMIGA_bootstrap; extern VideoBootStrap OS2DIVE_bootstrap; extern VideoBootStrap OS2VMAN_bootstrap; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index e0ac93b9ba..b73b93af55 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -110,6 +110,9 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_AMIGAOS4 &OS4_bootstrap, #endif +#if SDL_VIDEO_DRIVER_AMIGA + &AMIGA_bootstrap, +#endif #if SDL_VIDEO_DRIVER_QNX &QNX_bootstrap, #endif @@ -152,7 +155,7 @@ static SDL_VideoDevice *_this = NULL; return retval; \ } -#ifdef __AMIGAOS4__ +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) /* Let's have only one kind of full screen */ #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN) #else @@ -1160,7 +1163,7 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode) SDL_DisplayMode fullscreen_mode; if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode); -#ifdef __AMIGAOS4__ +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) // Force window on new screen _this->SetWindowFullscreen(_this, window, SDL_GetDisplayForWindow(window), SDL_TRUE); #endif @@ -1397,7 +1400,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) return 0; } -#ifdef __AMIGAOS4__ +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) /* Without this hack, SDL would trigger us to open a window before screen which causes unnecessary work, because then we would have to close the window first and re-open it on the custom screen */ #define CREATE_FLAGS \ @@ -2839,6 +2842,7 @@ SDL_OnWindowFocusLost(SDL_Window * window) if (ShouldMinimizeOnFocusLoss(window)) { SDL_MinimizeWindow(window); } + } /* !!! FIXME: is this different than SDL_GetKeyboardFocus()? @@ -3247,6 +3251,9 @@ SDL_GL_ResetAttributes() #ifdef __AMIGAOS4__ _this->gl_config.major_version = 1; /* MiniGL */ _this->gl_config.minor_version = 3; +#elif __MORPHOS__ + _this->gl_config.major_version = 1; /* TinyGL */ + _this->gl_config.minor_version = 2; #else _this->gl_config.major_version = 2; _this->gl_config.minor_version = 1; @@ -4006,6 +4013,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #if SDL_VIDEO_DRIVER_AMIGAOS4 #include "amigaos4/SDL_os4messagebox.h" #endif +#if SDL_VIDEO_DRIVER_AMIGA +#include "amiga/SDL_amigamessagebox.h" +#endif #if SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" #endif @@ -4013,7 +4023,8 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "os2/SDL_os2messagebox.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_AMIGAOS4 || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_AMIGAOS4 || SDL_VIDEO_DRIVER_AMIGA || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 + static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; @@ -4119,6 +4130,13 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) retval = 0; } #endif +#if SDL_VIDEO_DRIVER_AMIGA + if (retval == -1 && + SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_AMIGA) && + AMIGA_ShowMessageBox(messageboxdata, buttonid) == 0) { + retval = 0; + } +#endif #if SDL_VIDEO_DRIVER_HAIKU if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) && diff --git a/src/video/amiga/SDL_amigaclipboard.c b/src/video/amiga/SDL_amigaclipboard.c new file mode 100644 index 0000000000..bf10bc69d5 --- /dev/null +++ b/src/video/amiga/SDL_amigaclipboard.c @@ -0,0 +1,291 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" +#include "../../core/morphos/SDL_misc.h" + +#include +#include +#include +#include + +#define ID_FTXT MAKE_ID('F','T','X','T') +#define ID_CHRS MAKE_ID('C','H','R','S') +#define ID_UTF8 MAKE_ID('U','T','F','8') + + +STATIC APTR clipboard_open(void) +{ + struct IOClipReq *io; + struct MsgPort *mp; + + mp = CreateMsgPort(); + + if ((io = (struct IOClipReq *)CreateIORequest(mp,sizeof(struct IOClipReq)))) + { + if (!(OpenDevice("clipboard.device", 0, (struct IORequest *)io, 0))) + { + return io; + } + + DeleteIORequest((struct IORequest *)io); + } + + DeleteMsgPort(mp); + return NULL; +} + +STATIC ULONG clipboard_write_data(struct IOClipReq *io, CONST_APTR data, ULONG len) +{ + LONG rc; + + io->io_Command = CMD_WRITE; + io->io_Data = (APTR)data; + io->io_Length = len; + DoIO( (struct IORequest *)io); + + if (io->io_Actual != len) + { + io->io_Error = 1; + } + + rc = io->io_Error ? FALSE : TRUE; + return rc; +} + + +STATIC VOID clipboard_pad_text(struct IOClipReq *io, ULONG textlen) +{ + if (textlen & 1) clipboard_write_data(io, "", 1); +} + + +STATIC ULONG clipboard_write_header_and_text(struct IOClipReq *io, CONST_STRPTR string, ULONG slen, ULONG ulen) +{ + ULONG rc; + + struct + { + ULONG form; + ULONG totalsize; + ULONG ftxt; + ULONG type; + ULONG strlen; + } iffheader; + + io->io_Offset = 0; + io->io_Error = 0; +// io->io_ClipID = 0; + + iffheader.form = ID_FORM; + iffheader.totalsize = (slen & 1 ? slen + 1 : slen) + (ulen & 1 ? ulen + 1 : ulen) + 12 + 8; + iffheader.ftxt = ID_FTXT; + iffheader.type = ID_CHRS; + iffheader.strlen = slen; + + rc = FALSE; + + if (clipboard_write_data(io, &iffheader, sizeof(iffheader))) + { + if (clipboard_write_data(io, string, slen)) + { + clipboard_pad_text(io, slen); + rc = TRUE; + } + } + + return rc; +} + + +STATIC ULONG clipboard_write_utf8(struct IOClipReq *io, CONST_STRPTR utext, ULONG ulen) +{ + ULONG rc; + + struct + { + ULONG type; + ULONG strlen; + } utf8_header; + + /* FIXME: For correct operation we should also store font name. Used font + * is relevant with guides written in Japanese for example. + */ + + utf8_header.type = ID_UTF8; + utf8_header.strlen = ulen; + + rc = FALSE; + + if (clipboard_write_data(io, &utf8_header, sizeof(utf8_header))) + { + if (clipboard_write_data(io, utext, ulen)) + { + clipboard_pad_text(io, ulen); + rc = TRUE; + } + } + + return rc; +} + +STATIC VOID clipboard_finalize(struct IOClipReq *io) +{ + io->io_Command = CMD_UPDATE; + DoIO((struct IORequest *)io); +} + +STATIC void clipboard_close(struct IOClipReq *io) +{ + if (io) + { + struct MsgPort *mp = io->io_Message.mn_ReplyPort; + + CloseDevice((struct IORequest *)io); + DeleteIORequest((struct IORequest *)io); + DeleteMsgPort(mp); + } +} + +int +AMIGA_SetClipboardText(_THIS, const char *text) +{ + APTR ctx; + int rc = -1; + + if ((ctx = clipboard_open())) + { + char *stext = AMIGA_ConvertText(text, MIBENUM_UTF_8, MIBENUM_SYSTEM); + + if (stext) + { + int ulen = strlen(text); + + if (clipboard_write_header_and_text(ctx, stext, strlen(stext), ulen)) + { + if (clipboard_write_utf8(ctx, text, ulen)) + rc = 0; + } + + SDL_free(stext); + clipboard_finalize(ctx); + } + + clipboard_close(ctx); + } + + return rc; +} + +char * +AMIGA_GetClipboardText(_THIS) +{ + struct IFFHandle *clip = AllocIFF(); + char *text = NULL; + + if (clip) + { + clip->iff_Stream = (IPTR)OpenClipboard(0); + + if (clip->iff_Stream) + { + InitIFFasClip(clip); + + if (!OpenIFF(clip, IFFF_READ)) + { + if (!StopChunk(clip, ID_FTXT, ID_CHRS) && !StopChunk(clip, ID_FTXT, ID_UTF8)) + { + BOOL done = FALSE; + + while (done == FALSE && !ParseIFF(clip, IFFPARSE_SCAN)) + { + struct ContextNode *cn = CurrentChunk(clip); + + if (cn) + { + LONG size = cn->cn_Size; + + if (cn->cn_Type == ID_FTXT && size > 0) + { + if (cn->cn_ID == ID_CHRS && !text) + { + char *tmp = SDL_malloc(size + 1); + + if (tmp) + { + ReadChunkBytes(clip, tmp, size); + tmp[size] = '\0'; + text = AMIGA_ConvertText(tmp, MIBENUM_SYSTEM, MIBENUM_UTF_8); + SDL_free(tmp); + } + } + else if (cn->cn_ID == ID_UTF8) + { + if (text) + SDL_free(text); + + if ((text = SDL_malloc(size + 1))) + { + ReadChunkBytes(clip, text, size); + text[size] = '\0'; + done = TRUE; + break; + } + } + } + } + } + } + + CloseIFF(clip); + } + + CloseClipboard((struct ClipboardHandle *)clip->iff_Stream); + } + + FreeIFF(clip); + } + + if (text == NULL) + { + if ((text = SDL_malloc(1))) + text[0] = '\0'; + } + + return text; +} + +SDL_bool +AMIGA_HasClipboardText(_THIS) +{ + SDL_bool result = SDL_FALSE; + char *text = AMIGA_GetClipboardText(_this); + + if (text) { + result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE; + SDL_free(text); + } + + return result; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigaclipboard.h b/src/video/amiga/SDL_amigaclipboard.h new file mode 100644 index 0000000000..747360ec46 --- /dev/null +++ b/src/video/amiga/SDL_amigaclipboard.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigaclipboard_h +#define _SDL_amigaclipboard_h + +extern int AMIGA_SetClipboardText(_THIS, const char *text); +extern char *AMIGA_GetClipboardText(_THIS); +extern SDL_bool AMIGA_HasClipboardText(_THIS); + +#endif /* _SDL_amigaclipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c new file mode 100644 index 0000000000..b563ae731f --- /dev/null +++ b/src/video/amiga/SDL_amigaevents.c @@ -0,0 +1,484 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_scancode.h" +#include "../SDL_sysvideo.h" +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_mouse_c.h" +#include "../../events/scancodes_amiga.h" +#include "../../core/morphos/SDL_library.h" + +#include "SDL_amigavideo.h" +#include "SDL_amigawindow.h" +#include "SDL_amigaopengl.h" + +#include "SDL_timer.h" +#include "SDL_syswm.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void +AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) +{ + int state = (m->Code & IECODE_UP_PREFIX) ? SDL_RELEASED : SDL_PRESSED; + + switch (m->Code & ~(IECODE_UP_PREFIX)) + { + case IECODE_LBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_LEFT); + break; + case IECODE_RBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_RIGHT); + break; + case IECODE_MBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_MIDDLE); + break; + } +} + +static int +AMIGA_TranslateUnicode(struct IntuiMessage *m, char *buffer) +{ + int length; + +#ifdef __MORPHOS__ + WCHAR keycode; + + GetAttr(IMSGA_UCS4, m, (ULONG *)&keycode); + length = UTF8_Encode(keycode, buffer); +#else + struct InputEvent ie; + + ie.ie_Class = IECLASS_RAWKEY; + ie.ie_SubClass = 0; + ie.ie_Code = m->Code & ~(IECODE_UP_PREFIX); + ie.ie_Qualifier = m->Qualifier; + ie.ie_EventAddress = NULL; + + length = MapRawKey(&ie, buffer, sizeof(buffer), 0); +#endif + + return length; +} + +static void +AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) +{ + SDL_Scancode s; + UWORD code = m->Code; + UWORD rawkey = m->Code & 0x7F; + + switch (code) + { + case RAWKEY_NM_WHEEL_UP: + SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL); + break; + + case RAWKEY_NM_WHEEL_DOWN: + SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL); + break; + + case RAWKEY_NM_WHEEL_LEFT: + SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL); + break; + + case RAWKEY_NM_WHEEL_RIGHT: + SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL); + break; + + case RAWKEY_NM_BUTTON_FOURTH: + SDL_SendMouseButton(data->window, 0, SDL_PRESSED, SDL_BUTTON_X1); + break; + + case RAWKEY_NM_BUTTON_FOURTH | IECODE_UP_PREFIX: + SDL_SendMouseButton(data->window, 0, SDL_RELEASED, SDL_BUTTON_X1); + break; + + default: + if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0])) { + s = amiga_scancode_table[rawkey]; + if (m->Code <= 127) { + char text[10]; + int length = AMIGA_TranslateUnicode(m, text); + SDL_SendKeyboardKey(SDL_PRESSED, s); + if (length > 0) { + text[length] = '\0'; + SDL_SendKeyboardText(text); + } + } else { + SDL_SendKeyboardKey(SDL_RELEASED, s); + } + } + break; + } +} + +static void +AMIGA_HandleActivation(_THIS, struct IntuiMessage *m, SDL_bool activated) +{ + SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; + if(data->window) + { + if (activated) + { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + + if (SDL_GetKeyboardFocus() != data->window) + { + SDL_SetKeyboardFocus(data->window); + } + SDL_SetMouseFocus(data->window); + } + else + { + if (SDL_GetKeyboardFocus() == data->window) + { + SDL_SetKeyboardFocus(NULL); + } + if (SDL_GetMouseFocus() == data->window) + { + SDL_SetMouseFocus(NULL); + } + } + } +} + +static void +AMIGA_MouseMove(_THIS, struct IntuiMessage *m, SDL_WindowData *data) +{ + + if (!SDL_GetRelativeMouseMode()) + { + struct Screen *s = data->win->WScreen; + int x = (s->MouseX - data->win->LeftEdge - data->win->BorderLeft); + int y = (s->MouseY - data->win->TopEdge - data->win->BorderTop); + SDL_SendMouseMotion(data->window, 0, 0, x, y); + } + else + { + if (data->first_deltamove) + { + data->first_deltamove = 0; + return; + } + SDL_SendMouseMotion(data->window, 0, 1, m->MouseX, m->MouseY); + } +} + +static void +AMIGA_ChangeWindow(_THIS, const struct IntuiMessage *m, SDL_WindowData *data) +{ + struct Window *w = data->win; + + if (data->curr_x != w->LeftEdge || data->curr_h != w->TopEdge) + { + data->curr_x = w->LeftEdge; + data->curr_y = w->TopEdge; + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, data->curr_x, data->curr_y); + } + + if (data->curr_w != w->Width || data->curr_h != w->Height) + { + data->curr_w = w->Width; + data->curr_h = w->Height; + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, (data->curr_w - w->BorderLeft - w->BorderRight), (data->curr_h - w->BorderTop - w->BorderBottom)); + AMIGA_GL_ResizeContext(_this, data->window); + } +} + +static void AMIGA_GadgetEvent(_THIS, const struct IntuiMessage *m) +{ + D("[%s]\n", __FUNCTION__); + + switch (((struct Gadget *)m->IAddress)->GadgetID) + { + case ETI_Iconify: + AMIGA_HideApp(_this, TRUE); + break; + } +} + +static const char porters[] = "Bruno Peloille (BeWorld)\nSzilard Biro (BSzili)\n"; +static const char bases[] = "SDL 2.0.3 sources by Ilkka Lehtoranta"; + +static void +AMIGA_AboutSDL(struct Window *window) +{ + struct EasyStruct es; + es.es_StructSize = sizeof(struct EasyStruct); + es.es_Flags = 0; + es.es_Title = "SDL2"; + es.es_TextFormat = "SDL %ld.%ld.%ld -MorphOS-\nCompiled on " __AMIGADATE__ "\n\nSimple DirectMedia Layer is cross-platform development library designed to\nprovide low level access audio, keyboard, mouse, joysticks, and graphics hardware.\n\nSDL 2.0 is distributed under zlib license.\nThis license allows you to use SDL freely in any software.\n\nPorters:\n%s\nBased on %s\n\nwww.libsdl.org"; + es.es_GadgetFormat = "Ok"; + + EasyRequest(window, &es, NULL, SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, (ULONG)porters, (ULONG)bases); +} + +static void +AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) +{ + SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; + + switch (m->Class) + { + case IDCMP_MENUPICK: + { + struct MenuItem *item = ItemAddress(data->menu, m->Code); + if (item) + { + switch ((ULONG)GTMENUITEM_USERDATA(item)) + { + case MID_ABOUT: + AMIGA_AboutSDL(data->win); + break; + case MID_QUIT: + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); + break; + case MID_HIDE: + AMIGA_HideApp(_this, TRUE); + break; + default: + break; + } + } + } + break; + case IDCMP_REFRESHWINDOW: + BeginRefresh(m->IDCMPWindow); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); + EndRefresh(m->IDCMPWindow, TRUE); + break; + + case IDCMP_CLOSEWINDOW: + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); + break; + + case IDCMP_MOUSEMOVE: + AMIGA_MouseMove(_this, m, data); + break; + + case IDCMP_MOUSEBUTTONS: + AMIGA_DispatchMouseButtons(m, data); + break; + + case IDCMP_RAWKEY: + AMIGA_DispatchRawKey(m, data); + break; + + case IDCMP_ACTIVEWINDOW: + AMIGA_HandleActivation(_this, m, SDL_TRUE); + break; + + case IDCMP_INACTIVEWINDOW: + AMIGA_HandleActivation(_this, m, SDL_FALSE); + break; + + case IDCMP_CHANGEWINDOW: + AMIGA_ChangeWindow(_this, m, data); + break; + + case IDCMP_GADGETUP: + AMIGA_GadgetEvent(_this, m); + break; + } +} + +static void +AMIGA_CheckBrokerMsg(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + CxMsg *msg; + + while ((msg = (CxMsg *)GetMsg(&data->BrokerPort))) + { + size_t id = CxMsgID(msg); + size_t tp = CxMsgType(msg); + + D("[%s] check CxMsg\n", __FUNCTION__); + + ReplyMsg((APTR)msg); + + if (tp == CXM_COMMAND) + { + switch (id) + { + case CXCMD_KILL: + SDL_SendAppEvent(SDL_QUIT); + break; + + case CXCMD_APPEAR: + AMIGA_ShowApp(_this); + break; + + case CXCMD_DISAPPEAR: + AMIGA_HideApp(_this, TRUE); + break; + } + } + } +} + +static void +AMIGA_CheckScreenEvent(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + + for (;;) + { + struct ScreenNotifyMessage *snm; + + while ((snm = (struct ScreenNotifyMessage *)GetMsg(&data->ScreenNotifyPort)) != NULL) + { + D("[%s] check ScreenNotifyMessage\n", __FUNCTION__); + + switch ((size_t)snm->snm_Value) + { + case FALSE: + AMIGA_HideApp(_this, FALSE); + break; + + case TRUE: + AMIGA_ShowApp(_this); + break; + } + } + + if (data->WScreen) + break; + + WaitPort(&data->ScreenNotifyPort); + } +} + +static void +AMIGA_CheckWBEvents(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + struct AppMessage *msg; + char filename[1024]; + while ((msg = (struct AppMessage *)GetMsg(&data->WBPort)) != NULL) + { + D("[%s] check AppMessage\n", __FUNCTION__); + + switch (msg->am_Type) { + case AMTYPE_APPWINDOW: + { + SDL_Window *window = (SDL_Window *)msg->am_UserData; + struct WBArg *argptr = msg->am_ArgList; + for (int i = 0; i < msg->am_NumArgs; i++) { + if (argptr->wa_Lock) { + NameFromLock(argptr->wa_Lock, filename, 1024); + AddPart(filename, argptr->wa_Name, 1024); + + D("[%s] SDL_SendDropfile : '%s'\n", __FUNCTION__, filename); + SDL_SendDropFile(window, filename); + argptr++; + } + } + SDL_SendDropComplete(window); + } + break; + case AMTYPE_APPICON: + AMIGA_ShowApp(_this); + break; + default: + //D("[%s] Unknown AppMsg %d %p\n", __FUNCTION__, msg->am_Type, (APTR)msg->am_UserData); + break; + } + + } +} + +void +AMIGA_PumpEvents(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + struct IntuiMessage *m; + + LONG check_mousecoord = 0; + size_t sigs = SetSignal(0, data->ScrNotifySig | data->BrokerSig | data->WBSig | data->WinSig | SIGBREAKF_CTRL_C); + + if (sigs & data->WinSig) + { + SDL_WindowData *wdata; + while ((m = (struct IntuiMessage *)GetMsg(&data->WinPort))) + { + wdata = (SDL_WindowData *)m->IDCMPWindow->UserData; + BYTE fullscreen = wdata->winflags & SDL_AMIGA_WINDOW_FULLSCREEN; + if (m->Class == IDCMP_MOUSEMOVE && !fullscreen && !SDL_GetRelativeMouseMode()) + { + check_mousecoord = TRUE; + } + AMIGA_DispatchEvent(_this, m); + ReplyMsg((struct Message *)m); + } + + if (check_mousecoord) + { + struct Screen *s = wdata->win->WScreen; + LONG mx = s->MouseX; + LONG my = s->MouseY; + LONG ws = wdata->win->LeftEdge + wdata->win->BorderLeft; + LONG wy = wdata->win->TopEdge + wdata->win->BorderTop; + LONG wx2 = wdata->win->LeftEdge + wdata->win->Width - wdata->win->BorderRight; + LONG wy2 = wdata->win->TopEdge + wdata->win->Height - wdata->win->BorderBottom; + if (mx >= ws && my >= wy && mx <= wx2 && my <= wy2) + { + wdata->win->Flags |= WFLG_RMBTRAP; + } + else + { + wdata->win->Flags &= ~WFLG_RMBTRAP; + SDL_ShowCursor(TRUE); // force to show system cursor + } + } + } + + if (sigs & data->ScrNotifySig && data->ScreenNotifyHandle) + AMIGA_CheckScreenEvent(_this); + + if (sigs & data->BrokerSig) + AMIGA_CheckBrokerMsg(_this); + + if (sigs & data->WBSig) + AMIGA_CheckWBEvents(_this); + + if (sigs & SIGBREAKF_CTRL_C) + SDL_SendAppEvent(SDL_QUIT); +} diff --git a/src/video/amiga/SDL_amigaevents.h b/src/video/amiga/SDL_amigaevents.h new file mode 100644 index 0000000000..aeeba9d4f4 --- /dev/null +++ b/src/video/amiga/SDL_amigaevents.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigaevents_h +#define _SDL_amigaevents_h + +extern void AMIGA_PumpEvents(_THIS); + +#endif /* _SDL_amigaevents_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigaframebuffer.c b/src/video/amiga/SDL_amigaframebuffer.c new file mode 100644 index 0000000000..95d1e5bf34 --- /dev/null +++ b/src/video/amiga/SDL_amigaframebuffer.c @@ -0,0 +1,128 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigavideo.h" + +#include +#include +#include + + +void +AMIGA_DestroyWindowFramebuffer(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if (data) + { + SDL_free(data->fb); + } +} + +int +AMIGA_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, + void ** pixels, int *pitch) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + SDL_Framebuffer *fb; + Uint32 fmt; + int bpr; + + /* Free the old framebuffer surface */ + AMIGA_DestroyWindowFramebuffer(_this, window); + + switch (vd->sdlpixfmt) + { + case SDL_PIXELFORMAT_INDEX8: + fmt = SDL_PIXELFORMAT_INDEX8; + bpr = (window->w + 15) & ~15; + break; + + default: + fmt = SDL_PIXELFORMAT_ARGB8888; + bpr = ((window->w * 4) + 15) & ~15; + break; + } + + *format = fmt; + *pitch = bpr; + + data->fb = fb = SDL_malloc(sizeof(SDL_Framebuffer) + bpr * window->h); + + if (fb) + { + fb->bpr = bpr; + fb->pixfmt = fmt; + + *pixels = fb->buffer; + } + else + { + return SDL_OutOfMemory(); + } + + return 0; +} + +#ifndef MIN +# define MIN(x,y) ((x)<(y)?(x):(y)) +#endif + +int +AMIGA_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (data && data->win && data->fb) + { + SDL_Framebuffer *fb = data->fb; + struct RastPort *rp = data->win->RPort; + const struct IBox windowBox = { + data->win->BorderLeft, + data->win->BorderTop, + data->win->Width - data->win->BorderLeft - data->win->BorderRight, + data->win->Height - data->win->BorderTop - data->win->BorderBottom }; + int i, w, h, dx, dy; + const SDL_Rect * r; + for (i = 0; i < numrects; ++i) { + r = &rects[i]; + dx = r->x + windowBox.Left; + dy = r->y + windowBox.Top; + w = MIN(r->w, windowBox.Width); + h = MIN(r->h, windowBox.Height); + switch (fb->pixfmt) + { + case SDL_PIXELFORMAT_INDEX8: + if (data->videodata->CustomScreen) + WritePixelArray(fb->buffer, r->x, r->y, fb->bpr, rp, dx, dy, w, h, RECTFMT_RAW); + else + WriteLUTPixelArray(fb->buffer, r->x, r->y, fb->bpr, rp, data->videodata->coltab, dx, dy, w, h, CTABFMT_XRGB8); + break; + default: + case SDL_PIXELFORMAT_ARGB8888: + WritePixelArray(fb->buffer, r->x, r->y, fb->bpr, rp, dx, dy, w, h, RECTFMT_ARGB); + break; + } + } + } + return 0; +} diff --git a/src/video/amiga/SDL_amigaframebuffer.h b/src/video/amiga/SDL_amigaframebuffer.h new file mode 100644 index 0000000000..8c1e64d28a --- /dev/null +++ b/src/video/amiga/SDL_amigaframebuffer.h @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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 int AMIGA_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); +extern int AMIGA_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); +extern void AMIGA_DestroyWindowFramebuffer(_THIS, SDL_Window * window); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c new file mode 100644 index 0000000000..a4e8df4f9b --- /dev/null +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -0,0 +1,3145 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_config.h" + +/* wrapper functions for TinyGL (MorphOS) */ + +#if SDL_VIDEO_DRIVER_AMIGA + +#include +#include +#include +#include +#include + +/* The GL API */ + +/* + * Miscellaneous + */ + +#ifndef __MORPHOS__ +static void AmiglClearIndex( GLfloat c ) +{ + glClearIndex(c); +} + +/* + * Accumulation Buffer + */ + +static void AmiglClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +{ + glClearAccum(red, green, blue, alpha); +} + + +static void AmiglAccum( GLenum op, GLfloat value ) +{ + glAccum(op, value); +} +#endif + +static void AmiglClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { + glClearColor(red, green, blue, alpha); + } + +static void AmiglClear( GLbitfield mask ) { + glClear(mask); + } + +static void AmiglIndexMask( GLuint mask ) { +#ifndef __MORPHOS__ + glIndexMask(mask); +#endif + } + +static void AmiglColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { + glColorMask(red, green, blue, alpha); +} + +static void AmiglAlphaFunc( GLenum func, GLclampf ref ) { + glAlphaFunc(func, ref); +} + +static void AmiglBlendFunc( GLenum sfactor, GLenum dfactor ) { + glBlendFunc(sfactor, dfactor); + } + +/* tinygl new functions */ +static void AmiglBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { + glBlendColor(red, green, blue, alpha); +} + +static void AmiglBlendEquation( GLenum mode ) { + glBlendEquation(mode); +} + +static void AmiglBlendEquationSeparate( GLenum modeRGB, GLenum modeAlpha ) { + glBlendEquationSeparate(modeRGB, modeAlpha); +} + +static void AmiglBlendFuncSeparate( GLenum sfactorRGB, GLenum sfactorAlpha, GLenum dfactorRGB, GLenum dfactorAlpha ) { + glBlendFuncSeparate(sfactorRGB, sfactorAlpha, dfactorRGB, dfactorAlpha); +} + +static void AmiglLogicOp( GLenum opcode ) { + glLogicOp(opcode); +} + +static void AmiglCullFace( GLenum mode ) { + glCullFace(mode); + } + +static void AmiglFrontFace( GLenum mode ) { + glFrontFace(mode); + } + +static void AmiglPointSize( GLfloat size ) { + glPointSize(size); + } + +static void AmiglLineWidth( GLfloat width ) { + glLineWidth(width); + } + +static void AmiglLineStipple( GLint factor, GLushort pattern ) { + glLineStipple(factor, pattern); +} + +static void AmiglPolygonMode( GLenum face, GLenum mode ) { + glPolygonMode(face, mode); + } + +static void AmiglPolygonOffset( GLfloat factor, GLfloat units ) { + glPolygonOffset(factor, units); + } + +static void AmiglPolygonStipple( const GLubyte *mask ) { + glPolygonStipple(mask); + } + +static void AmiglGetPolygonStipple( GLubyte *mask ) { +#ifndef __MORPHOS__ + glGetPolygonStipple(mask); +#endif + } + +static void AmiglEdgeFlag( GLboolean flag ) { + glEdgeFlag(flag); + } + +static void AmiglEdgeFlagv( const GLboolean *flag ) { +#ifndef __MORPHOS__ + glEdgeFlagv(flag); +#else + glEdgeFlag(*flag); +#endif + } + +static void AmiglScissor( GLint x, GLint y, GLsizei width, GLsizei height) { + glScissor(x, y, width, height); + } + +static void AmiglClipPlane( GLenum plane, const GLdouble *equation ) { + glClipPlane(plane, (GLdouble *)equation); +} + +static void AmiglGetClipPlane( GLenum plane, GLdouble *equation ) { + glGetClipPlane(plane, equation); + } + +static void AmiglDrawBuffer( GLenum mode ) { + glDrawBuffer(mode); + } + +static void AmiglReadBuffer( GLenum mode ) { + glReadBuffer(mode); + } + +static void AmiglEnable( GLenum cap ) { + glEnable(cap); + } + +static void AmiglDisable( GLenum cap ) { + glDisable(cap); + } + +static GLboolean AmiglIsEnabled( GLenum cap ) { + return glIsEnabled(cap); + } + +static void AmiglEnableClientState( GLenum cap ) { /* 1.1 */ + glEnableClientState(cap); + } + +static void AmiglDisableClientState( GLenum cap ) { /* 1.1 */ + glDisableClientState(cap); + } + +static void AmiglGetBooleanv( GLenum pname, GLboolean *params ) { +#ifndef __MORPHOS__ + glGetBooleanv(pname, params); +#endif + } + +static void AmiglGetDoublev( GLenum pname, GLdouble *params ) { + glGetDoublev(pname, params); + } + +static void AmiglGetFloatv( GLenum pname, GLfloat *params ) { + glGetFloatv(pname, params); + } + +static void AmiglGetIntegerv( GLenum pname, GLint *params ) { + glGetIntegerv(pname, params); + } + +static void AmiglPushAttrib( GLbitfield mask ) { + glPushAttrib(mask); + } + +static void AmiglPopAttrib( void ) { + glPopAttrib(); + } + +static void AmiglPushClientAttrib( GLbitfield mask ) { /* 1.1 */ + glPushClientAttrib(mask); + } + +static void AmiglPopClientAttrib( void ) { /* 1.1 */ + glPopClientAttrib(); + } + +static GLint AmiglRenderMode( GLenum mode ) { + return glRenderMode(mode); +} + +static GLenum AmiglGetError( void ) { + return glGetError(); +} + +static const GLubyte* AmiglGetString( GLenum name ) { + return glGetString(name); + } + +static void AmiglFinish( void ) { + glFinish(); + } + +static void AmiglFlush( void ) { + glFlush(); +} + +static void AmiglHint( GLenum target, GLenum mode ) { + glHint(target, mode); + } + +/* + * Depth Buffer + */ + +static void AmiglClearDepth( GLclampd depth ) { + glClearDepth(depth); + } + +static void AmiglDepthFunc( GLenum func ) { + glDepthFunc(func); + } + +static void AmiglDepthMask( GLboolean flag ) { + glDepthMask(flag); + } + +static void AmiglDepthRange( GLclampd near_val, GLclampd far_val ) { + glDepthRange(near_val, far_val); + } + +/* + * Transformation + */ + +static void AmiglMatrixMode( GLenum mode ) { + glMatrixMode(mode); + } + +static void AmiglOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) { + glOrtho(left, right, bottom, top, near_val, far_val); + } + +static void AmiglFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) { + glFrustum(left, right, bottom, top, near_val, far_val); + } + +static void AmiglViewport( GLint x, GLint y, GLsizei width, GLsizei height ) { + glViewport(x, y, width, height); + } + +static void AmiglPushMatrix( void ) { + glPushMatrix(); + } + +static void AmiglPopMatrix( void ) { + glPopMatrix(); + } + +static void AmiglLoadIdentity( void ) { + glLoadIdentity(); + } + +static void AmiglLoadMatrixd( const GLdouble *m ) { + glLoadMatrixd(m); + } + +static void AmiglLoadMatrixf( const GLfloat *m ) { + glLoadMatrixf(m); + } + +static void AmiglMultMatrixd( const GLdouble *m ) { + glMultMatrixd(m); + } + +static void AmiglMultMatrixf( const GLfloat *m ) { + glMultMatrixf(m); + } + +static void AmiglRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { + glRotated(angle, x, y, z); + } + +static void AmiglRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { + glRotatef(angle, x, y, z); + } + +static void AmiglScaled( GLdouble x, GLdouble y, GLdouble z ) { + glScaled(x, y, z); + } + +static void AmiglScalef( GLfloat x, GLfloat y, GLfloat z ) { + glScalef(x, y, z); + } + +static void AmiglTranslated( GLdouble x, GLdouble y, GLdouble z ) { + glTranslated(x, y, z); + } + +static void AmiglTranslatef( GLfloat x, GLfloat y, GLfloat z ) { + glTranslatef(x, y, z); + } + +/* + * Display Lists + */ + +static GLboolean AmiglIsList( GLuint list ) { + return glIsList(list); + } + +static void AmiglDeleteLists( GLuint list, GLsizei range ) { + glDeleteLists(list, range); + } + +static GLuint AmiglGenLists( GLsizei range ) { + return glGenLists(range); + } + +static void AmiglNewList( GLuint list, GLenum mode ) { + glNewList(list, mode); + } + +static void AmiglEndList( void ) { + glEndList(); + } + +static void AmiglCallList( GLuint list ) { + glCallList(list); + } + +static void AmiglCallLists( GLsizei n, GLenum type, GLvoid *lists ) { + glCallLists(n, type, lists); + } + +static void AmiglListBase( GLuint base ) { + glListBase(base); + } + +/* + * Drawing Functions + */ + +static void AmiglBegin( GLenum mode ) { + glBegin(mode); + } + +static void AmiglEnd( void ) { + glEnd(); + } + +static void AmiglVertex2d( GLdouble x, GLdouble y ) { glVertex2d(x, y); } +static void AmiglVertex2f( GLfloat x, GLfloat y ) { glVertex2f(x, y); } +static void AmiglVertex2i( GLint x, GLint y ) { glVertex2i(x, y); } +static void AmiglVertex2s( GLshort x, GLshort y ) + { + glVertex2s(x, y); + } + +static void AmiglVertex3d( GLdouble x, GLdouble y, GLdouble z ) { glVertex3d(x, y, z); } +static void AmiglVertex3f( GLfloat x, GLfloat y, GLfloat z ) { glVertex3f(x, y, z); } +static void AmiglVertex3i( GLint x, GLint y, GLint z ) + { + glVertex3i(x, y, z); + } + +static void AmiglVertex3s( GLshort x, GLshort y, GLshort z ) + { + glVertex3s(x, y, z); + } + +static void AmiglVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) + { + glVertex4d(x, y, z, w); + } + +static void AmiglVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { glVertex4f(x, y, z, w); } +static void AmiglVertex4i( GLint x, GLint y, GLint z, GLint w ) + { + glVertex4i(x, y, z, w); + } + +static void AmiglVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) + { + glVertex4s(x, y, z, w); + } + +static void AmiglVertex2dv( const GLdouble *v ) + { + glVertex2dv(v); + } + +static void AmiglVertex2fv( const GLfloat *v ) { glVertex2fv(v); } + +static void AmiglVertex2iv( const GLint *v ) + { + glVertex2iv(v); +} + +static void AmiglVertex2sv( const GLshort *v ) { glVertex2sv(v); } + +static void AmiglVertex3dv( GLdouble *v ) + { + glVertex3dv(v); + } + +static void AmiglVertex3fv( GLfloat *v ) { glVertex3fv(v); } + +static void AmiglVertex3iv( const GLint *v ) + { + glVertex3iv(v); + } + +static void AmiglVertex3sv( const GLshort *v ) +{ +#ifndef __MORPHOS__ + glVertex3sv(v); +#else + glVertex3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif +} + +static void AmiglVertex4dv( GLdouble *v ) + { + glVertex4dv(v); + } + +static void AmiglVertex4fv( GLfloat *v ) { glVertex4fv(v); } +static void AmiglVertex4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glVertex4iv(v); +#else + glVertex4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); +#endif + } + +static void AmiglVertex4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glVertex4sv(v); +#else + glVertex4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); +#endif + } + +static void AmiglNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ) +{ +#ifndef __MORPHOS__ + glNormal3b(nx, ny, nz); +#else + glNormal3f((GLfloat)nx, (GLfloat)ny, (GLfloat)nz); +#endif +} + +static void AmiglNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +{ + glNormal3d(nx, ny, nz); +} + +static void AmiglNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ) { glNormal3f(nx, ny, nz); } + +static void AmiglNormal3i( GLint nx, GLint ny, GLint nz ) +{ +#ifndef __MORPHOS__ + glNormal3i(nx, ny, nz); +#else + glNormal3f((GLfloat)nx, (GLfloat)ny, (GLfloat)nz); +#endif +} + +static void AmiglNormal3s( GLshort nx, GLshort ny, GLshort nz ) +{ + glNormal3s(nx, ny, nz); +} + +static void AmiglNormal3bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glNormal3bv(v); +#else + glNormal3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglNormal3dv( const GLdouble *v ) +{ + glNormal3dv(v); +} + +static void AmiglNormal3fv( GLfloat *v ) { glNormal3fv(v); } + +static void AmiglNormal3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glNormal3iv(v); +#else + glNormal3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglNormal3sv( const GLshort *v ) + { + glNormal3sv(v); + } + +static void AmiglIndexd( GLdouble c ) + { +#ifndef __MORPHOS__ + glIndexd(c); +#endif + } + +static void AmiglIndexf( GLfloat c ) + { +#ifndef __MORPHOS__ + glIndexf(c); +#endif + } + +static void AmiglIndexi( GLint c ) + { + glIndexi(c); + } + +static void AmiglIndexs( GLshort c ) + { +#ifndef __MORPHOS__ + glIndexs(c); +#endif + } + +static void AmiglIndexub( GLubyte c ) + { +#ifndef __MORPHOS__ + glIndexub(c); +#endif + } + +static void AmiglIndexdv( const GLdouble *c ) + { +#ifndef __MORPHOS__ + glIndexdv(c); +#endif + } + +static void AmiglIndexfv( const GLfloat *c ) + { +#ifndef __MORPHOS__ + glIndexfv(c); +#endif + } + +static void AmiglIndexiv( const GLint *c ) + { +#ifndef __MORPHOS__ + glIndexiv(c); +#endif + } + +static void AmiglIndexsv( const GLshort *c ) + { +#ifndef __MORPHOS__ + glIndexsv(c); +#endif + } + +static void AmiglIndexubv( const GLubyte *c ) + { +#ifndef __MORPHOS__ + glIndexubv(c); +#endif + } + +static void AmiglColor3b( GLbyte red, GLbyte green, GLbyte blue ) + { +#ifndef __MORPHOS__ + glColor3b(red, green, blue); +#else + glColor3ub((GLubyte)red, (GLubyte)green, (GLubyte)blue); +#endif + } + +static void AmiglColor3d( GLdouble red, GLdouble green, GLdouble blue ) +{ + glColor3d(red, green, blue); +} + +static void AmiglColor3f( GLfloat red, GLfloat green, GLfloat blue ) { glColor3f(red, green, blue); } + +static void AmiglColor3i( GLint red, GLint green, GLint blue ) + { +#ifndef __MORPHOS__ + glColor3i(red, green, blue); +#else + glColor3f((GLfloat)red/429496795.0f, (GLfloat)green/429496795.0f, (GLfloat)blue/429496795.f); +#endif + } + +static void AmiglColor3s( GLshort red, GLshort green, GLshort blue ) + { +#ifndef __MORPHOS__ + glColor3s(red, green, blue); +#else + glColor3f((GLfloat)red/65535.0f, (GLfloat)green/65535.0f, (GLfloat)blue/65535.f); +#endif + } + +static void AmiglColor3ub( GLubyte red, GLubyte green, GLubyte blue ) { glColor3ub(red, green, blue); } +static void AmiglColor3ui( GLuint red, GLuint green, GLuint blue ) + { +#ifndef __MORPHOS__ + glColor3ui(red, green, blue); +#else + glColor3f((GLfloat)red/429496795.0f, (GLfloat)green/429496795.0f, (GLfloat)blue/429496795.f); +#endif + } + +static void AmiglColor3us( GLushort red, GLushort green, GLushort blue ) + { +#ifndef __MORPHOS__ + glColor3us(red, green, blue); +#else + glColor3f((GLfloat)red/65535.0f, (GLfloat)green/65535.0f, (GLfloat)blue/65535.f); +#endif + } + +static void AmiglColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) + { + glColor4b(red, green, blue, alpha); + } + +static void AmiglColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) + { + glColor4d(red, green, blue, alpha); + } + +static void AmiglColor4f( GLfloat red, GLfloat green,GLfloat blue, GLfloat alpha ) { glColor4f(red, green, blue, alpha); } + +static void AmiglColor4i( GLint red, GLint green, GLint blue, GLint alpha ) + { +#ifndef __MORPHOS__ + glColor4i(red, green, blue, alpha); +#else + glColor4f((GLfloat)red/429496795.0f, (GLfloat)green/429496795.0f, (GLfloat)blue/429496795.0f, (GLfloat)alpha/429496795.0f); +#endif + } + +static void AmiglColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha ) + { +#ifndef __MORPHOS__ + glColor4s(red, green, blue, alpha); +#else + glColor4f((GLfloat)red/65535.0f, (GLfloat)green/65535.0f, (GLfloat)blue/65535.f, (GLfloat)alpha/65535.0f); +#endif + } + +static void AmiglColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ) { glColor4ub(red, green, blue, alpha); } + +static void AmiglColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha ) + { +#ifndef __MORPHOS__ + glColor4ui(red, green, blue, alpha); +#else + glColor4f((GLfloat)red/429496795.0f, (GLfloat)green/429496795.0f, (GLfloat)blue/429496795.0f, (GLfloat)alpha/429496795.0f); +#endif + } + +static void AmiglColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha ) + { +#ifndef __MORPHOS__ + glColor4us(red, green, blue, alpha); +#else + glColor4f((GLfloat)red/65535.0f, (GLfloat)green/65535.0f, (GLfloat)blue/65535.f, (GLfloat)alpha/65535.0f); +#endif + } + +static void AmiglColor3bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glColor3bv(v); +#else + glColor3ubv((const GLubyte *)v); +#endif + } + +static void AmiglColor3dv( const GLdouble *v ) + { + glColor3dv(v); + } + +static void AmiglColor3fv( GLfloat *v ) { glColor3fv(v); } + +static void AmiglColor3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glColor3iv(v); +#else + glColor3f((GLfloat)v[0]/429496795.0f, (GLfloat)v[1]/429496795.0f, (GLfloat)v[2]/429496795.f); +#endif + } + +static void AmiglColor3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glColor3sv(v); +#else + glColor3f((GLfloat)v[0]/65535.0f, (GLfloat)v[1]/65535.0f, (GLfloat)v[2]/65535.f); +#endif + } + +static void AmiglColor3ubv( GLubyte *v ) { glColor3ubv(v); } + +static void AmiglColor3uiv( const GLuint *v ) + { +#ifndef __MORPHOS__ + glColor3uiv(v); +#else + glColor3f((GLfloat)v[0]/429496795.0f, (GLfloat)v[1]/429496795.0f, (GLfloat)v[2]/429496795.f); +#endif + } + +static void AmiglColor3usv( const GLushort *v ) + { +#ifndef __MORPHOS__ + glColor3usv(v); +#else + glColor3f((GLfloat)v[0]/65535.0f, (GLfloat)v[1]/65535.0f, (GLfloat)v[2]/65535.f); +#endif + } + +static void AmiglColor4bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glColor4bv(v); +#else + glColor4ubv((const GLubyte *)v); +#endif + } + +static void AmiglColor4dv( const GLdouble *v ) + { + glColor4dv(v); + } + +static void AmiglColor4fv( GLfloat *v ) { glColor4fv(v); } + +static void AmiglColor4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glColor4iv(v); +#else + glColor4f((GLfloat)v[0]/429496795.0f, (GLfloat)v[1]/429496795.0f, (GLfloat)v[2]/429496795.0f, (GLfloat)v[3]/429496795.0f); +#endif + } + +static void AmiglColor4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glColor4sv(v); +#else + glColor4f((GLfloat)v[0]/65535.0f, (GLfloat)v[1]/65535.0f, (GLfloat)v[2]/65535.f, (GLfloat)v[3]/65535.0f); +#endif + } + +static void AmiglColor4ubv( GLubyte *v ) { glColor4ubv(v); } + +static void AmiglColor4uiv( const GLuint *v ) + { +#ifndef __MORPHOS__ + glColor4uiv(v); +#else + glColor4f((GLfloat)v[0]/429496795.0f, (GLfloat)v[1]/429496795.0f, (GLfloat)v[2]/429496795.0f, (GLfloat)v[3]/429496795.0f); +#endif + } + +static void AmiglColor4usv( const GLushort *v ) + { +#ifndef __MORPHOS__ + glColor4usv(v); +#else + glColor4f((GLfloat)v[0]/65535.0f, (GLfloat)v[1]/65535.0f, (GLfloat)v[2]/65535.f, (GLfloat)v[3]/65535.0f); +#endif + } + +static void AmiglTexCoord1d( GLdouble s ) + { + glTexCoord1d(s); + } + +static void AmiglTexCoord1f( GLfloat s ) + { + glTexCoord1f(s); + } + +static void AmiglTexCoord1i( GLint s ) + { +#ifndef __MORPHOS__ + glTexCoord1i(s); +#else + glTexCoord2f((GLfloat)s, 0.0f); +#endif + } + +static void AmiglTexCoord1s( GLshort s ) + { +#ifndef __MORPHOS__ + glTexCoord1s(s); +#else + glTexCoord2f((GLfloat)s, 0.0f); +#endif + } + +static void AmiglTexCoord2d( GLdouble s, GLdouble t ) + { + glTexCoord2d(s, t); + } + +static void AmiglTexCoord2f( GLfloat s, GLfloat t ) { glTexCoord2f(s, t); } + +static void AmiglTexCoord2i( GLint s, GLint t ) { glTexCoord2i(s, t); } + +static void AmiglTexCoord2s( GLshort s, GLshort t ) + { +#ifndef __MORPHOS__ + glTexCoord2s(s, t); +#else + glTexCoord2f((GLfloat)s, (GLfloat)t); +#endif + } + +static void AmiglTexCoord3d( GLdouble s, GLdouble t, GLdouble r ) + { +#ifndef __MORPHOS__ + glTexCoord3d(s, t, r); +#else + glTexCoord3f((GLfloat)s, (GLfloat)t, (GLfloat)r); +#endif + } + +static void AmiglTexCoord3f( GLfloat s, GLfloat t, GLfloat r ) + { + glTexCoord3f(s, t, r); + } + +static void AmiglTexCoord3i( GLint s, GLint t, GLint r ) + { +#ifndef __MORPHOS__ + glTexCoord3i(s, t, r); +#else + glTexCoord3f((GLfloat)s, (GLfloat)t, (GLfloat)r); +#endif + } + +static void AmiglTexCoord3s( GLshort s, GLshort t, GLshort r ) + { +#ifndef __MORPHOS__ + glTexCoord3s(s, t, r); +#else + glTexCoord3f((GLfloat)s, (GLfloat)t, (GLfloat)r); +#endif + } + +static void AmiglTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) + { +#ifndef __MORPHOS__ + glTexCoord4d(s, t, r, q); +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif + } + +static void AmiglTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) + { + glTexCoord4f(s, t, r, q); + } + +static void AmiglTexCoord4i( GLint s, GLint t, GLint r, GLint q ) + { +#ifndef __MORPHOS__ + glTexCoord4i(s, t, r, q); +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif + } + +static void AmiglTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) + { +#ifndef __MORPHOS__ + glTexCoord4s(s, t, r, q); +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif + } + +static void AmiglTexCoord1dv( const GLdouble *v ) + { + glTexCoord1dv(v); + } + +static void AmiglTexCoord1fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord1fv(v); +#else + glTexCoord1f(v[0]); +#endif + } + +static void AmiglTexCoord1iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord1iv(v); +#else + glTexCoord1f((GLfloat)v[0]); +#endif + } + +static void AmiglTexCoord1sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord1sv(v); +#else + glTexCoord1f((GLfloat)v[0]); +#endif + } + +static void AmiglTexCoord2dv( const GLdouble *v ) + { + glTexCoord2dv(v); + } + +static void AmiglTexCoord2fv( GLfloat *v ) { glTexCoord2fv(v); } + +static void AmiglTexCoord2iv( const GLint *v ) + { + glTexCoord2iv(v); + } + +static void AmiglTexCoord2sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord2sv(v); +#else + glTexCoord2f((GLfloat)v[0], (GLfloat)v[1]); +#endif + } + +static void AmiglTexCoord3dv( const GLdouble *v ) + { + glTexCoord3dv(v); + } + +static void AmiglTexCoord3fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord3fv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglTexCoord3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord3iv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglTexCoord3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord3sv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglTexCoord4dv( const GLdouble *v ) + { + glTexCoord4dv(v); + } + +static void AmiglTexCoord4fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord4fv(v); +#else + glTexCoord4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); +#endif + } + +static void AmiglTexCoord4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord4iv(v); +#else + glTexCoord4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); +#endif + } + +static void AmiglTexCoord4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord4sv(v); +#else + glTexCoord4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); +#endif + } + +static void AmiglRasterPos2d( GLdouble x, GLdouble y ) + { + glRasterPos2d(x, y); + } + +static void AmiglRasterPos2f( GLfloat x, GLfloat y ) { glRasterPos2f(x, y); } + +static void AmiglRasterPos2i( GLint x, GLint y ) { glRasterPos2i(x, y); } + +static void AmiglRasterPos2s( GLshort x, GLshort y ) + { + glRasterPos2s(x, y); + } + +static void AmiglRasterPos3d( GLdouble x, GLdouble y, GLdouble z ) { glRasterPos3d(x, y, z); } + +static void AmiglRasterPos3f( GLfloat x, GLfloat y, GLfloat z ) { glRasterPos3f(x, y, z); } + +static void AmiglRasterPos3i( GLint x, GLint y, GLint z ) +{ +#ifndef __MORPHOS__ + glRasterPos3i(x, y, z); +#else + glRasterPos3f((GLfloat)x, (GLfloat)y, (GLfloat)z); +#endif +} + +static void AmiglRasterPos3s( GLshort x, GLshort y, GLshort z ) +{ +#ifndef __MORPHOS__ + glRasterPos3s(x, y, z); +#else + glRasterPos3f((GLfloat)x, (GLfloat)y, (GLfloat)z); +#endif +} + +static void AmiglRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) + { +#ifndef __MORPHOS__ + glRasterPos4d(x, y, z, w); +#endif + } + +static void AmiglRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) + { +#ifndef __MORPHOS__ + glRasterPos4f(x, y, z, w); +#endif + } + +static void AmiglRasterPos4i( GLint x, GLint y, GLint z, GLint w ) + { +#ifndef __MORPHOS__ + glRasterPos4i(x, y, z, w); +#endif + } + +static void AmiglRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ) + { +#ifndef __MORPHOS__ + glRasterPos4s(x, y, z, w); +#endif + } + +static void AmiglRasterPos2dv( const GLdouble *v ) + { +#ifndef __MORPHOS__ + glRasterPos2dv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); +#endif + } + +static void AmiglRasterPos2fv( const GLfloat *v ) +{ + glRasterPos2fv((GLfloat *)v); +} + +static void AmiglRasterPos2iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glRasterPos2iv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); +#endif + } + +static void AmiglRasterPos2sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glRasterPos2sv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); +#endif + } + +static void AmiglRasterPos3dv( const GLdouble *v ) + { +#ifndef __MORPHOS__ + glRasterPos3dv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglRasterPos3fv( const GLfloat *v ) +{ + glRasterPos3fv((GLfloat *)v); +} + +static void AmiglRasterPos3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glRasterPos3iv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglRasterPos3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glRasterPos3sv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); +#endif + } + +static void AmiglRasterPos4dv( const GLdouble *v ) + { +#ifndef __MORPHOS__ + glRasterPos4dv(v); +#endif + } + +static void AmiglRasterPos4fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glRasterPos4fv(v); +#endif + } + +static void AmiglRasterPos4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glRasterPos4iv(v); +#endif + } + +static void AmiglRasterPos4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glRasterPos4sv(v); +#endif + } + +static void AmiglRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) { glRectd(x1, y1, x2, y2); } +static void AmiglRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { glRectf(x1, y1, x2, y2); } +static void AmiglRecti( GLint x1, GLint y1, GLint x2, GLint y2 ) { glRecti(x1, y1, x2, y2); } + +static void AmiglRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) + { + glRects(x1, y1, x2, y2); + } + +static void AmiglRectdv( GLdouble *v1, GLdouble *v2 ) { glRectdv(v1, v2); } +static void AmiglRectfv( GLfloat *v1, GLfloat *v2 ) { glRectfv(v1, v2); } +static void AmiglRectiv( GLint *v1, GLint *v2 ) { glRectiv(v1, v2); } + +static void AmiglRectsv( const GLshort *v1, const GLshort *v2 ) + { +#ifndef __MORPHOS__ + glRectsv(v1, v2); +#endif + } + +/* + * Vertex Arrays (1.1) + */ + +static void AmiglVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { + glVertexPointer(size, type, stride, ptr); + } + +static void AmiglNormalPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) { + glNormalPointer(type, stride, ptr); + } + +static void AmiglColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { + glColorPointer(size, type, stride, ptr); + } + +static void AmiglIndexPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glIndexPointer(type, stride, ptr); +#endif + } + +static void AmiglTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { + glTexCoordPointer(size, type, stride, ptr); + } + +static void AmiglEdgeFlagPointer( GLsizei stride, const GLboolean *ptr ) { +#ifndef __MORPHOS__ + glEdgeFlagPointer(stride, ptr); +#endif + } + +static void AmiglGetPointerv( GLenum pname, void **params ) { + glGetPointerv(pname, params); + } + +static void AmiglArrayElement( GLint i ) { glArrayElement(i); } + +static void AmiglDrawArrays( GLenum mode, GLint first, GLsizei count ) { + glDrawArrays(mode, first, count); + } + +static void AmiglDrawElements( GLenum mode, GLsizei count, GLenum type, GLvoid *indices ) { + glDrawElements(mode, count, type, indices); + } + +static void AmiglInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer ) { +#ifndef __MORPHOS__ + glInterleavedArrays(format, stride, pointer); +#endif + } + +/* + * Lighting + */ + +static void AmiglShadeModel( GLenum mode ) { glShadeModel(mode); } + +static void AmiglLightf( GLenum light, GLenum pname, GLfloat param ) { glLightf(light, pname, param); } +static void AmiglLighti( GLenum light, GLenum pname, GLint param ) + { + glLighti(light, pname, param); + } + +static void AmiglLightfv( GLenum light, GLenum pname, + GLfloat *params ) { glLightfv(light, pname, params); } +static void AmiglLightiv( GLenum light, GLenum pname, const GLint *params ) + { +#ifndef __MORPHOS__ + glLightiv(light, pname, params); +#endif + } + +static void AmiglGetLightfv( GLenum light, GLenum pname, GLfloat *params ) + { + glGetLightfv(light, pname, params); + } + +static void AmiglGetLightiv( GLenum light, GLenum pname, GLint *params ) + { +#ifndef __MORPHOS__ + glGetLightiv(light, pname, params); +#endif + } + +static void AmiglLightModelf( GLenum pname, GLfloat param ) { glLightModelf(pname, param); } +static void AmiglLightModeli( GLenum pname, GLint param ) { glLightModeli(pname, param); } +static void AmiglLightModelfv( GLenum pname, GLfloat *params ) { glLightModelfv(pname, params); } +static void AmiglLightModeliv( GLenum pname, const GLint *params ) + { +#ifndef __MORPHOS__ + glLightModeliv(pname, params); +#endif +} + +static void AmiglMaterialf( GLenum face, GLenum pname, GLfloat param ) { glMaterialf(face, pname, param); } +static void AmiglMateriali( GLenum face, GLenum pname, GLint param ) +{ + glMateriali(face, pname, param); +} + +static void AmiglMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { glMaterialfv(face, pname, params); } +static void AmiglMaterialiv( GLenum face, GLenum pname, const GLint *params ) + { +#ifndef __MORPHOS__ + glMaterialiv(face, pname, params); +#endif + } + +static void AmiglGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) + { + glGetMaterialfv(face, pname, params); +} + +static void AmiglGetMaterialiv( GLenum face, GLenum pname, GLint *params ) + { +#ifndef __MORPHOS__ + glGetMaterialiv(face, pname, params); +#endif + } + +static void AmiglColorMaterial( GLenum face, GLenum mode ) { glColorMaterial(face, mode); } + +/* + * Raster functions + */ + +static void AmiglPixelZoom( GLfloat xfactor, GLfloat yfactor ) + { + glPixelZoom(xfactor, yfactor); + } + +static void AmiglPixelStoref( GLenum pname, GLfloat param ) { glPixelStoref(pname, param); } +static void AmiglPixelStorei( GLenum pname, GLint param ) { glPixelStorei(pname, param); } + +static void AmiglPixelTransferf( GLenum pname, GLfloat param ) + { + glPixelTransferf(pname, param); + } + +static void AmiglPixelTransferi( GLenum pname, GLint param ) + { + glPixelTransferi(pname, param); + } + +static void AmiglPixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) + { +#ifndef __MORPHOS__ + glPixelMapfv(map, mapsize, values); +#endif + } + +static void AmiglPixelMapuiv( GLenum map, GLint mapsize, const GLuint *values ) + { +#ifndef __MORPHOS__ + glPixelMapuiv(map, mapsize, values); +#endif + } + +static void AmiglPixelMapusv( GLenum map, GLint mapsize, const GLushort *values ) + { +#ifndef __MORPHOS__ + glPixelMapusv(map, mapsize, values); +#endif + } + +static void AmiglGetPixelMapfv( GLenum map, GLfloat *values ) + { +#ifndef __MORPHOS__ + glGetPixelMapfv(map, values); +#endif + } + +static void AmiglGetPixelMapuiv( GLenum map, GLuint *values ) + { +#ifndef __MORPHOS__ + glGetPixelMapuiv(map, values); +#endif + } + +static void AmiglGetPixelMapusv( GLenum map, GLushort *values ) + { +#ifndef __MORPHOS__ + glGetPixelMapusv(map, values); +#endif + } + +static void AmiglBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ) { + + glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); + } + +static void AmiglReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ) { + glReadPixels(x, y, width, height, format, type, pixels); + } + +static void AmiglDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ) { + glDrawPixels(width, height, format, type, pixels); + } + +static void AmiglCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ) { + glCopyPixels(x, y, width, height, type); + } + +/* + * Stenciling + */ + +static void AmiglStencilFunc( GLenum func, GLint ref, GLuint mask ) { + glStencilFunc(func, ref, mask); + } + +static void AmiglStencilMask( GLuint mask ) { + glStencilMask(mask); + } + +static void AmiglStencilOp( GLenum fail, GLenum zfail, GLenum zpass ) { + glStencilOp(fail, zfail, zpass); + } + +static void AmiglClearStencil( GLint s ) { + glClearStencil(s); + } + +/* + * Texture mapping + */ + +static void AmiglTexGend( GLenum coord, GLenum pname, GLdouble param ) + { + glTexGend(coord, pname, param); + } + +static void AmiglTexGenf( GLenum coord, GLenum pname, GLfloat param ) { glTexGenf(coord, pname, param); } +static void AmiglTexGeni( GLenum coord, GLenum pname, GLint param ) { glTexGeni(coord, pname, param); } + +static void AmiglTexGendv( GLenum coord, GLenum pname, const GLdouble *params ) + { +#ifndef __MORPHOS__ + glTexGendv(coord, pname, params); +#endif + } + +static void AmiglTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) + { + glTexGenfv(coord, pname, params); + } + +static void AmiglTexGeniv( GLenum coord, GLenum pname, const GLint *params ) + { +#ifndef __MORPHOS__ + glTexGeniv(coord, pname, params); +#endif + } + +static void AmiglGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) + { +#ifndef __MORPHOS__ + glGetTexGendv(coord, pname, params); +#endif + } + +static void AmiglGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) + { +#ifndef __MORPHOS__ + glGetTexGenfv(coord, pname, params); +#endif + } + +static void AmiglGetTexGeniv( GLenum coord, GLenum pname, GLint *params ) + { +#ifndef __MORPHOS__ + glGetTexGeniv(coord, pname, params); +#endif + } + +static void AmiglTexEnvf( GLenum target, GLenum pname, GLfloat param ) + { + glTexEnvf(target, pname, param); + } + +static void AmiglTexEnvi( GLenum target, GLenum pname, GLint param ) + { + glTexEnvi(target, pname, param); + } + +static void AmiglTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) + { + glTexEnvfv(target, pname, params); + } + +static void AmiglTexEnviv( GLenum target, GLenum pname, const GLint *params ) + { + glTexEnviv(target, pname, params); + } + +static void AmiglGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) + { + glGetTexEnvfv(target, pname, params); + } + +static void AmiglGetTexEnviv( GLenum target, GLenum pname, GLint *params ) + { + glGetTexEnviv(target, pname, params); + } + +static void AmiglTexParameterf( GLenum target, GLenum pname, GLfloat param ) { glTexParameterf(target, pname, param); } +static void AmiglTexParameteri( GLenum target, GLenum pname, GLint param ) { glTexParameteri(target, pname, param); } + +static void AmiglTexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) { + glTexParameterfv(target, pname, params); + } +static void AmiglTexParameteriv( GLenum target, GLenum pname, const GLint *params ) { + glTexParameteriv(target, pname, params); + } + +static void AmiglGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params) { + glGetTexParameterfv(target, pname, params); + } + +static void AmiglGetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { + glGetTexParameteriv(target, pname, params); + } + +static void AmiglGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { +#ifndef __MORPHOS__ + glGetTexLevelParameterfv(target, level, pname, params); +#endif + } + +static void AmiglGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { + glGetTexLevelParameteriv(target, level, pname, params); + } + +static void AmiglTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) { + glTexImage1D(target, level, internalFormat, + width, border, format, type, pixels); + } + +static void AmiglTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + GLvoid *pixels ) { + + glTexImage2D(target, level, internalFormat, + width, height, border, format, type, pixels); + } + +static void AmiglGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ) { + glGetTexImage(target, level, format, type, pixels); + } + +/* 1.1 functions */ + +static void AmiglGenTextures( GLsizei n, GLuint *textures ) { + glGenTextures(n, textures); +} + +static void AmiglDeleteTextures( GLsizei n, const GLuint *textures) { + glDeleteTextures(n, textures); + } + +static void AmiglBindTexture( GLenum target, GLuint texture ) { + glBindTexture(target, texture); + } + +static void AmiglPrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities ) { + glPrioritizeTextures(n, textures, priorities); + } + +static GLboolean AmiglAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { +#ifndef __MORPHOS__ + return glAreTexturesResident(n, textures, residences); +#else + return 0; +#endif + } + +static GLboolean AmiglIsTexture( GLuint texture ) { + return glIsTexture(texture); + } + +static void AmiglTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ) { +#ifndef __MORPHOS__ + glTexSubImage1D(target, level, xoffset, width, format, type, pixels); +#else + glTexSubImage1D(target, level, xoffset, width, format, type, (GLvoid *)pixels); +#endif + } + +static void AmiglTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ) { +#ifndef __MORPHOS__ + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +#else + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (GLvoid *)pixels); +#endif + } + +static void AmiglCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ) { +#ifndef __MORPHOS__ + glCopyTexImage1D(target, level, internalformat, x, y, width, border); +#endif + } + +static void AmiglCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ){ + glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); + } + +static void AmiglCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ) { +#ifndef __MORPHOS__ + glCopyTexSubImage1D(target, level, xoffset, x, y, width); +#endif + } + +static void AmiglCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ) { + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + } + +/* + * Evaluators + */ + +static void AmiglMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ) { + glMap1d(target, u1, u2, stride, order, points); + } +static void AmiglMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ) { + glMap1f(target, u1, u2, stride, order, points); + } + +static void AmiglMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ) { + glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + } +static void AmiglMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ) { + glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + } + +static void AmiglGetMapdv( GLenum target, GLenum query, GLdouble *v ) { + glGetMapdv(target, query, v); + } +static void AmiglGetMapfv( GLenum target, GLenum query, GLfloat *v ) { + glGetMapfv(target, query, v); + } +static void AmiglGetMapiv( GLenum target, GLenum query, GLint *v ) { + glGetMapiv(target, query, v); + } + +static void AmiglEvalCoord1d( GLdouble u ) { +#ifndef __MORPHOS__ + glEvalCoord1d(u); +#endif + } +static void AmiglEvalCoord1f( GLfloat u ) { + glEvalCoord1f(u); + } + +static void AmiglEvalCoord1dv( const GLdouble *u ) { +#ifndef __MORPHOS__ + glEvalCoord1dv(u); +#endif + } +static void AmiglEvalCoord1fv( const GLfloat *u ) { + glEvalCoord1fv(u); + } + +static void AmiglEvalCoord2d( GLdouble u, GLdouble v ) { +#ifndef __MORPHOS__ + glEvalCoord2d(u, v); +#endif + } +static void AmiglEvalCoord2f( GLfloat u, GLfloat v ) { + glEvalCoord2f(u, v); + } + +static void AmiglEvalCoord2dv( const GLdouble *u ) { +#ifndef __MORPHOS__ + glEvalCoord2dv(u); +#endif + } +static void AmiglEvalCoord2fv( const GLfloat *u ) { + glEvalCoord2fv(u); + } + +static void AmiglMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { + glMapGrid1d(un, u1, u2); + } +static void AmiglMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { + glMapGrid1f(un, u1, u2); + } + +static void AmiglMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { + glMapGrid2d(un, u1, u2, vn, v1, v2); + } +static void AmiglMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { + glMapGrid2f(un, u1, u2, vn, v1, v2); + } + +static void AmiglEvalPoint1( GLint i ) { + glEvalPoint1(i); + } + +static void AmiglEvalPoint2( GLint i, GLint j ) { + glEvalPoint2(i, j); + } + +static void AmiglEvalMesh1( GLenum mode, GLint i1, GLint i2 ) { + glEvalMesh1(mode, i1, i2); + } + +static void AmiglEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { + glEvalMesh2(mode, i1, i2, j1, j2); + } + +/* + * Fog + */ + +static void AmiglFogf( GLenum pname, GLfloat param ) { + glFogf(pname, param); + } + +static void AmiglFogi( GLenum pname, GLint param ) { + glFogi(pname, param); + } + +static void AmiglFogfv( GLenum pname, GLfloat *params ) { + glFogfv(pname, params); + } + +static void AmiglFogiv( GLenum pname, const GLint *params ) { +#ifndef __MORPHOS__ + glFogiv(pname, params); +#endif + } + +/* + * Selection and Feedback + */ + +static void AmiglFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { +#ifndef __MORPHOS__ + glFeedbackBuffer(size, type, buffer); +#endif + } + +static void AmiglPassThrough( GLfloat token ) { +#ifndef __MORPHOS__ + glPassThrough(token); +#endif + } + +static void AmiglSelectBuffer( GLsizei size, GLuint *buffer ) { + glSelectBuffer(size, buffer); + } + +static void AmiglInitNames( void ) { + glInitNames(); + } + +static void AmiglLoadName( GLuint name ) { + glLoadName(name); + } + +static void AmiglPushName( GLuint name ) { + glPushName(name); + } + +static void AmiglPopName( void ) { + glPopName(); + } + +/* + * 1.0 Extensions + */ + +/* GL_EXT_blend_minmax Imaging subset */ +static void AmiglBlendEquationEXT( GLenum mode ) { +#ifndef __MORPHOS__ + glBlendEquationEXT(mode); +#endif + } + +/* GL_EXT_blend_color Imaging subset */ +static void AmiglBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { +#ifndef __MORPHOS__ + glBlendColorEXT(red, green, blue, alpha); +#endif + } + +/* GL_EXT_color_table */ + +static void AmiglColorTableEXT( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ) { +#ifndef __MORPHOS__ + glColorTableEXT(target, internalformat, width, format, type, table); +#else + glColorTable(target, internalformat, width, format, type, (GLvoid *)table); +#endif + } + +static void AmiglColorSubTableEXT( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ) { +#ifndef __MORPHOS__ + glColorSubTableEXT(target, start, count, format, type, data); +#endif + } + +static void AmiglGetColorTableEXT( GLenum target, GLenum format, + GLenum type, GLvoid *table ) { +#ifndef __MORPHOS__ + glGetColorTableEXT(target, format, type, table); +#endif + } + +static void AmiglGetColorTableParameterfvEXT( GLenum target, + GLenum pname, + GLfloat *params ) { +#ifndef __MORPHOS__ + glGetColorTableParameterfvEXT(target, pname, params); +#endif + } + +static void AmiglGetColorTableParameterivEXT( GLenum target, + GLenum pname, + GLint *params ) { +#ifndef __MORPHOS__ + glGetColorTableParameterivEXT(target, pname, params); +#endif + } + + +#ifndef __MORPHOS__ +/* GL_EXT_multitexture */ + +static void AmiglMultiTexCoord1dEXT(GLenum target, GLdouble s) { + glMultiTexCoord1dEXT(target, s); + } +static void AmiglMultiTexCoord1dvEXT(GLenum target, const GLdouble *v) { + glMultiTexCoord1dvEXT(target, v); + } +static void AmiglMultiTexCoord1fEXT(GLenum target, GLfloat s) { + glMultiTexCoord1fEXT(target, s); + } +static void AmiglMultiTexCoord1fvEXT(GLenum target, const GLfloat *v) { + glMultiTexCoord1fvEXT(target, v); + } +static void AmiglMultiTexCoord1iEXT(GLenum target, GLint s) { + glMultiTexCoord1iEXT(target, s); + } +static void AmiglMultiTexCoord1ivEXT(GLenum target, const GLint *v) { + glMultiTexCoord1ivEXT(target, v); + } +static void AmiglMultiTexCoord1sEXT(GLenum target, GLshort s) { + glMultiTexCoord1sEXT(target, s); + } +static void AmiglMultiTexCoord1svEXT(GLenum target, const GLshort *v) { + glMultiTexCoord1svEXT(target, v); + } +static void AmiglMultiTexCoord2dEXT(GLenum target, GLdouble s, GLdouble t) { + glMultiTexCoord2dEXT(target, s, t); + } +static void AmiglMultiTexCoord2dvEXT(GLenum target, const GLdouble *v) { + glMultiTexCoord2dvEXT(target, v); + } +static void AmiglMultiTexCoord2fEXT(GLenum target, GLfloat s, GLfloat t) { + glMultiTexCoord2fEXT(target, s, t); + } +static void AmiglMultiTexCoord2fvEXT(GLenum target, const GLfloat *v) { + glMultiTexCoord2fvEXT(target, v); + } +static void AmiglMultiTexCoord2iEXT(GLenum target, GLint s, GLint t) { + glMultiTexCoord2iEXT(target, s, t); + } +static void AmiglMultiTexCoord2ivEXT(GLenum target, const GLint *v) { + glMultiTexCoord2ivEXT(target, v); + } +static void AmiglMultiTexCoord2sEXT(GLenum target, GLshort s, GLshort t) { + glMultiTexCoord2sEXT(target, s, t); + } +static void AmiglMultiTexCoord2svEXT(GLenum target, const GLshort *v) { + glMultiTexCoord2svEXT(target, v); + } +static void AmiglMultiTexCoord3dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r) { + glMultiTexCoord3dEXT(target, s, t, r); + } +static void AmiglMultiTexCoord3dvEXT(GLenum target, const GLdouble *v) { + glMultiTexCoord3dvEXT(target, v); + } +static void AmiglMultiTexCoord3fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r) { + glMultiTexCoord3fEXT(target, s, t, r); + } +static void AmiglMultiTexCoord3fvEXT(GLenum target, const GLfloat *v) { + glMultiTexCoord3fvEXT(target, v); + } +static void AmiglMultiTexCoord3iEXT(GLenum target, GLint s, GLint t, GLint r) { + glMultiTexCoord3iEXT(target, s, t, r); + } +static void AmiglMultiTexCoord3ivEXT(GLenum target, const GLint *v) { + glMultiTexCoord3ivEXT(target, v); + } +static void AmiglMultiTexCoord3sEXT(GLenum target, GLshort s, GLshort t, GLshort r) { + glMultiTexCoord3sEXT(target, s, t, r); + } +static void AmiglMultiTexCoord3svEXT(GLenum target, const GLshort *v) { + glMultiTexCoord3svEXT(target, v); + } +static void AmiglMultiTexCoord4dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { + glMultiTexCoord4dEXT(target, s, t, r, q); + } +static void AmiglMultiTexCoord4dvEXT(GLenum target, const GLdouble *v) { + glMultiTexCoord4dvEXT(target, v); + } +static void AmiglMultiTexCoord4fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { + glMultiTexCoord4fEXT(target, s, t, r, q); + } +static void AmiglMultiTexCoord4fvEXT(GLenum target, const GLfloat *v) { + glMultiTexCoord4fvEXT(target, v); + } +static void AmiglMultiTexCoord4iEXT(GLenum target, GLint s, GLint t, GLint r, GLint q) { + glMultiTexCoord4iEXT(target, s, t, r, q); + } +static void AmiglMultiTexCoord4ivEXT(GLenum target, const GLint *v) { + glMultiTexCoord4ivEXT(target, v); + } +static void AmiglMultiTexCoord4sEXT(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { + glMultiTexCoord4sEXT(target, s, t, r, q); + } +static void AmiglMultiTexCoord4svEXT(GLenum target, const GLshort *v) { + glMultiTexCoord4svEXT(target, v); + } +static void AmiglInterleavedTextureCoordSetsEXT( GLint factor ) { + glInterleavedTextureCoordSetsEXT(factor); + } + +static void AmiglSelectTextureEXT( GLenum target ) { + glSelectTextureEXT(target); + } + +static void AmiglSelectTextureCoordSetEXT( GLenum target ) { + glSelectTextureCoordSetEXT(target); + } + +static void AmiglSelectTextureTransformEXT( GLenum target ) { + glSelectTextureTransformEXT(target); + } +#endif + +/* GL_EXT_point_parameters */ +#ifdef __MORPHOS__ +#define GLPointParameterf GLPointParameterfEXT +#endif +static void AmiglPointParameterfEXT( GLenum pname, GLfloat param ) { + glPointParameterfEXT(pname, param); + } + +static void AmiglPointParameterfvEXT( GLenum pname, GLfloat *params ) { + glPointParameterfvEXT(pname, params); + } + +/* 1.2 functions */ +static void AmiglDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) { + #ifndef __MORPHOS__ + glDrawRangeElements(mode, start, end, count, type, indices); + #else + glDrawRangeElements(mode, start, end, count, type, (GLvoid *)indices); + #endif + } + +static void AmiglTexImage3D( GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) { +#ifndef __MORPHOS__ + glTexImage3D(target, level, internalFormat, width, height, depth, + border, format, type, pixels); +#endif + } + +static void AmiglTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels) { +#ifndef __MORPHOS__ + glTexSubImage3D(target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, pixels); +#endif + } + +static void AmiglCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ) { +#ifndef __MORPHOS__ + glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); +#endif + } + +/* GL_EXT_compiled_vertex_array */ + +static void AmiglLockArraysEXT( GLint first, GLint count ) { + glLockArraysEXT(first, count); +} + +static void AmiglUnlockArraysEXT( void ) { + glUnlockArraysEXT(); +} + +/* GL_ARB_multitexture */ + +#ifdef __MORPHOS__ +#define glMultiTexCoord2dvARB(a, v) GLMultiTexCoord2dvARB(__tglContext, a, v) +//#define glMultiTexCoord3dvARB(a, v) GLMultiTexCoord3dvARB(__tglContext, a, v) +#endif + +static void AmiglActiveTextureARB(GLenum unit) { + glActiveTextureARB(unit); +} + +static void AmiglMultiTexCoord2fARB(GLenum unit, GLfloat s, GLfloat t) { + glMultiTexCoord2fARB(unit, s, t); +} + +static void AmiglMultiTexCoord3fARB(GLenum unit, GLfloat s, GLfloat t, GLfloat r) { + glMultiTexCoord3fARB(unit, s, t, r); +} + +static void AmiglMultiTexCoord4fARB(GLenum unit, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { + glMultiTexCoord4fARB(unit, s, t, r, q); +} + +static void AmiglMultiTexCoord2fvARB(GLenum unit, const GLfloat *v) { + glMultiTexCoord2fvARB(unit, v); +} + +static void AmiglMultiTexCoord3fvARB(GLenum unit, const GLfloat *v) { + glMultiTexCoord3fvARB(unit, v); +} + +static void AmiglMultiTexCoord4fvARB(GLenum unit, const GLfloat *v) { + glMultiTexCoord4fvARB(unit, v); +} + +static void AmiglMultiTexCoord2dvARB(GLenum unit, const GLdouble *v) { + glMultiTexCoord2dvARB(unit, v); +} + +static void AmiglMultiTexCoord3dvARB(GLenum unit, const GLdouble *v) { + //glMultiTexCoord3dvARB(unit, v); +} + +static void AmiglClientActiveTextureARB(GLenum unit) { + glClientActiveTextureARB(unit); +} + +/* 1.5 functions*/ + +/* GL_ARB_vertex_buffer_object */ + +static void AmiglGenBuffers(GLuint num, GLuint *out) { + glGenBuffers(num, out); +} + +static void AmiglBufferData(GLenum target, GLsizei size, const GLvoid * data, GLenum usage) { + glBufferData(target, size, data, usage); +} + +static void AmiglBufferSubData(GLenum target, GLintptr offset, GLsizei size, const GLvoid * data) { + glBufferSubData(target, offset, size, data); +} + +static void AmiglBindBuffer(GLenum target, GLuint buffer) { + glBindBuffer(target, buffer); +} + +static void AmiglDeleteBuffers(GLsizei n, const GLuint *buffers) { + glDeleteBuffers(n, buffers); +} + +static void AmiglGetBufferParameteriv(GLenum target, GLenum value, GLint * data) { + glGetBufferParameteriv(target, value, data); +} + +/* shaders */ + +static void AmiglAttachShader(GLuint program, GLuint shader) { + glAttachShader(program, shader); +} + +static void AmiglCompileShader(GLuint shader) { + glCompileShader(shader); +} + +static void AmiglLinkProgram(GLuint program) { + glLinkProgram(program); +} + +static void AmiglUseProgram(GLuint program) { + glUseProgram(program); +} + +static GLuint AmiglCreateShader(GLenum type) { + return glCreateShader(type); +} + +static GLuint AmiglCreateProgram(void) { + return glCreateProgram(); +} + +static void AmiglShaderSource(GLuint shader, GLsizei count, const GLchar **string, const GLint *length) { + glShaderSource(shader, count, string, length); +} + +static void AmiglValidateProgram(GLuint program) { + glValidateProgram(program); +} + +static void AmiglUniform1f(GLint location, GLfloat v0) { + glUniform1f(location, v0); +} + +static void AmiglUniform2f(GLint location, GLfloat v0, GLfloat v1) { + glUniform2f(location, v0, v1); +} + +static void AmiglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { + glUniform3f(location, v0, v1, v2); +} + +static void AmiglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { + glUniform4f(location, v0, v1, v2, v3); +} + +static void AmiglUniform1i(GLint location, GLint v0) { + glUniform1i(location, v0); +} + +static void AmiglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { + glUniformMatrix4fv(location, count, transpose, value); +} + +static GLint AmiglGetUniformLocation(GLuint program, const char *name) { + return glGetUniformLocation(program, name); +} + +static void AmiglUniform4fv(GLint location, GLsizei count, const GLfloat *value) { + glUniform4fv(location, count, value); +} + +static GLint AmiglGetAttribLocation(GLuint program, const GLchar *name) { + return glGetAttribLocation(program, name); +} + +static void AmiglVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer) { + glVertexAttribPointer(index, size, type, normalized, stride, pointer); +} + +static void AmiglEnableVertexAttribArray(GLuint index) { + glEnableVertexAttribArray(index); +} + +static void AmiglDisableVertexAttribArray(GLuint index) { + glDisableVertexAttribArray(index); +} + +static void AmiglGetShaderiv(GLuint shader, GLenum pname, GLint *params) { + glGetShaderiv(shader, pname, params); +} + +static void AmiglGetProgramiv(GLuint program, GLenum pname, GLint *params) { + glGetProgramiv(program, pname, params); +} + +static void AmiglGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { + glGetProgramInfoLog(program, bufSize, length, infoLog); +} + +static void AmiglGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { + glGetShaderInfoLog(shader, bufSize, length, infoLog); +} + + +/* The GLU API */ + +/* + * + * Miscellaneous functions + * + * These functions are in libGLU.a but require constructor handling... so these are left out. + */ + +static void AmigluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez, + GLdouble centerx, GLdouble centery, + GLdouble centerz, + GLdouble upx, GLdouble upy, GLdouble upz ) { + + gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz); + } + +static void AmigluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar ) { + gluPerspective(fovy, aspect, zNear, zFar); + } + +static void AmigluPickMatrix( GLdouble x, GLdouble y, GLdouble width, GLdouble height, const GLint viewport[4] ) +{ + gluPickMatrix(x, y, width, height, (GLint *)viewport); +} + +#ifndef __MORPHOS__ +static void AmigluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top ) { + gluOrtho2D(left, right, bottom, top); + } + +static GLint AmigluProject( GLdouble objx, GLdouble objy, GLdouble objz, + const GLdouble modelMatrix[16], + const GLdouble projMatrix[16], + const GLint viewport[4], + GLdouble *winx, GLdouble *winy, + GLdouble *winz ) +{ + return gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz); +} + +static GLint AmigluUnProject( GLdouble winx, GLdouble winy, + GLdouble winz, + const GLdouble modelMatrix[16], + const GLdouble projMatrix[16], + const GLint viewport[4], + GLdouble *objx, GLdouble *objy, + GLdouble *objz ) { + + return gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz); + } + +static const GLubyte* AmigluErrorString( GLenum errorCode ) { +#ifndef __MORPHOS__ + return gluErrorString(errorCode); +#else + return NULL; +#endif + } + +/* + * + * Mipmapping and image scaling + * + */ + +static GLint AmigluScaleImage( GLenum format, + GLint widthin, GLint heightin, + GLenum typein, const void *datain, + GLint widthout, GLint heightout, + GLenum typeout, void *dataout ) { + return gluScaleImage(format, widthin, heightin, typein, datain, widthout, heightout, typeout, dataout); + } + +static GLint AmigluBuild1DMipmaps( GLenum target, GLint components, + GLint width, GLenum format, + GLenum type, const void *data ) { +#ifndef __MORPHOS__ + return gluBuild1DMipmaps(target, components, width, format, type, data); +#else + return 0; +#endif + } + +static GLint AmigluBuild2DMipmaps( GLenum target, GLint components, + GLint width, GLint height, + GLenum format, + GLenum type, void *data ) { + + return gluBuild2DMipmaps(target, components, width, height, format, type, data); + } + +/* + * + * Quadrics + * + */ + +static GLUquadricObj* AmigluNewQuadric( void ) { + return gluNewQuadric(); + } + +static void AmigluDeleteQuadric( GLUquadricObj *state ) { + gluDeleteQuadric(state); + } + +static void AmigluQuadricDrawStyle( GLUquadricObj *quadObject, GLenum drawStyle ) { + gluQuadricDrawStyle(quadObject, drawStyle); + } + +static void AmigluQuadricOrientation( GLUquadricObj *quadObject, GLenum orientation ) { + gluQuadricOrientation(quadObject, orientation); + } + +static void AmigluQuadricNormals( GLUquadricObj *quadObject, GLenum normals ) { + gluQuadricNormals(quadObject, normals); + } + +static void AmigluQuadricTexture( GLUquadricObj *quadObject, GLboolean textureCoords ) { + gluQuadricTexture(quadObject, textureCoords); + } + +/* +static void AmigluQuadricCallback( GLUquadricObj *qobj, GLenum which, void (CALLBACK *fn)() ) { + gluQuadricCallback(qobj, which, fn); + } +*/ +static void AmigluQuadricCallback( GLUquadricObj *qobj, GLenum which, void *fn) { +#ifndef __MORPHOS__ + gluQuadricCallback(qobj, which, fn); +#endif + } + +static void AmigluCylinder( GLUquadricObj *qobj, + GLdouble baseRadius, + GLdouble topRadius, + GLdouble height, + GLint slices, GLint stacks ) { + gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks); + } + +static void AmigluSphere( GLUquadricObj *qobj, GLdouble radius, GLint slices, GLint stacks ) { + gluSphere(qobj, radius, slices, stacks); + } + +static void AmigluDisk( GLUquadricObj *qobj, + GLdouble innerRadius, GLdouble outerRadius, + GLint slices, GLint loops ) { + gluDisk(qobj, innerRadius, outerRadius, slices, loops); + } + +static void AmigluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius, + GLdouble outerRadius, GLint slices, + GLint loops, GLdouble startAngle, + GLdouble sweepAngle ) { + gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle); + } + +/* + * + * Nurbs + * + */ + +static GLUnurbsObj* AmigluNewNurbsRenderer( void ) { +#ifndef __MORPHOS__ + return gluNewNurbsRenderer(); +#else + return NULL; +#endif + } + +static void AmigluDeleteNurbsRenderer( GLUnurbsObj *nobj ) { +#ifndef __MORPHOS__ + gluDeleteNurbsRenderer(nobj); +#endif + } + +static void AmigluLoadSamplingMatrices( GLUnurbsObj *nobj, + const GLfloat modelMatrix[16], + const GLfloat projMatrix[16], + const GLint viewport[4] ) { +#ifndef __MORPHOS__ + gluLoadSamplingMatrices(nobj, modelMatrix, projMatrix, viewport); +#endif + } + +static void AmigluNurbsProperty( GLUnurbsObj *nobj, GLenum property, GLfloat value ) { +#ifndef __MORPHOS__ + gluNurbsProperty(nobj, property, value); +#endif + } + +static void AmigluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property, GLfloat *value ) +{ +#ifndef __MORPHOS__ + gluGetNurbsProperty(nobj, property, value); +#endif +} + +static void AmigluBeginCurve( GLUnurbsObj *nobj ) +{ +#ifndef __MORPHOS__ + gluBeginCurve(nobj); +#endif +} + +static void AmigluEndCurve( GLUnurbsObj * nobj ) +{ +#ifndef __MORPHOS__ + gluEndCurve(nobj); +#endif +} + +static void AmigluNurbsCurve( GLUnurbsObj *nobj, GLint nknots, + GLfloat *knot, GLint stride, + GLfloat *ctlarray, GLint order, + GLenum type ) +{ +#ifndef __MORPHOS__ + gluNurbsCurve(nobj, nknots, knot, stride, ctlarray, order, type); +#endif +} + +static void AmigluBeginSurface( GLUnurbsObj *nobj ) +{ +#ifndef __MORPHOS__ + gluBeginSurface(nobj); +#endif +} + +static void AmigluEndSurface( GLUnurbsObj * nobj ) +{ +#ifndef __MORPHOS__ + gluEndSurface(nobj); +#endif +} + +static void AmigluNurbsSurface( GLUnurbsObj *nobj, + GLint sknot_count, GLfloat *sknot, + GLint tknot_count, GLfloat *tknot, + GLint s_stride, GLint t_stride, + GLfloat *ctlarray, + GLint sorder, GLint torder, + GLenum type ) +{ +#ifndef __MORPHOS__ + gluNurbsSurface(nobj, sknot_count, sknot, tknot_count, tknot, s_stride, t_stride, ctlarray, sorder, torder, type); +#endif +} + +static void AmigluBeginTrim( GLUnurbsObj *nobj ) +{ +#ifndef __MORPHOS__ + gluBeginTrim(nobj); +#endif +} + +static void AmigluEndTrim( GLUnurbsObj *nobj ) +{ +#ifndef __MORPHOS__ + gluEndTrim(nobj); +#endif +} + +static void AmigluPwlCurve( GLUnurbsObj *nobj, GLint count, GLfloat *array, GLint stride, GLenum type ) { +#ifndef __MORPHOS__ + gluPwlCurve(nobj, count, array, stride, type); +#endif + } + +static void AmigluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void *fn ) +{ +#ifndef __MORPHOS__ + gluNurbsCallback(nobj, which, fn); +#endif +} + +/* + * + * Polygon tesselation + * + */ + +static GLUtriangulatorObj* AmigluNewTess( void ) { + return gluNewTess(); + } + +/* +static void AmigluTessCallback( GLUtriangulatorObj *tobj, GLenum which, void (CALLBACK *fn)() ) { + gluTessCallback(tobj, which, fn); + } +*/ +static void AmigluTessCallback( GLUtriangulatorObj *tobj, GLenum which, void *fn ) { + gluTessCallback(tobj, which, fn); + } + +static void AmigluDeleteTess( GLUtriangulatorObj *tobj ) { + gluDeleteTess(tobj); + } + +static void AmigluBeginPolygon( GLUtriangulatorObj *tobj ) { + gluBeginPolygon(tobj); + } + +static void AmigluEndPolygon( GLUtriangulatorObj *tobj ) { + gluEndPolygon(tobj); + } + +static void AmigluNextContour( GLUtriangulatorObj *tobj, GLenum type ) { + gluNextContour(tobj, type); + } + +static void AmigluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3], void *data ) { + gluTessVertex(tobj, v, data); + } + +/* + * + * New functions in GLU 1.1 + * + */ + +static const GLubyte* AmigluGetString( GLenum name ) +{ +#ifndef __MORPHOS__ + return gluGetString(name); +#else + return NULL; +#endif +} +#endif /* MORPHOS */ + +struct MyGLFunc +{ + CONST_STRPTR name; + APTR func; +}; + +void *AmiGetGLProc(const char *proc) +{ + static CONST struct MyGLFunc table[] = + { + { "glClearColor", AmiglClearColor }, + { "glClear", AmiglClear }, + { "glIndexMask", AmiglIndexMask }, + { "glColorMask", AmiglColorMask }, + { "glAlphaFunc", AmiglAlphaFunc }, + { "glBlendFunc", AmiglBlendFunc }, + { "glBlendColor", AmiglBlendColor }, + { "glBlendEquation", AmiglBlendEquation }, + { "glBlendEquationSeparate", AmiglBlendEquationSeparate }, + { "glBlendFuncSeparate", AmiglBlendFuncSeparate }, + { "glLogicOp", AmiglLogicOp }, + { "glCullFace", AmiglCullFace }, + { "glFrontFace", AmiglFrontFace }, + { "glPointSize", AmiglPointSize }, + { "glLineWidth", AmiglLineWidth }, + { "glLineStipple", AmiglLineStipple }, + { "glPolygonMode", AmiglPolygonMode }, + { "glPolygonOffset", AmiglPolygonOffset }, + { "glPolygonStipple", AmiglPolygonStipple }, + { "glGetPolygonStipple", AmiglGetPolygonStipple }, + { "glEdgeFlag", AmiglEdgeFlag }, + { "glEdgeFlagv", AmiglEdgeFlagv }, + { "glScissor", AmiglScissor }, + { "glClipPlane", AmiglClipPlane }, + { "glGetClipPlane", AmiglGetClipPlane }, + { "glDrawBuffer", AmiglDrawBuffer }, + { "glReadBuffer", AmiglReadBuffer }, + { "glEnable", AmiglEnable }, + { "glDisable", AmiglDisable }, + { "glIsEnabled", AmiglIsEnabled }, + { "glEnableClientState", AmiglEnableClientState }, + { "glDisableClientState", AmiglDisableClientState }, + { "glGetBooleanv", AmiglGetBooleanv }, + { "glGetDoublev", AmiglGetDoublev }, + { "glGetFloatv", AmiglGetFloatv }, + { "glGetIntegerv", AmiglGetIntegerv }, + { "glPushAttrib", AmiglPushAttrib }, + { "glPopAttrib", AmiglPopAttrib }, + { "glPushClientAttrib", AmiglPushClientAttrib }, + { "glPopClientAttrib", AmiglPopClientAttrib }, + { "glRenderMode", AmiglRenderMode }, + { "glGetError", AmiglGetError }, + { "glGetString", AmiglGetString }, + { "glFinish", AmiglFinish }, + { "glFlush", AmiglFlush }, + { "glHint", AmiglHint }, + { "glClearDepth", AmiglClearDepth }, + { "glDepthFunc", AmiglDepthFunc }, + { "glDepthMask", AmiglDepthMask }, + { "glDepthRange", AmiglDepthRange }, + #ifndef __MORPHOS__ + { "glClearAccum", AmiglClearAccum }, + { "glAccum", AmiglAccum }, + #endif + { "glMatrixMode", AmiglMatrixMode }, + { "glOrtho", AmiglOrtho }, + { "glFrustum", AmiglFrustum }, + { "glViewport", AmiglViewport }, + { "glPushMatrix", AmiglPushMatrix }, + { "glPopMatrix", AmiglPopMatrix }, + { "glLoadIdentity", AmiglLoadIdentity }, + { "glLoadMatrixd", AmiglLoadMatrixd }, + { "glLoadMatrixf", AmiglLoadMatrixf }, + { "glMultMatrixd", AmiglMultMatrixd }, + { "glMultMatrixf", AmiglMultMatrixf }, + { "glRotated", AmiglRotated }, + { "glRotatef", AmiglRotatef }, + { "glScaled", AmiglScaled }, + { "glScalef", AmiglScalef }, + { "glTranslated", AmiglTranslated }, + { "glTranslatef", AmiglTranslatef }, + { "glIsList", AmiglIsList }, + { "glDeleteLists", AmiglDeleteLists }, + { "glGenLists", AmiglGenLists }, + { "glNewList", AmiglNewList }, + { "glEndList", AmiglEndList }, + { "glCallList", AmiglCallList }, + { "glCallLists", AmiglCallLists }, + { "glListBase", AmiglListBase }, + { "glBegin", AmiglBegin }, + { "glEnd", AmiglEnd }, + { "glVertex2d", AmiglVertex2d }, + { "glVertex2f", AmiglVertex2f }, + { "glVertex2i", AmiglVertex2i }, + { "glVertex2s", AmiglVertex2s }, + { "glVertex3d", AmiglVertex3d }, + { "glVertex3f", AmiglVertex3f }, + { "glVertex3i", AmiglVertex3i }, + { "glVertex3s", AmiglVertex3s }, + { "glVertex4d", AmiglVertex4d }, + { "glVertex4f", AmiglVertex4f }, + { "glVertex4i", AmiglVertex4i }, + { "glVertex4s", AmiglVertex4s }, + { "glVertex2dv", AmiglVertex2dv }, + { "glVertex2fv", AmiglVertex2fv }, + { "glVertex2iv", AmiglVertex2iv }, + { "glVertex2sv", AmiglVertex2sv }, + { "glVertex3dv", AmiglVertex3dv }, + { "glVertex3fv", AmiglVertex3fv }, + { "glVertex3iv", AmiglVertex3iv }, + { "glVertex3sv", AmiglVertex3sv }, + { "glVertex4dv", AmiglVertex4dv }, + { "glVertex4fv", AmiglVertex4fv }, + { "glVertex4iv", AmiglVertex4iv }, + { "glVertex4sv", AmiglVertex4sv }, + { "glNormal3b", AmiglNormal3b }, + { "glNormal3d", AmiglNormal3d }, + { "glNormal3f", AmiglNormal3f }, + { "glNormal3i", AmiglNormal3i }, + { "glNormal3s", AmiglNormal3s }, + { "glNormal3bv", AmiglNormal3bv }, + { "glNormal3dv", AmiglNormal3dv }, + { "glNormal3fv", AmiglNormal3fv }, + { "glNormal3iv", AmiglNormal3iv }, + { "glNormal3sv", AmiglNormal3sv }, + { "glIndexd", AmiglIndexd }, + { "glIndexf", AmiglIndexf }, + { "glIndexi", AmiglIndexi }, + { "glIndexs", AmiglIndexs }, + { "glIndexub", AmiglIndexub }, + { "glIndexdv", AmiglIndexdv }, + { "glIndexfv", AmiglIndexfv }, + { "glIndexiv", AmiglIndexiv }, + { "glIndexsv", AmiglIndexsv }, + { "glIndexubv", AmiglIndexubv }, + { "glColor3b", AmiglColor3b }, + { "glColor3d", AmiglColor3d }, + { "glColor3f", AmiglColor3f }, + { "glColor3i", AmiglColor3i }, + { "glColor3s", AmiglColor3s }, + { "glColor3ub", AmiglColor3ub }, + { "glColor3ui", AmiglColor3ui }, + { "glColor3us", AmiglColor3us }, + { "glColor4b", AmiglColor4b }, + { "glColor4d", AmiglColor4d }, + { "glColor4f", AmiglColor4f }, + { "glColor4i", AmiglColor4i }, + { "glColor4s", AmiglColor4s }, + { "glColor4ub", AmiglColor4ub }, + { "glColor4ui", AmiglColor4ui }, + { "glColor4us", AmiglColor4us }, + { "glColor3bv", AmiglColor3bv }, + { "glColor3dv", AmiglColor3dv }, + { "glColor3fv", AmiglColor3fv }, + { "glColor3iv", AmiglColor3iv }, + { "glColor3sv", AmiglColor3sv }, + { "glColor3ubv", AmiglColor3ubv }, + { "glColor3uiv", AmiglColor3uiv }, + { "glColor3usv", AmiglColor3usv }, + { "glColor4bv", AmiglColor4bv }, + { "glColor4dv", AmiglColor4dv }, + { "glColor4fv", AmiglColor4fv }, + { "glColor4iv", AmiglColor4iv }, + { "glColor4sv", AmiglColor4sv }, + { "glColor4ubv", AmiglColor4ubv }, + { "glColor4uiv", AmiglColor4uiv }, + { "glColor4usv", AmiglColor4usv }, + { "glTexCoord1d", AmiglTexCoord1d }, + { "glTexCoord1f", AmiglTexCoord1f }, + { "glTexCoord1i", AmiglTexCoord1i }, + { "glTexCoord1s", AmiglTexCoord1s }, + { "glTexCoord2d", AmiglTexCoord2d }, + { "glTexCoord2f", AmiglTexCoord2f }, + { "glTexCoord2i", AmiglTexCoord2i }, + { "glTexCoord2s", AmiglTexCoord2s }, + { "glTexCoord3d", AmiglTexCoord3d }, + { "glTexCoord3f", AmiglTexCoord3f }, + { "glTexCoord3i", AmiglTexCoord3i }, + { "glTexCoord3s", AmiglTexCoord3s }, + { "glTexCoord4d", AmiglTexCoord4d }, + { "glTexCoord4f", AmiglTexCoord4f }, + { "glTexCoord4i", AmiglTexCoord4i }, + { "glTexCoord4s", AmiglTexCoord4s }, + { "glTexCoord1dv", AmiglTexCoord1dv }, + { "glTexCoord1fv", AmiglTexCoord1fv }, + { "glTexCoord1iv", AmiglTexCoord1iv }, + { "glTexCoord1sv", AmiglTexCoord1sv }, + { "glTexCoord2dv", AmiglTexCoord2dv }, + { "glTexCoord2fv", AmiglTexCoord2fv }, + { "glTexCoord2iv", AmiglTexCoord2iv }, + { "glTexCoord2sv", AmiglTexCoord2sv }, + { "glTexCoord3dv", AmiglTexCoord3dv }, + { "glTexCoord3fv", AmiglTexCoord3fv }, + { "glTexCoord3iv", AmiglTexCoord3iv }, + { "glTexCoord3sv", AmiglTexCoord3sv }, + { "glTexCoord4dv", AmiglTexCoord4dv }, + { "glTexCoord4fv", AmiglTexCoord4fv }, + { "glTexCoord4iv", AmiglTexCoord4iv }, + { "glTexCoord4sv", AmiglTexCoord4sv }, + { "glRasterPos2d", AmiglRasterPos2d }, + { "glRasterPos2f", AmiglRasterPos2f }, + { "glRasterPos2i", AmiglRasterPos2i }, + { "glRasterPos2s", AmiglRasterPos2s }, + { "glRasterPos3d", AmiglRasterPos3d }, + { "glRasterPos3f", AmiglRasterPos3f }, + { "glRasterPos3i", AmiglRasterPos3i }, + { "glRasterPos3s", AmiglRasterPos3s }, + { "glRasterPos4d", AmiglRasterPos4d }, + { "glRasterPos4f", AmiglRasterPos4f }, + { "glRasterPos4i", AmiglRasterPos4i }, + { "glRasterPos4s", AmiglRasterPos4s }, + { "glRasterPos2dv", AmiglRasterPos2dv }, + { "glRasterPos2fv", AmiglRasterPos2fv }, + { "glRasterPos2iv", AmiglRasterPos2iv }, + { "glRasterPos2sv", AmiglRasterPos2sv }, + { "glRasterPos3dv", AmiglRasterPos3dv }, + { "glRasterPos3fv", AmiglRasterPos3fv }, + { "glRasterPos3iv", AmiglRasterPos3iv }, + { "glRasterPos3sv", AmiglRasterPos3sv }, + { "glRasterPos4dv", AmiglRasterPos4dv }, + { "glRasterPos4fv", AmiglRasterPos4fv }, + { "glRasterPos4iv", AmiglRasterPos4iv }, + { "glRasterPos4sv", AmiglRasterPos4sv }, + { "glRectd", AmiglRectd }, + { "glRectf", AmiglRectf }, + { "glRecti", AmiglRecti }, + { "glRects", AmiglRects }, + { "glRectdv", AmiglRectdv }, + { "glRectfv", AmiglRectfv }, + { "glRectiv", AmiglRectiv }, + { "glRectsv", AmiglRectsv }, + { "glVertexPointer", AmiglVertexPointer }, + { "glNormalPointer", AmiglNormalPointer }, + { "glColorPointer", AmiglColorPointer }, + { "glIndexPointer", AmiglIndexPointer }, + { "glTexCoordPointer", AmiglTexCoordPointer }, + { "glEdgeFlagPointer", AmiglEdgeFlagPointer }, + { "glGetPointerv", AmiglGetPointerv }, + { "glArrayElement", AmiglArrayElement }, + { "glDrawArrays", AmiglDrawArrays }, + { "glDrawElements", AmiglDrawElements }, + { "glInterleavedArrays", AmiglInterleavedArrays }, + { "glShadeModel", AmiglShadeModel }, + { "glLightf", AmiglLightf }, + { "glLighti", AmiglLighti }, + { "glLightfv", AmiglLightfv }, + { "glLightiv", AmiglLightiv }, + { "glGetLightfv", AmiglGetLightfv }, + { "glGetLightiv", AmiglGetLightiv }, + { "glLightModelf", AmiglLightModelf }, + { "glLightModeli", AmiglLightModeli }, + { "glLightModelfv", AmiglLightModelfv }, + { "glLightModeliv", AmiglLightModeliv }, + { "glMaterialf", AmiglMaterialf }, + { "glMateriali", AmiglMateriali }, + { "glMaterialfv", AmiglMaterialfv }, + { "glMaterialiv", AmiglMaterialiv }, + { "glGetMaterialfv", AmiglGetMaterialfv }, + { "glGetMaterialiv", AmiglGetMaterialiv }, + { "glColorMaterial", AmiglColorMaterial }, + { "glPixelZoom", AmiglPixelZoom }, + { "glPixelStoref", AmiglPixelStoref }, + { "glPixelStorei", AmiglPixelStorei }, + { "glPixelTransferf", AmiglPixelTransferf }, + { "glPixelTransferi", AmiglPixelTransferi }, + { "glPixelMapfv", AmiglPixelMapfv }, + { "glPixelMapuiv", AmiglPixelMapuiv }, + { "glPixelMapusv", AmiglPixelMapusv }, + { "glGetPixelMapfv", AmiglGetPixelMapfv }, + { "glGetPixelMapuiv", AmiglGetPixelMapuiv }, + { "glGetPixelMapusv", AmiglGetPixelMapusv }, + { "glBitmap", AmiglBitmap }, + { "glReadPixels", AmiglReadPixels }, + { "glDrawPixels", AmiglDrawPixels }, + { "glCopyPixels", AmiglCopyPixels }, + { "glStencilFunc", AmiglStencilFunc }, + { "glStencilMask", AmiglStencilMask }, + { "glStencilOp", AmiglStencilOp }, + { "glClearStencil", AmiglClearStencil }, + { "glTexGend", AmiglTexGend }, + { "glTexGenf", AmiglTexGenf }, + { "glTexGeni", AmiglTexGeni }, + { "glTexGendv", AmiglTexGendv }, + { "glTexGenfv", AmiglTexGenfv }, + { "glTexGeniv", AmiglTexGeniv }, + { "glGetTexGendv", AmiglGetTexGendv }, + { "glGetTexGenfv", AmiglGetTexGenfv }, + { "glGetTexGeniv", AmiglGetTexGeniv }, + { "glTexEnvf", AmiglTexEnvf }, + { "glTexEnvi", AmiglTexEnvi }, + { "glTexEnvfv", AmiglTexEnvfv }, + { "glTexEnviv", AmiglTexEnviv }, + { "glGetTexEnvfv", AmiglGetTexEnvfv }, + { "glGetTexEnviv", AmiglGetTexEnviv }, + { "glTexParameterf", AmiglTexParameterf }, + { "glTexParameteri", AmiglTexParameteri }, + { "glTexParameterfv", AmiglTexParameterfv }, + { "glTexParameteriv", AmiglTexParameteriv }, + { "glGetTexParameterfv", AmiglGetTexParameterfv }, + { "glGetTexParameteriv", AmiglGetTexParameteriv }, + { "glGetTexLevelParameterfv", AmiglGetTexLevelParameterfv }, + { "glGetTexLevelParameteriv", AmiglGetTexLevelParameteriv }, + { "glTexImage1D", AmiglTexImage1D }, + { "glTexImage2D", AmiglTexImage2D }, + { "glGetTexImage", AmiglGetTexImage }, + { "glGenTextures", AmiglGenTextures }, + { "glDeleteTextures", AmiglDeleteTextures }, + { "glBindTexture", AmiglBindTexture }, + { "glPrioritizeTextures", AmiglPrioritizeTextures }, + { "glAreTexturesResident", AmiglAreTexturesResident }, + { "glIsTexture", AmiglIsTexture }, + { "glTexSubImage1D", AmiglTexSubImage1D }, + { "glTexSubImage2D", AmiglTexSubImage2D }, + { "glCopyTexImage1D", AmiglCopyTexImage1D }, + { "glCopyTexImage2D", AmiglCopyTexImage2D }, + { "glCopyTexSubImage1D", AmiglCopyTexSubImage1D }, + { "glCopyTexSubImage2D", AmiglCopyTexSubImage2D }, + { "glMap1d", AmiglMap1d }, + { "glMap1f", AmiglMap1f }, + { "glMap2d", AmiglMap2d }, + { "glMap2f", AmiglMap2f }, + { "glGetMapdv", AmiglGetMapdv }, + { "glGetMapfv", AmiglGetMapfv }, + { "glGetMapiv", AmiglGetMapiv }, + { "glEvalCoord1d", AmiglEvalCoord1d }, + { "glEvalCoord1f", AmiglEvalCoord1f }, + { "glEvalCoord1dv", AmiglEvalCoord1dv }, + { "glEvalCoord1fv", AmiglEvalCoord1fv }, + { "glEvalCoord2d", AmiglEvalCoord2d }, + { "glEvalCoord2f", AmiglEvalCoord2f }, + { "glEvalCoord2dv", AmiglEvalCoord2dv }, + { "glEvalCoord2fv", AmiglEvalCoord2fv }, + { "glMapGrid1d", AmiglMapGrid1d }, + { "glMapGrid1f", AmiglMapGrid1f }, + { "glMapGrid2d", AmiglMapGrid2d }, + { "glMapGrid2f", AmiglMapGrid2f }, + { "glEvalPoint1", AmiglEvalPoint1 }, + { "glEvalPoint2", AmiglEvalPoint2 }, + { "glEvalMesh1", AmiglEvalMesh1 }, + { "glEvalMesh2", AmiglEvalMesh2 }, + { "glFogf", AmiglFogf }, + { "glFogi", AmiglFogi }, + { "glFogfv", AmiglFogfv }, + { "glFogiv", AmiglFogiv }, + { "glFeedbackBuffer", AmiglFeedbackBuffer }, + { "glPassThrough", AmiglPassThrough }, + { "glSelectBuffer", AmiglSelectBuffer }, + { "glInitNames", AmiglInitNames }, + { "glLoadName", AmiglLoadName }, + { "glPushName", AmiglPushName }, + { "glPopName", AmiglPopName }, + + { "glBlendEquationEXT", AmiglBlendEquationEXT }, + { "glBlendColorEXT", AmiglBlendColorEXT }, + { "glPolygonOffsetEXT", AmiglPolygonOffset }, + { "glVertexPointerEXT", AmiglVertexPointer }, + { "glNormalPointerEXT", AmiglNormalPointer }, + { "glColorPointerEXT", AmiglColorPointer }, + { "glIndexPointerEXT", AmiglIndexPointer }, + { "glTexCoordPointerEXT", AmiglTexCoordPointer }, + { "glEdgeFlagPointerEXT", AmiglEdgeFlagPointer }, + { "glGetPointervEXT", AmiglGetPointerv }, + { "glArrayElementEXT", AmiglArrayElement }, + { "glDrawArraysEXT", AmiglDrawArrays }, + { "glGenTexturesEXT", AmiglGenTextures }, + { "glDeleteTexturesEXT", AmiglDeleteTextures }, + { "glBindTextureEXT", AmiglBindTexture }, + { "glPrioritizeTexturesEXT", AmiglPrioritizeTextures }, + { "glAreTexturesResidentEXT", AmiglAreTexturesResident }, + { "glIsTextureEXT", AmiglIsTexture }, + { "glTexImage3DEXT", AmiglTexImage3D }, + { "glTexSubImage3DEXT", AmiglTexSubImage3D }, + { "glCopyTexSubImage3DEXT", AmiglCopyTexSubImage3D }, + { "glColorTableEXT", AmiglColorTableEXT }, + { "glColorSubTableEXT", AmiglColorSubTableEXT }, + { "glGetColorTableEXT", AmiglGetColorTableEXT }, + { "glGetColorTableParameterfvEXT", AmiglGetColorTableParameterfvEXT }, + { "glGetColorTableParameterivEXT", AmiglGetColorTableParameterivEXT }, +#ifndef __MORPHOS__ + { "glMultiTexCoord1dEXT", AmiglMultiTexCoord1dEXT }, + { "glMultiTexCoord1dvEXT", AmiglMultiTexCoord1dvEXT }, + { "glMultiTexCoord1fEXT", AmiglMultiTexCoord1fEXT }, + { "glMultiTexCoord1fvEXT", AmiglMultiTexCoord1fvEXT }, + { "glMultiTexCoord1iEXT", AmiglMultiTexCoord1iEXT }, + { "glMultiTexCoord1ivEXT", AmiglMultiTexCoord1ivEXT }, + { "glMultiTexCoord1sEXT", AmiglMultiTexCoord1sEXT }, + { "glMultiTexCoord1svEXT", AmiglMultiTexCoord1svEXT }, + { "glMultiTexCoord2dEXT", AmiglMultiTexCoord2dEXT }, + { "glMultiTexCoord2dvEXT", AmiglMultiTexCoord2dvEXT }, + { "glMultiTexCoord2fEXT", AmiglMultiTexCoord2fEXT }, + { "glMultiTexCoord2fvEXT", AmiglMultiTexCoord2fvEXT }, + { "glMultiTexCoord2iEXT", AmiglMultiTexCoord2iEXT }, + { "glMultiTexCoord2ivEXT", AmiglMultiTexCoord2ivEXT }, + { "glMultiTexCoord2sEXT", AmiglMultiTexCoord2sEXT }, + { "glMultiTexCoord2svEXT", AmiglMultiTexCoord2svEXT }, + { "glMultiTexCoord3dEXT", AmiglMultiTexCoord3dEXT }, + { "glMultiTexCoord3dvEXT", AmiglMultiTexCoord3dvEXT }, + { "glMultiTexCoord3fEXT", AmiglMultiTexCoord3fEXT }, + { "glMultiTexCoord3fvEXT", AmiglMultiTexCoord3fvEXT }, + { "glMultiTexCoord3iEXT", AmiglMultiTexCoord3iEXT }, + { "glMultiTexCoord3ivEXT", AmiglMultiTexCoord3ivEXT }, + { "glMultiTexCoord3sEXT", AmiglMultiTexCoord3sEXT }, + { "glMultiTexCoord3svEXT", AmiglMultiTexCoord3svEXT }, + { "glMultiTexCoord4dEXT", AmiglMultiTexCoord4dEXT }, + { "glMultiTexCoord4dvEXT", AmiglMultiTexCoord4dvEXT }, + { "glMultiTexCoord4fEXT", AmiglMultiTexCoord4fEXT }, + { "glMultiTexCoord4fvEXT", AmiglMultiTexCoord4fvEXT }, + { "glMultiTexCoord4iEXT", AmiglMultiTexCoord4iEXT }, + { "glMultiTexCoord4ivEXT", AmiglMultiTexCoord4ivEXT }, + { "glMultiTexCoord4sEXT", AmiglMultiTexCoord4sEXT }, + { "glMultiTexCoord4svEXT", AmiglMultiTexCoord4svEXT }, + { "glInterleavedTextureCoordSetsEXT", AmiglInterleavedTextureCoordSetsEXT }, + { "glSelectTextureEXT", AmiglSelectTextureEXT }, + { "glSelectTextureCoordSetEXT", AmiglSelectTextureCoordSetEXT }, + { "glSelectTextureTransformEXT", AmiglSelectTextureTransformEXT }, +#endif + { "glPointParameterfEXT", AmiglPointParameterfEXT }, + { "glPointParameterfvEXT", AmiglPointParameterfvEXT }, + { "glDrawRangeElements", AmiglDrawRangeElements }, + { "glTexImage3D", AmiglTexImage3D }, + { "glTexSubImage3D", AmiglTexSubImage3D }, + { "glCopyTexSubImage3D", AmiglCopyTexSubImage3D }, + { "glLockArraysEXT", AmiglLockArraysEXT }, + { "glUnlockArraysEXT", AmiglUnlockArraysEXT }, + + { "glActiveTextureARB", AmiglActiveTextureARB }, + { "glMultiTexCoord2fARB", AmiglMultiTexCoord2fARB }, + { "glMultiTexCoord3fARB", AmiglMultiTexCoord3fARB }, + { "glMultiTexCoord4fARB", AmiglMultiTexCoord4fARB }, + { "glMultiTexCoord2fvARB", AmiglMultiTexCoord2fvARB }, + { "glMultiTexCoord3fvARB", AmiglMultiTexCoord3fvARB }, + { "glMultiTexCoord4fvARB", AmiglMultiTexCoord4fvARB }, + { "glMultiTexCoord2dvARB", AmiglMultiTexCoord2dvARB }, + { "glMultiTexCoord3dvARB", AmiglMultiTexCoord3dvARB }, + { "glClientActiveTextureARB", AmiglClientActiveTextureARB }, + + { "glGenBuffers", AmiglGenBuffers }, + { "glGenBuffersARB", AmiglGenBuffers }, + { "glBufferData", AmiglBufferData }, + { "glBufferDataARB", AmiglBufferData }, + { "glBufferSubData", AmiglBufferSubData }, + { "glBufferSubDataARB", AmiglBufferSubData }, + { "glBindBuffer", AmiglBindBuffer }, + { "glBindBufferARB", AmiglBindBuffer }, + { "glDeleteBuffers", AmiglDeleteBuffers }, + { "glDeleteBuffersARB", AmiglDeleteBuffers }, + { "glGetBufferParameteriv", AmiglGetBufferParameteriv }, + { "glGetBufferParameterivARB", AmiglGetBufferParameteriv }, + + { "glAttachShader", AmiglAttachShader }, + { "glCompileShader", AmiglCompileShader }, + { "glLinkProgram", AmiglLinkProgram }, + { "glUseProgram", AmiglUseProgram }, + { "glCreateShader", AmiglCreateShader }, + { "glCreateProgram", AmiglCreateProgram }, + { "glShaderSource", AmiglShaderSource }, + { "glValidateProgram", AmiglValidateProgram }, + { "glUniform1f", AmiglUniform1f }, + { "glUniform1fv", AmiglUniform1f }, + { "glUniform1i", AmiglUniform1i }, + { "glUniform1iv", AmiglUniform1i }, + { "glUniform2f", AmiglUniform2f }, + { "glUniform3f", AmiglUniform3f }, + { "glUniform4f", AmiglUniform4f }, + { "glUniformMatrix4fv", AmiglUniformMatrix4fv }, + { "glGetUniformLocation", AmiglGetUniformLocation }, + { "glUniform4fv", AmiglUniform4fv }, + { "glGetAttribLocation", AmiglGetAttribLocation }, + { "glVertexAttribPointer", AmiglVertexAttribPointer }, + { "glEnableVertexAttribArray", AmiglEnableVertexAttribArray }, + { "glDisableVertexAttribArray", AmiglDisableVertexAttribArray }, + { "glGetShaderiv", AmiglGetShaderiv }, + { "glGetProgramiv", AmiglGetProgramiv }, + { "glGetProgramInfoLog", AmiglGetProgramInfoLog }, + { "glGetShaderInfoLog", AmiglGetShaderInfoLog }, + + { "gluLookAt", AmigluLookAt }, + { "gluPerspective", AmigluPerspective }, + { "gluPickMatrix", AmigluPickMatrix }, + +#ifndef __MORPHOS__ + { "gluOrtho2D", AmigluOrtho2D }, + { "gluProject", AmigluProject }, + { "gluUnProject", AmigluUnProject }, + { "gluErrorString", AmigluErrorString }, + { "gluScaleImage", AmigluScaleImage }, + { "gluBuild1DMipmaps", AmigluBuild1DMipmaps }, + { "gluBuild2DMipmaps", AmigluBuild2DMipmaps }, + { "gluNewQuadric", AmigluNewQuadric }, + { "gluDeleteQuadric", AmigluDeleteQuadric }, + { "gluQuadricDrawStyle", AmigluQuadricDrawStyle }, + { "gluQuadricOrientation", AmigluQuadricOrientation }, + { "gluQuadricNormals", AmigluQuadricNormals }, + { "gluQuadricTexture", AmigluQuadricTexture }, + { "gluQuadricCallback", AmigluQuadricCallback }, + { "gluCylinder", AmigluCylinder }, + { "gluSphere", AmigluSphere }, + { "gluDisk", AmigluDisk }, + { "gluPartialDisk", AmigluPartialDisk }, + { "gluNewNurbsRenderer", AmigluNewNurbsRenderer }, + { "gluDeleteNurbsRenderer", AmigluDeleteNurbsRenderer }, + { "gluLoadSamplingMatrices", AmigluLoadSamplingMatrices }, + { "gluNurbsProperty", AmigluNurbsProperty }, + { "gluGetNurbsProperty", AmigluGetNurbsProperty }, + { "gluBeginCurve", AmigluBeginCurve }, + { "gluEndCurve", AmigluEndCurve }, + { "gluNurbsCurve", AmigluNurbsCurve }, + { "gluBeginSurface", AmigluBeginSurface }, + { "gluEndSurface", AmigluEndSurface }, + { "gluNurbsSurface", AmigluNurbsSurface }, + { "gluBeginTrim", AmigluBeginTrim }, + { "gluEndTrim", AmigluEndTrim }, + { "gluPwlCurve", AmigluPwlCurve }, + { "gluNurbsCallback", AmigluNurbsCallback }, + { "gluNewTess", AmigluNewTess }, + { "gluTessCallback", AmigluTessCallback }, + { "gluDeleteTess", AmigluDeleteTess }, + { "gluBeginPolygon", AmigluBeginPolygon }, + { "gluEndPolygon", AmigluEndPolygon }, + { "gluNextContour", AmigluNextContour }, + { "gluTessVertex", AmigluTessVertex }, + { "gluGetString", AmigluGetString }, +#endif + + { NULL, NULL } + }; + + CONST struct MyGLFunc *tb = table; + + do + { + if (!strcmp(tb->name, proc)) + { + return tb->func; + } + tb++; + } + while (tb->name); + + return NULL; +} + +#endif /* SDL_VIDEO_DRIVER_AMIGA */ diff --git a/src/video/amiga/SDL_amigakeyboard.c b/src/video/amiga/SDL_amigakeyboard.c new file mode 100644 index 0000000000..e87fbae110 --- /dev/null +++ b/src/video/amiga/SDL_amigakeyboard.c @@ -0,0 +1,88 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/scancodes_amiga.h" + +#include + +static SDL_Keycode AMIGA_MapRawKey(UWORD code) +{ + struct InputEvent ie; + WORD res; + char buffer[2] = {0, 0}; + + ie.ie_Class = IECLASS_RAWKEY; + ie.ie_SubClass = 0; + ie.ie_Code = code; + ie.ie_Qualifier = 0; + ie.ie_EventAddress = NULL; + + res = MapRawKey(&ie, buffer, sizeof(buffer), NULL); + if (res > 0) { + return (buffer[0] + buffer[1] * 256); + } else { + return 0; + } +} + +static void AMIGA_UpdateKeymap(_THIS) +{ + int i; + SDL_Scancode scancode; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; + + SDL_GetDefaultKeymap(keymap); + + for (i = 0; i < SDL_arraysize(amiga_scancode_table); i++) { + /* Make sure this scancode is a valid character scancode */ + scancode = amiga_scancode_table[i]; + if (scancode == SDL_SCANCODE_UNKNOWN ) { + continue; + } + + /* If this key is one of the non-mappable keys, ignore it */ + /* Don't allow the number keys right above the qwerty row to translate or the top left key (grave/backquote) */ + /* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */ + if ((keymap[scancode] & SDLK_SCANCODE_MASK) || + scancode == SDL_SCANCODE_GRAVE /*|| + (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)*/ ) { + continue; + } + + keymap[scancode] = AMIGA_MapRawKey(i); + } + + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); +} + +void AMIGA_InitKeyboard(_THIS) +{ + AMIGA_UpdateKeymap(_this); + + SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); + SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command"); + SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigakeyboard.h b/src/video/amiga/SDL_amigakeyboard.h new file mode 100644 index 0000000000..bb73d65626 --- /dev/null +++ b/src/video/amiga/SDL_amigakeyboard.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigakeyboard_h +#define _SDL_amigakeyboard_h + +extern void AMIGA_InitKeyboard(_THIS); + +#endif /* _SDL_amigakeyboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigamessagebox.c b/src/video/amiga/SDL_amigamessagebox.c new file mode 100644 index 0000000000..39a69ba422 --- /dev/null +++ b/src/video/amiga/SDL_amigamessagebox.c @@ -0,0 +1,96 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_messagebox.h" +#include "../SDL_sysvideo.h" +#include "../../core/morphos/SDL_misc.h" + +#include +#include +#include + + +int +AMIGA_ShowMessageBox(const SDL_MessageBoxData *mbd, int *buttonid) +{ + struct Library *MUIMasterBase = OpenLibrary("muimaster.library", 0); + int rc = -1; + + D("[%s]\n", __FUNCTION__); + + if (MUIMasterBase) + { + char *title = AMIGA_ConvertText(mbd->title, MIBENUM_UTF_8, MIBENUM_SYSTEM); + char *message = AMIGA_ConvertText(mbd->message, MIBENUM_UTF_8, MIBENUM_SYSTEM); + + if (message) + { + size_t i, tlen = 1; + char *btxt; + + for (i = mbd->numbuttons; i > 0; i--) + { + tlen += ConvertTagList((APTR)mbd->buttons[i].text, -1, NULL, -1, MIBENUM_UTF_8, MIBENUM_SYSTEM, NULL) + 3; + } + + btxt = SDL_malloc(tlen); + + if (btxt) + { + char *buf = btxt; + + for (i = 0; i < mbd->numbuttons; i++) + { + if (i > 0) + *buf++ = '|'; + + if (mbd->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) + *buf++ = '*'; + + buf += ConvertTagList((APTR)mbd->buttons[i].text, -1, buf, -1, MIBENUM_UTF_8, MIBENUM_SYSTEM, NULL); + } + + *buf = '\0'; + + rc = MUI_RequestA(NULL, NULL, 0, title == NULL ? "SDL" : title, btxt, message, NULL); + + if (rc == 0) + rc = mbd->numbuttons - 1; + else + rc -= 1; + + *buttonid = mbd->buttons[rc].buttonid; + + SDL_free(btxt); + rc = 0; + } + + SDL_free(message); + } + + SDL_free(title); + + CloseLibrary(MUIMasterBase); + } + + return rc; +} diff --git a/src/video/amiga/SDL_amigamessagebox.h b/src/video/amiga/SDL_amigamessagebox.h new file mode 100644 index 0000000000..6d9f0f5a97 --- /dev/null +++ b/src/video/amiga/SDL_amigamessagebox.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigamessagebox_h +#define _SDL_amigamessagebox_h + +extern int AMIGA_ShowMessageBox(const SDL_MessageBoxData *mbd, int *buttonid); + +#endif /* _SDL_amigamessagebox_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c new file mode 100644 index 0000000000..e1d427c52a --- /dev/null +++ b/src/video/amiga/SDL_amigamodes.c @@ -0,0 +1,482 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigamodes.h" +#include "SDL_amigavideo.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static Uint32 +AMIGA_SDLPixelFormatToDepth(Uint32 pixfmt) +{ + switch (pixfmt) + { + case SDL_PIXELFORMAT_INDEX8: + return 8; + + case SDL_PIXELFORMAT_RGB555: + return 15; + + case SDL_PIXELFORMAT_RGB565: + case SDL_PIXELFORMAT_BGR565: + return 16; + + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGR888: + return 24; + + default: + case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGRA8888: + case SDL_PIXELFORMAT_RGBA8888: + return 32; + } +} + +static Uint32 +AMIGA_GetSDLPixelFormat(Uint32 pixfmt, Uint32 default_pixfmt) +{ + D("[%s]\n", __FUNCTION__); + + switch (pixfmt) + { + #if BYTEORDER == LITTLE_ENDIAN + case PIXFMT_RGB15PC: return SDL_PIXELFORMAT_RGB555; // Will not work on big endian machine + case PIXFMT_BGR15PC: return SDL_PIXELFORMAT_BGR555; // Will not work on big endian machine + case PIXFMT_RGB16PC: return SDL_PIXELFORMAT_RGB565; // Will not work on big endian machine + case PIXFMT_BGR16PC: return SDL_PIXELFORMAT_BGR565; // Will not work on big endian machine + #else + case PIXFMT_RGB15PC: + case PIXFMT_BGR15PC: + case PIXFMT_RGB16PC: + case PIXFMT_BGR16PC: + return default_pixfmt; + #endif + + case PIXFMT_LUT8 : return SDL_PIXELFORMAT_INDEX8; + case PIXFMT_RGB15 : return SDL_PIXELFORMAT_RGB555; + case PIXFMT_RGB15X : return SDL_PIXELFORMAT_RGB555; + case PIXFMT_RGB16 : return SDL_PIXELFORMAT_RGB565; + case PIXFMT_BGR16 : return SDL_PIXELFORMAT_BGR565; + case PIXFMT_RGB24 : return SDL_PIXELFORMAT_RGB888; + case PIXFMT_BGR24 : return SDL_PIXELFORMAT_BGR888; + case PIXFMT_ARGB32 : return SDL_PIXELFORMAT_ARGB8888; + case PIXFMT_BGRA32 : return SDL_PIXELFORMAT_BGRA8888; + case PIXFMT_RGBA32 : return SDL_PIXELFORMAT_RGBA8888; + default : return SDL_PIXELFORMAT_BGRA8888; + } +} + +static int +AMIGA_GetRefreshRate(struct Screen *s) +{ + ULONG modeid = getv(s, SA_DisplayID); + APTR handle = FindDisplayInfo(modeid); + ULONG freq = 60; + + D("[%s]\n", __FUNCTION__); + + if (handle) + { + struct MonitorInfo mi; + + if (GetDisplayInfoData(handle, (UBYTE *)&mi, sizeof(mi), DTAG_MNTR, 0) >= sizeof(mi)) + { + if (mi.TotalRows) + { + freq = (ULONG)(1000000000L / ((FLOAT)mi.TotalColorClocks * 280.0 * (FLOAT)mi.TotalRows / 1000.0) + 5.0); + } + } + } + + return freq; +} + +#define MAX_SDL_PIXEL_FORMATS 10 + +static const struct +{ + Uint32 PixFmt, NewPixFmt; +} pixelformats[MAX_SDL_PIXEL_FORMATS] = +{ + { PIXFMT_LUT8 , SDL_PIXELFORMAT_INDEX8 }, + { PIXFMT_RGB15 , SDL_PIXELFORMAT_RGB555 }, + { PIXFMT_RGB15X, SDL_PIXELFORMAT_RGB555 }, + { PIXFMT_RGB16 , SDL_PIXELFORMAT_RGB565 }, + { PIXFMT_BGR16 , SDL_PIXELFORMAT_BGR565 }, + { PIXFMT_RGB24 , SDL_PIXELFORMAT_RGB888 }, + { PIXFMT_BGR24 , SDL_PIXELFORMAT_BGR888 }, + { PIXFMT_ARGB32, SDL_PIXELFORMAT_ARGB8888 }, + { PIXFMT_BGRA32, SDL_PIXELFORMAT_BGRA8888 }, + { PIXFMT_RGBA32, SDL_PIXELFORMAT_RGBA8888 }, +}; + +int +AMIGA_InitModes(_THIS) +{ + Uint32 pixfmt = SDL_PIXELFORMAT_BGRA8888; + int width = 1920, height = 1080, dispcount = 0; + SDL_VideoDisplay display; + SDL_DisplayMode mode; + Object **monitors; + struct Screen *s; + APTR mon; + + D("[%s]\n", __FUNCTION__); + SDL_zero(display); + + mode.w = 1920; + mode.h = 1080; + mode.refresh_rate = 60; + mode.format = SDL_PIXELFORMAT_ARGB8888; + mode.driverdata = NULL; + + s = LockPubScreen("Workbench"); + mon = NULL; + + if (s) + { + SDL_DisplayModeData *modedata; + + // This is not actual view size but virtual screens are so 90s + width = s->Width; + height = s->Height; + + pixfmt = AMIGA_GetSDLPixelFormat(getv(s, SA_PixelFormat), SDL_PIXELFORMAT_ARGB8888); + mon = (APTR)getv(s, SA_MonitorObject); + + UnlockPubScreen(NULL, s); + + modedata = SDL_malloc(sizeof(*modedata)); + + if (modedata) + { + modedata->monitor = mon; + + mode.format = pixfmt; + mode.w = width; + mode.h = height; + mode.refresh_rate = AMIGA_GetRefreshRate(s); + mode.driverdata = SDL_malloc(4); + + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = modedata; + display.name = (char *)getv(mon, MA_MonitorName); + + SDL_AddVideoDisplay(&display, SDL_FALSE); + dispcount++; + + mode.driverdata = NULL; + + D("[%s] Added Workbench screen\n", __FUNCTION__); + } + } + + // Add other monitors (not desktop) + if ((monitors = GetMonitorList(NULL))) + { + APTR m; + int i, j; + + for (i = 0; (m = monitors[i]); i++) + { + if (m != mon) + { + SDL_DisplayModeData *modedata = SDL_malloc(sizeof(*modedata)); + + if (modedata) + { + ULONG *fmt = (ULONG *)getv(m, MA_PixelFormats); + + for (j = MAX_SDL_PIXEL_FORMATS - 1; j >= 0; j--) + { + Uint32 pixfmt = pixelformats[j].PixFmt; + + if (fmt[pixfmt]) + { + mode.format = pixelformats[j].NewPixFmt; + D("[%s] Add %ld/%ld pixfmt %ld\n", __FUNCTION__, mode.w, mode.h, mode.format); + break; + } + } + + modedata->monitor = m; + + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = modedata; + display.name = (char *)getv(mon, MA_MonitorName); + + D("[%s] Add video display '%s'\n", __FUNCTION__, display.name); + + SDL_AddVideoDisplay(&display, SDL_FALSE); + dispcount++; + } + } + } + + FreeMonitorList(monitors); + } + + return dispcount > 0 ? 0 : -1; +} + +static int +AMIGA_CheckMonitor(APTR mon, ULONG id) +{ + IPTR tags[] = { GMLA_DisplayID, id, TAG_DONE }; + Object **monlist = GetMonitorList((struct TagItem *)&tags); + int rc = 0; + D("[%s] find mon 0x%08lx\n", __FUNCTION__, mon); + + if (monlist) + { + int idx; + + for (idx = 0; monlist[idx]; idx++) + { + if (monlist[idx] == mon) + { + rc = 1; + break; + } + } + + FreeMonitorList(monlist); + } + + return rc; +} + +void +AMIGA_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) +{ + SDL_DisplayModeData *md = sdl_display->driverdata; + D("[%s]\n", __FUNCTION__); + + if (md) + { + ULONG i, *fmt = (ULONG *)getv(md->monitor, MA_PixelFormats); + SDL_DisplayMode mode = sdl_display->desktop_mode; + + for (i = 0; i < MAX_SDL_PIXEL_FORMATS; i++) + { + Uint32 pixfmt = pixelformats[i].PixFmt; + + if (fmt[pixfmt]) + { + ULONG nextid = INVALID_ID; + + mode.format = pixelformats[i].NewPixFmt; + + // Go through display database to find out what modes are available to this monitor + D("[%s] Go through display database\n", __FUNCTION__); + while ((nextid = NextDisplayInfo(nextid)) != INVALID_ID) + { + if (GetCyberIDAttr(CYBRIDATTR_PIXFMT, nextid) == pixfmt) + { + D("[%s] id 0x%08lx matches to pixfmt %ld\n", __FUNCTION__, nextid, pixfmt); + + if (AMIGA_CheckMonitor(md->monitor, nextid)) + { + mode.w = GetCyberIDAttr(CYBRIDATTR_WIDTH, nextid); + mode.h = GetCyberIDAttr(CYBRIDATTR_HEIGHT, nextid); + mode.driverdata = sdl_display->desktop_mode.driverdata ? SDL_malloc(4) : NULL; + + SDL_AddDisplayMode(sdl_display, &mode); + } + } + + D("[%s] Mode 0x%08lx checked.\n", __FUNCTION__, nextid); + } + + D("[%s] finished pixel format %ld\n", __FUNCTION__, pixfmt); + } + } + } +} + +int +AMIGA_GetScreen(_THIS, BYTE fullscreen, SDL_bool support3d) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + struct Screen *screen; + int use_wb_screen = 0; + ULONG openError = 0; + + D("[%s] Use monitor '%s'\n", __FUNCTION__, data->ScrMonName ? data->ScrMonName : (STRPTR)"Workbench"); + + if (!fullscreen && data->ScrMonName == NULL) + { + data->CustomScreen = NULL; + screen = LockPubScreen("Workbench"); + use_wb_screen = 1; + } + else + { + struct TagItem screentags[] = + { + {SA_Quiet, TRUE}, + {SA_ShowTitle, FALSE}, + {SA_AutoScroll, TRUE}, + {SA_Title, (IPTR)"SDL2"}, + {SA_AdaptSize, TRUE}, + {SA_ErrorCode, &openError}, + {support3d ? SA_3DSupport : TAG_IGNORE, TRUE}, + {TAG_DONE} + }; + + D("[%s] Open screen %ldx%ldx%ld\n", __FUNCTION__, data->ScrWidth, data->ScrHeight, data->ScrDepth); + + if (fullscreen && data->ScrMonName == NULL) + { + screen = OpenScreenTags(NULL, + //SA_LikeWorkbench, TRUE, + SA_Width, data->ScrWidth, + SA_Height, data->ScrHeight, + SA_Depth, data->ScrDepth, + TAG_MORE, (IPTR)screentags); + } + else + { + screen = OpenScreenTags(NULL, + SA_Width, data->ScrWidth, + SA_Height, data->ScrHeight, + SA_Depth, data->ScrDepth, + SA_MonitorName, data->ScrMonName, + TAG_MORE, (IPTR)screentags); + } + + data->CustomScreen = screen; + } + + if (screen == NULL) + { + if (data->ScrMonName != NULL) + screen = LockPubScreen("Workbench"); + + if (screen == NULL) { + switch (openError) { + case OSERR_NOMONITOR: + SDL_SetError("Monitor for display mode not available"); + break; + case OSERR_NOCHIPS: + SDL_SetError("Newer custom chips required"); + break; + case OSERR_NOMEM: + case OSERR_NOCHIPMEM: + SDL_OutOfMemory(); + break; + case OSERR_PUBNOTUNIQUE: + SDL_SetError("Public screen name not unique"); + break; + case OSERR_UNKNOWNMODE: + case OSERR_TOODEEP: + SDL_SetError("Unknown display mode"); + break; + case OSERR_ATTACHFAIL: + SDL_SetError("Attachment failed"); + break; + default: + SDL_SetError("Failed to get screen."); + break; + } + return -1; + } + use_wb_screen = 1; + } + + data->WScreen = screen; + + if (use_wb_screen) + { + data->ScreenNotifyHandle = AddWorkbenchClient(&data->ScreenNotifyPort, -20); + } + + if (data->ScreenSaverSuspendCount) + { + size_t i; + + for (i = data->ScreenSaverSuspendCount; i > 0; i--) + SetAttrs(screen, SA_StopBlanker, TRUE, TAG_DONE); + } + + return 0; +} + +int +AMIGA_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + + D("[%s]\n", __FUNCTION__); + + AMIGA_CloseWindows(_this); + AMIGA_CloseDisplay(_this); + + data->sdlpixfmt = mode->format; + data->ScrMonName = NULL; + + // NULL means non-WB mode + data->ScrWidth = mode->w; + data->ScrHeight = mode->h; + data->ScrDepth = AMIGA_SDLPixelFormatToDepth(mode->format); + + if (mode->driverdata == NULL) + { + data->ScrMonName = display->name; + D("[%s] Use monitor %s\n", __FUNCTION__, data->ScrMonName); + } + + //AMIGA_GetScreen(_this); + //AMIGA_OpenWindows(_this); + + return 0; +} + +int +AMIGA_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + /*SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; + + rect->x = data->x; + rect->y = data->y; + rect->w = display->current_mode.w; + rect->h = display->current_mode.h;*/ + + //dprintf("x=%d, y=%d, w=%d, h=%d\n", rect->x, rect->y, rect->w, rect->h); + + return 0; +} +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigamodes.h b/src/video/amiga/SDL_amigamodes.h new file mode 100644 index 0000000000..12697dda3b --- /dev/null +++ b/src/video/amiga/SDL_amigamodes.h @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigamodes_h +#define _SDL_amigamodes_h + +#include "../SDL_sysvideo.h" + +#ifndef EXEC_TYPES_H +#include +#endif + +typedef struct +{ + APTR monitor; +} SDL_DisplayModeData; + +extern int AMIGA_InitModes(_THIS); +extern void AMIGA_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display); +extern int AMIGA_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); +extern int AMIGA_GetScreen(_THIS, BYTE FullScreen, SDL_bool support3d); +extern int AMIGA_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); + +#endif /* _SDL_amigamodes_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c new file mode 100644 index 0000000000..0a90c1d66c --- /dev/null +++ b/src/video/amiga/SDL_amigamouse.c @@ -0,0 +1,336 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigamouse.h" +#include "SDL_amigavideo.h" + +#include "../../events/SDL_mouse_c.h" +#include "SDL_hints.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static SDL_Cursor * +AMIGA_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) +{ + SDL_AmigaCursor *cursor = SDL_malloc(sizeof(*cursor)); + D("[%s]\n", __FUNCTION__); + + if (cursor) + { + SDL_AmigaCursor *ac = SDL_malloc(sizeof(*ac)); + struct BitMap *bmp; + + cursor->Cursor.next = NULL; + cursor->Cursor.driverdata = &cursor->Pointer; + cursor->Pointer.offx = hot_x; + cursor->Pointer.offy = hot_y; + + bmp = AllocBitMap(surface->w, surface->h, 32, BMF_MINPLANES | BMF_SPECIALFMT | SHIFT_PIXFMT(PIXFMT_ARGB32), NULL); + + if (bmp != NULL) + { + struct RastPort rp; + + cursor->Pointer.bmp = bmp; + + InitRastPort(&rp); + rp.BitMap = bmp; + + if (SDL_LockSurface(surface) == 0) + { + WritePixelArray(surface->pixels, 0, 0, surface->pitch, &rp, 0, 0, surface->w, surface->h, RECTFMT_ARGB); + SDL_UnlockSurface(surface); + } + } + else + { + SDL_free(cursor); + cursor = NULL; + } + } + + return &cursor->Cursor; +} + +static SDL_Cursor * +AMIGA_CreateSystemCursor(SDL_SystemCursor id) +{ + SDL_Cursor *cursor = SDL_malloc(sizeof(*cursor)); + D("[%s]\n", __FUNCTION__); + + if (cursor) + { + size_t type = POINTERTYPE_NORMAL; + + cursor->next = NULL; + + switch (id) + { + default: + case SDL_SYSTEM_CURSOR_ARROW: type = POINTERTYPE_NORMAL; break; + case SDL_SYSTEM_CURSOR_IBEAM: type = POINTERTYPE_SELECTTEXT; break; + case SDL_SYSTEM_CURSOR_WAIT: type = POINTERTYPE_BUSY; break; + case SDL_SYSTEM_CURSOR_CROSSHAIR: type = POINTERTYPE_AIMING; break; + case SDL_SYSTEM_CURSOR_WAITARROW: type = POINTERTYPE_WORKING; break; + case SDL_SYSTEM_CURSOR_SIZENWSE: type = POINTERTYPE_VERTICALRESIZE; break; + case SDL_SYSTEM_CURSOR_SIZENESW: type = POINTERTYPE_VERTICALRESIZE; break; + case SDL_SYSTEM_CURSOR_SIZEWE: type = POINTERTYPE_HORIZONTALRESIZE; break; + case SDL_SYSTEM_CURSOR_SIZENS: type = POINTERTYPE_HORIZONTALRESIZE; break; + case SDL_SYSTEM_CURSOR_SIZEALL: type = POINTERTYPE_MOVE; break; + case SDL_SYSTEM_CURSOR_NO: type = POINTERTYPE_NOTAVAILABLE; break; + case SDL_SYSTEM_CURSOR_HAND: type = POINTERTYPE_SELECTLINK; break; + } + + cursor->driverdata = (APTR)type; + D("[%s] %ld to %ld\n", __FUNCTION__, id, type); + } + else + { + SDL_OutOfMemory(); + } + + return cursor; +} + +static void +AMIGA_FreeCursor(SDL_Cursor *cursor) +{ + D("[%s] 0x%08lx\n", __FUNCTION__, cursor); + + if (!IS_SYSTEM_CURSOR(cursor)) + { + FreeBitMap(((SDL_AmigaCursor *)cursor)->Pointer.bmp); + } + + SDL_free(cursor); +} + +static int +AMIGA_ShowCursor(SDL_Cursor * cursor) +{ + SDL_VideoDevice *video = SDL_GetVideoDevice(); + SDL_VideoData *data = (SDL_VideoData *)video->driverdata; + //D("[%s] 0x%08lx\n", __FUNCTION__, cursor); + + if (IS_SYSTEM_CURSOR(cursor)) + { + size_t type = cursor ? (size_t)cursor->driverdata : POINTERTYPE_INVISIBLE; + + if (data->CurrentPointer != cursor) + { + SDL_WindowData *wd; + size_t pointertags[] = { WA_PointerType, type, TAG_DONE }; + + ForeachNode(&data->windowlist, wd) + { + if (wd->win) + { + SetAttrsA(wd->win, (struct TagItem *)&pointertags); + } + } + } + } + else + { + SDL_AmigaCursor *ac = (SDL_AmigaCursor *)cursor; + SDL_WindowData *wd; + size_t pointertags[] = { POINTERA_BitMap, (size_t)ac->Pointer.bmp, POINTERA_XOffset, ac->Pointer.offx, POINTERA_YOffset, ac->Pointer.offy, TAG_DONE }; + + ForeachNode(&data->windowlist, wd) + { + if (wd->win) + { + SetWindowPointerA(wd->win, (struct TagItem *)&pointertags); + } + } + } + + data->CurrentPointer = cursor; + + return 0; +} + +static void +AMIGA_WarpMouse(SDL_Window * window, int x, int y) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + struct Window *win; + D("[%s]\n", __FUNCTION__); + + BOOL warpHostPointer; + + warpHostPointer = !SDL_GetRelativeMouseMode() && (window == SDL_GetMouseFocus()); + + if (warpHostPointer) { + + if ((win = data->win)) + { + struct MsgPort port; + struct IOStdReq req; + + port.mp_Flags = PA_IGNORE; + NEWLIST(&port.mp_MsgList); + + req.io_Message.mn_ReplyPort = &port; + req.io_Device = NULL; + req.io_Unit = NULL; + + if (OpenDevice("input.device", 0, (struct IORequest *)&req, 0) == 0) + { + struct InputEvent ie; + struct IEPointerPixel newpos; + + newpos.iepp_Screen = win->WScreen; + newpos.iepp_Position.X = x + win->BorderLeft + win->LeftEdge; + newpos.iepp_Position.Y = y + win->BorderTop + win->TopEdge; + + ie.ie_EventAddress = &newpos; + ie.ie_NextEvent = NULL; + ie.ie_Class = IECLASS_NEWPOINTERPOS; + ie.ie_SubClass = IESUBCLASS_PIXEL; + ie.ie_Code = IECODE_NOBUTTON; + ie.ie_Qualifier = 0; + + req.io_Data = &ie; + req.io_Length = sizeof(ie); + req.io_Command = IND_WRITEEVENT; + + DoIO((struct IORequest *)&req); + CloseDevice((struct IORequest *)&req); + } + } + }else{ + SDL_SendMouseMotion(window,0, SDL_GetRelativeMouseMode(), x, y); + } +} + +static int +AMIGA_SetRelativeMouseMode(SDL_bool enabled) +{ + SDL_VideoDevice *video = SDL_GetVideoDevice(); + SDL_VideoData *data = (SDL_VideoData *)video->driverdata; + SDL_WindowData *wd; + size_t or_mask, and_mask; + + if (enabled) + { + or_mask = IDCMP_DELTAMOVE; + and_mask = ~0; + } + else + { + or_mask = 0; + and_mask = ~IDCMP_DELTAMOVE; + } + + ForeachNode(&data->windowlist, wd) + { + if (wd->win) + { + ModifyIDCMP(wd->win, (wd->win->IDCMPFlags | or_mask) & and_mask); + } + } + + return 0; +} + +static Uint32 +AMIGA_GetDoubleClickTimeInMillis(_THIS) +{ + Uint32 interval = 500; + +#ifdef __MORPHOS__ + struct RDArgs rda; + SDL_memset(&rda, 0, sizeof(rda)); + rda.RDA_Source.CS_Buffer = (STRPTR)SDL_LoadFile("ENV:sys/mouse.conf", (size_t *)&rda.RDA_Source.CS_Length); + if (rda.RDA_Source.CS_Buffer) { + LONG *array[4] = {0}; + if (ReadArgs("Pointer/K,RMBEmulationQualifier/K,DoubleClickS/N/K,DoubleClickM/N/K,/F", (LONG *)array, &rda)) { + interval = *array[2] * 1000 + *array[3] / 1000; + FreeArgs(&rda); + } + SDL_free(rda.RDA_Source.CS_Buffer); + } +#else + struct IFFHandle *iffhandle; + if ((iffhandle = AllocIFF())) { + if ((iffhandle->iff_Stream = (ULONG)Open("ENV:Sys/input.prefs", MODE_OLDFILE))) { + InitIFFasDOS(iffhandle); + if (!OpenIFF(iffhandle, IFFF_READ)) { + PropChunk(iffhandle, ID_PREF, ID_INPT); + while (!ParseIFF(iffhandle, IFFPARSE_STEP)) { + struct StoredProperty *sp; + if ((sp = FindProp(iffhandle, ID_PREF, ID_INPT))) { + struct InputPrefs *ip = (struct InputPrefs *)sp->sp_Data; + interval = ip->ip_DoubleClick.tv_secs * 1000 + ip->ip_DoubleClick.tv_micro / 1000; + break; + } + } + CloseIFF(iffhandle); + } + Close(iffhandle->iff_Stream); + } + FreeIFF(iffhandle); + } +#endif + return interval; +} + +void +AMIGA_InitMouse(_THIS) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + char buffer[16]; + + mouse->CreateCursor = AMIGA_CreateCursor; + mouse->CreateSystemCursor = AMIGA_CreateSystemCursor; + mouse->ShowCursor = AMIGA_ShowCursor; + mouse->FreeCursor = AMIGA_FreeCursor; + mouse->WarpMouse = AMIGA_WarpMouse; + mouse->SetRelativeMouseMode = AMIGA_SetRelativeMouseMode; + + SDL_SetDefaultCursor(AMIGA_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); + SDL_SetHint(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, SDL_uitoa(AMIGA_GetDoubleClickTimeInMillis(_this), buffer, 10)); +} + +void +AMIGA_QuitMouse(_THIS) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + D("[%s]\n", __FUNCTION__); + + if ( mouse->def_cursor ) { + SDL_free(mouse->def_cursor); + mouse->def_cursor = NULL; + mouse->cur_cursor = NULL; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigamouse.h b/src/video/amiga/SDL_amigamouse.h new file mode 100644 index 0000000000..529074d92a --- /dev/null +++ b/src/video/amiga/SDL_amigamouse.h @@ -0,0 +1,47 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigamouse_h +#define _SDL_amigamouse_h + +#include "SDL_amigavideo.h" + +#define IS_SYSTEM_CURSOR(cursor) (cursor == NULL || ((size_t)(cursor)->driverdata) < POINTERTYPE_NUMTYPES) + +struct SDL_AmigaPointerData +{ + struct BitMap *bmp; + int offx, offy; +}; + +typedef struct +{ + struct SDL_Cursor Cursor; + struct SDL_AmigaPointerData Pointer; +} SDL_AmigaCursor; + +extern void AMIGA_InitMouse(_THIS); +extern void AMIGA_QuitMouse(_THIS); + +#endif /* _SDL_amigamouse_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c new file mode 100644 index 0000000000..0ec2689012 --- /dev/null +++ b/src/video/amiga/SDL_amigaopengl.c @@ -0,0 +1,242 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_AMIGA + +/* TinyGL implementation of SDL OpenGL support */ +/* MorphOS/TinyGL support by LouiSe */ + +#include "SDL_error.h" +#include "SDL_syswm.h" +#include "../SDL_sysvideo.h" +/*#include "SDL_cgxgl_c.h" +#include "SDL_cgxvideo.h" +#include "mydebug.h"*/ +#include "SDL_amigavideo.h" +#include "SDL_amigawindow.h" +#include "../../core/morphos/SDL_library.h" + +#include +#include +#include +#include +#include + +GLContext *__tglContext; +extern void *AmiGetGLProc(const char *proc); +//struct Screen *DefaultScreen; + +//extern struct SDL_Library *PowerSDLBase; +extern struct SDL_Library *SDL2Base; + +int AMIGA_GL_LoadLibrary(_THIS, const char *path) +{ + D("[%s]\n", __FUNCTION__); + + if (SDL2Base->MyTinyGLBase) { + if (!TinyGLBase) + TinyGLBase = OpenLibrary("tinygl.library", 52); // This is opened only once, closed only at final exit + + if (TinyGLBase) { + + *SDL2Base->MyTinyGLBase = TinyGLBase; + return 0; + } + } + + SDL_SetError("Failed to open tinygl.library"); + return -1; +} + +void *AMIGA_GL_GetProcAddress(_THIS, const char *proc) +{ + void *func = NULL; + + func = AmiGetGLProc(proc); + + D("[%s] proc %s func 0x%08lx\n", __FUNCTION__, proc, func); + + return func; +} + +void AMIGA_GL_UnloadLibrary(_THIS) +{ + D("[%s]\n", __FUNCTION__); + + if (SDL2Base->MyTinyGLBase && *SDL2Base->MyTinyGLBase && TinyGLBase) { + CloseLibrary(TinyGLBase); + *SDL2Base->MyTinyGLBase = TinyGLBase = NULL; + } +} + +SDL_GLContext AMIGA_GL_CreateContext(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + BYTE fullscreen = data->winflags & SDL_AMIGA_WINDOW_FULLSCREEN; + + GLContext *glcont = GLInit(); + + D("[%s] context 0x%08lx\n", __FUNCTION__, glcont); + + if (glcont) { + int success; + struct TagItem tgltags[] = + { + {TAG_IGNORE, 0}, + {TGL_CONTEXT_STENCIL, TRUE}, // TODO check if stencil and depth are needed + {TAG_DONE} + }; + + if (fullscreen) { + tgltags[0].ti_Tag = TGL_CONTEXT_SCREEN; + tgltags[0].ti_Data = (IPTR)vd->CustomScreen; + } else { + tgltags[0].ti_Tag = TGL_CONTEXT_WINDOW; + tgltags[0].ti_Data = (IPTR)data->win; + } + + success = GLAInitializeContext(glcont, tgltags); + + D("[%s] success %d\n", __FUNCTION__, success); + + if (success) { + *SDL2Base->MyGLContext = __tglContext = glcont; + return glcont; + } + + GLClose(glcont); + } else { + SDL_SetError("Couldn't create TinyGL/OpenGL context"); + } + + return NULL; +} + +int +AMIGA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +{ + D("[%s] context 0x%08lx\n", __FUNCTION__, context); + + /*if (window && context)*/ { + *SDL2Base->MyGLContext = __tglContext = context; + return 0; + } + + return -1; +} + +void AMIGA_GL_GetDrawableSize(_THIS, SDL_Window * window, int *w, int *h) +{ + //D("[%s]\n", __FUNCTION__); + + if (window) { + SDL_WindowData * data = window->driverdata; + + if (w) { + *w = data->win->Width - data->win->BorderLeft - data->win->BorderRight; + //D("[%s] w %d\n", __FUNCTION__, *w); + } + + if (h) { + *h = data->win->Height - data->win->BorderTop - data->win->BorderBottom; + //D("[%s] h %d\n", __FUNCTION__, *h); + } + } +} + +int AMIGA_GL_SetSwapInterval(_THIS, int interval) +{ + D("[%s]\n", __FUNCTION__); + + return 0; // pretend to succeed +} + +int AMIGA_GL_GetSwapInterval(_THIS) +{ + SDL_VideoData *data = _this->driverdata; + + D("[%s]\n", __FUNCTION__); + + // full screen double buffering is always vsynced + return data->CustomScreen != NULL ? 1 : 0; +} + +int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window) +{ + //D("[%s]\n", __FUNCTION__); + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (!data->win) + return -1; + // TODO check the window context + GLASwapBuffers(__tglContext); + return 0; +} + +void +AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context) +{ + D("[%s] context 0x%08lx\n", __FUNCTION__, context); + + if (TinyGLBase == NULL) { + D("[%s] the library is already closed\n", __FUNCTION__); + return; + } + + if (context) { + GLADestroyContext((GLContext *)context); + GLClose(context); + } +} + +int AMIGA_GL_ResizeContext(_THIS, SDL_Window *window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + int success; + + D("[%s]\n", __FUNCTION__); + + if (__tglContext == NULL) { + // only if __tglContext exists + D("[%s] no OpenGL context\n", __FUNCTION__); + return -1; + } + + if (vd->CustomScreen) { + struct TagItem tgltags[] = + { + {TGL_CONTEXT_SCREEN, (IPTR)vd->CustomScreen}, + {TGL_CONTEXT_STENCIL, TRUE}, // TODO check if stencil and depth are needed + {TAG_DONE} + }; + GLADestroyContext(__tglContext); + success = GLAInitializeContext(__tglContext, tgltags); + } else { + success = GLAReinitializeContextWindowed(__tglContext, data->win); + } + D("[%s] success %d\n", __FUNCTION__, success); + + return success ? 0 : -1; +} + +#endif diff --git a/src/video/amiga/SDL_amigaopengl.h b/src/video/amiga/SDL_amigaopengl.h new file mode 100644 index 0000000000..3b77b812d1 --- /dev/null +++ b/src/video/amiga/SDL_amigaopengl.h @@ -0,0 +1,44 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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. +*/ + +/* TinyGL implementation of SDL OpenGL support */ + +#include "../../SDL_internal.h" + +#ifndef _SDL_amigaopengl_h +#define _SDL_amigaopengl_h + +/* OpenGL functions */ +extern int AMIGA_GL_LoadLibrary(_THIS, const char *path); +extern void *AMIGA_GL_GetProcAddress(_THIS, const char *proc); +extern void AMIGA_GL_UnloadLibrary(_THIS); +extern SDL_GLContext AMIGA_GL_CreateContext(_THIS, SDL_Window * window); +extern int AMIGA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void AMIGA_GL_GetDrawableSize(_THIS, SDL_Window * window, int *w, int *h); +extern int AMIGA_GL_SetSwapInterval(_THIS, int interval); +extern int AMIGA_GL_GetSwapInterval(_THIS); +extern int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window); +extern void AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context); + +/* Non-SDL functions */ +extern int AMIGA_GL_ResizeContext(_THIS, SDL_Window *window); + +#endif /* _SDL_amigaopengl_h */ diff --git a/src/video/amiga/SDL_amigashape.c b/src/video/amiga/SDL_amigashape.c new file mode 100644 index 0000000000..6c69a65c1b --- /dev/null +++ b/src/video/amiga/SDL_amigashape.c @@ -0,0 +1,196 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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" + +#include "SDL_amigashape.h" +#include "SDL_amigawindow.h" + +#include +#include +#include + + +SDL_WindowShaper* +AMIGA_CreateShaper(SDL_Window *window) +{ + SDL_WindowShaper *result; + + if ((result = SDL_malloc(sizeof(*result)))) + { + result->window = window; + result->mode.mode = ShapeModeDefault; + result->mode.parameters.binarizationCutoff = 1; + result->userx = window->x; + result->usery = window->y; + result->driverdata = NULL; + + window->shaper = result; + } + + return result; +} + +int +AMIGA_ResizeWindowShape(SDL_Window* window) +{ + //SDL_WindowData *data = window->driverdata; + SDL_WindowShaper *shaper = window->shaper; + + shaper->userx = window->x; + shaper->usery = window->y; + + return 0; +} + +static void +AMIGA_ShapeToRegion(struct Region *region, SDL_Surface *shape, const SDL_WindowShapeMode mode) +{ + Uint32 y, bpr = shape->format->BytesPerPixel, pitch; + const Uint8 *pixels; + SDL_Color key; + + D("[%s] mode: %ld\n", __FUNCTION__, mode.mode); + + if (SDL_MUSTLOCK(shape)) + SDL_LockSurface(shape); + + pixels = shape->pixels; + pitch = shape->pitch; + + for (y = 0; y < shape->h; y++) + { + struct Rectangle rect; + int x, have_transp = 0; + + for (x = 0; x < shape->w; x++) + { + Uint32 pixel_value = 0, mask_value = 0; + Uint8 *pixel = (Uint8 *)(pixels) + (y * pitch) + (x * bpr); + Uint8 r, g, b, alpha; + + switch (bpr) + { + case 1: + pixel_value = *(Uint8*)pixel; + break; + + case 2: + pixel_value = *(Uint16*)pixel; + break; + + case 3: + pixel_value = *(Uint32*)pixel & (~shape->format->Amask); + break; + + case 4: + pixel_value = *(Uint32*)pixel; + break; + } + + SDL_GetRGBA(pixel_value, shape->format, &r, &g, &b, &alpha); + + switch (mode.mode) + { + case ShapeModeDefault: + mask_value = (alpha >= 1 ? 1 : 0); + break; + + case ShapeModeBinarizeAlpha: + mask_value = (alpha >= mode.parameters.binarizationCutoff ? 1 : 0); + break; + + case ShapeModeReverseBinarizeAlpha: + mask_value = (alpha <= mode.parameters.binarizationCutoff ? 1 : 0); + break; + + case ShapeModeColorKey: + key = mode.parameters.colorKey; + mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0); + break; + } + + if (have_transp == 0) + { + if (mask_value == 0) + { + rect.MinX = x; + rect.MinY = y; + rect.MaxY = y; + have_transp = 1; + } + } + else + { + if (mask_value == 1) + { + rect.MaxX = x - 1; + have_transp = 0; + OrRectRegion(region, &rect); + } + } + } + + if (have_transp) + { + rect.MaxX = shape->w - 1; + OrRectRegion(region, &rect); + } + } + + if (SDL_MUSTLOCK(shape)) + SDL_UnlockSurface(shape); +} + +int +AMIGA_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *mode) +{ + SDL_WindowData *data = shaper->window->driverdata; + //SDL_ShapeData *sd = shaper->driverdata; + struct Region *old = data->region; + struct Region *region = NewRegion(); + + D("[%s] shaper: 0x%08lx, window: 0x%08lx, driverdata: 0x%08lx, old: 0x%08lx\n", __FUNCTION__, shaper, shaper->window, data, old); + + if (region) + { + data->region = region; + + AMIGA_ShapeToRegion(region, shape, shaper->mode); + + if (data->win) + { + size_t tags[] = { TRANSPCONTROL_REGION, (size_t)region, TAG_DONE }; + D("[%s] Set transparency region (0x%08lx)\n", __FUNCTION__, region); + TransparencyControl(data->win, TRANSPCONTROLMETHOD_INSTALLREGION, (struct TagItem *)&tags); + } + + D("[%s] DisposeRegion(0x%08lx)\n", __FUNCTION__, old); + + if (old) + DisposeRegion(old); + } + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigashape.h b/src/video/amiga/SDL_amigashape.h new file mode 100644 index 0000000000..eed46f80ce --- /dev/null +++ b/src/video/amiga/SDL_amigashape.h @@ -0,0 +1,36 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigashape_h +#define _SDL_amigashape_h + +typedef struct +{ +} SDL_ShapeData; + +extern SDL_WindowShaper *AMIGA_CreateShaper(SDL_Window *window); +extern int AMIGA_ResizeWindowShape(SDL_Window* window); +extern int AMIGA_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode); + +#endif /* _SDL_amigashape_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c new file mode 100644 index 0000000000..03a0d54caf --- /dev/null +++ b/src/video/amiga/SDL_amigavideo.c @@ -0,0 +1,415 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_video.h" +#include "SDL_mouse.h" +#include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" +#include "SDL_hints.h" + +#include "SDL_amigaclipboard.h" +#include "SDL_amigaevents.h" +#include "SDL_amigaframebuffer.h" +#include "SDL_amigakeyboard.h" +#include "SDL_amigamodes.h" +#include "SDL_amigamouse.h" +#include "SDL_amigashape.h" +#include "SDL_amigavideo.h" +#include "SDL_amigawindow.h" +#include "SDL_amigamessagebox.h" +#include "SDL_amigaopengl.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +void +AMIGA_CloseDisplay(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + D("[%s]\n", __FUNCTION__); + + if (data->CustomScreen) + { + CloseScreen(data->CustomScreen); + } + else if (data->WScreen) + { + if (data->ScreenSaverSuspendCount) + { + size_t i; + + for (i = data->ScreenSaverSuspendCount; i > 0; i--) + SetAttrs(data->WScreen, SA_StopBlanker, FALSE, TAG_DONE); + } + + UnlockPubScreen(NULL, data->WScreen); + + if (data->ScreenNotifyHandle) + { + while (!RemWorkbenchClient(data->ScreenNotifyHandle)) + Delay(10); + + data->ScreenNotifyHandle = NULL; + } + } + + data->CustomScreen = NULL; + data->WScreen = NULL; +} + +size_t getv(APTR obj, size_t attr) +{ + size_t val; + GetAttr(attr, obj, (ULONG *)&val); + return val; +} + +void +AMIGA_HideApp(_THIS, size_t with_app_icon) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + D("[%s] %siconify\n", __FUNCTION__, with_app_icon ? "" : "no "); + + AMIGA_CloseWindows(_this); + AMIGA_CloseDisplay(_this); + + if (with_app_icon && data->AppIcon) + { + data->AppIconRef = AddAppIconA(0, 0, FilePart(data->FullAppName), &data->WBPort, 0, data->AppIcon, NULL); + } +} + +void +AMIGA_ShowApp(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + D("[%s]\n", __FUNCTION__); + + if (data->AppIconRef) + { + struct Message *msg; + + RemoveAppIcon(data->AppIconRef); + data->AppIconRef = NULL; + + while ((msg = GetMsg(&data->WBPort)) != NULL) + ReplyMsg(msg); + } + + //AMIGA_GetScreen(_this); + AMIGA_OpenWindows(_this); + AMIGA_GL_ResizeContext(_this, _this->current_glwin); +} + +static int +AMIGA_VideoInit(_THIS) +{ + D("[%s]\n", __FUNCTION__); + + if (AMIGA_InitModes(_this) < 0) + { + return SDL_SetError("Failed to initialize modes"); + } + + AMIGA_InitKeyboard(_this); + AMIGA_InitMouse(_this); + + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); + SDL_SetHint(SDL_HINT_GAMECONTROLLERCONFIG_FILE, "ENV:gamecontrollerdb.txt"); + + return 0; +} + +static void +AMIGA_VideoQuit(_THIS) +{ + //SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + D("[%s]\n", __FUNCTION__); + + AMIGA_CloseWindows(_this); + AMIGA_CloseDisplay(_this); + + AMIGA_QuitMouse(_this); +} + +static void +AMIGA_DeleteDevice(SDL_VideoDevice * device) +{ + SDL_VideoData *data = (SDL_VideoData *) device->driverdata; + D("[%s]\n", __FUNCTION__); + + FreeSignal(data->ScreenNotifyPort.mp_SigBit); + FreeSignal(data->BrokerPort.mp_SigBit); + FreeSignal(data->WBPort.mp_SigBit); + FreeSignal(data->WinPort.mp_SigBit); + + if (data->BrokerRef) + DeleteCxObjAll(data->BrokerRef); + + if (data->AppIcon) + FreeDiskObject(data->AppIcon); + + SDL_free(data); + SDL_free(device); +} + +void +AMIGA_SuspendScreenSaver(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + LONG suspend = _this->suspend_screensaver; + + D("[%s] screen 0x%08lx, suspend %ld\n", __FUNCTION__, data->WScreen, suspend); + + if (suspend == 0 && data->ScreenSaverSuspendCount == 0) + return; + + data->ScreenSaverSuspendCount += suspend ? 1 : -1; + + if (data->WScreen) + { + SetAttrs(data->WScreen, SA_StopBlanker, suspend, TAG_DONE); + } +} + +static +CONST_STRPTR AMIGA_GetTaskName() +{ + struct Process *task = (struct Process *)FindTask(NULL); + STRPTR name = "SDL"; + + if (task->pr_Task.tc_Node.ln_Type == NT_PROCESS || task->pr_Task.tc_Node.ln_Type == NT_TASK) + { + if (task->pr_Task.tc_Node.ln_Type == NT_PROCESS && task->pr_CLI) + { + struct CommandLineInterface *cli = (struct CommandLineInterface *)BADDR(task->pr_CLI); + + if (cli->cli_Module && cli->cli_CommandName) + { + CONST_STRPTR src = (CONST_STRPTR)BADDR(cli->cli_CommandName); + size_t len = *src + 1; + + if (len <= 1) + { + src = "SDL"; + len = sizeof("SDL"); + } + else + { + if (src[1] == '"' && src[len] == '"') + len -= 2; + + src++; + } + + name = SDL_malloc(len); + + if (name) + stccpy(name, src, len); + } + } + else + { + size_t len = strlen(task->pr_Task.tc_Node.ln_Name) + sizeof("PROGDIR:"); + + name = SDL_malloc(len); + + if (name) + { + strcpy(name, "PROGDIR:"); + strcpy(name+8, task->pr_Task.tc_Node.ln_Name); + } + } + } + + D("[%s] '%s'\n", __FUNCTION__, name); + return name; +} + +static void +AMIGA_InitPort(struct MsgPort *port) +{ + port->mp_Node.ln_Name = "SDL"; + port->mp_Flags = PA_SIGNAL; + port->mp_SigTask = SysBase->ThisTask; + + NEWLIST(&port->mp_MsgList); + + port->mp_SigBit = AllocSignal(-1); +} + +static void +AMIGA_InitBroker(SDL_VideoData *data) +{ + D("[%s]\n", __FUNCTION__); + STRPTR name = FilePart(data->FullAppName); + + data->AppBroker.nb_Version = NB_VERSION; + data->AppBroker.nb_Name = name; + data->AppBroker.nb_Title = name; + data->AppBroker.nb_Descr = "SDL"; + data->AppBroker.nb_Unique = NBU_DUPLICATE; + data->AppBroker.nb_Flags = COF_SHOW_HIDE; + data->AppBroker.nb_Pri = 0; + data->AppBroker.nb_Port = &data->BrokerPort; + data->AppBroker.nb_ReservedChannel = 0; + + data->BrokerRef = CxBroker(&data->AppBroker, NULL); + + if (data->BrokerRef) + { + ActivateCxObj(data->BrokerRef, 1); + } +} + +static SDL_VideoDevice * +AMIGA_CreateDevice(int devindex) +{ + /* Initialize all variables that we clean on shutdown */ + SDL_VideoDevice *device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + D("[%s]\n", __FUNCTION__); + + if (device) + { + SDL_VideoData *data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + + device->driverdata = data; + + if (data) + { + AMIGA_InitPort(&data->ScreenNotifyPort); + AMIGA_InitPort(&data->BrokerPort); + AMIGA_InitPort(&data->WBPort); + AMIGA_InitPort(&data->WinPort); + + data->ScrNotifySig = 1 << data->ScreenNotifyPort.mp_SigBit; + data->BrokerSig = 1 << data->BrokerPort.mp_SigBit; + data->WBSig = 1 << data->WBPort.mp_SigBit; + data->WinSig = 1 << data->WinPort.mp_SigBit; + + data->sdlpixfmt = SDL_PIXELFORMAT_ARGB8888; + + NEWLIST(&data->windowlist); + + data->FullAppName = AMIGA_GetTaskName(); + data->AppIcon = GetDiskObject((STRPTR)data->FullAppName); + + if (data->AppIcon == NULL) + { + data->AppIcon = GetDiskObject((STRPTR)"ENVARC:Sys/def_SDL"); + } + + if (data->AppIcon) + { + data->AppIcon->do_CurrentX = NO_ICON_POSITION; + data->AppIcon->do_CurrentY = NO_ICON_POSITION; + data->AppIcon->do_Type = 0; + } + + AMIGA_InitBroker(data); + + data->VideoDevice = device; + + /* Set the function pointers */ + device->VideoInit = AMIGA_VideoInit; + device->VideoQuit = AMIGA_VideoQuit; + device->GetDisplayModes = AMIGA_GetDisplayModes; + //device->GetDisplayBounds = AMIGA_GetDisplayBounds;; + device->SetDisplayMode = AMIGA_SetDisplayMode; + device->SuspendScreenSaver = AMIGA_SuspendScreenSaver; + device->PumpEvents = AMIGA_PumpEvents; + + device->CreateSDLWindow = AMIGA_CreateWindow; + device->CreateSDLWindowFrom = AMIGA_CreateWindowFrom; + device->SetWindowTitle = AMIGA_SetWindowTitle; + device->SetWindowIcon = AMIGA_SetWindowIcon; + device->SetWindowPosition = AMIGA_SetWindowPosition; + device->SetWindowSize = AMIGA_SetWindowSize; + device->SetWindowMinimumSize = AMIGA_SetWindowMinimumSize; + device->SetWindowMaximumSize = AMIGA_SetWindowMaximumSize; + device->ShowWindow = AMIGA_ShowWindow; + device->HideWindow = AMIGA_HideWindow; + device->RaiseWindow = AMIGA_RaiseWindow; + device->MaximizeWindow = AMIGA_MaximizeWindow; + device->MinimizeWindow = AMIGA_MinimizeWindow; + device->RestoreWindow = AMIGA_RestoreWindow; + device->SetWindowBordered = AMIGA_SetWindowBordered; + device->SetWindowFullscreen = AMIGA_SetWindowFullscreen; + device->SetWindowGammaRamp = AMIGA_SetWindowGammaRamp; + device->SetWindowGrab = AMIGA_SetWindowGrab; + device->DestroyWindow = AMIGA_DestroyWindow; + device->CreateWindowFramebuffer = AMIGA_CreateWindowFramebuffer; + device->UpdateWindowFramebuffer = AMIGA_UpdateWindowFramebuffer; + device->DestroyWindowFramebuffer = AMIGA_DestroyWindowFramebuffer; + device->GetWindowWMInfo = AMIGA_GetWindowWMInfo; + + device->shape_driver.CreateShaper = AMIGA_CreateShaper; + device->shape_driver.SetWindowShape = AMIGA_SetWindowShape; + device->shape_driver.ResizeWindowShape = AMIGA_ResizeWindowShape; + + device->GL_LoadLibrary = AMIGA_GL_LoadLibrary; + device->GL_GetProcAddress = AMIGA_GL_GetProcAddress; + device->GL_UnloadLibrary = AMIGA_GL_UnloadLibrary; + device->GL_CreateContext = AMIGA_GL_CreateContext; + device->GL_MakeCurrent = AMIGA_GL_MakeCurrent; + device->GL_GetDrawableSize = AMIGA_GL_GetDrawableSize; + device->GL_SetSwapInterval = AMIGA_GL_SetSwapInterval; + device->GL_GetSwapInterval = AMIGA_GL_GetSwapInterval; + device->GL_SwapWindow = AMIGA_GL_SwapWindow; + device->GL_DeleteContext = AMIGA_GL_DeleteContext; + + device->SetClipboardText = AMIGA_SetClipboardText; + device->GetClipboardText = AMIGA_GetClipboardText; + device->HasClipboardText = AMIGA_HasClipboardText; + + //device->ShowMessageBox = AMIGA_ShowMessageBox; + + device->SetWindowResizable = AMIGA_SetWindowResizable; + //device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; + device->SetWindowOpacity = AMIGA_SetWindowOpacity; + + device->free = AMIGA_DeleteDevice; + + return device; + } + + SDL_free(device); + } + + SDL_OutOfMemory(); + return NULL; +} + +VideoBootStrap AMIGA_bootstrap = { + "amiga", "SDL Amiga video driver", + AMIGA_CreateDevice +}; + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigavideo.h b/src/video/amiga/SDL_amigavideo.h new file mode 100644 index 0000000000..ae0d77d11f --- /dev/null +++ b/src/video/amiga/SDL_amigavideo.h @@ -0,0 +1,94 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigavideo_h +#define _SDL_amigavideo_h + +#include "SDL_keycode.h" + +#include "../SDL_sysvideo.h" +#include "../../events/SDL_mouse_c.h" + +#include "SDL_amigaclipboard.h" +#include "SDL_amigawindow.h" + +#ifndef EXEC_PORTS_H +#include +#endif + +#ifndef LIBRARIES_COMMODITIES_H +#include +#endif + +/* Private display data */ + +struct DiskObject; + +typedef struct SDL_VideoData +{ + struct MsgPort ScreenNotifyPort; + struct MsgPort BrokerPort; + struct MsgPort WBPort; + struct MsgPort WinPort; + + size_t ScrNotifySig, BrokerSig, WBSig, WinSig; + + struct Screen *WScreen; + struct Screen *CustomScreen; + + struct MinList windowlist; + + SDL_Cursor *CurrentPointer; + ULONG sdlpixfmt; + + ULONG coltab[256]; + UBYTE gammatable[3][256]; + + LONG ScreenSaverSuspendCount; + + APTR ScreenNotifyHandle; + + CONST_STRPTR FullAppName; + struct DiskObject *AppIcon; + + APTR AppIconRef; + APTR BrokerRef; + + struct NewBroker AppBroker; + + // Screen information + size_t ScrWidth, ScrHeight, ScrDepth; + CONST_STRPTR ScrMonName; + + SDL_VideoDevice *VideoDevice; + + BYTE FullScreen; +} SDL_VideoData; + +extern size_t getv(APTR obj, size_t attr); +extern void AMIGA_CloseDisplay(_THIS); +extern void AMIGA_HideApp(_THIS, size_t with_app_icon); +extern void AMIGA_ShowApp(_THIS); + +#endif /* _SDL_amigavideo_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c new file mode 100644 index 0000000000..54cfeb9b99 --- /dev/null +++ b/src/video/amiga/SDL_amigawindow.c @@ -0,0 +1,809 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_hints.h" +#include "SDL_syswm.h" +#include "SDL_version.h" +#include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" +#include "../../core/morphos/SDL_misc.h" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/SDL_mouse_c.h" + +#include "SDL_amigavideo.h" +#include "SDL_amigamodes.h" +#include "SDL_amigamouse.h" +#include "SDL_amigaopengl.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +extern struct NewMenu SDL_NewMenu; + +static void CloseWindowSafely(SDL_Window *sdlwin, struct Window *win) +{ + D("[%s]\n", __FUNCTION__); + + if (SDL_GetKeyboardFocus() == sdlwin) + SDL_SetKeyboardFocus(NULL); + + if (SDL_GetMouseFocus() == sdlwin) + SDL_SetMouseFocus(NULL); + + if ((sdlwin->flags & SDL_WINDOW_FOREIGN) == 0) + { + struct IntuiMessage *msg, *tmp; + + Forbid(); + + ForeachNodeSafe(&win->UserPort->mp_MsgList, msg, tmp) + { + if (msg->IDCMPWindow == win) + { + REMOVE(&msg->ExecMessage.mn_Node); + ReplyMsg(&msg->ExecMessage); + } + } + + #if !defined(__MORPHOS__) + win->UserPort = NULL; + ModifyIDCMP(win, 0); + #endif + + SDL_WindowData *data = (SDL_WindowData *) sdlwin->driverdata; + if (data->appmsg) { + if (RemoveAppWindow(data->appmsg)) { + data->appmsg = NULL; + } + } + + ClearMenuStrip(win); + + CloseWindow(win); + if (data->menu) FreeMenus(data->menu); + if (data->visualinfo) FreeVisualInfo(data->visualinfo); + data->menu = NULL; + data->visualinfo = NULL; + Permit(); + } +} + +void +AMIGA_CloseWindows(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_WindowData *wd; + D("[%s]\n", __FUNCTION__); + + ForeachNode(&data->windowlist, wd) + { + struct Window *win = wd->win; + + if (win) + { + wd->win = NULL; + CloseWindowSafely(wd->window, win); + } + } +} + +void AMIGA_OpenWindows(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_WindowData *wd; + D("[%s]\n", __FUNCTION__); + + ForeachNode(&data->windowlist, wd) + { + if (wd->win == NULL && !(wd->window->flags & SDL_WINDOW_FOREIGN) && (wd->winflags & SDL_AMIGA_WINDOW_SHOWN)) + { + AMIGA_ShowWindow_Internal(_this, wd->window); + } + } +} + +static int +AMIGA_SetupWindowData(_THIS, SDL_Window *window, struct Window *win) +{ + D("[%s]\n", __FUNCTION__); + + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_WindowData *wd = SDL_malloc(sizeof(*wd)); + + if (wd) + { + window->driverdata = wd; + + ADDHEAD(&data->windowlist, wd); + + wd->region = NULL; + wd->fb = NULL; + wd->window = window; + wd->win = win; + wd->grabbed = -1; + wd->sdlflags = 0; + wd->window_title = NULL; + wd->videodata = data; + wd->first_deltamove = 0; + wd->winflags = 0; + wd->appmsg = NULL; + + if (win) + { + win->UserData = (APTR)wd; + } + } + else + { + return SDL_OutOfMemory(); + } + + return 0; +} + +int +AMIGA_CreateWindow(_THIS, SDL_Window * window) +{ + return AMIGA_SetupWindowData(_this, window, NULL); +} + +int +AMIGA_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + struct Window *win = (struct Window *)data; + size_t flags; + + if (win->Title && win->Title != (APTR)-1) + window->title = AMIGA_ConvertText(win->Title, MIBENUM_SYSTEM, MIBENUM_UTF_8); + + flags = (window->flags | SDL_WINDOW_SHOWN | SDL_WINDOW_FOREIGN) & ~SDL_WINDOW_MINIMIZED; + + if (win->Flags & WFLG_SIZEGADGET) + flags |= SDL_WINDOW_RESIZABLE; + else + flags &= ~SDL_WINDOW_RESIZABLE; + + if (win->Flags & WFLG_BORDERLESS) + flags |= SDL_WINDOW_BORDERLESS; + else + flags &= ~SDL_WINDOW_BORDERLESS; + + if (win->Flags & WFLG_WINDOWACTIVE) + { + flags |= SDL_WINDOW_INPUT_FOCUS; + SDL_SetKeyboardFocus(window); + } + + window->flags = flags; + + return AMIGA_SetupWindowData(_this, window, win); +} + +void +AMIGA_SetWindowTitle(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + APTR old = data->window_title; + APTR title = NULL; + + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + title = AMIGA_ConvertText(window->title, MIBENUM_UTF_8, MIBENUM_SYSTEM); + + D("[AMIGA_SetWindowTitle] %s to %s (0x%08lx)\n", window->title, title, data->win); + SetWindowTitles(data->win, title, title); + } + + data->window_title = title; + + SDL_free(old); +} + +void +AMIGA_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ + //#warning convert this icon to appicon +} + +void +AMIGA_SetWindowPosition(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + SDL_VideoData *vd = data->videodata; + struct Screen *scr = vd->WScreen; + size_t bh = 0, top = window->y; + + if (vd->CustomScreen == NULL) + bh = scr->BarHeight + 1; + + top = MAX(bh, top); + + ChangeWindowBox(data->win, window->x, top, data->win->Width, data->win->Height); + } +} + +void +AMIGA_SetWindowMinimumSize(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + SDL_VideoData *vd = data->videodata; + struct Screen *scr = vd->WScreen; + size_t bh = 0, min_h = window->min_h, min_w = window->min_w; + + if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) + { + min_w += data->win->BorderLeft + data->win->BorderRight; + min_h += data->win->BorderTop + data->win->BorderBottom; + } + + if (vd->CustomScreen == NULL) + bh = scr->BarHeight + 1; + + min_h = MIN(scr->Height - bh, min_h); + + WindowLimits(data->win, min_w, min_h, data->win->MaxWidth, MAX(data->win->MaxHeight, min_h)); + } +} + +void +AMIGA_SetWindowMaximumSize(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + SDL_VideoData *vd = data->videodata; + struct Screen *scr = vd->WScreen; + size_t bh = 0, max_h = window->max_h, max_w = window->max_w; + + if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) + { + max_w += data->win->BorderLeft + data->win->BorderRight; + max_h += data->win->BorderTop + data->win->BorderBottom; + } + + if (vd->CustomScreen == NULL) + bh = scr->BarHeight + 1; + + max_h = MIN(scr->Height - bh, max_h); + + WindowLimits(data->win, data->win->MinWidth, MIN(data->win->MinHeight, max_h), max_w, max_h); + } +} + +void +AMIGA_SetWindowSize(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s]\n", __FUNCTION__); + + if (data->win) + { + SDL_VideoData *vd = data->videodata; + struct Screen *scr = vd->WScreen; + size_t bh = 0, h = window->h, w = window->w; + + if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) + { + w += data->win->BorderLeft + data->win->BorderRight; + h += data->win->BorderTop + data->win->BorderBottom; + } + + if (vd->CustomScreen == NULL) + bh = scr->BarHeight + 1; + + h = MIN(scr->Height - bh, h); + + ChangeWindowBox(data->win, data->win->LeftEdge, data->win->TopEdge, w, h); + } +} + +static void +AMIGA_UpdateWindowState(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s]\n", __FUNCTION__); + + if (data->win) + { + AMIGA_HideWindow(_this, window); + AMIGA_ShowWindow(_this, window); + } +} + +void +AMIGA_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) +{ + D("[%s]\n", __FUNCTION__); + AMIGA_UpdateWindowState(_this, window); +} + +static void +AMIGA_WindowToFront(struct Window *win) +{ + D("[%s] wnd 0x%08lx\n", __FUNCTION__, win); + ActivateWindow(win); + WindowToFront(win); +} + +void +AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + D("[%s] wnd 0x%08lx, scr 0x%08lx\n", __FUNCTION__, data->win, vd->WScreen); + + if (data->win == NULL && (data->sdlflags & SDL_WINDOW_MINIMIZED) == 0) + { + struct Screen *scr; + size_t flags = WFLG_SIMPLE_REFRESH | WFLG_REPORTMOUSE | WFLG_ACTIVATE; + size_t w = window->w, h = window->h, max_w = window->max_w, max_h = window->max_h; + size_t min_w = window->min_w, min_h = window->min_h; + size_t left = window->x, top = window->y; + int maxheight, barheight = 0; + BYTE fullscreen = data->winflags & SDL_AMIGA_WINDOW_FULLSCREEN; + + data->winflags |= SDL_AMIGA_WINDOW_SHOWN; + + D("[%s] initial sizes %ld/%ld and %ld/%ld\n", __FUNCTION__, w, h, max_w, max_h); + + if (vd->WScreen == NULL) + AMIGA_GetScreen(vd->VideoDevice, vd->FullScreen, (window->flags & SDL_WINDOW_OPENGL) != 0); + + scr = vd->WScreen; + + D("[%s] screen 0x%08lx is %ld/%ld and %ld/%ld\n", __FUNCTION__, scr, scr->Width, scr->Height); + + // Add border sizes + APTR di = GetScreenDrawInfo(scr); + + if (vd->CustomScreen == NULL) + barheight = GetSkinInfoAttrA(di, SI_ScreenTitlebarHeight, NULL); + + FreeScreenDrawInfo(scr, di); + + maxheight = scr->Height - barheight; + + // Maximize window + if (fullscreen) + { + w = scr->Width; + h = maxheight; + top = left = 0; + } + else if (data->sdlflags & SDL_WINDOW_MAXIMIZED) + { + int border_w = GetSkinInfoAttrA(di, SI_BorderLeft , NULL) + GetSkinInfoAttrA(di, SI_BorderRight, NULL); + int border_h = GetSkinInfoAttrA(di, SI_BorderTopTitle, NULL) + GetSkinInfoAttrA(di, window->flags & SDL_WINDOW_RESIZABLE ? SI_BorderBottomSize : SI_BorderBottom, NULL); + + D("[%s] Border width %ld, border height %ld, bar height %ld\n", __FUNCTION__, border_w, border_h, barheight); + + max_w = MAX(w, max_w) - border_w; + max_h = MAX(h, max_h) - border_h; + max_h = MIN(maxheight - border_h, max_h); + + left = 0; + top = barheight; //MAX(barheight, top); + + w = max_w; + h = max_h; + + if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) + { + //top = barheight; + } + + D("[%s] maximize to %ld/%ld\n", __FUNCTION__, w, h); + } + if (!fullscreen) + { + data->visualinfo = GetVisualInfoA(vd->WScreen, NULL); + if (data->visualinfo) + { + data->menu = CreateMenusA(&SDL_NewMenu, NULL); + if (data->menu) + { + LayoutMenusA(data->menu, data->visualinfo, NULL); + } + } + } + + min_w = MIN(min_w, scr->Width); + min_h = MIN(min_h, maxheight); + max_w = MIN(max_w, scr->Width); + max_h = MIN(max_h, maxheight); + w = MAX(min_w, w); + h = MAX(min_h, h); + + if (window->flags & SDL_WINDOW_BORDERLESS || fullscreen) + flags |= WFLG_BORDERLESS; + else + flags |= WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET; + + SDL_bool win_resizable = (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen); + + if (win_resizable) + flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; + + if (data->window_title == NULL) + data->window_title = AMIGA_ConvertText(window->title, MIBENUM_UTF_8, MIBENUM_SYSTEM); + + D("[%s] min %ld/%ld, normal %ld/%ld, max %ld/%ld\n", __FUNCTION__, min_w, min_h, w, h, max_w, max_h); + + data->win = OpenWindowTags(NULL, + WA_Left, left, WA_Top, top, + WA_InnerWidth, w, + WA_InnerHeight, h, + WA_MinWidth, win_resizable ? 32 : min_w, + WA_MinHeight, win_resizable ? 32 : min_h, + WA_MaxWidth, win_resizable ? -1 : max_w, + WA_MaxHeight, win_resizable ? -1 : max_h, + WA_Flags, flags, + vd->CustomScreen ? WA_CustomScreen : TAG_IGNORE, vd->CustomScreen, + vd->CustomScreen ? TAG_IGNORE : WA_PubScreen, vd->WScreen, + data->region ? WA_TransparentRegion : TAG_IGNORE, data->region, + WA_ScreenTitle, data->window_title, + fullscreen ? TAG_IGNORE : WA_Title, data->window_title, + WA_UserPort, &vd->WinPort, + WA_AutoAdjust, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_MOUSEMOVE | IDCMP_DELTAMOVE | IDCMP_MOUSEBUTTONS | IDCMP_REFRESHWINDOW | IDCMP_ACTIVEWINDOW | IDCMP_INACTIVEWINDOW | IDCMP_CHANGEWINDOW | IDCMP_GADGETUP | IDCMP_MENUPICK, + WA_ExtraTitlebarGadgets, ETG_ICONIFY, + TAG_DONE); + + if (data->win) + { + if (IS_SYSTEM_CURSOR(vd->CurrentPointer)) + { + size_t pointertags[] = { WA_PointerType, vd->CurrentPointer == NULL ? POINTERTYPE_INVISIBLE : (size_t)vd->CurrentPointer->driverdata, TAG_DONE }; + SetAttrsA(data->win, (struct TagItem *)&pointertags); + } + else + { + SDL_AmigaCursor *ac = (SDL_AmigaCursor *)vd->CurrentPointer; + size_t pointertags[] = { POINTERA_BitMap, (size_t)ac->Pointer.bmp, POINTERA_XOffset, ac->Pointer.offx, POINTERA_YOffset, ac->Pointer.offy, TAG_DONE }; + SetWindowPointerA(data->win, (struct TagItem *)&pointertags); + } + + data->curr_x = data->win->LeftEdge; + data->curr_y = data->win->TopEdge; + data->curr_w = data->win->Width; + data->curr_h = data->win->Height; + + data->first_deltamove = TRUE; + + data->win->UserData = (APTR)data; + + if (data->menu) + { + SetMenuStrip(data->win, data->menu); + } + + if (!data->appmsg) { + data->appmsg = AddAppWindow(0, (ULONG)window, data->win, &vd->WBPort, TAG_DONE); + if (!data->appmsg) { + D("[%s] ERROR AddAppWindow \n", __FUNCTION__); + } + } + + if (data->grabbed > 0) + DoMethod((Object *)data->win, WM_ObtainEvents); + } + + } + else if (data->win) + { + AMIGA_WindowToFront(data->win); + } +} + +void +AMIGA_ShowWindow(_THIS, SDL_Window * window) +{ + D("[%s]\n", __FUNCTION__); + + AMIGA_ShowWindow_Internal(_this, window); +} + +void +AMIGA_HideWindow_Internal(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + CloseWindowSafely(window, data->win); + data->win = NULL; + } +} + +void +AMIGA_HideWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s]\n", __FUNCTION__); + + data->winflags &= ~SDL_AMIGA_WINDOW_SHOWN; + AMIGA_HideWindow_Internal(_this, window); +} + +void +AMIGA_RaiseWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] wnd 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + AMIGA_WindowToFront(data->win); + } +} + +void +AMIGA_MaximizeWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *videodata = (SDL_VideoData *) data->videodata; + struct Screen *scr = data->win->WScreen; + ULONG bh = 0; + + D("[%s] wnd 0x%08lx\n", __FUNCTION__, data->win); + + data->sdlflags |= SDL_WINDOW_MAXIMIZED; + data->sdlflags &= ~SDL_WINDOW_MINIMIZED; + + if (data->win) + { + if (videodata->CustomScreen == NULL) + bh = scr->BarHeight + 1; + + ChangeWindowBox(data->win, 0, bh, data->win->MaxWidth, data->win->MaxHeight); + } +} + +void +AMIGA_MinimizeWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] wnd 0x%08lx\n", __FUNCTION__, data->win); + + data->sdlflags |= SDL_WINDOW_MINIMIZED; + data->sdlflags &= ~SDL_WINDOW_MAXIMIZED; + + AMIGA_HideWindow(_this, window); +} + +void +AMIGA_RestoreWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] wnd 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + data->sdlflags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED); + + ChangeWindowBox(data->win, window->x, window->y, window->w, window->h); + AMIGA_WindowToFront(data->win); + } +} + +void +AMIGA_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + + D("[%s]\n", __FUNCTION__); + + if (fullscreen) + data->winflags |= SDL_AMIGA_WINDOW_FULLSCREEN; + else + data->winflags &= ~SDL_AMIGA_WINDOW_FULLSCREEN; + + vd->FullScreen = fullscreen; + + AMIGA_OpenWindows(_this); + //AMIGA_UpdateWindowState(_this, window); + AMIGA_GL_ResizeContext(_this, window); +} + + +int +AMIGA_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + int i; + + for (i = 0; i < 256; i++) { + vd->gammatable[0][i] = ramp[0*256 + i] >> 8; + vd->gammatable[1][i] = ramp[1*256 + i] >> 8; + vd->gammatable[2][i] = ramp[2*256 + i] >> 8; + } + + if (vd->CustomScreen) { + SetAttrs(vd->CustomScreen, + SA_GammaRed, (IPTR)vd->gammatable[0], + SA_GammaGreen, (IPTR)vd->gammatable[1], + SA_GammaBlue, (IPTR)vd->gammatable[2], + TAG_DONE); + } + + return 0; +} + +void +AMIGA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if (data->win && data->grabbed != (grabbed ? 1 : 0)) + { + D("[%s] %s\n", __FUNCTION__, grabbed ? "grabbed" : "not grabbed"); + + data->grabbed = grabbed ? 1 : 0; + + if (grabbed && (data->win->Flags & WFLG_WINDOWACTIVE) == 0) + AMIGA_WindowToFront(data->win); + + DoMethod((Object *)data->win, grabbed ? WM_ObtainEvents : WM_ReleaseEvents); + } +} + +void +AMIGA_DestroyWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + D("[%s]\n", __FUNCTION__); + window->driverdata = NULL; + + if (data) + { + SDL_VideoData *videodata = (SDL_VideoData *) data->videodata; + + REMOVE(&data->node); + + if (data->win) + CloseWindowSafely(window, data->win); + + if (data->region) + DisposeRegion(data->region); + + if (IsListEmpty((struct List *)&videodata->windowlist)) // && videodata->CustomScreen) + { + D("[%s] Was last window... get rid of screen.\n", __FUNCTION__); + AMIGA_CloseDisplay(_this); + //CloseScreen(videodata->CustomScreen); + //videodata->CustomScreen = NULL; + } + + SDL_free(data->window_title); + SDL_free(data); + } +} + +SDL_bool +AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if (info->version.major >= SDL_MAJOR_VERSION) + { + info->subsystem = SDL_SYSWM_AMIGA; + info->info.intui.window = data->win; + return SDL_TRUE; + } else { + SDL_SetError("Application not compiled with SDL %d\n", SDL_MAJOR_VERSION); + return SDL_FALSE; + } +} + +static void AMIGA_CloseWindow(SDL_Window *window) +{ + + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (data->win) + { + if (data->appmsg) { + if (RemoveAppWindow(data->appmsg)) { + data->appmsg = NULL; + } + } + + struct Window *win = data->win; + CloseWindow(win); + data->win = NULL; + } +} + +void +AMIGA_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) +{ + SDL_WindowData *data = window->driverdata; + D("[%s] 0x%08lx\n", __FUNCTION__, data->win); + + if (window->flags & SDL_WINDOW_FOREIGN) { + D("[%s] Cannot modify native window '%s'\n", __FUNCTION__, window->title); + return; + } + + if (data->win) { + D("[%s] Closing system window '%s' before re-creation\n", __FUNCTION__, window->title); + AMIGA_CloseWindow(window); + } + + AMIGA_ShowWindow_Internal(_this, window); + + if (data->win) { + // Make sure the new window is active + AMIGA_ShowWindow(_this, window); + } else { + D("[%s] Failed to re-create window '%s'\n", __FUNCTION__, window->title); + } +} + +int +AMIGA_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + LONG ret; + + ULONG value = ((opacity) * (ULONG_MAX)); + + D("Setting window '%s' opaqueness to %lu\n", window->title, value); + + ret = SetAttrs( + data->win, + WA_Opacity, value, + TAG_DONE); + + if (ret) { + D("Failed to set window opaqueness to %d\n", value); + return -1; + } + + return 0; +} +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h new file mode 100644 index 0000000000..b8e8fb5d9a --- /dev/null +++ b/src/video/amiga/SDL_amigawindow.h @@ -0,0 +1,106 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 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_amigawindow_h +#define _SDL_amigawindow_h + +#ifndef EXEC_NODES_H +#include +#endif + +typedef struct +{ + Uint32 kludge1, kludge2, bpr, pixfmt; + Uint8 buffer[0]; +} SDL_Framebuffer; + +typedef struct +{ + struct MinNode node; + + struct Region *region; + SDL_Framebuffer *fb; + + SDL_Window *window; + struct Window *win; + struct AppWindow *appmsg; + + // Localized window title, use SDL_free() to deallocate + char *window_title; + + struct SDL_VideoData *videodata; + + // Currently known window position and dimensions + LONG curr_x, curr_y, curr_w, curr_h; + + // Flags that must be taken into account at AMIGA_ShowWindow() + Uint32 sdlflags; + + BYTE grabbed; + BYTE first_deltamove; + BYTE winflags; + + APTR visualinfo; + struct Menu *menu; +} SDL_WindowData; + +/* Is this window shown (not iconified) */ +#define SDL_AMIGA_WINDOW_SHOWN (1 << 0) +#define SDL_AMIGA_WINDOW_FULLSCREEN (1 << 1) + +extern void AMIGA_CloseWindows(_THIS); +extern void AMIGA_OpenWindows(_THIS); + + +extern int AMIGA_CreateWindow(_THIS, SDL_Window * window); +extern int AMIGA_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +extern void AMIGA_SetWindowTitle(_THIS, SDL_Window * window); +extern void AMIGA_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +extern void AMIGA_SetWindowPosition(_THIS, SDL_Window * window); +extern void AMIGA_SetWindowMinimumSize(_THIS, SDL_Window * window); +extern void AMIGA_SetWindowMaximumSize(_THIS, SDL_Window * window); +extern void AMIGA_SetWindowSize(_THIS, SDL_Window * window); +extern void AMIGA_ShowWindow(_THIS, SDL_Window * window); +extern void AMIGA_HideWindow(_THIS, SDL_Window * window); +extern void AMIGA_RaiseWindow(_THIS, SDL_Window * window); +extern void AMIGA_MaximizeWindow(_THIS, SDL_Window * window); +extern void AMIGA_MinimizeWindow(_THIS, SDL_Window * window); +extern void AMIGA_RestoreWindow(_THIS, SDL_Window * window); +extern void AMIGA_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); +extern void AMIGA_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); +extern int AMIGA_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); +extern void AMIGA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +extern void AMIGA_DestroyWindow(_THIS, SDL_Window * window); +extern SDL_bool AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); + +extern void AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window); +extern void AMIGA_HideWindow_Internal(_THIS, SDL_Window * window); + +extern void AMIGA_SetWindowResizable (_THIS, SDL_Window * window, SDL_bool resizable); + +extern int AMIGA_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); +//extern int AMIGA_GetWindowBordersSize(_THIS, SDL_Window * window, int * top, int * left, int * bottom, int * right); + + +#endif /* _SDL_amigawindow_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/Makefile.mos b/test/Makefile.mos new file mode 100644 index 0000000000..a850c75e92 --- /dev/null +++ b/test/Makefile.mos @@ -0,0 +1,304 @@ +# Makefile to build the MorphOS SDL tests + +AR = ppc-morphos-ar +CC = ppc-morphos-gcc-10 +CFLAGS = -noixemul -O2 -Wall -g -I../include -DHAVE_OPENGL +LIBS = -L. -lSDL2test -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm + +TARGETS = \ + checkkeys \ + controllermap \ + helloworld \ + loopwave \ + loopwavequeue \ + sdl2benchmark \ + testatomic \ + testaudiocapture \ + testaudiohotplug \ + testaudioinfo \ + testautomation \ + testbounds \ + testcustomcursor \ + testdisplayinfo \ + testdraw2 \ + testdrawchessboard \ + testdropfile \ + testerror \ + testfile \ + testfilesystem \ + testgamecontroller \ + testgesture \ + testgl2 \ + testgles \ + testgles2 \ + testhaptic \ + testhittesting \ + testhotplug \ + testiconv \ + testime \ + testintersections \ + testjoystick \ + testkeys \ + testloadso \ + testlock \ + testmessage \ + testmultiaudio \ + testnative \ + testoffscreen \ + testoverlay2 \ + testplatform \ + testpower \ + testqsort \ + testrelative \ + testrendercopyex \ + testrendertarget \ + testresample \ + testrumble \ + testscale \ + testsem \ + testshader \ + testshape \ + testsprite2 \ + testspriteminimal \ + teststreaming \ + testthread \ + testtimer \ + testurl \ + testver \ + testviewport \ + testvulkan \ + testwm2 \ + testyuv \ + torturethread \ + +# testgesture \ +# testsensor \ + +CSRCS = 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 +TESTLIB = libSDL2test.a +COBJS = $(addprefix ../src/test/, $(CSRCS:.c=.o)) + +all: $(TESTLIB) $(TARGETS) + +$(TESTLIB): $(COBJS) + $(AR) crvs $@ $^ + +checkkeys: checkkeys.o + $(CC) -o $@ $^ $(LIBS) + +helloworld: helloworld.o + $(CC) -o $@ $^ $(LIBS) + +loopwave: loopwave.o + $(CC) -o $@ $^ $(LIBS) + +loopwavequeue: loopwavequeue.o + $(CC) -o $@ $^ $(LIBS) + +sdl2benchmark: sdl2benchmark.o + $(CC) -o $@ $^ $(LIBS) + +testresample: testresample.o + $(CC) -o $@ $^ $(LIBS) + +testaudioinfo: testaudioinfo.o + $(CC) -o $@ $^ $(LIBS) + +testautomation: testautomation.o \ + testautomation_audio.o \ + testautomation_clipboard.o \ + testautomation_events.o \ + testautomation_keyboard.o \ + testautomation_main.o \ + testautomation_mouse.o \ + testautomation_pixels.o \ + testautomation_platform.o \ + testautomation_rect.o \ + testautomation_render.o \ + testautomation_rwops.o \ + testautomation_sdltest.o \ + testautomation_stdlib.o \ + testautomation_surface.o \ + testautomation_syswm.o \ + testautomation_timer.o \ + testautomation_video.o \ + testautomation_hints.o + $(CC) -o $@ $^ $(LIBS) + +testmultiaudio: testmultiaudio.o + $(CC) -o $@ $^ $(LIBS) + +testaudiohotplug: testaudiohotplug.o + $(CC) -o $@ $^ $(LIBS) + +testaudiocapture: testaudiocapture.o + $(CC) -o $@ $^ $(LIBS) + +testatomic: testatomic.o + $(CC) -o $@ $^ $(LIBS) + +testintersections: testintersections.o + $(CC) -o $@ $^ $(LIBS) + +testrelative: testrelative.o + $(CC) -o $@ $^ $(LIBS) + +testhittesting: testhittesting.o + $(CC) -o $@ $^ $(LIBS) + +testdraw2: testdraw2.o + $(CC) -o $@ $^ $(LIBS) + +testdrawchessboard: testdrawchessboard.o + $(CC) -o $@ $^ $(LIBS) + +testdropfile: testdropfile.o + $(CC) -o $@ $^ $(LIBS) + +testerror: testerror.o + $(CC) -o $@ $^ $(LIBS) + +testfile: testfile.o + $(CC) -o $@ $^ $(LIBS) + +testgamecontroller: testgamecontroller.o + $(CC) -o $@ $^ $(LIBS) + +testgesture: testgesture.o + $(CC) -o $@ $^ $(LIBS) + +testgl2: testgl2.o + $(CC) -o $@ $^ $(LIBS) + +testgles: testgles.o + $(CC) -o $@ $^ $(LIBS) + +testgles2: testgles2.o + $(CC) -o $@ $^ $(LIBS) + +testhaptic: testhaptic.o + $(CC) -o $@ $^ $(LIBS) + +testhotplug: testhotplug.o + $(CC) -o $@ $^ $(LIBS) + +testrumble: testrumble.o + $(CC) -o $@ $^ $(LIBS) + +testthread: testthread.o + $(CC) -o $@ $^ $(LIBS) + +testiconv: testiconv.o + $(CC) -o $@ $^ $(LIBS) + +testime: testime.o + $(CC) -o $@ $^ $(LIBS) + +testjoystick: testjoystick.o + $(CC) -o $@ $^ $(LIBS) + +testkeys: testkeys.o + $(CC) -o $@ $^ $(LIBS) + +testloadso: testloadso.o + $(CC) -o $@ $^ $(LIBS) + +testlock: testlock.o + $(CC) -o $@ $^ $(LIBS) + +testnative: testnative.o testnativeamigaos4.o + $(CC) -o $@ $^ $(LIBS) + +testoffscreen: testoffscreen.o + $(CC) -o $@ $^ $(LIBS) + +testoverlay2: testoverlay2.o testyuv_cvt.o + $(CC) -o $@ $^ $(LIBS) + +testplatform: testplatform.o + $(CC) -o $@ $^ $(LIBS) + +testpower: testpower.o + $(CC) -o $@ $^ $(LIBS) + +testfilesystem: testfilesystem.o + $(CC) -o $@ $^ $(LIBS) + +testrendertarget: testrendertarget.o + $(CC) -o $@ $^ $(LIBS) + +testscale: testscale.o + $(CC) -o $@ $^ $(LIBS) + +testsem: testsem.o + $(CC) -o $@ $^ $(LIBS) + +testsensor: testsensor.o + $(CC) -o $@ $^ $(LIBS) + +testshader: testshader.o + $(CC) -o $@ $^ $(LIBS) + +testshape: testshape.o + $(CC) -o $@ $^ $(LIBS) + +testsprite2: testsprite2.o + $(CC) -o $@ $^ $(LIBS) + +testspriteminimal: testspriteminimal.o + $(CC) -o $@ $^ $(LIBS) + +teststreaming: teststreaming.o + $(CC) -o $@ $^ $(LIBS) + +testtimer: testtimer.o + $(CC) -o $@ $^ $(LIBS) + +testver: testver.o + $(CC) -o $@ $^ $(LIBS) + +testviewport: testviewport.o + $(CC) -o $@ $^ $(LIBS) + +testwm2: testwm2.o + $(CC) -o $@ $^ $(LIBS) + +testyuv: testyuv.o testyuv_cvt.o + $(CC) -o $@ $^ $(LIBS) + +torturethread: torturethread.o + $(CC) -o $@ $^ $(LIBS) + +testrendercopyex: testrendercopyex.o + $(CC) -o $@ $^ $(LIBS) + +testmessage: testmessage.o + $(CC) -o $@ $^ $(LIBS) + +testdisplayinfo: testdisplayinfo.o + $(CC) -o $@ $^ $(LIBS) + +testqsort: testqsort.o + $(CC) -o $@ $^ $(LIBS) + +testbounds: testbounds.o + $(CC) -o $@ $^ $(LIBS) + +testcustomcursor: testcustomcursor.o + $(CC) -o $@ $^ $(LIBS) + +controllermap: controllermap.o + $(CC) -o $@ $^ $(LIBS) + +testvulkan: testvulkan.o + $(CC) -o $@ $^ $(LIBS) + +testurl: testurl.o + $(CC) -o $@ $^ $(LIBS) + +clean: + rm -f $(TARGETS) *.o $(COBJS) $(TESTLIB) diff --git a/test/controllermap.c b/test/controllermap.c index db98f32f3d..976c140718 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -737,7 +737,7 @@ main(int argc, char *argv[]) return 2; } - while (SDL_NumJoysticks() == 0) { + while (SDL_NumJoysticks() == 0 && !done) { SDL_Event event; while (SDL_PollEvent(&event) > 0) { diff --git a/test/helloworld.c b/test/helloworld.c index 7fb9376080..808c5e1a25 100644 --- a/test/helloworld.c +++ b/test/helloworld.c @@ -6,8 +6,13 @@ for doing ad-hoc testing related to AmigaOS 4 port. */ #include +#ifdef __MORPHOS__ +#include "SDL.h" +#include "SDL_opengl.h" +#else #include "SDL2/SDL.h" #include "SDL2/SDL_opengl.h" +#endif #if SDL_BYTEORDER != SDL_BIG_ENDIAN #warning "wrong endian?" diff --git a/test/sdl2benchmark.c b/test/sdl2benchmark.c index 570b71af0e..b92c74152f 100755 --- a/test/sdl2benchmark.c +++ b/test/sdl2benchmark.c @@ -15,7 +15,11 @@ will give failure. */ +#ifdef __MORPHOS__ +#include "SDL.h" +#else #include "SDL2/SDL.h" +#endif #define BENCHMARK_VERSION "0.6" diff --git a/test/testgl2.c b/test/testgl2.c index 894ff80c2d..98d4ff1639 100644 --- a/test/testgl2.c +++ b/test/testgl2.c @@ -22,6 +22,9 @@ #ifdef HAVE_OPENGL +#ifdef __MORPHOS__ +#define _NO_PPCINLINE +#endif #include "SDL_opengl.h" typedef struct GL_Context @@ -51,6 +54,11 @@ static int LoadContext(GL_Context * data) #if defined __SDL_NOGETPROCADDR__ #define SDL_PROC(ret,func,params) data->func=func; +#elif defined(__MORPHOS__) +#define SDL_PROC(ret,func,params) \ + do { \ + data->func = SDL_GL_GetProcAddress(#func); \ + } while ( 0 ); #else #define SDL_PROC(ret,func,params) \ do { \ diff --git a/test/testvulkan.c b/test/testvulkan.c index 3a2830b95d..9c49c53c41 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -16,7 +16,7 @@ #include "SDL_test_common.h" -#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) +#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) || defined(__MORPHOS__) int main(int argc, char *argv[]) { diff --git a/test/torturethread.c b/test/torturethread.c index 382a2ede15..786de428cc 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -88,7 +88,9 @@ main(int argc, char *argv[]) return (1); } +#ifndef __MORPHOS__ signal(SIGSEGV, SIG_DFL); +#endif for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i);