From 28dad4529ffb1fa3ef3bb73f418aa611b9786308 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 16:18:46 +0100 Subject: [PATCH 001/214] Create makefile.mos --- makefile.mos | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 makefile.mos diff --git a/makefile.mos b/makefile.mos new file mode 100644 index 0000000000..533f82a0b2 --- /dev/null +++ b/makefile.mos @@ -0,0 +1,82 @@ +# Makefile to build the MorphOS SDL library + +AR = ppc-morphos-ar +RANLIB = ppc-morphos-ranlib +CC = ppc-morphos-gcc-8 +CXX = ppc-morphos-g++-8 +STRIP = ppc-morphos-strip + +AMIGADATE = $(shell date +"%-d.%-m.%Y") + +CFLAGS = -Wall -Wno-pointer-sign -mresident32 -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" + +TARGET_STATIC = libSDL2.a +TARGET_SHARED = libSDL2-2.0.so +TESTLIB_STATIC = libSDL2_test.a + +SOURCES = \ + ./src/*.c \ + ./src/atomic/*.c \ + ./src/audio/*.c \ + ./src/audio/morphos/*.c \ + ./src/audio/dummy/*.c \ + ./src/core/morphos/*.c \ + ./src/cpuinfo/*.c \ + ./src/events/*.c \ + ./src/file/*.c \ + ./src/filesystem/morphos/*.c \ + ./src/haptic/*.c \ + ./src/haptic/dummy/*.c \ + ./src/joystick/*.c \ + ./src/joystick/morphos/*.c \ + ./src/loadso/dlopen/*.c \ + ./src/render/*.c \ + ./src/power/*.c \ + ./src/power/morphos/*.c \ + ./src/render/software/*.c \ + ./src/sensor/*.c \ + ./src/sensor/dummy/*.c \ + ./src/stdlib/*.c \ + ./src/thread/*.c \ + ./src/thread/morphos/*.c\ + ./src/timer/*.c \ + ./src/timer/morphos/*.c \ + ./src/video/*.c \ + ./src/video/morphos/*.c \ + ./src/video/yuv2rgb/*.c \ + +TESTLIB_SOURCES =./src/test/*.c + +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') +TESTLIB_OBJECTS = $(shell echo $(TESTLIB_SOURCES) | sed -e 's,\.c,\.o,g') +VERSION_OBJECT = src/main/morphos/SDL_os4version.o + +all: $(TARGET_STATIC) $(TARGET_SHARED) $(TESTLIB_STATIC) + +$(TESTLIB_STATIC): $(TESTLIB_OBJECTS) + $(AR) crv $@ $^ + $(RANLIB) $@ + +$(TARGET_STATIC): $(OBJECTS) + $(AR) crv $@ $^ + $(RANLIB) $@ + +$(TARGET_SHARED): $(OBJECTS) $(VERSION_OBJECT) + $(CC) -shared -Wl,-soname,$(TARGET_SHARED) -o $(TARGET_SHARED) $(OBJECTS) $(VERSION_OBJECT) + +config_copy: + cp include/SDL_config_morphos.h include/SDL_config.h + +clean: + rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(TESTLIB_STATIC) $(OBJECTS) + +install: + mkdir -p /SDK/local/newlib/lib + mkdir -p /SDK/local/newlib/include/SDL2 + cp -f $(TARGET_STATIC) /SDK/local/newlib/lib + cp -f $(TARGET_SHARED) /SDK/local/newlib/lib + cp -f $(TESTLIB_STATIC) /SDK/local/newlib/lib + cp -f include/*.h /SDK/local/newlib/include/SDL2/ + +src/video/SDL_blit_N.o: src/video/SDL_blit_N.c + ppc-morphos-gcc-5 -I./include -DNDEBUG -DNO_AMIGADEBUG -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c From cfa24c787976a2168c3de16ecc7b6737ec8f00c5 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 16:41:15 +0100 Subject: [PATCH 002/214] Update SDL_cpuinfo.c --- src/cpuinfo/SDL_cpuinfo.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 312c0dbf84..e181bf9ab7 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 @@ -116,7 +122,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! */ @@ -340,6 +346,17 @@ CPU_haveAltiVec(void) IExec->GetCPUInfoTags(GCIT_VectorUnit, &vec_unit, TAG_DONE); altivec = (vec_unit == VECTORTYPE_ALTIVEC); } +#elif defined(__MORPHOS__) + if (SysBase->LibNode.lib_Version >=51) { + ULONG has_altivec; + if (NewGetSystemAttrs(&has_altivec, size_of(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); @@ -590,6 +607,9 @@ SDL_GetCPUCount(void) &SDL_CPUCount, sizeof(SDL_CPUCount) ); } #endif +#endif +#ifdef __MORPHOS__ + NewGetSystemAttrs(&SDL_CPUCount, sizeof(SDL_CPUCount), SYSTEMINFOTYPE_CPUCOUNT, TAG_DONE); #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -729,6 +749,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; From d855d093f6c3a32864ef0276db4c15e1584272c1 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:00:37 +0100 Subject: [PATCH 003/214] FileSystem for MorphOS --- src/filesystem/morphos/SDL_sysfilesystem.c | 140 +++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 src/filesystem/morphos/SDL_sysfilesystem.c diff --git a/src/filesystem/morphos/SDL_sysfilesystem.c b/src/filesystem/morphos/SDL_sysfilesystem.c new file mode 100644 index 0000000000..9b4f63d3c1 --- /dev/null +++ b/src/filesystem/morphos/SDL_sysfilesystem.c @@ -0,0 +1,140 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 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_MORPHOS + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* 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_AMIGAOS4 */ + +/* vi: set ts=4 sw=4 expandtab: */ From 87ae333ec10f8cad0785ae94af2bae31654b7592 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:01:33 +0100 Subject: [PATCH 004/214] MORPHOS : Joystick with sensors support --- src/joystick/morphos/SDL_sysjoystick.c | 479 +++++++++++++++++++++++ src/joystick/morphos/SDL_sysjoystick_c.h | 102 +++++ 2 files changed, 581 insertions(+) create mode 100644 src/joystick/morphos/SDL_sysjoystick.c create mode 100644 src/joystick/morphos/SDL_sysjoystick_c.h diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c new file mode 100644 index 0000000000..0d16a9455a --- /dev/null +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -0,0 +1,479 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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_joystick.h" +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" +#include "SDL_sysjoystick_c.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUFFER_OFFSET(buffer, offset) (((int32 *)buffer)[offset]) + +static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, SENSORS_Type, SensorType_HID_Gamepad, TAG_DONE }; +static struct sensordata *sensors; + +extern APTR threadpool; + +static void sensor_events(struct sensordata *sensors, struct MsgPort *port) +{ + struct SensorsNotificationMessage *snm; + + sensors->sensorport = port; + + Signal(sensors->notifytask, SIGF_SINGLE); + + for (;;) + { + ULONG sigs = Wait(1 << port->mp_SigBit | SIGBREAKF_CTRL_C); + + if (sigs & SIGBREAKF_CTRL_C) + break; + + snm = (struct SensorsNotificationMessage *)GetMsg(port); + + // a NULL snm->Sensor means it's a class list change notification! + if (snm->Sensor == NULL) + { + } + else + { + struct TagItem *tag, *tags = snm->Notifications; + struct sensornotify *sn = snm->UserData; + + while ((tag = NextTagItem(&tags))) + { + DOUBLE *ptr = (DOUBLE *)tag->ti_Data; + + switch (tag->ti_Tag) + { + case SENSORS_HIDInput_Value: + if (sn->type == SensorType_HIDInput_Trigger) + sn->values[0] = *ptr; + break; + + case SENSORS_HIDInput_Y_Index: + case SENSORS_HIDInput_NS_Value: + sn->values[1] = *ptr; + break; + + case SENSORS_HIDInput_X_Index: + case SENSORS_HIDInput_EW_Value: + sn->values[0] = *ptr; + break; + + case SENSORS_HIDInput_Z_Index: + sn->values[2] = *ptr; + break; + } + } + } + + ReplyMsg(&snm->Msg); + } + + while ((snm = (APTR)GetMsg(port))) + ReplyMsg(&snm->Msg); +} + +/* Function to scan the system for joysticks. + * It should return 0, or -1 on an unrecoverable fatal error. + */ +int +SDL_SYS_JoystickInit(void) +{ + struct sensordata *s = SDL_malloc(sizeof(*s)); + int rc = -1; + printf("[SDL_SYS_JoystickInit]\n"); + + if (s) + { + s->notifytask = SysBase->ThisTask; + printf("[SDL_SYS_JoystickInit] Create sensor events worker thread...\n"); + + if (QueueWorkItem(threadpool, (THREADFUNC)sensor_events, s) == WORKITEM_INVALID) + { + SDL_free(s); + } + else + { + APTR sensorlist, sensor = NULL; + ULONG count = 0; + + sensors = s; + + NEWLIST(&s->sensorlist); + + while (s->sensorport == NULL) + Wait(SIGF_SINGLE); + + printf("[SDL_SYS_JoystickInit] Obtain sensor list...\n"); + sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; + + while ((sensor = NextSensor(sensor, sensorlist, NULL))) + { + CONST_STRPTR name = "", serial = NULL; + size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) + { + size_t namelen = strlen(name) + 1; + struct joystick_hwdata *hwdata = SDL_malloc(sizeof(*hwdata) + namelen); + + if (hwdata) + { + count++; + + ADDTAIL(&s->sensorlist, hwdata); + NEWLIST(&hwdata->notifylist); + + hwdata->attached = 1; + + // Using strncpy() is intentional + strncpy((char *)&hwdata->guid, serial, sizeof(hwdata->guid)); + strcpy(hwdata->name, name); + } + } + } + + ReleaseSensorsList(sensorlist, NULL); + + printf("[SDL_SYS_JoystickInit] Found %ld joysticks...\n", count); + + s->joystick_count = count; + rc = count; + } + } + + return rc; +} + +int SDL_SYS_NumJoysticks() +{ + return sensors->joystick_count; +} + +static struct joystick_hwdata *GetByIndex(int index) +{ + struct joystick_hwdata *hwdata = NULL, *ptr; + + + ForeachNode(&sensors->sensorlist, ptr) + { + if (index == 0) + { + hwdata = ptr; + break; + } + + index--; + }; + + return hwdata; +} + +void SDL_SYS_JoystickDetect() +{ +} + +SDL_bool SDL_SYS_JoystickNeedsPolling() +{ + return SDL_FALSE; +} + +/* Function to get the device-dependent name of a joystick */ +const char * +SDL_SYS_JoystickNameForDeviceIndex(int device_index) +{ + struct joystick_hwdata *hwdata = GetByIndex(device_index); + return hwdata->name; +} + +/* Function to perform the mapping from device index to the instance id for this index */ +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +{ + return device_index; +} + +static void set_notify(struct sensordata *s, struct joystick_hwdata *hwdata, APTR sensor, ULONG type) +{ + struct sensornotify *sn; + int count = 1; + + switch (type) + { + case SensorType_HIDInput_Stick: + case SensorType_HIDInput_AnalogStick: + count = 2; + break; + + case SensorType_HIDInput_3DStick: + count = 3; + break; + } + + sn = SDL_malloc(sizeof(*sn) + count * sizeof(DOUBLE)); + + if (sn) + { + size_t notifytags[] = { SENSORS_Notification_Destination, (size_t)s->sensorport, SENSORS_Notification_SendInitialValue, TRUE, SENSORS_Notification_UserData, (size_t)sn, TAG_DONE }; + struct TagItem tags[4]; + int i; + + sn->type = type; + + for (i = 0; i < count; i++) + sn->values[i] = 0.0; + + tags[0].ti_Data = TRUE; + tags[1].ti_Tag = TAG_IGNORE; + tags[1].ti_Data = TRUE; + tags[2].ti_Tag = TAG_IGNORE; + tags[2].ti_Data = TRUE; + tags[3].ti_Tag = TAG_MORE; + tags[3].ti_Data = (size_t)¬ifytags; + + switch (type) + { + case SensorType_HIDInput_Trigger: + tags[0].ti_Tag = SENSORS_HIDInput_Value; + break; + + case SensorType_HIDInput_Stick: + case SensorType_HIDInput_AnalogStick: + tags[0].ti_Tag = SENSORS_HIDInput_NS_Value; + tags[1].ti_Tag = SENSORS_HIDInput_EW_Value; + break; + + case SensorType_HIDInput_3DStick: + tags[0].ti_Tag = SENSORS_HIDInput_X_Index; + tags[1].ti_Tag = SENSORS_HIDInput_Y_Index; + tags[2].ti_Tag = SENSORS_HIDInput_Z_Index; + break; + } + + sn->notifyptr = StartSensorNotify(sensor, (struct TagItem *)&tags); + + ADDTAIL(&hwdata->notifylist, sn); + } +} + +static void GetJoyData(SDL_Joystick * joystick, struct joystick_hwdata *hwdata, APTR parent) +{ + struct sensordata *s = sensors; + size_t sensortags[] = { SENSORS_Parent, (size_t)parent, SENSORS_Class, SensorClass_HID, TAG_DONE }; + size_t buttons = 0, naxes = 0; + APTR sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; + + while ((sensor = NextSensor(sensor, sensorlist, NULL)) != NULL) + { + SensorType_HIDInput type = SensorType_HIDInput_Unknown; + size_t qt[] = { SENSORS_Type, (size_t)&type, TAG_DONE }; + + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) + { + switch (type) + { + case SensorType_HIDInput_Trigger: + buttons++; + break; + + case SensorType_HIDInput_Stick: + case SensorType_HIDInput_AnalogStick: + naxes += 2; + break; + + case SensorType_HIDInput_3DStick: + naxes += 3; + break; + + default: + continue; + } + + set_notify(s, hwdata, sensor, type); + } + } + + ReleaseSensorsList(sensorlist, NULL); + + joystick->naxes = naxes; + joystick->nbuttons = buttons; +} + +/* 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. + */ +int +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +{ + struct joystick_hwdata *hwdata = GetByIndex(device_index); + int rc = -1; + + if (hwdata) + { + APTR sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; + + while ((sensor = NextSensor(sensor, sensorlist, NULL))) + { + CONST_STRPTR name = "", serial = NULL; + size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) + { + SDL_JoystickGUID guid; + + strncpy((char *)&guid, serial, sizeof(guid)); + + if (memcmp(&hwdata->guid, &guid, sizeof(guid)) == 0) + { + GetJoyData(joystick, hwdata, sensor); + rc = 0; + break; + } + } + } + + ReleaseSensorsList(sensorlist, NULL); + } + + return rc; +} + +/* Function to determine is this joystick is attached to the system right now */ +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) +{ + return SDL_TRUE; +} + +/* Function to update the state of a joystick - called as a device poll. + * This function shouldn't update the joystick structure directly, + * but instead should call SDL_PrivateJoystick*() to deliver events + * and update joystick device state. + */ +void +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + struct sensornotify *sn; + void *buffer; + int naxe = 0, nbutton = 0; + + ForeachNode(&hwdata->notifylist, sn) + { + DOUBLE val; + WORD sval; + + switch (sn->type) + { + case SensorType_HIDInput_Trigger: + val = sn->values[0]; + int buttondata = BUFFER_OFFSET(buffer, hwdata->buttonBufferOffset[nbutton]); + if ((joystick->buttons[nbutton] && val == 0.0) || (joystick->buttons[nbutton] == 0 && val > 0.0)) { + SDL_PrivateJoystickButton(joystick, nbutton, val == 0.0 ? 0 : 1); + hwdata->buttonData[nbutton] = (val == 0.0 ? 0 : 1); + } + + nbutton++; + break; + + case SensorType_HIDInput_Stick: + case SensorType_HIDInput_AnalogStick: + case SensorType_HIDInput_3DStick: + sval = (WORD)(sn->values[0] * 32768.0); + + if (sval !=hwdata->axisData[naxe]) { + SDL_PrivateJoystickAxis(joystick, naxe, sval); + hwdata->axisData[naxe] = sval; + } + + naxe++; + + sval = (WORD)(sn->values[1] * 32768.0); + + if (sval != hwdata->axisData[naxe]) { + SDL_PrivateJoystickAxis(joystick, naxe, sval); + hwdata->axisData[naxe] = sval; + } + + // TODO : sn->values[1] ?? for SANSORS_HIDInput_Z_Index + + naxe++; + break; + } + } +} + +/* Function to close a joystick after use */ +void +SDL_SYS_JoystickClose(SDL_Joystick * joystick) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + + if (hwdata) + { + struct sensornotify *sn, *tmp; + + ForeachNodeSafe(&hwdata->notifylist, sn, tmp) + { + if (sn->notifyptr) + EndSensorNotify(sn->notifyptr, NULL); + + SDL_free(sn); + } + } +} + +/* Function to perform any system-specific joystick related cleanup */ +void +SDL_SYS_JoystickQuit(void) +{ + struct joystick_hwdata *hwdata, *tmp; + struct sensordata *s = sensors; + + ForeachNodeSafe(&s->sensorlist, hwdata, tmp) + { + SDL_free(hwdata); + } + + Signal(s->sensorport->mp_SigTask, SIGBREAKF_CTRL_C); +} + +SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +{ + struct joystick_hwdata *hwdata = GetByIndex(device_index); + return hwdata->guid; +} + +SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +{ + return joystick->hwdata->guid; +} diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h new file mode 100644 index 0000000000..169ad1ef86 --- /dev/null +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -0,0 +1,102 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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_SYSJOYSTICK_C_H +#define SDL_SYSJOYSTICK_C_H + +#ifndef EXEC_LISTS_H +#include +#endif + +#define DEBUG +#include "../../main/morphos/SDL_os4debug.h" + +#define MAX_JOYSTICKS 32 + +#define MAX_AXES 8 +#define MAX_BUTTONS 16 +#define MAX_HATS 8 + +#define ForeachNode(l, n) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + ((struct Node *)(n))->ln_Succ; \ + n = (void *)(((struct Node *)(n))->ln_Succ) \ +) +#define ForeachNodeSafe(l,n,n2) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + (n2 = (void *)((struct Node *)(n))->ln_Succ); \ + n = (void *)n2 \ +) + +struct sensordata +{ + struct MsgPort *sensorport; + struct MinList sensorlist; + int joystick_count; + + struct Task *notifytask; +}; + +/*struct joystick_hwdata +{ + struct MinNode node; + struct MinList notifylist; + + ULONG attached; + SDL_JoystickGUID guid; + TEXT name[0]; +};*/ + +struct joystick_hwdata +{ + struct MinNode node; + struct MinList notifylist; + + ULONG attached; + SDL_JoystickGUID guid; + TEXT name[0]; + + //AIN_DeviceHandle *handle; + //APTR context; + + uint32 axisBufferOffset[MAX_AXES]; + int32 axisData[MAX_AXES]; + TEXT axisName[MAX_AXES][32]; + + uint32 buttonBufferOffset[MAX_BUTTONS]; + int32 buttonData[MAX_BUTTONS]; + + uint32 hatBufferOffset[MAX_HATS]; + int32 hatData[MAX_HATS]; +}; + + +struct sensornotify +{ + struct MinNode node; + APTR notifyptr; + ULONG type; + DOUBLE values[0]; +}; + +#endif From e0f5e813539c6d53af6bd01cd04d467bf722eb98 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:03:26 +0100 Subject: [PATCH 005/214] MORPHOS : syspower --- src/power/morphos/SDL_syspower.c | 101 +++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/power/morphos/SDL_syspower.c diff --git a/src/power/morphos/SDL_syspower.c b/src/power/morphos/SDL_syspower.c new file mode 100644 index 0000000000..6cb927e8c6 --- /dev/null +++ b/src/power/morphos/SDL_syspower.c @@ -0,0 +1,101 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 */ + From 3db8d8f840eee108e9fd6d7b5721bd7754004944 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:05:04 +0100 Subject: [PATCH 006/214] MORPHOS : thread --- src/thread/morphos/SDL_syscond.c | 220 ++++++++++++++ src/thread/morphos/SDL_sysmutex.c | 110 +++++++ src/thread/morphos/SDL_sysmutex_c.h | 22 ++ src/thread/morphos/SDL_syssem.c | 285 ++++++++++++++++++ src/thread/morphos/SDL_systhread.c | 90 ++++++ src/thread/morphos/SDL_systhread_c.h | 25 ++ src/thread/morphos/SDL_systls.c | 96 ++++++ .../sdl2-tc-userdata-replacement.diff.txt | 95 ++++++ 8 files changed, 943 insertions(+) create mode 100644 src/thread/morphos/SDL_syscond.c create mode 100644 src/thread/morphos/SDL_sysmutex.c create mode 100644 src/thread/morphos/SDL_sysmutex_c.h create mode 100644 src/thread/morphos/SDL_syssem.c create mode 100644 src/thread/morphos/SDL_systhread.c create mode 100644 src/thread/morphos/SDL_systhread_c.h create mode 100644 src/thread/morphos/SDL_systls.c create mode 100644 src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt diff --git a/src/thread/morphos/SDL_syscond.c b/src/thread/morphos/SDL_syscond.c new file mode 100644 index 0000000000..64cc634006 --- /dev/null +++ b/src/thread/morphos/SDL_syscond.c @@ -0,0 +1,220 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..9622847d66 --- /dev/null +++ b/src/thread/morphos/SDL_sysmutex.c @@ -0,0 +1,110 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..f868fade80 --- /dev/null +++ b/src/thread/morphos/SDL_sysmutex_c.h @@ -0,0 +1,22 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..179b6557a5 --- /dev/null +++ b/src/thread/morphos/SDL_syssem.c @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..924f939449 --- /dev/null +++ b/src/thread/morphos/SDL_systhread.c @@ -0,0 +1,90 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 + +extern APTR threadpool; + +#if 0 +static void +RunThread(APTR data, struct MsgPort *port) +{ + SDL_RunThread(data); +} +#endif + +int +SDL_SYS_CreateThread(SDL_Thread * thread, void *args) +{ + thread->handle = QueueWorkItem(threadpool, (APTR)SDL_RunThread, args); + 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_NORMAL: pri = 0; break; + case SDL_THREAD_PRIORITY_HIGH: pri = 5; 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..c4e884e3ad --- /dev/null +++ b/src/thread/morphos/SDL_systhread_c.h @@ -0,0 +1,25 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..61a599c5d6 --- /dev/null +++ b/src/thread/morphos/SDL_systls.c @@ -0,0 +1,96 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/thread/morphos/sdl2-tc-userdata-replacement.diff.txt b/src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt new file mode 100644 index 0000000000..46ed4050d9 --- /dev/null +++ b/src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt @@ -0,0 +1,95 @@ +Index: sdl2-main/src/thread/morphos/SDL_systhread.c +=================================================================== +RCS file: /home/cvs/root/morphos/morphoswb/libs/sdl2/sdl2-main/src/thread/morphos/SDL_systhread.c,v +retrieving revision 1.1 +diff -u -r1.1 SDL_systhread.c +--- sdl2-main/src/thread/morphos/SDL_systhread.c 11 Sep 2014 15:48:16 -0000 1.1 ++++ sdl2-main/src/thread/morphos/SDL_systhread.c 25 May 2015 18:49:10 -0000 +@@ -51,8 +51,6 @@ + { + struct Task *t = SysBase->ThisTask; + t->tc_Node.ln_Name = (STRPTR)name; +- t->tc_UserData = NULL; +- D("[%s] tc_UserData is 0x%08lx.\n", __FUNCTION__, t->tc_UserData); + } + + SDL_threadID +Index: sdl2-main/src/thread/morphos/SDL_systls.c +=================================================================== +RCS file: /home/cvs/root/morphos/morphoswb/libs/sdl2/sdl2-main/src/thread/morphos/SDL_systls.c,v +retrieving revision 1.1 +diff -u -r1.1 SDL_systls.c +--- sdl2-main/src/thread/morphos/SDL_systls.c 11 Sep 2014 15:48:16 -0000 1.1 ++++ sdl2-main/src/thread/morphos/SDL_systls.c 25 May 2015 18:49:10 -0000 +@@ -25,21 +25,69 @@ + + #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() + { +- return (SDL_TLSData *)SysBase->ThisTask->tc_UserData; ++ 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) + { +- SysBase->ThisTask->tc_UserData = 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; + } + From 11206e2669ae44def4021341b502f3550cfa3fc1 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:05:41 +0100 Subject: [PATCH 007/214] MORPHOS : timer --- src/timer/morphos/SDL_systimer.c | 112 +++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/timer/morphos/SDL_systimer.c diff --git a/src/timer/morphos/SDL_systimer.c b/src/timer/morphos/SDL_systimer.c new file mode 100644 index 0000000000..45dbedbaa2 --- /dev/null +++ b/src/timer/morphos/SDL_systimer.c @@ -0,0 +1,112 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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: */ From 3eb00b199d5a338ad4be5ea5e1f1e6d5f4d57906 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:07:23 +0100 Subject: [PATCH 008/214] MORPHOS : add NewRawDoFmt function --- src/SDL_log.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); From 5e15462cd25175f824de2a5c7c060742f667458d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:08:27 +0100 Subject: [PATCH 009/214] MORPHOS : add MorphOS Platform --- src/SDL.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL.c b/src/SDL.c index 59bb32a91a..3f8ab38dd9 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -524,6 +524,8 @@ SDL_GetPlatform() return "PlayStation Portable"; #elif __AMIGAOS4__ return "AmigaOS 4"; +#elif __MORPHOS__ + return "MorphOS"; #else return "Unknown (see SDL_platform.h)"; #endif From ff8f34682a5c60f3495021ce2126736be7b30d91 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:10:09 +0100 Subject: [PATCH 010/214] MORPHOS : upload video function --- src/video/SDL_video.c | 13 + src/video/morphos/SDL_amigaclipboard.c | 291 ++++++++++ src/video/morphos/SDL_amigaclipboard.h | 32 ++ src/video/morphos/SDL_amigaevents.c | 440 ++++++++++++++ src/video/morphos/SDL_amigaevents.h | 30 + src/video/morphos/SDL_amigaframebuffer.c | 162 ++++++ src/video/morphos/SDL_amigaframebuffer.h | 28 + src/video/morphos/SDL_amigakeyboard.c | 33 ++ src/video/morphos/SDL_amigakeyboard.h | 30 + src/video/morphos/SDL_amigamessagebox.c | 96 ++++ src/video/morphos/SDL_amigamessagebox.h | 30 + src/video/morphos/SDL_amigamodes.c | 437 ++++++++++++++ src/video/morphos/SDL_amigamodes.h | 44 ++ src/video/morphos/SDL_amigamouse.c | 282 +++++++++ src/video/morphos/SDL_amigashape.c | 196 +++++++ src/video/morphos/SDL_amigashape.h | 36 ++ src/video/morphos/SDL_amigavideo.c | 413 ++++++++++++++ src/video/morphos/SDL_amigavideo.h | 93 +++ src/video/morphos/SDL_amigawindow.c | 696 +++++++++++++++++++++++ src/video/morphos/SDL_amigawindow.h | 95 ++++ 20 files changed, 3477 insertions(+) create mode 100644 src/video/morphos/SDL_amigaclipboard.c create mode 100644 src/video/morphos/SDL_amigaclipboard.h create mode 100644 src/video/morphos/SDL_amigaevents.c create mode 100644 src/video/morphos/SDL_amigaevents.h create mode 100644 src/video/morphos/SDL_amigaframebuffer.c create mode 100644 src/video/morphos/SDL_amigaframebuffer.h create mode 100644 src/video/morphos/SDL_amigakeyboard.c create mode 100644 src/video/morphos/SDL_amigakeyboard.h create mode 100644 src/video/morphos/SDL_amigamessagebox.c create mode 100644 src/video/morphos/SDL_amigamessagebox.h create mode 100644 src/video/morphos/SDL_amigamodes.c create mode 100644 src/video/morphos/SDL_amigamodes.h create mode 100644 src/video/morphos/SDL_amigamouse.c create mode 100644 src/video/morphos/SDL_amigashape.c create mode 100644 src/video/morphos/SDL_amigashape.h create mode 100644 src/video/morphos/SDL_amigavideo.c create mode 100644 src/video/morphos/SDL_amigavideo.h create mode 100644 src/video/morphos/SDL_amigawindow.c create mode 100644 src/video/morphos/SDL_amigawindow.h diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index af89aecc78..ab9acac4d4 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -109,6 +109,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 @@ -3966,6 +3969,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 @@ -4070,6 +4076,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/morphos/SDL_amigaclipboard.c b/src/video/morphos/SDL_amigaclipboard.c new file mode 100644 index 0000000000..a4bb9b60a7 --- /dev/null +++ b/src/video/morphos/SDL_amigaclipboard.c @@ -0,0 +1,291 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigaclipboard.h b/src/video/morphos/SDL_amigaclipboard.h new file mode 100644 index 0000000000..ebd56cffb1 --- /dev/null +++ b/src/video/morphos/SDL_amigaclipboard.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigaevents.c b/src/video/morphos/SDL_amigaevents.c new file mode 100644 index 0000000000..6a33ff1043 --- /dev/null +++ b/src/video/morphos/SDL_amigaevents.c @@ -0,0 +1,440 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 "SDL_amigavideo.h" +#include "SDL_amigawindow.h" + +#include "SDL_timer.h" +#include "SDL_syswm.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static SDL_Scancode +AMIGA_ScanCodeToSDL(UWORD code) +{ + switch (code) + { + case RAWKEY_KP_0: return SDL_SCANCODE_KP_0; + case RAWKEY_KP_1: return SDL_SCANCODE_KP_1; + case RAWKEY_KP_2: return SDL_SCANCODE_KP_2; + case RAWKEY_KP_3: return SDL_SCANCODE_KP_3; + case RAWKEY_KP_4 : return SDL_SCANCODE_KP_4; + case RAWKEY_KP_5 : return SDL_SCANCODE_KP_5; + case RAWKEY_KP_6 : return SDL_SCANCODE_KP_6; + case RAWKEY_KP_7 : return SDL_SCANCODE_KP_7; + case RAWKEY_KP_8 : return SDL_SCANCODE_KP_8; + case RAWKEY_KP_9 : return SDL_SCANCODE_KP_9; + case RAWKEY_KP_DECIMAL : return SDL_SCANCODE_KP_PERIOD; + case RAWKEY_KP_ENTER : return SDL_SCANCODE_KP_ENTER; + case RAWKEY_KP_MINUS : return SDL_SCANCODE_KP_MINUS; + case RAWKEY_KP_DIVIDE : return SDL_SCANCODE_KP_DIVIDE; + case RAWKEY_KP_MULTIPLY: return SDL_SCANCODE_KP_MULTIPLY; + case RAWKEY_KP_PLUS : return SDL_SCANCODE_KP_PLUS; + + case RAWKEY_BACKSPACE : return SDL_SCANCODE_BACKSPACE; + case RAWKEY_TAB : return SDL_SCANCODE_TAB; + case RAWKEY_RETURN : return SDL_SCANCODE_RETURN; + case RAWKEY_ESCAPE : return SDL_SCANCODE_ESCAPE; + case RAWKEY_DELETE : return SDL_SCANCODE_DELETE; + case RAWKEY_INSERT : return SDL_SCANCODE_INSERT; + case RAWKEY_PAGEUP : return SDL_SCANCODE_PAGEUP; + case RAWKEY_PAGEDOWN : return SDL_SCANCODE_PAGEDOWN; + case RAWKEY_HOME : return SDL_SCANCODE_HOME; + case RAWKEY_END : return SDL_SCANCODE_END; + case RAWKEY_UP : return SDL_SCANCODE_UP; + case RAWKEY_DOWN : return SDL_SCANCODE_DOWN; + case RAWKEY_LEFT : return SDL_SCANCODE_LEFT; + case RAWKEY_RIGHT : return SDL_SCANCODE_RIGHT; + + case RAWKEY_F1 : return SDL_SCANCODE_F1; + case RAWKEY_F2 : return SDL_SCANCODE_F2; + case RAWKEY_F3 : return SDL_SCANCODE_F3; + case RAWKEY_F4 : return SDL_SCANCODE_F4; + case RAWKEY_F5 : return SDL_SCANCODE_F5; + case RAWKEY_F6 : return SDL_SCANCODE_F6; + case RAWKEY_F7 : return SDL_SCANCODE_F7; + case RAWKEY_F8 : return SDL_SCANCODE_F8; + case RAWKEY_F9 : return SDL_SCANCODE_F9; + case RAWKEY_F10 : return SDL_SCANCODE_F10; + case RAWKEY_F11 : return SDL_SCANCODE_F11; + case RAWKEY_F12 : return SDL_SCANCODE_F12; + + case RAWKEY_HELP : return SDL_SCANCODE_HELP; + + case RAWKEY_LSHIFT : return SDL_SCANCODE_LSHIFT; + case RAWKEY_RSHIFT : return SDL_SCANCODE_RSHIFT; + case RAWKEY_LALT : return SDL_SCANCODE_LALT; + case RAWKEY_RALT : return SDL_SCANCODE_RALT; + case RAWKEY_LAMIGA : return SDL_SCANCODE_LGUI; + case RAWKEY_RAMIGA : return SDL_SCANCODE_RGUI; + case RAWKEY_CONTROL : return SDL_SCANCODE_LCTRL; + case RAWKEY_CAPSLOCK : return SDL_SCANCODE_CAPSLOCK; + + case RAWKEY_SCRLOCK : return SDL_SCANCODE_SCROLLLOCK; + case RAWKEY_PRTSCREEN : return SDL_SCANCODE_PRINTSCREEN; + case RAWKEY_NUMLOCK : return SDL_SCANCODE_NUMLOCKCLEAR; + case RAWKEY_PAUSE : return SDL_SCANCODE_PAUSE; + +#if 0 + case RAWKEY_MEDIA1 : return SDL_SCANCODE_VOLUMEUP; + case RAWKEY_MEDIA2 : return SDL_SCANCODE_VOLUMEDOWN; + case RAWKEY_MEDIA3 : return SDL_SCANCODE_WWW; + case RAWKEY_MEDIA4 : return SDL_SCANCODE_MAIL; + case RAWKEY_MEDIA5 : return SDL_SCANCODE_CALCULATOR; + case RAWKEY_MEDIA6 : return SDL_SCANCODE_COMPUTER; +#else + case RAWKEY_CDTV_STOP : return SDL_SCANCODE_AUDIOSTOP; + case RAWKEY_CDTV_PLAY : return SDL_SCANCODE_AUDIOPLAY; + case RAWKEY_CDTV_PREV : return SDL_SCANCODE_AUDIOPREV; + case RAWKEY_CDTV_NEXT : return SDL_SCANCODE_AUDIONEXT; + case RAWKEY_CDTV_REW : return SDL_SCANCODE_AC_BACK; + case RAWKEY_CDTV_FF : return SDL_SCANCODE_AC_FORWARD; +#endif + } + + return SDL_SCANCODE_UNKNOWN; +} + +static void +AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) +{ + int i = 1, state = SDL_PRESSED; + + switch (m->Code) + { + case SELECTUP : i = 1; state = SDL_RELEASED; break; + case SELECTDOWN: i = 1; break; + case MENUUP : i = 2; state = SDL_RELEASED; break; + case MENUDOWN : i = 2; break; + case MIDDLEUP : i = 3; state = SDL_RELEASED; break; + case MIDDLEDOWN: i = 3; break; + default : return; + } + + SDL_SendMouseButton(data->window, 0, state, i); +} + +static void +AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) +{ + SDL_Scancode sc; + UWORD code = m->Code; + + 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, 4); + break; + + case RAWKEY_NM_BUTTON_FOURTH | IECODE_UP_PREFIX: + SDL_SendMouseButton(data->window, 0, SDL_RELEASED, 4); + break; + + default: + sc = AMIGA_ScanCodeToSDL(code & ~(IECODE_UP_PREFIX)); + + if (sc != SDL_SCANCODE_UNKNOWN) + { + SDL_SendKeyboardKey(code & IECODE_UP_PREFIX ? SDL_RELEASED : SDL_PRESSED, sc); + } + else + { + WCHAR keycode; + TEXT buffer[8]; + ULONG length; + + GetAttr(IMSGA_UCS4, m, (ULONG *)&keycode); + length = UTF8_Encode(keycode, buffer); + + D("[AMIGA_DispatchRawKey] Converted %ld (UCS-4: %ld) to UTF-8...\n", code, keycode); + + if (length > 0) + { + buffer[length] = '\0'; + SDL_SendKeyboardText(buffer); + } + } + break; + } +} + +static void +AMIGA_MouseMove(const struct IntuiMessage *m, SDL_WindowData *data) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + if (!mouse->relative_mode || mouse->relative_mode_warp) + { + struct Screen *s = data->win->WScreen; + SDL_SendMouseMotion(data->window, 0, 0, s->MouseX, s->MouseY); + } + else + { + if (data->first_deltamove) + { + data->first_deltamove = 0; + return; + } + + SDL_SendMouseMotion(data->window, 0, 1, m->MouseX, m->MouseY); + } +} + +static void +AMIGA_ChangeWindow(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, data->curr_h); + } +} + +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 void +AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) +{ + SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; + + switch (m->Class) + { + 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(m, data); + break; + + case IDCMP_MOUSEBUTTONS: + AMIGA_DispatchMouseButtons(m, data); + break; + + case IDCMP_RAWKEY: + AMIGA_DispatchRawKey(m, data); + break; + + case IDCMP_ACTIVEWINDOW: + SDL_SetKeyboardFocus(data->window); + SDL_SetMouseFocus(data->window); + break; + + case IDCMP_INACTIVEWINDOW: + if (SDL_GetKeyboardFocus() == data->window) + { + SDL_SetKeyboardFocus(NULL); + } + + if (SDL_GetMouseFocus() == data->window) + { + SDL_SetMouseFocus(NULL); + } + break; + + case IDCMP_CHANGEWINDOW: + AMIGA_ChangeWindow(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; + + while ((msg = (struct AppMessage *)GetMsg(&data->WBPort)) != NULL) + { + D("[%s] check AppMessage\n", __FUNCTION__); + + if (msg->am_NumArgs == 0 && msg->am_ArgList == NULL) + AMIGA_ShowApp(_this); + +#warning object dragn drop + } +} + +void +AMIGA_PumpEvents(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + struct IntuiMessage *m; + + size_t sigs = SetSignal(0, data->ScrNotifySig | data->BrokerSig | data->WBSig | data->WinSig | SIGBREAKF_CTRL_C); + + if (sigs & data->WinSig) + { + while ((m = (struct IntuiMessage *)GetMsg(&data->WinPort))) + { + AMIGA_DispatchEvent(_this, m); + ReplyMsg((struct Message *)m); + } + } + + 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); +} + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigaevents.h b/src/video/morphos/SDL_amigaevents.h new file mode 100644 index 0000000000..1af43bdb15 --- /dev/null +++ b/src/video/morphos/SDL_amigaevents.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigaframebuffer.c b/src/video/morphos/SDL_amigaframebuffer.c new file mode 100644 index 0000000000..ec589e4e73 --- /dev/null +++ b/src/video/morphos/SDL_amigaframebuffer.c @@ -0,0 +1,162 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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; +} + +int +AMIGA_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if (data->win) + { + SDL_Framebuffer *fb = data->fb; + struct RastPort *rp = data->win->RPort; + int i, x, y, w, h, offx, offy; + + offx = data->win->BorderLeft; + offy = data->win->BorderTop; + + for (i = 0; i < numrects; ++i) + { + int dx, dy; + + x = rects[i].x; + y = rects[i].y; + w = rects[i].w; + h = rects[i].h; + + /* Clipped? */ + if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0) + continue; + + if (x < 0) + { + x += w; + w += rects[i].x; + } + + if (y < 0) + { + y += h; + h += rects[i].y; + } + + if (x + w > window->w) + w = window->w - x; + + if (y + h > window->h) + h = window->h - y; + + if (y + h < 0 || y > h) + continue; + + if (x + w < 0 || x > w) + continue; + + dx = x + offx; + dy = y + offy; + + switch (fb->pixfmt) + { + case SDL_PIXELFORMAT_INDEX8: + if (data->videodata->CustomScreen) + WritePixelArray(fb->buffer, x, y, fb->bpr, rp, dx, dy, w, h, RECTFMT_RAW); + else + WriteLUTPixelArray(fb->buffer, x, y, fb->bpr, rp, data->videodata->coltab, dx, dy, w, h, CTABFMT_XRGB8); + break; + + default: + case SDL_PIXELFORMAT_ARGB8888: + WritePixelArray(fb->buffer, x, y, fb->bpr, rp, dx, dy, w, h, RECTFMT_ARGB); + break; + } + } + } + + return 0; +} + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigaframebuffer.h b/src/video/morphos/SDL_amigaframebuffer.h new file mode 100644 index 0000000000..d405cdb26c --- /dev/null +++ b/src/video/morphos/SDL_amigaframebuffer.h @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigakeyboard.c b/src/video/morphos/SDL_amigakeyboard.c new file mode 100644 index 0000000000..017087d8db --- /dev/null +++ b/src/video/morphos/SDL_amigakeyboard.c @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 "../../events/SDL_keyboard_c.h" + +void +AMIGA_InitKeyboard(_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/morphos/SDL_amigakeyboard.h b/src/video/morphos/SDL_amigakeyboard.h new file mode 100644 index 0000000000..6b39ee6072 --- /dev/null +++ b/src/video/morphos/SDL_amigakeyboard.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigamessagebox.c b/src/video/morphos/SDL_amigamessagebox.c new file mode 100644 index 0000000000..6a1da778a9 --- /dev/null +++ b/src/video/morphos/SDL_amigamessagebox.c @@ -0,0 +1,96 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigamessagebox.h b/src/video/morphos/SDL_amigamessagebox.h new file mode 100644 index 0000000000..350926213f --- /dev/null +++ b/src/video/morphos/SDL_amigamessagebox.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigamodes.c b/src/video/morphos/SDL_amigamodes.c new file mode 100644 index 0000000000..bfabf60f9c --- /dev/null +++ b/src/video/morphos/SDL_amigamodes.c @@ -0,0 +1,437 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 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 + + +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); + 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); + 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_VideoData *data = (SDL_VideoData *) _this->driverdata; + struct Screen *screen; + int use_wb_screen = 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 + { + static const size_t screentags[] = + { + SA_Quiet, TRUE, SA_ShowTitle, FALSE, SA_AutoScroll, TRUE, SA_Title, (size_t)"SDL", + SA_AdaptSize, 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, screentags); + } + else + { + screen = OpenScreenTags(NULL, + SA_Width, data->ScrWidth, + SA_Height, data->ScrHeight, + SA_Depth, data->ScrDepth, + SA_MonitorName, data->ScrMonName, + TAG_MORE, screentags); + } + + data->CustomScreen = screen; + } + + if (screen == NULL) + { + if (data->ScrMonName != NULL) + screen = LockPubScreen("Workbench"); + + if (screen == NULL) + return SDL_SetError("Failed to get screen."); + + 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; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigamodes.h b/src/video/morphos/SDL_amigamodes.h new file mode 100644 index 0000000000..fe2a096202 --- /dev/null +++ b/src/video/morphos/SDL_amigamodes.h @@ -0,0 +1,44 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 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); + +#endif /* _SDL_amigamodes_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigamouse.c b/src/video/morphos/SDL_amigamouse.c new file mode 100644 index 0000000000..c5f62d960a --- /dev/null +++ b/src/video/morphos/SDL_amigamouse.c @@ -0,0 +1,282 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 +#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__); + + 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); + } + } +} + +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; +} + +void +AMIGA_InitMouse(_THIS) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + 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(WIN_CreateDefaultCursor()); + //SDL_SetDoubleClickTime(GetDoubleClickTime()); +} + +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/morphos/SDL_amigashape.c b/src/video/morphos/SDL_amigashape.c new file mode 100644 index 0000000000..a2efdb0503 --- /dev/null +++ b/src/video/morphos/SDL_amigashape.c @@ -0,0 +1,196 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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, mask_value; + 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/morphos/SDL_amigashape.h b/src/video/morphos/SDL_amigashape.h new file mode 100644 index 0000000000..02a35a9519 --- /dev/null +++ b/src/video/morphos/SDL_amigashape.h @@ -0,0 +1,36 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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/morphos/SDL_amigavideo.c b/src/video/morphos/SDL_amigavideo.c new file mode 100644 index 0000000000..30e25a8578 --- /dev/null +++ b/src/video/morphos/SDL_amigavideo.c @@ -0,0 +1,413 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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_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 +#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 driver bootstrap functions */ + +static int +AMIGA_Available(void) +{ + return 1; +} + +static int +AMIGA_VideoInit(_THIS) +{ + int rc = -1; + D("[%s]\n", __FUNCTION__); + + if ((rc = AMIGA_InitModes(_this)) == 0) + { + AMIGA_InitKeyboard(_this); + AMIGA_InitMouse(_this); + } + + return rc; +} + +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 = X11_GetDisplayBounds; + device->SetDisplayMode = AMIGA_SetDisplayMode; + device->SuspendScreenSaver = AMIGA_SuspendScreenSaver; + device->PumpEvents = AMIGA_PumpEvents; + + device->CreateWindow = AMIGA_CreateWindow; + device->CreateWindowFrom = 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; + +#if SDL_VIDEO_OPENGL_GLX + device->GL_LoadLibrary = X11_GL_LoadLibrary; + device->GL_GetProcAddress = X11_GL_GetProcAddress; + device->GL_UnloadLibrary = X11_GL_UnloadLibrary; + device->GL_CreateContext = X11_GL_CreateContext; + device->GL_MakeCurrent = X11_GL_MakeCurrent; + device->GL_SetSwapInterval = X11_GL_SetSwapInterval; + device->GL_GetSwapInterval = X11_GL_GetSwapInterval; + device->GL_SwapWindow = X11_GL_SwapWindow; + device->GL_DeleteContext = X11_GL_DeleteContext; +#endif + + device->SetClipboardText = AMIGA_SetClipboardText; + device->GetClipboardText = AMIGA_GetClipboardText; + device->HasClipboardText = AMIGA_HasClipboardText; + + device->ShowMessageBox = AMIGA_ShowMessageBox; + + device->free = AMIGA_DeleteDevice; + + return device; + } + + SDL_free(device); + } + + SDL_OutOfMemory(); + return NULL; +} + +const VideoBootStrap AMIGA_bootstrap = { + "amiga", "SDL Amiga video driver", + AMIGA_Available, AMIGA_CreateDevice +}; + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigavideo.h b/src/video/morphos/SDL_amigavideo.h new file mode 100644 index 0000000000..23b5c89ba1 --- /dev/null +++ b/src/video/morphos/SDL_amigavideo.h @@ -0,0 +1,93 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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]; + + 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/morphos/SDL_amigawindow.c b/src/video/morphos/SDL_amigawindow.c new file mode 100644 index 0000000000..0bd536078a --- /dev/null +++ b/src/video/morphos/SDL_amigawindow.c @@ -0,0 +1,696 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 + +#include +#include +#include +#include +#include +#include +#include + +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 + + CloseWindow(win); + 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(wd->window); + } + } +} + +static int +AMIGA_SetupWindowData(_THIS, SDL_Window *window, struct Window *win) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_WindowData *wd = SDL_malloc(sizeof(*wd)); + D("[%s]\n", __FUNCTION__); + + window->driverdata = wd; + + if (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; + + 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, (APTR)-1); + } + + 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 += scr->WBorLeft + scr->WBorRight; + min_h += scr->WBorTop + scr->WBorBottom; + } + + 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 += scr->WBorLeft + scr->WBorRight; + max_h += scr->WBorTop + scr->WBorBottom; + } + + 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 += scr->WBorLeft + scr->WBorRight; + h += scr->WBorTop + scr->WBorBottom; + } + + 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(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 | WFLG_RMBTRAP; + 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); + + 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); + + #if 0 + if ((window->flags & SDL_WINDOW_BORDERLESS) == 0 && !fullscreen) + { + border_w = GetSkinInfoAttrA(di, SI_BorderLeft , NULL) + GetSkinInfoAttrA(di, SI_BorderRight, NULL); + border_h = GetSkinInfoAttrA(di, SI_BorderTopTitle, NULL) + GetSkinInfoAttrA(di, window->flags & SDL_WINDOW_RESIZABLE ? SI_BorderBottomSize : SI_BorderBottom, NULL); + + min_w += border_w; + max_w += border_w; + min_h += border_h; + max_h += border_h; + } + #endif + + 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); + } + +#warning check this... + 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; + + if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) + 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, min_w, + WA_MinHeight, min_h, + WA_MaxWidth, max_w, + WA_MaxHeight, 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, + 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->grabbed > 0) + DoMethod((Object *)data->win, WM_ObtainEvents); + } + } + else if (data->win) + { + AMIGA_WindowToFront(data->win); + } +} + +void +AMIGA_ShowWindow(_THIS, SDL_Window * window) +{ + //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + D("[%s]\n", __FUNCTION__); + + AMIGA_ShowWindow_Internal(window); +} + +void +AMIGA_HideWindow_Internal(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(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); +} + + +int +AMIGA_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) +{ + //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + #warning implement me + + 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) + 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; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/morphos/SDL_amigawindow.h b/src/video/morphos/SDL_amigawindow.h new file mode 100644 index 0000000000..8e9cafaba5 --- /dev/null +++ b/src/video/morphos/SDL_amigawindow.h @@ -0,0 +1,95 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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; + + // 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; +} 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(SDL_Window * window); +extern void AMIGA_HideWindow_Internal(SDL_Window * window); + +#endif /* _SDL_amigawindow_h */ + +/* vi: set ts=4 sw=4 expandtab: */ From f8f7bb026a0c1a41e823d4933f966ad4f205ce3d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:24:58 +0100 Subject: [PATCH 011/214] MORPHOS : modify for detection G5 TODO : compile with GCC 8 ?! (altivec) --- src/video/SDL_blit_N.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 3722f239be..4e799f54dc 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -77,7 +77,27 @@ GetL3CacheSize(void) } #endif /* __MACOSX__ */ -#if (defined(__MACOSX__) && (__GNUC__ < 4)) +#if defined(__MORPHOS__) +#include +#include + +static size_t +SDL_IsG5(void) +{ + size_t is_g5 = 0; + char *cpu_family; + + if (NewGetSystemAttrs(&cpu_family, sizeof(cpu_family), SYSTEMINFOTYPE_CPUFAMILYNAME, TAG_DONE)) + { + if (cpu_family && stricmp(cpu_family, "G5") == 0) + is_g5 = 1; + } + + return is_g5; +} +#endif + +#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) \ @@ -922,8 +942,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() ? 4 : 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 ); } } From 1bc5d60fdd180568093ffa4851256d7c8051c9dd Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:28:39 +0100 Subject: [PATCH 012/214] MORPHOS : add AMIGA_bootstrap dont know if it's necessary (not reference to AmigaOS4) --- src/video/SDL_sysvideo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index c29daa5270..c2f3d654fb 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -437,7 +437,8 @@ extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; - +extern VideoBootStrap AMIGA_bootstrap; + extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display, SDL_bool send_event); From 18d167ddcb43224ccf4e4137693f3caed7a83ffb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 20:14:53 +0100 Subject: [PATCH 013/214] MORPHOS : support for sdl_config_morphos.h --- include/SDL_atomic.h | 5 + include/SDL_config.h | 2 + include/SDL_config_morphos.h | 248 +++++++++++++++++++++++++++++++++++ include/SDL_test.h | 8 ++ include/begin_code.h | 2 +- 5 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 include/SDL_config_morphos.h 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..e124378274 --- /dev/null +++ b/include/SDL_config_morphos.h @@ -0,0 +1,248 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2019 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_ +#define SDL_config_h_ + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* C datatypes */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif +#define HAVE_GCC_ATOMICS 1 +/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ + +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +/* #undef HAVE_MEMORY_H */ +#define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_WCHAR_H 1 +/* #undef HAVE_PTHREAD_NP_H */ +/* #undef HAVE_LIBUNWIND_H */ + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +/* #undef HAVE_UNSETENV */ +#endif +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +/* #undef HAVE_MEMCMP */ +#define HAVE_WCSLEN 1 +/* #undef HAVE_WCSLCPY */ +/* #undef HAVE_WCSLCAT */ +#define HAVE_WCSCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +/* #undef HAVE__STRREV */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +/* #undef HAVE_INDEX */ +/* #undef HAVE_RINDEX */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_ITOA */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__UITOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +/* #undef HAVE__I64TOA */ +/* #undef HAVE__UI64TOA */ +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +/* #undef HAVE_STRTOD */ +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +/* #undef HAVE__STRICMP */ +#define HAVE_STRCASECMP 1 +/* #undef HAVE__STRNICMP */ +#define HAVE_STRNCASECMP 1 +/* #undef HAVE_SSCANF */ +#define HAVE_VSSCANF 1 +/* #undef HAVE_SNPRINTF */ +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI /**/ +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_FOPEN64 1 +#define HAVE_FSEEKO 1 +#define HAVE_FSEEKO64 1 +/* #undef HAVE_SIGACTION */ +/* #undef HAVE_SA_SIGACTION */ +#define HAVE_SETJMP 1 +/* #undef HAVE_NANOSLEEP */ +/* #undef HAVE_SYSCONF */ +/* #undef HAVE_SYSCTLBYNAME */ +/* #undef HAVE_CLOCK_GETTIME */ +/* #undef HAVE_GETPAGESIZE */ +/* #undef HAVE_MPROTECT */ +#define HAVE_ICONV 1 +/* #undef HAVE_PTHREAD_SETNAME_NP */ +/* #undef HAVE_PTHREAD_SET_NAME_NP */ +/* #undef HAVE_SEM_TIMEDWAIT */ +/* #undef HAVE_GETAUXVAL */ +/* #undef HAVE_POLL */ + + +/*#define HAVE_ALTIVEC_H 1*/ +/* #undef HAVE_DBUS_DBUS_H */ +/* #undef HAVE_FCITX_FRONTEND_H */ +/* #undef HAVE_IBUS_IBUS_H */ +/* #undef HAVE_IMMINTRIN_H */ +/* #undef HAVE_LIBSAMPLERATE_H */ +/* #undef HAVE_LIBUDEV_H */ + +/* #undef HAVE_DDRAW_H */ +/* #undef HAVE_DINPUT_H */ +/* #undef HAVE_DSOUND_H */ +/* #undef HAVE_DXGI_H */ +/* #undef HAVE_XINPUT_H */ +/* #undef HAVE_ENDPOINTVOLUME_H */ +/* #undef HAVE_MMDEVICEAPI_H */ +/* #undef HAVE_AUDIOCLIENT_H */ +/* #undef HAVE_XINPUT_GAMEPAD_EX */ +/* #undef HAVE_XINPUT_STATE_EX */ + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_MORPHOS 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_AMIGAINPUT 1 +#define SDL_JOYSTICK_MORPHOS 1 +#define SDL_HAPTIC_DUMMY 1 + + +/* Enable various sensor drivers */ +/* #undef SDL_SENSOR_ANDROID */ +// #undef SDL_SENSOR_DUMMY 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_MORPHOS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_MORPHOS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_MORPHOS 1 + +/* Enable OpenGL support */ +#define SDL_VIDEO_OPENGL 1 + +/* Enable Vulkan support */ +/* #undef SDL_VIDEO_VULKAN */ + +/* Enable system power support */ +#define SDL_POWERMORPHOS 1 + +/* Enable system filesystem support */ +#define SDL_FILESYSTEM_AMIGA 1 + +/* Enable assembly routines */ +//#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ALTIVEC_BLITTERS 1 + +/* Enable ime support */ +/* #undef SDL_USE_IME */ + +/* Enable dynamic udev support */ +/* #undef SDL_UDEV_DYNAMIC */ + +/* Enable dynamic libsamplerate support */ +/* #undef SDL_LIBSAMPLERATE_DYNAMIC */ + +#endif /* SDL_config_MORPHOS_h_ */ 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/include/begin_code.h b/include/begin_code.h index 170d69ec55..77084bdeeb 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -68,7 +68,7 @@ # define DECLSPEC # endif # else -# if defined(__GNUC__) && __GNUC__ >= 4 +# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MORPHOS__) # define DECLSPEC __attribute__ ((visibility("default"))) # else # define DECLSPEC From 1a01ee0697ae9c5b9b7d1284d7989ffd181a423b Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:15:28 +0100 Subject: [PATCH 014/214] MORPHOS : add thread for MORPHOS --- src/thread/SDL_thread_c.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 9c75eb1fa0..f5a926d796 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" #else From b47699fcd7afc53892be45c52b7a9c05bc477e86 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:30:58 +0100 Subject: [PATCH 015/214] MORPHOS : fix define here uint32 and int32 ? not sure.... --- src/joystick/morphos/SDL_sysjoystick_c.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 169ad1ef86..be1682b006 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -26,8 +26,8 @@ #include #endif -#define DEBUG -#include "../../main/morphos/SDL_os4debug.h" +typedef unsigned int uint32; +typedef signed int int32; #define MAX_JOYSTICKS 32 From d3929d483792745f36fd894b7d8cc02571e5fc96 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:33:16 +0100 Subject: [PATCH 016/214] MORPHOS : ForeachNode and ForeachNodeSafe --- src/joystick/morphos/SDL_sysjoystick_c.h | 2 ++ src/thread/morphos/SDL_systls.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index be1682b006..bc74b86209 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -35,6 +35,8 @@ typedef signed int int32; #define MAX_BUTTONS 16 #define MAX_HATS 8 + +// Dont know why i need to redefine this... #define ForeachNode(l, n) \ for ( \ n = (void *)(((struct List *)(l))->lh_Head); \ diff --git a/src/thread/morphos/SDL_systls.c b/src/thread/morphos/SDL_systls.c index 61a599c5d6..ccbfe94f27 100644 --- a/src/thread/morphos/SDL_systls.c +++ b/src/thread/morphos/SDL_systls.c @@ -33,6 +33,21 @@ #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" + +// Dont know why i need to redefine this... +#define ForeachNode(l, n) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + ((struct Node *)(n))->ln_Succ; \ + n = (void *)(((struct Node *)(n))->ln_Succ) \ +) +#define ForeachNodeSafe(l,n,n2) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + (n2 = (void *)((struct Node *)(n))->ln_Succ); \ + n = (void *)n2 \ +) + struct tlsmagic { UBYTE magicid[sizeof(TLS_MAGICID)]; From c7b01d5479cdee1e39b48e564c196c5ab230bb41 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:43:51 +0100 Subject: [PATCH 017/214] MORPHOS : mistake .h file --- src/video/morphos/SDL_amigamouse.h | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/video/morphos/SDL_amigamouse.h diff --git a/src/video/morphos/SDL_amigamouse.h b/src/video/morphos/SDL_amigamouse.h new file mode 100644 index 0000000000..23e81a0473 --- /dev/null +++ b/src/video/morphos/SDL_amigamouse.h @@ -0,0 +1,47 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 "../../events/SDL_mouse_c.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: */ From 14789535e06b46cd21df70bccb42823a99224f1e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:45:52 +0100 Subject: [PATCH 018/214] MORPHOS : ForeachNode and ForeachNodeSafe Same here.. dont know why i need to redefine this --- src/video/morphos/SDL_amigamouse.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/video/morphos/SDL_amigamouse.h b/src/video/morphos/SDL_amigamouse.h index 23e81a0473..fde34186e6 100644 --- a/src/video/morphos/SDL_amigamouse.h +++ b/src/video/morphos/SDL_amigamouse.h @@ -27,6 +27,20 @@ #define IS_SYSTEM_CURSOR(cursor) (cursor == NULL || ((size_t)(cursor)->driverdata) < POINTERTYPE_NUMTYPES) +// Dont know why i need to redefine this... +#define ForeachNode(l, n) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + ((struct Node *)(n))->ln_Succ; \ + n = (void *)(((struct Node *)(n))->ln_Succ) \ +) +#define ForeachNodeSafe(l,n,n2) \ +for ( \ + n = (void *)(((struct List *)(l))->lh_Head); \ + (n2 = (void *)((struct Node *)(n))->ln_Succ); \ + n = (void *)n2 \ +) + struct SDL_AmigaPointerData { struct BitMap *bmp; From 1591ba8b86c23147be3ba791f424af53cfe3274e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:52:15 +0100 Subject: [PATCH 019/214] MORPHOS : fix --- src/video/morphos/SDL_amigavideo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/morphos/SDL_amigavideo.c b/src/video/morphos/SDL_amigavideo.c index 30e25a8578..ad3ef54ae0 100644 --- a/src/video/morphos/SDL_amigavideo.c +++ b/src/video/morphos/SDL_amigavideo.c @@ -347,8 +347,8 @@ AMIGA_CreateDevice(int devindex) device->SuspendScreenSaver = AMIGA_SuspendScreenSaver; device->PumpEvents = AMIGA_PumpEvents; - device->CreateWindow = AMIGA_CreateWindow; - device->CreateWindowFrom = AMIGA_CreateWindowFrom; + device->CreateSDLWindow = AMIGA_CreateWindow; + device->CreateSDLWindowFrom = AMIGA_CreateWindowFrom; device->SetWindowTitle = AMIGA_SetWindowTitle; device->SetWindowIcon = AMIGA_SetWindowIcon; device->SetWindowPosition = AMIGA_SetWindowPosition; @@ -405,7 +405,7 @@ AMIGA_CreateDevice(int devindex) return NULL; } -const VideoBootStrap AMIGA_bootstrap = { +VideoBootStrap AMIGA_bootstrap = { "amiga", "SDL Amiga video driver", AMIGA_Available, AMIGA_CreateDevice }; From e1b316634d39b80eac2700a4fad7b89c6aa38ae9 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 21:54:26 +0100 Subject: [PATCH 020/214] MORPHOS : add SDL_SYSWM_AMIGA --- include/SDL_syswm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 1fdc268894..8ffc7ff3bd 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -131,6 +131,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, From ef65c01f240d3ee9c38c7e171fd8fdcfc0428082 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:02:07 +0100 Subject: [PATCH 021/214] MorphOS : fix --- src/video/SDL_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ab9acac4d4..fcc28c13d7 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3976,7 +3976,7 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "haiku/SDL_bmessagebox.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 +#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_AMIGAOS || SDL_VIDEO_DRIVER_HAIKU static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; From 7846f762fcc2cfc5ee53328d456864f4583660b4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:23:54 +0100 Subject: [PATCH 022/214] MORPHOS : mistake fix --- include/SDL_syswm.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 8ffc7ff3bd..ccd76bc986 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -287,7 +287,12 @@ struct SDL_SysWMinfo struct Window *window; /**< The AmigaOS 4 window */ } os4; #endif - +#if defined(SDL_VIDEO_DRIVER_AMIGA) + struct + { + struct Window *window; /**< Intuition window */ + } intui; +#endif #if defined(SDL_VIDEO_DRIVER_VIVANTE) struct { From a1a0be02a31f014a42875f31e8dd0cb31c22b9ae Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:26:02 +0100 Subject: [PATCH 023/214] MORPHOS : fix --- include/SDL_config_morphos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index e124378274..a6aa4212f5 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -218,7 +218,7 @@ #define SDL_TIMER_MORPHOS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_MORPHOS 1 +#define SDL_VIDEO_DRIVER_VIDEO 1 /* Enable OpenGL support */ #define SDL_VIDEO_OPENGL 1 From 8762766fd0cee0d8d4b99814f7174553dc67258c Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:36:47 +0100 Subject: [PATCH 024/214] MORPHOS : fix path error --- src/video/SDL_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index fcc28c13d7..1571bd2807 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3970,7 +3970,7 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "amigaos4/SDL_os4messagebox.h" #endif #if SDL_VIDEO_DRIVER_AMIGA -#include "amiga/SDL_amigamessagebox.h" +#include "morphos/SDL_amigamessagebox.h" #endif #if SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" From abd73a85301d1cbc5642886b1a21d37d2b86ca91 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:40:03 +0100 Subject: [PATCH 025/214] MORPHOS : GCC 9 and add AROS_ALMOST_COMPATIBLE --- makefile.mos | 6 +++--- src/joystick/morphos/SDL_sysjoystick_c.h | 15 --------------- src/thread/morphos/SDL_systls.c | 14 -------------- src/video/morphos/SDL_amigamouse.h | 14 -------------- 4 files changed, 3 insertions(+), 46 deletions(-) diff --git a/makefile.mos b/makefile.mos index 533f82a0b2..05192d0f87 100644 --- a/makefile.mos +++ b/makefile.mos @@ -2,13 +2,13 @@ AR = ppc-morphos-ar RANLIB = ppc-morphos-ranlib -CC = ppc-morphos-gcc-8 -CXX = ppc-morphos-g++-8 +CC = ppc-morphos-gcc-9 +CXX = ppc-morphos-g++-9 STRIP = ppc-morphos-strip AMIGADATE = $(shell date +"%-d.%-m.%Y") -CFLAGS = -Wall -Wno-pointer-sign -mresident32 -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +CFLAGS = -Wall -Wno-pointer-sign -mresident32 -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" TARGET_STATIC = libSDL2.a TARGET_SHARED = libSDL2-2.0.so diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index bc74b86209..517028a276 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -35,21 +35,6 @@ typedef signed int int32; #define MAX_BUTTONS 16 #define MAX_HATS 8 - -// Dont know why i need to redefine this... -#define ForeachNode(l, n) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - ((struct Node *)(n))->ln_Succ; \ - n = (void *)(((struct Node *)(n))->ln_Succ) \ -) -#define ForeachNodeSafe(l,n,n2) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - (n2 = (void *)((struct Node *)(n))->ln_Succ); \ - n = (void *)n2 \ -) - struct sensordata { struct MsgPort *sensorport; diff --git a/src/thread/morphos/SDL_systls.c b/src/thread/morphos/SDL_systls.c index ccbfe94f27..f19a40429a 100644 --- a/src/thread/morphos/SDL_systls.c +++ b/src/thread/morphos/SDL_systls.c @@ -34,20 +34,6 @@ #define TLS_MAGICID "SDL2TLS" -// Dont know why i need to redefine this... -#define ForeachNode(l, n) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - ((struct Node *)(n))->ln_Succ; \ - n = (void *)(((struct Node *)(n))->ln_Succ) \ -) -#define ForeachNodeSafe(l,n,n2) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - (n2 = (void *)((struct Node *)(n))->ln_Succ); \ - n = (void *)n2 \ -) - struct tlsmagic { UBYTE magicid[sizeof(TLS_MAGICID)]; diff --git a/src/video/morphos/SDL_amigamouse.h b/src/video/morphos/SDL_amigamouse.h index fde34186e6..23e81a0473 100644 --- a/src/video/morphos/SDL_amigamouse.h +++ b/src/video/morphos/SDL_amigamouse.h @@ -27,20 +27,6 @@ #define IS_SYSTEM_CURSOR(cursor) (cursor == NULL || ((size_t)(cursor)->driverdata) < POINTERTYPE_NUMTYPES) -// Dont know why i need to redefine this... -#define ForeachNode(l, n) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - ((struct Node *)(n))->ln_Succ; \ - n = (void *)(((struct Node *)(n))->ln_Succ) \ -) -#define ForeachNodeSafe(l,n,n2) \ -for ( \ - n = (void *)(((struct List *)(l))->lh_Head); \ - (n2 = (void *)((struct Node *)(n))->ln_Succ); \ - n = (void *)n2 \ -) - struct SDL_AmigaPointerData { struct BitMap *bmp; From 903ee4f3fb07581194d07d55dba0a2d286d0e881 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:52:43 +0100 Subject: [PATCH 026/214] MORPHOS : delete os4 reference --- makefile.mos | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/makefile.mos b/makefile.mos index 05192d0f87..2e101b6a1d 100644 --- a/makefile.mos +++ b/makefile.mos @@ -49,7 +49,6 @@ TESTLIB_SOURCES =./src/test/*.c OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') TESTLIB_OBJECTS = $(shell echo $(TESTLIB_SOURCES) | sed -e 's,\.c,\.o,g') -VERSION_OBJECT = src/main/morphos/SDL_os4version.o all: $(TARGET_STATIC) $(TARGET_SHARED) $(TESTLIB_STATIC) @@ -71,12 +70,12 @@ clean: rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(TESTLIB_STATIC) $(OBJECTS) install: - mkdir -p /SDK/local/newlib/lib - mkdir -p /SDK/local/newlib/include/SDL2 - cp -f $(TARGET_STATIC) /SDK/local/newlib/lib - cp -f $(TARGET_SHARED) /SDK/local/newlib/lib - cp -f $(TESTLIB_STATIC) /SDK/local/newlib/lib - cp -f include/*.h /SDK/local/newlib/include/SDL2/ + mkdir -p /usr/local/lib + mkdir -p /usr/local/include/SDL2 + cp -f $(TARGET_STATIC) /usr/local/lib + cp -f $(TARGET_SHARED) /usr/local/lib + cp -f $(TESTLIB_STATIC) /usr/local/lib + cp -f include/*.h /usr/local/include/SDL2/ src/video/SDL_blit_N.o: src/video/SDL_blit_N.c ppc-morphos-gcc-5 -I./include -DNDEBUG -DNO_AMIGADEBUG -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c From 09a5bf379cbf9cc043a3d9e7651a2cc430df35e2 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:56:42 +0100 Subject: [PATCH 027/214] MORPHOS : fix.. i'm tired --- include/SDL_config_morphos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index a6aa4212f5..9d4137c600 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -218,7 +218,7 @@ #define SDL_TIMER_MORPHOS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_VIDEO 1 +#define SDL_VIDEO_DRIVER_AMIGA 1 /* Enable OpenGL support */ #define SDL_VIDEO_OPENGL 1 From 863ff38749b7a62aba5bc74fd994086fd40ec00d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:03:09 +0100 Subject: [PATCH 028/214] MORPHOS : add audio disk --- makefile.mos | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile.mos b/makefile.mos index 2e101b6a1d..1f95806610 100644 --- a/makefile.mos +++ b/makefile.mos @@ -19,6 +19,7 @@ SOURCES = \ ./src/atomic/*.c \ ./src/audio/*.c \ ./src/audio/morphos/*.c \ + ./src/audio/disk/*.c \ ./src/audio/dummy/*.c \ ./src/core/morphos/*.c \ ./src/cpuinfo/*.c \ From 35d865de94770a8411a563bad5d6299696f1295a Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 08:29:31 +0100 Subject: [PATCH 029/214] MORPHOS : add debug function D() --- include/SDL_config_morphos.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 9d4137c600..7205a3c8cd 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -236,13 +236,16 @@ //#define SDL_ASSEMBLY_ROUTINES 1 #define SDL_ALTIVEC_BLITTERS 1 -/* Enable ime support */ -/* #undef SDL_USE_IME */ - -/* Enable dynamic udev support */ -/* #undef SDL_UDEV_DYNAMIC */ - -/* Enable dynamic libsamplerate support */ -/* #undef SDL_LIBSAMPLERATE_DYNAMIC */ +#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_ */ From 6d62e7c50135f1337b15aefa80f4623f9642b9e2 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 08:34:14 +0100 Subject: [PATCH 030/214] MORPHOS : add -D__SDL_DEBUG --- makefile.mos => Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename makefile.mos => Makefile.mos (91%) diff --git a/makefile.mos b/Makefile.mos similarity index 91% rename from makefile.mos rename to Makefile.mos index 1f95806610..e158b8e655 100644 --- a/makefile.mos +++ b/Makefile.mos @@ -8,7 +8,7 @@ STRIP = ppc-morphos-strip AMIGADATE = $(shell date +"%-d.%-m.%Y") -CFLAGS = -Wall -Wno-pointer-sign -mresident32 -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +CFLAGS = -Wall -Wno-pointer-sign -mresident32 -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" TARGET_STATIC = libSDL2.a TARGET_SHARED = libSDL2-2.0.so From ec4522c1ca7bdbcd1520c279e895ca937a5a6c48 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 11:20:16 +0100 Subject: [PATCH 031/214] MORPHOS : fix sizeof --- src/cpuinfo/SDL_cpuinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index e181bf9ab7..3efa63d2d2 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -347,16 +347,16 @@ CPU_haveAltiVec(void) altivec = (vec_unit == VECTORTYPE_ALTIVEC); } #elif defined(__MORPHOS__) - if (SysBase->LibNode.lib_Version >=51) { + //if (SysBase->LibNode.lib_Version >=51) { ULONG has_altivec; - if (NewGetSystemAttrs(&has_altivec, size_of(has_altivec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE)) + 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); From d2c806ed9dfa32713665480840e5e76a43a84b5f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 12:02:08 +0100 Subject: [PATCH 032/214] MORPHOS : clean delete shared, add optimization -O2 and delete -mresident32 --- Makefile.mos | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index e158b8e655..66d233be15 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -8,10 +8,9 @@ STRIP = ppc-morphos-strip AMIGADATE = $(shell date +"%-d.%-m.%Y") -CFLAGS = -Wall -Wno-pointer-sign -mresident32 -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +CFLAGS = -O2 -Wall -Wno-pointer-sign -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" TARGET_STATIC = libSDL2.a -TARGET_SHARED = libSDL2-2.0.so TESTLIB_STATIC = libSDL2_test.a SOURCES = \ @@ -51,7 +50,7 @@ TESTLIB_SOURCES =./src/test/*.c OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') TESTLIB_OBJECTS = $(shell echo $(TESTLIB_SOURCES) | sed -e 's,\.c,\.o,g') -all: $(TARGET_STATIC) $(TARGET_SHARED) $(TESTLIB_STATIC) +all: $(TARGET_STATIC) $(TESTLIB_STATIC) $(TESTLIB_STATIC): $(TESTLIB_OBJECTS) $(AR) crv $@ $^ @@ -61,20 +60,16 @@ $(TARGET_STATIC): $(OBJECTS) $(AR) crv $@ $^ $(RANLIB) $@ -$(TARGET_SHARED): $(OBJECTS) $(VERSION_OBJECT) - $(CC) -shared -Wl,-soname,$(TARGET_SHARED) -o $(TARGET_SHARED) $(OBJECTS) $(VERSION_OBJECT) - config_copy: cp include/SDL_config_morphos.h include/SDL_config.h clean: - rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(TESTLIB_STATIC) $(OBJECTS) + rm -f $(TARGET_STATIC)* $(TESTLIB_STATIC) $(OBJECTS) install: mkdir -p /usr/local/lib mkdir -p /usr/local/include/SDL2 cp -f $(TARGET_STATIC) /usr/local/lib - cp -f $(TARGET_SHARED) /usr/local/lib cp -f $(TESTLIB_STATIC) /usr/local/lib cp -f include/*.h /usr/local/include/SDL2/ From afd31b96f41df63a46a20311ddcf67cb1c611c02 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 12:06:52 +0100 Subject: [PATCH 033/214] Update SDL_config_morphos.h --- include/SDL_config_morphos.h | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 7205a3c8cd..9d8f6152f7 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -66,12 +66,6 @@ #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 -#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -/* #undef HAVE_UNSETENV */ -#endif #define HAVE_QSORT 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 @@ -174,24 +168,7 @@ /* #undef HAVE_POLL */ -/*#define HAVE_ALTIVEC_H 1*/ -/* #undef HAVE_DBUS_DBUS_H */ -/* #undef HAVE_FCITX_FRONTEND_H */ -/* #undef HAVE_IBUS_IBUS_H */ -/* #undef HAVE_IMMINTRIN_H */ -/* #undef HAVE_LIBSAMPLERATE_H */ -/* #undef HAVE_LIBUDEV_H */ - -/* #undef HAVE_DDRAW_H */ -/* #undef HAVE_DINPUT_H */ -/* #undef HAVE_DSOUND_H */ -/* #undef HAVE_DXGI_H */ -/* #undef HAVE_XINPUT_H */ -/* #undef HAVE_ENDPOINTVOLUME_H */ -/* #undef HAVE_MMDEVICEAPI_H */ -/* #undef HAVE_AUDIOCLIENT_H */ -/* #undef HAVE_XINPUT_GAMEPAD_EX */ -/* #undef HAVE_XINPUT_STATE_EX */ +#define HAVE_ALTIVEC_H 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_MORPHOS 1 From b2869ffdc8997686622789cf4653aca07ad9c1eb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 12:19:47 +0100 Subject: [PATCH 034/214] MOS : add SDL_AMIGAINPUT_JoystickDriver definition add mistake function --- src/joystick/morphos/SDL_sysjoystick.c | 44 +++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 0d16a9455a..1fd2b8583f 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -110,12 +110,12 @@ SDL_SYS_JoystickInit(void) { struct sensordata *s = SDL_malloc(sizeof(*s)); int rc = -1; - printf("[SDL_SYS_JoystickInit]\n"); + D("[SDL_SYS_JoystickInit]\n"); if (s) { s->notifytask = SysBase->ThisTask; - printf("[SDL_SYS_JoystickInit] Create sensor events worker thread...\n"); + D("[SDL_SYS_JoystickInit] Create sensor events worker thread...\n"); if (QueueWorkItem(threadpool, (THREADFUNC)sensor_events, s) == WORKITEM_INVALID) { @@ -133,7 +133,7 @@ SDL_SYS_JoystickInit(void) while (s->sensorport == NULL) Wait(SIGF_SINGLE); - printf("[SDL_SYS_JoystickInit] Obtain sensor list...\n"); + D("[SDL_SYS_JoystickInit] Obtain sensor list...\n"); sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; while ((sensor = NextSensor(sensor, sensorlist, NULL))) @@ -164,7 +164,7 @@ SDL_SYS_JoystickInit(void) ReleaseSensorsList(sensorlist, NULL); - printf("[SDL_SYS_JoystickInit] Found %ld joysticks...\n", count); + D("[SDL_SYS_JoystickInit] Found %ld joysticks...\n", count); s->joystick_count = count; rc = count; @@ -472,8 +472,44 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) struct joystick_hwdata *hwdata = GetByIndex(device_index); return hwdata->guid; } +static +int +SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return 0; +} SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) { return joystick->hwdata->guid; } + +static int +SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) +{ + return device_index; +} + +static void +SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) +{ + D("Not implemented\n"); +} + +SDL_JoystickDriver SDL_AMIGAINPUT_JoystickDriver = +{ + SDL_SYS_JoystickInit, + SDL_SYS_NumJoysticks, + SDL_SYS_JoystickDetect, + SDL_SYS_JoystickNameForDeviceIndex, + SDL_SYS_JoystickGetDevicePlayerIndex, + SDL_SYS_JoystickSetDevicePlayerIndex, + SDL_SYS_JoystickGetGUID, + SDL_SYS_GetInstanceIdOfDeviceIndex, + SDL_SYS_JoystickOpen, + SDL_SYS_JoystickRumble, + SDL_SYS_JoystickUpdate, + SDL_SYS_JoystickClose, + SDL_SYS_JoystickQuit, +}; + From 8adb4710c3773a19fd1ddf2a52908a20d49154f2 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 12:56:18 +0100 Subject: [PATCH 035/214] MORPHOS : fix --- src/video/SDL_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 1571bd2807..621b30eea5 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3976,7 +3976,7 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "haiku/SDL_bmessagebox.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_AMIGAOS || SDL_VIDEO_DRIVER_HAIKU +#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 static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; From 7ac9639e83696c15aae337f646ad734a4feb924c Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 13:10:01 +0100 Subject: [PATCH 036/214] MOS : fix clean --- Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.mos b/Makefile.mos index 66d233be15..93dcea0f74 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -64,7 +64,7 @@ config_copy: cp include/SDL_config_morphos.h include/SDL_config.h clean: - rm -f $(TARGET_STATIC)* $(TESTLIB_STATIC) $(OBJECTS) + rm -f $(TARGET_STATIC) $(TESTLIB_STATIC) $(OBJECTS) install: mkdir -p /usr/local/lib From 82036435913e9917912b4c38f1418fa9ca8de867 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 13:13:23 +0100 Subject: [PATCH 037/214] MOS : add noixemul CFLAGS --- Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.mos b/Makefile.mos index 93dcea0f74..46942d1034 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -8,7 +8,7 @@ STRIP = ppc-morphos-strip AMIGADATE = $(shell date +"%-d.%-m.%Y") -CFLAGS = -O2 -Wall -Wno-pointer-sign -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +CFLAGS = -O2 -Wall -noixemul -Wno-pointer-sign -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" TARGET_STATIC = libSDL2.a TESTLIB_STATIC = libSDL2_test.a From bce720a25802ef22d2fa8de4c8dd9a6ddaf42691 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 13:39:57 +0100 Subject: [PATCH 038/214] MORPHOS : update rwops --- include/SDL_rwops.h | 15 ++- src/file/SDL_rwops.c | 231 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+), 1 deletion(-) diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 2e6225fcbd..538c308412 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 6 /* Amiga file */ + /** * This is the read/write operation structure -- very basic. */ @@ -110,6 +111,18 @@ typedef struct SDL_RWops size_t left; } buffer; } windowsio; +#elif defined(AMIGA) + struct + { + Uint8 AppendMode : 1, NoSeek : 1, IsAtEnd : 1, autoclose : 1; + Uint8 Writable : 1; + + union + { + size_t dos; + void *libc; + } fp; + } amigaio; #endif #ifdef HAVE_STDIO_H diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index a7d66dfd12..c4f5eb7c32 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -38,6 +38,11 @@ #define off64_t _off64_t #endif +#if defined(AMIGA) +#include "../core/morphos/SDL_misc.h" +#include +#endif + #ifdef HAVE_STDIO_H #include #endif @@ -309,6 +314,206 @@ windows_file_close(SDL_RWops * context) } #endif /* __WIN32__ */ +#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) ? 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 (ExamineFH(context->hidden.amigaio.fp.dos, &fib)) + 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 ((result = Read(context->hidden.amigaio.fp.dos, ptr, rsize)) != rsize) + { + SDL_Error(SDL_EFWRITE); + } + + 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); +} +#endif + #ifdef HAVE_STDIO_H #ifdef HAVE_FOPEN64 @@ -599,7 +804,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__ From f8aebffe6b37d6b76cad48e0fb0f0b849082e9a4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 13:46:32 +0100 Subject: [PATCH 039/214] add makefile for MorphOS --- test/Makefile.mos | 286 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 test/Makefile.mos diff --git a/test/Makefile.mos b/test/Makefile.mos new file mode 100644 index 0000000000..cbf590bda4 --- /dev/null +++ b/test/Makefile.mos @@ -0,0 +1,286 @@ +# Makefile to build the AmigaOS4 SDL tests + +CC = ppc-morphos-gcc +CFLAGS = -noixemul -O2 -Wall -g -I../include -DHAVE_OPENGL +LIBS = -L../ -lSDL2 -lSDL2_test -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 \ + testsensor \ + testshader \ + testshape \ + testsprite2 \ + testspriteminimal \ + teststreaming \ + testthread \ + testtimer \ + testver \ + testviewport \ + testvulkan \ + testwm2 \ + testyuv \ + torturethread \ + +all: $(TARGETS) + +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) + +clean: + rm -f $(TARGETS) *.o From ef384eac7d08e248e63672e0180448f6ba442384 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 15:56:13 +0100 Subject: [PATCH 040/214] Create TODO.MORPHOS --- TODO.MORPHOS | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 TODO.MORPHOS diff --git a/TODO.MORPHOS b/TODO.MORPHOS new file mode 100644 index 0000000000..1dcaf78a10 --- /dev/null +++ b/TODO.MORPHOS @@ -0,0 +1,11 @@ +TODO + +- Initialise all libraries (same as AmigaOS4) + - timer (GlobalTimeReq) + - thread (threadpool) + - etc.. + +- use gcc 9 with altivec for SDL_BLIT_N.C + + +01/03/2020 BeWorld From 4ffc2f80a40dba52325b4ebf90c472c3cbf99cb0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:09:27 +0100 Subject: [PATCH 041/214] Update TODO.MORPHOS --- TODO.MORPHOS | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index 1dcaf78a10..4995e56574 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -5,7 +5,6 @@ TODO - thread (threadpool) - etc.. -- use gcc 9 with altivec for SDL_BLIT_N.C 01/03/2020 BeWorld From e63100a6e9e762a4ec186af91e3d0b31a7a4a23b Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:10:49 +0100 Subject: [PATCH 042/214] morphos : delete gcc5 for SDL_blit_N --- Makefile.mos | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 46942d1034..5ba80de895 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -72,6 +72,3 @@ install: cp -f $(TARGET_STATIC) /usr/local/lib cp -f $(TESTLIB_STATIC) /usr/local/lib cp -f include/*.h /usr/local/include/SDL2/ - -src/video/SDL_blit_N.o: src/video/SDL_blit_N.c - ppc-morphos-gcc-5 -I./include -DNDEBUG -DNO_AMIGADEBUG -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c From 5a68ddd511c956cb1d6ad8e84bc252e35beb9823 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:21:40 +0100 Subject: [PATCH 043/214] Update TODO.MORPHOS --- TODO.MORPHOS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index 4995e56574..fbecd5896d 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -1,10 +1,13 @@ TODO +1) static library : - Initialise all libraries (same as AmigaOS4) - timer (GlobalTimeReq) - thread (threadpool) - etc.. - +or +2) shared library : +- Import Itix 's work 01/03/2020 BeWorld From b1ef9be866f81dead9224be2173d16d7a7d2c57f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 2 Mar 2020 20:40:14 +0100 Subject: [PATCH 044/214] MOS: first update on joystick Fix detection sensors Put Real Name of Sensors --- src/joystick/morphos/SDL_sysjoystick.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 1fd2b8583f..2c846cfa40 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -30,13 +30,15 @@ #include #include #include +#define USE_INLINE_STDARG #include +#undef USE_INLINE_STDARG #include #include #define BUFFER_OFFSET(buffer, offset) (((int32 *)buffer)[offset]) -static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, SENSORS_Type, SensorType_HID_Gamepad, TAG_DONE }; +static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, /*SENSORS_Type, SensorType_HID_Gamepad,*/ TAG_DONE }; static struct sensordata *sensors; extern APTR threadpool; @@ -140,7 +142,7 @@ SDL_SYS_JoystickInit(void) { CONST_STRPTR name = "", serial = NULL; size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; - + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) { size_t namelen = strlen(name) + 1; @@ -346,7 +348,8 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { CONST_STRPTR name = "", serial = NULL; size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; - + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) { SDL_JoystickGUID guid; From 57cc74ceb710090b379ab29c786e67985a4b31e3 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 3 Mar 2020 07:55:52 +0100 Subject: [PATCH 045/214] Update TODO.MORPHOS --- TODO.MORPHOS | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index fbecd5896d..71c3e5cd41 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -10,4 +10,13 @@ or - Import Itix 's work -01/03/2020 BeWorld +3) fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) + - Detection = ok (begin fix 02/03/2020) + - Crash when open it :-( + +4) check keyboard (all keys a-z doesnt work on SDL2 itix) + +5) check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) + + +BeWorld From 909a537abd70865eba80b81a52d7915f5eab41e6 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 3 Mar 2020 14:59:46 +0100 Subject: [PATCH 046/214] MOS : fix keyboard --- src/video/morphos/SDL_amigaevents.c | 43 ++++++++++++++++++- src/video/morphos/SDL_amigakeyboard.c | 59 ++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/video/morphos/SDL_amigaevents.c b/src/video/morphos/SDL_amigaevents.c index 6a33ff1043..4e9680422e 100644 --- a/src/video/morphos/SDL_amigaevents.c +++ b/src/video/morphos/SDL_amigaevents.c @@ -24,6 +24,7 @@ #include "../SDL_sysvideo.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_mouse_c.h" +#include "../../events/scancodes_amiga.h" #include "SDL_amigavideo.h" #include "SDL_amigawindow.h" @@ -152,6 +153,27 @@ AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *d SDL_SendMouseButton(data->window, 0, state, i); } +static char +AMIGA_TranslateUnicode(UWORD code, UWORD qualifier) +{ + struct InputEvent ie; + WORD res; + char buffer[10]; + + ie.ie_Class = IECLASS_RAWKEY; + ie.ie_SubClass = 0; + ie.ie_Code = code & ~(IECODE_UP_PREFIX); + ie.ie_Qualifier = qualifier; + ie.ie_EventAddress = NULL; + + res = MapRawKey(&ie, buffer, sizeof(buffer), 0); + + if (res != 1) + return 0; + else + return buffer[0]; +} + static void AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) { @@ -193,7 +215,7 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) } else { - WCHAR keycode; + /*WCHAR keycode; TEXT buffer[8]; ULONG length; @@ -206,6 +228,25 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) { buffer[length] = '\0'; SDL_SendKeyboardText(buffer); + }*/ + + UWORD rawkey = m->Code & 0x0F; + if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0]) { + + SDL_Scancode s = amiga_scancode_table[rawkey]; + + if (imsg->Code <= 127) { + + char text[2]; + + text[0] = AMIGA_TranslateUnicode(_this, imsg->Code, imsg->Qualifier); + text[1] = '\0'; + + SDL_SendKeyboardKey(SDL_PRESSED, s); + SDL_SendKeyboardText(text); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, s); + } } } break; diff --git a/src/video/morphos/SDL_amigakeyboard.c b/src/video/morphos/SDL_amigakeyboard.c index 017087d8db..6f10b54552 100644 --- a/src/video/morphos/SDL_amigakeyboard.c +++ b/src/video/morphos/SDL_amigakeyboard.c @@ -22,9 +22,64 @@ #include "../../events/SDL_keyboard_c.h" -void -AMIGA_InitKeyboard(_THIS) +#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() +{ + 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(); + SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); From e4a1c5122a120cfc7e3da06dce7bdedb9e45334e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 3 Mar 2020 15:31:31 +0100 Subject: [PATCH 047/214] Update TODO.MORPHOS --- TODO.MORPHOS | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index 71c3e5cd41..90bbe9a5d4 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -15,6 +15,7 @@ or - Crash when open it :-( 4) check keyboard (all keys a-z doesnt work on SDL2 itix) + - begin fix but need optimization. (03/03/2020) 5) check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) From 758908d7716909a3d0e7943f151c2922ed67d738 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:00:24 +0100 Subject: [PATCH 048/214] MOS: comment unnecessary code --- src/video/morphos/SDL_amigaevents.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/video/morphos/SDL_amigaevents.c b/src/video/morphos/SDL_amigaevents.c index 4e9680422e..a6e38fb21e 100644 --- a/src/video/morphos/SDL_amigaevents.c +++ b/src/video/morphos/SDL_amigaevents.c @@ -48,7 +48,7 @@ #include #include -static SDL_Scancode +/*static SDL_Scancode AMIGA_ScanCodeToSDL(UWORD code) { switch (code) @@ -132,7 +132,7 @@ AMIGA_ScanCodeToSDL(UWORD code) } return SDL_SCANCODE_UNKNOWN; -} +}*/ static void AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) @@ -177,9 +177,11 @@ AMIGA_TranslateUnicode(UWORD code, UWORD qualifier) static void AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) { - SDL_Scancode sc; - UWORD code = m->Code; - + //SDL_Scancode sc; + //UWORD code = m->Code; + SDL_Scancode s; + UWORD rawkey = m->Code & 0x0F; + switch (code) { case RAWKEY_NM_WHEEL_UP: @@ -207,14 +209,14 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) break; default: - sc = AMIGA_ScanCodeToSDL(code & ~(IECODE_UP_PREFIX)); + /*sc = AMIGA_ScanCodeToSDL(code & ~(IECODE_UP_PREFIX)); if (sc != SDL_SCANCODE_UNKNOWN) { SDL_SendKeyboardKey(code & IECODE_UP_PREFIX ? SDL_RELEASED : SDL_PRESSED, sc); } else - { + {*/ /*WCHAR keycode; TEXT buffer[8]; ULONG length; @@ -230,10 +232,9 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) SDL_SendKeyboardText(buffer); }*/ - UWORD rawkey = m->Code & 0x0F; if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0]) { - SDL_Scancode s = amiga_scancode_table[rawkey]; + s = amiga_scancode_table[rawkey]; if (imsg->Code <= 127) { @@ -248,7 +249,7 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) SDL_SendKeyboardKey(SDL_RELEASED, s); } } - } + //} break; } } From 10723aed9fb34624f7fbb2b509f0ad9404c826d4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:45:48 +0100 Subject: [PATCH 049/214] MOS : add cilb, fb, ppcinline, proto files for SDK Need to be move in future --- sdk/clib/sdl2_protos.h | 728 ++++++ sdk/fd/sdl2_lib.fd | 610 +++++ sdk/ppcinline/sdl2.h | 5307 ++++++++++++++++++++++++++++++++++++++++ sdk/proto/sdl2.h | 33 + 4 files changed, 6678 insertions(+) create mode 100644 sdk/clib/sdl2_protos.h create mode 100644 sdk/fd/sdl2_lib.fd create mode 100644 sdk/ppcinline/sdl2.h create mode 100644 sdk/proto/sdl2.h diff --git a/sdk/clib/sdl2_protos.h b/sdk/clib/sdl2_protos.h new file mode 100644 index 0000000000..633958e178 --- /dev/null +++ b/sdk/clib/sdl2_protos.h @@ -0,0 +1,728 @@ +#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(voiud) +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); +SDL_GLContext SDL_GL_CreateContext(SDL_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.3 to 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.04 to 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.6 to 2.0.11 */ +SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, 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); +SDL_bool SDL_HasAVX512F(void); +SDL_bool SDL_HasARMSIMD(void); +size_t SDL_SIMDGetAlignment(void); +void * SDL_SIMDAlloc(const size_t len); +void SDL_SIMDFree(void *ptr); +SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); +char *SDL_GameControllerMappingForDeviceIndex(int joystick_index); +SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); +SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller); +int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); +void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); +int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +void SDL_LockJoysticks(void); +void SDL_UnlockJoysticks(void); +int SDL_JoystickGetDevicePlayerIndex(int device_index); +SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index); +int SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); +void SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); +int SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + +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); +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); +void *SDL_RenderGetMetalLayer(SDL_Renderer * renderer); +void *SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); + +void *SDL_LoadFile(const char *file, size_t *datasize); +int SDL_RWclose(SDL_RWops *context); +size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num); +size_t SDL_RWread(SDL_RWops *context,void *ptr, size_t size, size_t maxnum); +Sint64 SDL_RWtell(SDL_RWops *context); +Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence); +Sint64 SDL_RWsize(SDL_RWops *context); + +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); +char *SDL_strtokr(char *s1, const char *s2, char **saveptr); +wchar_t *SDL_wcsdup(const wchar_t *wstr); +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); + +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); +double SDL_exp(double x); +float SDL_expf(float x); +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); + +SDL_bool SDL_HasColorKey(SDL_Surface * surface); +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); +SDL_bool SDL_IsTablet(void) +SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); +SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); +SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex); + +#endif + +#endif /* CLIB_SDL2_PROTOS_H */ diff --git a/sdk/fd/sdl2_lib.fd b/sdk/fd/sdl2_lib.fd new file mode 100644 index 0000000000..2bdfd2dcf8 --- /dev/null +++ b/sdk/fd/sdl2_lib.fd @@ -0,0 +1,610 @@ +##base _SDL2Base +##bias 30 +* The SDL interface +##public +* general +SDL_InitTGL(glcptr,tglptr)(base,sysv) +SDL_SetExitPointer(exitfunc)(base,sysv) +SDL_SetError(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,src_rate,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_HasAVX512F()(sysv,r12base) +SDL_HasARMSIMD()(sysv,r12base) +SDL_SIMDGetAlignment()(sysv,r12base) +SDL_SIMDAlloc(len)(sysv,r12base) +SDL_SIMDFree(ptr)(sysv,r12base) +SDL_GameControllerTypeForIndex(joystick_index)(sysv,r12base) +SDL_GameControllerMappingForDeviceIndex(joystick_index)(sysv,r12base) +SDL_GameControllerFromPlayerIndex(player_index)(sysv,r12base) +SDL_GameControllerGetType(gamecontroller)(sysv,r12base) +SDL_GameControllerGetPlayerIndex(gamecontroller)(sysv,r12base) +SDL_GameControllerSetPlayerIndex(gamecontroller,player_index)(sysv,r12base) +SDL_GameControllerRumble(gamecontroller,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) +SDL_LockJoysticks()(sysv,r12base) +SDL_UnlockJoysticks()(sysv,r12base) +SDL_JoystickGetDevicePlayerIndex(device_index)(sysv,r12base) +SDL_JoystickFromPlayerIndex(player_index)(sysv,r12base) +SDL_JoystickGetPlayerIndex(joystick)(sysv,r12base) +SDL_JoystickSetPlayerIndex(joystick,player_index)(sysv,r12base) +SDL_JoystickRumble(joystick,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) +SDL_SetTextureScaleMode(texture,scaleMode)(sysv,r12base) +SDL_GetTextureScaleMode(texture,scaleMode)(sysv,r12base) +SDL_LockTextureToSurface(texture,rect,surface)(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_RenderGetMetalLayer(renderer)(sysv,r12base) +SDL_RenderGetMetalCommandEncoder(renderer)(sysv,r12base) +SDL_LoadFile(file,datasize)(sysv,r12base) +SDL_RWclose(context)(sysv,r12base) +SDL_RWwrite(context,ptr,size,num)(sysv,r12base) +SDL_RWread(context,ptr,size,maxnum)(sysv,r12base) +SDL_RWtell(context)(sysv,r12base) +SDL_RWseek(context,offset,whence)(sysv,r12base) +SDL_RWsize(context)(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_strtokr(s1,s2,saveptr)(sysv,r12base) +SDL_wcsdup(wstr)(sysv,r12base) +SDL_wcsstr(haystack,needle)(sysv,r12base) +SDL_wcsncmp(str1,str2,maxlen)(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_exp(x)(sysv,r12base) +SDL_expf(x)(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_HasColorKey(surface)(sysv,r12base) +SDL_SetYUVConversionMode(mode)(sysv,r12base) +SDL_GetYUVConversionMode()(sysv,r12base) +SDL_GetYUVConversionModeForResolution(width,height)(sysv,r12base) +SDL_IsTablet()(sysv,r12base)(sysv,r12base) +SDL_CreateThreadWithStackSize(fn,name,stacksize,data)(sysv,r12base) +SDL_GetTouchDeviceType(touchID)(sysv,r12base) +SDL_GetDisplayOrientation(displayIndex)(sysv,r12base) + diff --git a/sdk/ppcinline/sdl2.h b/sdk/ppcinline/sdl2.h new file mode 100644 index 0000000000..c34e4413b8 --- /dev/null +++ b/sdk/ppcinline/sdl2.h @@ -0,0 +1,5307 @@ +/* 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_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;\ + va_list __t__p2 = __p2;\ + 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, __t__p2));\ + }) + +#define SDL_vsnprintf(__p0, __p1, __p2, __p3) \ + ({ \ + char * __t__p0 = __p0;\ + size_t __t__p1 = __p1;\ + const char * __t__p2 = __p2;\ + va_list __t__p3 = __p3;\ + 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, __t__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_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;\ + va_list __t__p3 = __p3;\ + 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, __t__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(__p0) \ + ({ \ + voiud __t__p0 = __p0;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(voiud ) SDL_bool SDL_GetRelativeMouseMode(void))*(void**)(__base - 2626))(__t__p0));\ + }) + +#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_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_NewAudioStream(__p0, __p1, __p2, __p3, __p4, __p5) \ + ({ \ + const SDL_AudioFormat __t__p0 = __p0;\ + const Uint8 __t__p1 = __p1;\ + const int __t__p2 = __p2;\ + const SDL_AudioFormat __t__p3 = __p3;\ + const Uint8 __t__p4 = __p4;\ + const int __t__p5 = __p5;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_AudioStream *(*)(const SDL_AudioFormat , const Uint8 , const int , const SDL_AudioFormat , const Uint8 , const int ))*(void**)(__base - 3166))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + }) + +#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_HasAVX512F() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 3208))());\ + }) + +#define SDL_HasARMSIMD() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void))*(void**)(__base - 3214))());\ + }) + +#define SDL_SIMDGetAlignment() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((size_t (*)(void))*(void**)(__base - 3220))());\ + }) + +#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 - 3226))(__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 - 3232))(__t__p0));\ + }) + +#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 - 3238))(__t__p0));\ + }) + +#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 - 3244))(__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 - 3250))(__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 - 3256))(__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 - 3262))(__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 - 3268))(__t__p0, __t__p1));\ + }) + +#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 - 3274))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#define SDL_LockJoysticks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3280))());\ + }) + +#define SDL_UnlockJoysticks() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((void (*)(void))*(void**)(__base - 3286))());\ + }) + +#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 - 3292))(__t__p0));\ + }) + +#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 - 3298))(__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 - 3304))(__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");\ + (((void (*)(SDL_Joystick *, int ))*(void**)(__base - 3310))(__t__p0, __t__p1));\ + }) + +#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 - 3316))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#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 - 3322))(__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 - 3328))(__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 - 3334))(__t__p0, __t__p1, __t__p2));\ + }) + +#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 - 3340))(__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 - 3346))(__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 - 3352))(__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 - 3358))(__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 - 3364))(__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 - 3370))(__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 - 3376))(__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 - 3382))(__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 - 3388))(__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 - 3394))(__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 - 3400))(__t__p0));\ + }) + +#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 - 3406))(__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 - 3412))(__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 - 3418))(__t__p0, __t__p1));\ + }) + +#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 - 3424))(__t__p0));\ + }) + +#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 - 3430))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#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 - 3436))(__t__p0, __t__p1, __t__p2, __t__p3));\ + }) + +#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 - 3442))(__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 - 3448))(__t__p0, __t__p1, __t__p2));\ + }) + +#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 - 3454))(__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 - 3460))(__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 - 3466))(__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 - 3472))());\ + }) + +#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 - 3478))(__t__p0, __t__p1, __t__p2));\ + }) + +#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 - 3484))(__t__p0));\ + }) + +#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 - 3490))(__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 - 3496))(__t__p0, __t__p1, __t__p2));\ + }) + +#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 - 3502))(__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 - 3508))(__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 - 3514))(__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 - 3520))(__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 - 3526))(__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 - 3532))(__t__p0, __t__p1));\ + }) + +#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 - 3538))(__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 - 3544))(__t__p0));\ + }) + +#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 - 3550))(__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 - 3556))(__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 - 3562))(__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 - 3568))(__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 - 3574))(__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 - 3580))(__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 - 3586))(__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 - 3592))(__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 - 3598))(__t__p0, __t__p1));\ + }) + +#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 - 3604))(__t__p0));\ + }) + +#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 - 3610))(__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 - 3616))());\ + }) + +#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 - 3622))(__t__p0, __t__p1));\ + }) + +#define SDL_IsTablet() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_bool (*)(void) SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data))*(void**)(__base - 3628))());\ + }) + +#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 - 3640))(__t__p0));\ + }) + +#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 - 3646))(__t__p0));\ + }) + +#endif /* !_PPCINLINE_SDL2_H */ diff --git a/sdk/proto/sdl2.h b/sdk/proto/sdl2.h new file mode 100644 index 0000000000..3299580da2 --- /dev/null +++ b/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 */ + From 57436af7701fa5a8f1fa3e449dc08b15623f19a2 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:48:05 +0100 Subject: [PATCH 050/214] MOS: upload to make SDL2.library --- Makefile.mos | 160 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 102 insertions(+), 58 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 5ba80de895..89f1cc8c0a 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -1,74 +1,118 @@ -# Makefile to build the MorphOS SDL library +# Makefile to build the SDL 2 library +# +# Enable debug with -D__SDL_DEBUG -AR = ppc-morphos-ar -RANLIB = ppc-morphos-ranlib -CC = ppc-morphos-gcc-9 -CXX = ppc-morphos-g++-9 -STRIP = ppc-morphos-strip +CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG +CC = ppc-morphos-gcc-9 -noixemul +INCLUDE = -I./include +CFLAGS = -maltivec -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) +AR = ar +RANLIB = ranlib -AMIGADATE = $(shell date +"%-d.%-m.%Y") +ECHE = echo -e +BOLD = \033[1m +NRML = \033[22m -CFLAGS = -O2 -Wall -noixemul -Wno-pointer-sign -D__SDL_DEBUG -DAROS_ALMOST_COMPATIBLE -DNDEBUG -maltivec -DNO_AMIGADEBUG -mcpu=750 -mtune=7450 -I./include -D__AMIGADATE__=\"$(AMIGADATE)\" +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_STATIC = libSDL2.a -TESTLIB_STATIC = libSDL2_test.a +TARGET = libSDL.a +LIBRARY = sdl2.library SOURCES = \ - ./src/*.c \ - ./src/atomic/*.c \ - ./src/audio/*.c \ - ./src/audio/morphos/*.c \ - ./src/audio/disk/*.c \ - ./src/audio/dummy/*.c \ - ./src/core/morphos/*.c \ - ./src/cpuinfo/*.c \ - ./src/events/*.c \ - ./src/file/*.c \ - ./src/filesystem/morphos/*.c \ - ./src/haptic/*.c \ - ./src/haptic/dummy/*.c \ - ./src/joystick/*.c \ - ./src/joystick/morphos/*.c \ - ./src/loadso/dlopen/*.c \ - ./src/render/*.c \ - ./src/power/*.c \ - ./src/power/morphos/*.c \ - ./src/render/software/*.c \ - ./src/sensor/*.c \ - ./src/sensor/dummy/*.c \ - ./src/stdlib/*.c \ - ./src/thread/*.c \ - ./src/thread/morphos/*.c\ - ./src/timer/*.c \ - ./src/timer/morphos/*.c \ - ./src/video/*.c \ - ./src/video/morphos/*.c \ - ./src/video/yuv2rgb/*.c \ - -TESTLIB_SOURCES =./src/test/*.c + 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/morphos/*.c \ + src/loadso/dlopen/*.c \ + src/power/*.c \ + src/power/morphos/*.c \ + src/render/*.c \ + src/render/software/*.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 \ + +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') -TESTLIB_OBJECTS = $(shell echo $(TESTLIB_SOURCES) | sed -e 's,\.c,\.o,g') -all: $(TARGET_STATIC) $(TESTLIB_STATIC) +all: $(LIBRARY) headers lib -$(TESTLIB_STATIC): $(TESTLIB_OBJECTS) - $(AR) crv $@ $^ - $(RANLIB) $@ +sdk: all + mkdir -p /usr/local/bin + mkdir -p /usr/local/include/SDL2 + mkdir -p /usr/local/ppc-morphos/lib + mkdir -p /usr/local/ppc-morphos/lib/libb32 + cp sdl2-config /usr/local/bin + cp include/*.h /usr/local/include/SDL2 + cp src/core/morphos/devenv/lib/libSDL.a /usr/local/lib/libSDL2.a + cp src/core/morphos/devenv/lib/libb32/libSDL.a /usr/local/lib/libb32/libSDL2.a + +headers: + $(HEADERING) + @cvinclude.pl --fd=sdk/fd/sdl2_lib.fd --clib=sdk/clib/sdl2_protos.h --proto=sdk/proto/sdl2.h + @cvinclude.pl --fd=sdk/fd/sdl2_lib.fd --clib=sdk/clib/sdl2_protos.h --inline=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) -$(TARGET_STATIC): $(OBJECTS) - $(AR) crv $@ $^ +install-iso: + @echo "not for the ISO.. skipping" + +#install-iso: $(LIBRARY) lib +# mkdir -p $(ISOPATH)MorphOS/Libs/ +# @cp sdl2.library $(ISOPATH)MorphOS/Libs/ + +#src/video/SDL_blit_N.o: src/video/SDL_blit_N.c +# ppc-morphos-gcc-4 $(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 + ppc-morphos-gcc-9 $(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) + @ppc-morphos-gcc-9 -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + +$(TARGET): $(OBJECTS) + $(ARCHIVING) + @$(AR) crv $@ $^ $(RANLIB) $@ -config_copy: - cp include/SDL_config_morphos.h include/SDL_config.h +$(LIBRARY): $(TARGET) $(COREOBJECTS) + $(LINKING) + @$(CC) -nostartfiles -mresident32 -Wl,-Map=sdl2.map $(COREOBJECTS) -o $@.db -L. -lSDL -lm + $(STRIPPING) + @ppc-morphos-strip -o $@ --remove-section=.comment $@.db clean: - rm -f $(TARGET_STATIC) $(TESTLIB_STATIC) $(OBJECTS) + rm -f $(LIBRARY) $(TARGET) $(OBJECTS) $(COREOBJECTS) *.db *.s + @cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi; -install: - mkdir -p /usr/local/lib - mkdir -p /usr/local/include/SDL2 - cp -f $(TARGET_STATIC) /usr/local/lib - cp -f $(TESTLIB_STATIC) /usr/local/lib - cp -f include/*.h /usr/local/include/SDL2/ +dump: + objdump --disassemble-all --reloc $(LIBRARY).db >$(LIBRARY).s From f7e6b9d47b29df1aee8224788454dbbf87a6b99c Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:50:26 +0100 Subject: [PATCH 051/214] Update TODO.MORPHOS --- TODO.MORPHOS | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index 90bbe9a5d4..beefab187c 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -1,23 +1,18 @@ TODO -1) static library : -- Initialise all libraries (same as AmigaOS4) - - timer (GlobalTimeReq) - - thread (threadpool) - - etc.. -or -2) shared library : -- Import Itix 's work +1) Merge with last SDL 2 + - Done + - Need more and more tests -3) fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) +2) fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) - Detection = ok (begin fix 02/03/2020) - Crash when open it :-( -4) check keyboard (all keys a-z doesnt work on SDL2 itix) - - begin fix but need optimization. (03/03/2020) +3) check keyboard (all keys a-z doesnt work on SDL2 itix) + - begin fix but need code improvement and optimization. (03/03/2020) -5) check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) +4) check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) BeWorld From a235e87cd8aa52222f9ea8ffd0acbf64f998a171 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:53:20 +0100 Subject: [PATCH 052/214] MOS : reoragnize SDL_config_morphos.h Need optimizations --- include/SDL_config_morphos.h | 246 ++++++++++++++--------------------- 1 file changed, 100 insertions(+), 146 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 9d8f6152f7..64459e48ba 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2019 Sam Lantinga + 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 @@ -19,199 +19,153 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef SDL_config_morphos_h_ -#define SDL_config_morphos_h_ -#define SDL_config_h_ +#ifndef _SDL_config_morphos_h +#define _SDL_config_morphos_h -/* This is a set of defines to configure the SDL features */ - -/* General platform specific identifiers */ #include "SDL_platform.h" -/* C datatypes */ -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 +/** + * \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 -#define HAVE_GCC_ATOMICS 1 -/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +#define SIZEOF_VOIDP sizeof(IPTR) /* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_ICONV_H 1 +#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_LIMITS_H 1 -#define HAVE_MALLOC_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 #define HAVE_MATH_H 1 -/* #undef HAVE_MEMORY_H */ -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_WCHAR_H 1 -/* #undef HAVE_PTHREAD_NP_H */ -/* #undef HAVE_LIBUNWIND_H */ /* C library functions */ #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 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_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -/* #undef HAVE_MEMCMP */ -#define HAVE_WCSLEN 1 -/* #undef HAVE_WCSLCPY */ -/* #undef HAVE_WCSLCAT */ -#define HAVE_WCSCMP 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -/* #undef HAVE__STRREV */ -/* #undef HAVE__STRUPR */ -/* #undef HAVE__STRLWR */ -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 +#define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -/* #undef HAVE_ITOA */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__UITOA */ -/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -/* #undef HAVE__I64TOA */ -/* #undef HAVE__UI64TOA */ -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -/* #undef HAVE_STRTOD */ -#define HAVE_ATOI 1 -#define HAVE_ATOF 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 -/* #undef HAVE__STRICMP */ +#define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 -/* #undef HAVE__STRNICMP */ #define HAVE_STRNCASECMP 1 -/* #undef HAVE_SSCANF */ #define HAVE_VSSCANF 1 -/* #undef HAVE_SNPRINTF */ -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI /**/ -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 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_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 1 -#define HAVE_COS 1 -#define HAVE_COSF 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_EXP 1 #define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 #define HAVE_FMOD 1 #define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 #define HAVE_LOG10 1 #define HAVE_LOG10F 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_FOPEN64 1 -#define HAVE_FSEEKO 1 -#define HAVE_FSEEKO64 1 -/* #undef HAVE_SIGACTION */ -/* #undef HAVE_SA_SIGACTION */ -#define HAVE_SETJMP 1 -/* #undef HAVE_NANOSLEEP */ -/* #undef HAVE_SYSCONF */ -/* #undef HAVE_SYSCTLBYNAME */ -/* #undef HAVE_CLOCK_GETTIME */ -/* #undef HAVE_GETPAGESIZE */ -/* #undef HAVE_MPROTECT */ -#define HAVE_ICONV 1 -/* #undef HAVE_PTHREAD_SETNAME_NP */ -/* #undef HAVE_PTHREAD_SET_NAME_NP */ -/* #undef HAVE_SEM_TIMEDWAIT */ -/* #undef HAVE_GETAUXVAL */ -/* #undef HAVE_POLL */ +#define SDL_DYNAMIC_API 1 #define HAVE_ALTIVEC_H 1 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_MORPHOS 1 -#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_AHI 1 +#define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 -/* Enable various input drivers */ -#define SDL_JOYSTICK_AMIGAINPUT 1 -#define SDL_JOYSTICK_MORPHOS 1 -#define SDL_HAPTIC_DUMMY 1 +/* Enable haptic drivers */ +#define SDL_HAPTIC_DUMMY 1 - -/* Enable various sensor drivers */ -/* #undef SDL_SENSOR_ANDROID */ -// #undef SDL_SENSOR_DUMMY 1 +/* Enable input drivers */ +#define SDL_JOYSTICK_AMIGA 1 +#define SDL_JOYSTICK_MORPHOS 1 /* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 - -/* Enable various threading systems */ -#define SDL_THREAD_MORPHOS 1 +#define SDL_LOADSO_DLOPEN 1 -/* Enable various timer systems */ -#define SDL_TIMER_MORPHOS 1 +/* Enable thread support */ +#define SDL_THREAD_MORPHOS 1 -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_AMIGA 1 +/* Enable timer support */ +#define SDL_TIMERS_AMIGA 1 -/* Enable OpenGL support */ -#define SDL_VIDEO_OPENGL 1 +/* Enable video driver */ +#define SDL_VIDEO_DRIVER_AMIGA 1 -/* Enable Vulkan support */ -/* #undef SDL_VIDEO_VULKAN */ +/* Enable filesystem driver */ +#define SDL_FILESYSTEM_AMIGA 1 /* Enable system power support */ -#define SDL_POWERMORPHOS 1 - -/* Enable system filesystem support */ -#define SDL_FILESYSTEM_AMIGA 1 +#define SDL_POWER_MORPHOS 1 /* Enable assembly routines */ -//#define SDL_ASSEMBLY_ROUTINES 1 -#define SDL_ALTIVEC_BLITTERS 1 +#define SDL_ALTIVEC_BLITTERS 1 + +#define SDL_VIDEO_RENDER_SW 1 + +/* Need or not... */ +#define SDL_HAVE_YUV 1 + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif #if defined(__MORPHOS__) #if defined(__SDL_DEBUG) @@ -225,4 +179,4 @@ #define D(fmt, ...) #endif -#endif /* SDL_config_MORPHOS_h_ */ +#endif /* _SDL_config_amiga_h */ From cfb5708ff8013099bcf9ab61a8ac73dafb7f718f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:57:03 +0100 Subject: [PATCH 053/214] MOS : update SDL_rwops.h --- include/SDL_rwops.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 538c308412..2536a0c648 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -45,7 +45,7 @@ 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 6 /* Amiga file */ +#define SDL_RWOPS_AMIGAFILE 6U /**< Amiga file */ /** * This is the read/write operation structure -- very basic. @@ -92,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__) @@ -158,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 From c1522b9660517c2e7fa86db86aedcdd9473d6f18 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:58:49 +0100 Subject: [PATCH 054/214] MOS : update for morphos_exit --- src/SDL.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SDL.c b/src/SDL.c index 3f8ab38dd9..daf2845d5b 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -77,6 +77,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 From 4631f7c0debcb749dfbb12072eadf4137e41751a Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:07:24 +0100 Subject: [PATCH 055/214] MOS : update --- src/SDL_error.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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) From c18f4a0ed30bf245f5a09bef3dd4150dcc9de2c4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:08:41 +0100 Subject: [PATCH 056/214] MOS : add AHIAUD_bootstrap --- src/audio/SDL_audio.c | 3 +++ src/audio/SDL_sysaudio.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 534656d8ac..77bb5d1d89 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -112,6 +112,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 3d60d90a04..cb7b75fcde 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; #endif /* SDL_sysaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ From 74570bc964492620794282ddc5e29d2fbb1430d0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:11:21 +0100 Subject: [PATCH 057/214] MOS : add AHI support --- src/audio/ahi/SDL_ahi_audio.c | 312 ++++++++++++++++++++++++++++++++++ src/audio/ahi/SDL_ahi_audio.h | 57 +++++++ 2 files changed, 369 insertions(+) create mode 100644 src/audio/ahi/SDL_ahi_audio.c create mode 100644 src/audio/ahi/SDL_ahi_audio.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..61359da2e0 --- /dev/null +++ b/src/audio/ahi/SDL_ahi_audio.c @@ -0,0 +1,312 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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; + + printf("[%s] PlayDevice... !\n", __FUNCTION__); + + 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_Std.io_Command = CMD_WRITE; + 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); + + switch (hidden->convert) + { + case AMIAUD_CONVERT_NONE : + //printf("[%s] AMIAUD_CONVERT_NONE... !\n", __FUNCTION__); + break; + case AMIAUD_CONVERT_8: { + + ULONG *buf4 = hidden->buffers[current]; + do { + *buf4++ ^= 0x80808080; + *buf4++ ^= 0x80808080; + this->spec.size -= 8; + } + while (this->spec.size >=8); + break; + } + case AMIAUD_CONVERT_16: + { + WORD *buf = hidden->buffers[current]; + + do + { + buf[0] = buf[0] - 32768; + buf[1] = buf[1] - 32768; + buf[2] = buf[2] - 32768; + buf[3] = buf[3] - 32768; + buf += 4; + this->spec.size -= 8; + } + while (this->spec.size > 8); + } + break; + + case AMIAUD_CONVERT_U16LSB: + { + UWORD *buf = hidden->buffers[current]; + do + { + UWORD sample = *buf; + *buf++ = ((sample >> 8) | (sample << 8)) - 32768; + *buf++ = ((sample >> 8) | (sample << 8)) - 32768; + *buf++ = ((sample >> 8) | (sample << 8)) - 32768; + *buf++ = ((sample >> 8) | (sample << 8)) - 32768; + this->spec.size -= 8; + } + while (this->spec.size > 8); + } + 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); + hidden->current_buffer = current2; + hidden->playing = 1; + +} + +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, 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."); + + test_format = SDL_FirstAudioFormat(this->spec.format); + + while (sample_format < 0 && test_format) + { + convert = AMIAUD_CONVERT_NONE; + switch (test_format) + { + case AUDIO_U8 : + convert = AMIAUD_CONVERT_8; + case AUDIO_S8 : + + sample_format = this->spec.channels == 1 ? AHIST_M8S : AHIST_S8S; break; + + break; + #if BYTEORDER == LITTLE_ENDIAN + #error Not implemented + #else + case AUDIO_S16LSB: + convert = AMIAUD_CONVERT_SWAP16; + case AUDIO_U16LSB: + convert = AMIAUD_CONVERT_U16LSB; + case AUDIO_U16MSB: + convert = AMIAUD_CONVERT_16;; + 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; + #endif + + default: + printf("[%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 - and samples are %ld\n", __FUNCTION__, sample_format,this->spec.samples); + + 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 + 0x7) & ~0x7; + } + + /* 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..2670391add --- /dev/null +++ b/src/audio/ahi/SDL_ahi_audio.h @@ -0,0 +1,57 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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_8, + AMIAUD_CONVERT_SWAP16, + AMIAUD_CONVERT_U16LSB, + AMIAUD_CONVERT_16, + 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 */ From 12d0816ef47f44a8d07e706fe77316c5887b6cb8 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:18:07 +0100 Subject: [PATCH 058/214] MorphOS : add of all Itix SDL2 files Add all files to make sdl2.library, libSDL.a and SDK stuff I update all need to last SDL 2.0.11 --- src/core/morphos/SDL_amigaversion.h | 6 + src/core/morphos/SDL_amigaversion.rev | 1 + src/core/morphos/SDL_cpu.c | 263 ++++++++++ src/core/morphos/SDL_cpu.h | 34 ++ src/core/morphos/SDL_functions.h | 621 ++++++++++++++++++++++ src/core/morphos/SDL_library.c | 513 ++++++++++++++++++ src/core/morphos/SDL_library.h | 102 ++++ src/core/morphos/SDL_misc.c | 104 ++++ src/core/morphos/SDL_misc.h | 34 ++ src/core/morphos/SDL_startup.c | 128 +++++ src/core/morphos/SDL_startup.h | 28 + src/core/morphos/SDL_stubs.c | 49 ++ src/core/morphos/SDL_stubs.h | 728 ++++++++++++++++++++++++++ src/core/morphos/devenv/Makefile | 68 +++ src/core/morphos/devenv/sdl-startup.c | 244 +++++++++ src/core/morphos/devenv/sdl-stubs.c | 125 +++++ 16 files changed, 3048 insertions(+) create mode 100644 src/core/morphos/SDL_amigaversion.h create mode 100644 src/core/morphos/SDL_amigaversion.rev create mode 100644 src/core/morphos/SDL_cpu.c create mode 100644 src/core/morphos/SDL_cpu.h create mode 100644 src/core/morphos/SDL_functions.h create mode 100644 src/core/morphos/SDL_library.c create mode 100644 src/core/morphos/SDL_library.h create mode 100644 src/core/morphos/SDL_misc.c create mode 100644 src/core/morphos/SDL_misc.h create mode 100644 src/core/morphos/SDL_startup.c create mode 100644 src/core/morphos/SDL_startup.h create mode 100644 src/core/morphos/SDL_stubs.c create mode 100644 src/core/morphos/SDL_stubs.h create mode 100644 src/core/morphos/devenv/Makefile create mode 100644 src/core/morphos/devenv/sdl-startup.c create mode 100644 src/core/morphos/devenv/sdl-stubs.c diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h new file mode 100644 index 0000000000..68a46f18ec --- /dev/null +++ b/src/core/morphos/SDL_amigaversion.h @@ -0,0 +1,6 @@ +#define VERSION 53 +#define REVISION 0 +#define DATE "02.03.2020" +#define VERS "sdl2.library 53.0" +#define VSTRING "sdl2.library 53.0 (04.03.2020) © Ilkka Lehtoranta, Bruno Peloille\r\n" +#define VERSTAG "\0$VER: sdl2.library 53.0 (04.03.2020) © Ilkka Lehtoranta, Bruno Peloille" diff --git a/src/core/morphos/SDL_amigaversion.rev b/src/core/morphos/SDL_amigaversion.rev new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/src/core/morphos/SDL_amigaversion.rev @@ -0,0 +1 @@ +1 diff --git a/src/core/morphos/SDL_cpu.c b/src/core/morphos/SDL_cpu.c new file mode 100644 index 0000000000..7900602d48 --- /dev/null +++ b/src/core/morphos/SDL_cpu.c @@ -0,0 +1,263 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..780086d4f9 --- /dev/null +++ b/src/core/morphos/SDL_cpu.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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_functions.h b/src/core/morphos/SDL_functions.h new file mode 100644 index 0000000000..6d7d7d7795 --- /dev/null +++ b/src/core/morphos/SDL_functions.h @@ -0,0 +1,621 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 to generate shared library calls. + * + */ + +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_sscanf(const char *text, const char *fmt, ...); +int SDL_vsscanf(const char *text, const char *fmt, va_list ap); +int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); +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_assert_state SDL_ReportAssertion(SDL_assert_data *, 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_assert_data * 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, +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); +int SDL_SetError(const char *fmt, ...); +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_Log(const char *fmt, ...); +void SDL_LogVerbose(int category, const char *fmt, ...); +void SDL_LogDebug(int category, const char *fmt, ...); +void SDL_LogInfo(int category, const char *fmt, ...); +void SDL_LogWarn(int category, const char *fmt, ...); +void SDL_LogError(int category, const char *fmt, ...); +void SDL_LogCritical(int category, const char *fmt, ...); +void SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...); +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); +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); +SDL_GLContext SDL_GL_CreateContext(SDL_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.6 to 2.0.11 */ +SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, 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); +SDL_bool SDL_HasAVX512F(void); +SDL_bool SDL_HasARMSIMD(void); +size_t SDL_SIMDGetAlignment(void); +void * SDL_SIMDAlloc(const size_t len); +void SDL_SIMDFree(void *ptr); +SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); +char *SDL_GameControllerMappingForDeviceIndex(int joystick_index); +SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); +SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller); +int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); +void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); +int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +void SDL_LockJoysticks(void); +void SDL_UnlockJoysticks(void); +int SDL_JoystickGetDevicePlayerIndex(int device_index); +SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index); +int SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); +void SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); +int SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + +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); +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); +void *SDL_RenderGetMetalLayer(SDL_Renderer * renderer); +void *SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); + +void *SDL_LoadFile(const char *file, size_t *datasize); +int SDL_RWclose(SDL_RWops *context); +size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num); +size_t SDL_RWread(SDL_RWops *context,void *ptr, size_t size, size_t maxnum); +Sint64 SDL_RWtell(SDL_RWops *context); +Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence); +Sint64 SDL_RWsize(SDL_RWops *context); + +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); +char *SDL_strtokr(char *s1, const char *s2, char **saveptr); +wchar_t *SDL_wcsdup(const wchar_t *wstr); +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); + +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); +double SDL_exp(double x); +float SDL_expf(float x); +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); + +SDL_bool SDL_HasColorKey(SDL_Surface * surface); +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); +SDL_bool SDL_IsTablet(void) +SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); +SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); +SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex); \ No newline at end of file diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c new file mode 100644 index 0000000000..8463353c95 --- /dev/null +++ b/src/core/morphos/SDL_library.c @@ -0,0 +1,513 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 "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 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); + + 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; +} + +/********************************************************************** + 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)) + { + 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..f30fd392d0 --- /dev/null +++ b/src/core/morphos/SDL_library.h @@ -0,0 +1,102 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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 + +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..efcb0a5336 --- /dev/null +++ b/src/core/morphos/SDL_misc.c @@ -0,0 +1,104 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..f20a37a5b7 --- /dev/null +++ b/src/core/morphos/SDL_misc.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..5941ad1cbb --- /dev/null +++ b/src/core/morphos/SDL_startup.c @@ -0,0 +1,128 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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" + +/*********************************************************************/ + +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; + + 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..50f3154943 --- /dev/null +++ b/src/core/morphos/SDL_startup.h @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..5a7ac720e1 --- /dev/null +++ b/src/core/morphos/SDL_stubs.c @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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..612a3adcd2 --- /dev/null +++ b/src/core/morphos/SDL_stubs.h @@ -0,0 +1,728 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 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) + +// Version 2.0.4 + 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) + +// Version 2.0.4 + 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) + /* 2.0.11*/ + STUB(SDL_NewAudioStream) + STUB(SDL_AudioStreamPut) + STUB(SDL_AudioStreamGet) + STUB(SDL_AudioStreamAvailable) + STUB(SDL_AudioStreamFlush) + STUB(SDL_AudioStreamClear) + STUB(SDL_FreeAudioStream) + STUB(SDL_HasAVX512F) + STUB(SDL_HasARMSIMD) + STUB(SDL_SIMDGetAlignment) + STUB(SDL_SIMDAlloc) + STUB(SDL_SIMDFree) + STUB(SDL_GameControllerTypeForIndex) + STUB(SDL_GameControllerMappingForDeviceIndex) + STUB(SDL_GameControllerFromPlayerIndex) + STUB(SDL_GameControllerGetType) + STUB(SDL_GameControllerGetPlayerIndex) + STUB(SDL_GameControllerSetPlayerIndex) + STUB(SDL_GameControllerRumble) + STUB(SDL_LockJoysticks) + STUB(SDL_UnlockJoysticks) + STUB(SDL_JoystickGetDevicePlayerIndex) + STUB(SDL_JoystickFromPlayerIndex) + STUB(SDL_JoystickGetPlayerIndex) + STUB(SDL_JoystickSetPlayerIndex) + STUB(SDL_JoystickRumble) + STUB(SDL_SetTextureScaleMode) + STUB(SDL_GetTextureScaleMode) + STUB(SDL_LockTextureToSurface) + 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_RenderGetMetalLayer) + STUB(SDL_RenderGetMetalCommandEncoder) + STUB(SDL_LoadFile) + STUB(SDL_RWclose) + STUB(SDL_RWwrite) + STUB(SDL_RWread) + STUB(SDL_RWtell) + STUB(SDL_RWseek) + STUB(SDL_RWsize) + STUB(SDL_GetMemoryFunctions) + STUB(SDL_SetMemoryFunctions) + STUB(SDL_GetNumAllocations) + STUB(SDL_strtokr) + STUB(SDL_wcsdup) + STUB(SDL_wcsstr) + STUB(SDL_wcsncmp) + STUB(SDL_acosf) + STUB(SDL_asinf) + STUB(SDL_atanf) + STUB(SDL_atan2f) + STUB(SDL_ceilf) + STUB(SDL_copysignf) + STUB(SDL_exp) + STUB(SDL_expf) + 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_HasColorKey) + STUB(SDL_SetYUVConversionMode) + STUB(SDL_GetYUVConversionMode) + STUB(SDL_GetYUVConversionModeForResolution) + STUB(SDL_IsTablet) + STUB(SDL_CreateThreadWithStackSize) + STUB(SDL_GetTouchDeviceType) + STUB(SDL_GetDisplayOrientation) + +#if 0 + 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) +#endif + +#if 0 + /* 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) +#endif + + + diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile new file mode 100644 index 0000000000..b56f7b25f0 --- /dev/null +++ b/src/core/morphos/devenv/Makefile @@ -0,0 +1,68 @@ +# Makefile to build the SDL 2 + +CC = ppc-morphos-gcc-9 -noixemul +INCLUDE = -I../../../../include -I../../../../sdk +CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE +AR = ar +RANLIB = ranlib + +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/libSDL.a lib/libb32/libSDL.a lib/libb32/libSDL-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-startup-brel.o: sdl-startup.c sdl-stubs.c + $(COMPILING) + @$(CC) $(CFLAGS) -mresident32 -o $@ -c sdl-startup.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 + +lib/libSDL.a: sdl-startup.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) cru $@ sdl-startup.o + @ppc-morphos-ranlib $@ + +lib/libb32/libSDL.a: sdl-startup-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) cru $@ sdl-startup-brel.o + @ppc-morphos-ranlib $@ + +lib/libb32/libSDL-nc.a: sdl-startup-brel-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) cru $@ sdl-startup-brel-nc.o + @ppc-morphos-ranlib $@ + +install-iso: + @echo "Nothing to install-iso here." + +clean: + @-rm -rf lib *.s *.o + +dump: + objdump --disassemble-all --reloc lib/libSDL.a >lib/libSDL.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..1793a68390 --- /dev/null +++ b/src/core/morphos/devenv/sdl-startup.c @@ -0,0 +1,244 @@ +/* + * 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 +void _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; + 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 + +void _getenv(void) __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; +} + +/* 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); +} diff --git a/src/core/morphos/devenv/sdl-stubs.c b/src/core/morphos/devenv/sdl-stubs.c new file mode 100644 index 0000000000..26ad6d3b9d --- /dev/null +++ b/src/core/morphos/devenv/sdl-stubs.c @@ -0,0 +1,125 @@ +#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); +} +*/ \ No newline at end of file From 266db0f869b29857f076c632f5fb0fc933d66725 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:21:16 +0100 Subject: [PATCH 059/214] MOS : code cleanup --- src/cpuinfo/SDL_cpuinfo.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 3efa63d2d2..351124ffa4 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -347,16 +347,12 @@ CPU_haveAltiVec(void) altivec = (vec_unit == VECTORTYPE_ALTIVEC); } #elif defined(__MORPHOS__) - //if (SysBase->LibNode.lib_Version >=51) { ULONG has_altivec; - if (NewGetSystemAttrs(&has_altivec, sizeof(has_altivec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE)) - { - if(has_altivec) - { - altivec = 1; - } - } - //} + 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); @@ -607,9 +603,9 @@ SDL_GetCPUCount(void) &SDL_CPUCount, sizeof(SDL_CPUCount) ); } #endif -#endif #ifdef __MORPHOS__ - NewGetSystemAttrs(&SDL_CPUCount, sizeof(SDL_CPUCount), SYSTEMINFOTYPE_CPUCOUNT, TAG_DONE); + NewGetSystemAttrs(&SDL_CPUCount, sizeof(SDL_CPUCount), SYSTEMINFOTYPE_CPUCOUNT, TAG_DONE); +#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { From 06a8d41dc0ad1c077e57620e78d9c212dae352e1 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:22:42 +0100 Subject: [PATCH 060/214] MOS : add SDL_SystemRAM --- src/cpuinfo/SDL_cpuinfo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 351124ffa4..41d4a8be27 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -971,6 +971,9 @@ SDL_GetSystemRAM(void) } } #endif +#ifdef AMIGA + SDL_SystemRAM = AvailMem(MEMF_FAST | MEMF_TOTAL); // Exclude possible chip ram. +#endif #endif } return SDL_SystemRAM; From 282f38a41589cf419a9f6b307b4f40089f8e0af0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:25:03 +0100 Subject: [PATCH 061/214] MorphOS : update --- src/file/SDL_rwops.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index c4f5eb7c32..a83769dc6b 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -38,11 +38,6 @@ #define off64_t _off64_t #endif -#if defined(AMIGA) -#include "../core/morphos/SDL_misc.h" -#include -#endif - #ifdef HAVE_STDIO_H #include #endif @@ -71,6 +66,30 @@ #include "nacl_io/nacl_io.h" #endif +#if defined(AMIGA) +#include "../core/morphos/SDL_library.h" +#include "../core/morphos/SDL_misc.h" +#include + +#if defined(__MORPHOS__) +#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 +#endif + #ifdef __WIN32__ /* Functions to read/write Win32 API file pointers */ @@ -854,7 +873,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) { @@ -947,6 +966,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; From 1db87c9346158711e02ca81df4f0816affad9a50 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:26:13 +0100 Subject: [PATCH 062/214] MorphOS / AmigaOS : add filesystem --- src/filesystem/{morphos => amiga}/SDL_sysfilesystem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename src/filesystem/{morphos => amiga}/SDL_sysfilesystem.c (94%) diff --git a/src/filesystem/morphos/SDL_sysfilesystem.c b/src/filesystem/amiga/SDL_sysfilesystem.c similarity index 94% rename from src/filesystem/morphos/SDL_sysfilesystem.c rename to src/filesystem/amiga/SDL_sysfilesystem.c index 9b4f63d3c1..cc2270ce73 100644 --- a/src/filesystem/morphos/SDL_sysfilesystem.c +++ b/src/filesystem/amiga/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2014 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 @@ -20,13 +20,14 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_FILESYSTEM_MORPHOS +#ifdef SDL_FILESYSTEM_AMIGA /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include "SDL_error.h" #include "SDL_filesystem.h" + #include "../../core/morphos/SDL_misc.h" #include @@ -38,7 +39,7 @@ SDL_GetBasePath(void) BPTR lock = Lock("PROGDIR:", ACCESS_READ); char *path = NULL; - //D("[%s]\n", __FUNCTION__); + D("[%s]\n", __FUNCTION__); if (lock) { @@ -135,6 +136,6 @@ SDL_GetPrefPath(const char *org, const char *app) return path; } -#endif /* SDL_FILESYSTEM_AMIGAOS4 */ +#endif /* SDL_FILESYSTEM_AMIGA */ /* vi: set ts=4 sw=4 expandtab: */ From e4f03893d1e5bc75764aa261fcc4a41454e8f7cb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:44:07 +0100 Subject: [PATCH 063/214] MorphOS : add SDL_GetPowerInfo_MorphOS --- src/power/SDL_power.c | 5 ++++- src/power/SDL_syspower.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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 *);*/ From fa1cefe1c4fa94f07f667a50d476b7ba2661bc33 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:46:39 +0100 Subject: [PATCH 064/214] MorphOS : add systimer.c --- src/timer/{morphos => amiga}/SDL_systimer.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/timer/{morphos => amiga}/SDL_systimer.c (100%) diff --git a/src/timer/morphos/SDL_systimer.c b/src/timer/amiga/SDL_systimer.c similarity index 100% rename from src/timer/morphos/SDL_systimer.c rename to src/timer/amiga/SDL_systimer.c From 6b036c3278e3f977ab622b3163994415d0f24582 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:49:01 +0100 Subject: [PATCH 065/214] MorphOS : change directory to amiga --- src/video/SDL_video.c | 2 +- src/video/{morphos => amiga}/SDL_amigaclipboard.c | 0 src/video/{morphos => amiga}/SDL_amigaclipboard.h | 0 src/video/{morphos => amiga}/SDL_amigaevents.c | 0 src/video/{morphos => amiga}/SDL_amigaevents.h | 0 src/video/{morphos => amiga}/SDL_amigaframebuffer.c | 0 src/video/{morphos => amiga}/SDL_amigaframebuffer.h | 0 src/video/{morphos => amiga}/SDL_amigakeyboard.c | 0 src/video/{morphos => amiga}/SDL_amigakeyboard.h | 0 src/video/{morphos => amiga}/SDL_amigamessagebox.c | 0 src/video/{morphos => amiga}/SDL_amigamessagebox.h | 0 src/video/{morphos => amiga}/SDL_amigamodes.c | 0 src/video/{morphos => amiga}/SDL_amigamodes.h | 0 src/video/{morphos => amiga}/SDL_amigamouse.c | 0 src/video/{morphos => amiga}/SDL_amigamouse.h | 0 src/video/{morphos => amiga}/SDL_amigashape.c | 0 src/video/{morphos => amiga}/SDL_amigashape.h | 0 src/video/{morphos => amiga}/SDL_amigavideo.c | 0 src/video/{morphos => amiga}/SDL_amigavideo.h | 0 src/video/{morphos => amiga}/SDL_amigawindow.c | 0 src/video/{morphos => amiga}/SDL_amigawindow.h | 0 21 files changed, 1 insertion(+), 1 deletion(-) rename src/video/{morphos => amiga}/SDL_amigaclipboard.c (100%) rename src/video/{morphos => amiga}/SDL_amigaclipboard.h (100%) rename src/video/{morphos => amiga}/SDL_amigaevents.c (100%) rename src/video/{morphos => amiga}/SDL_amigaevents.h (100%) rename src/video/{morphos => amiga}/SDL_amigaframebuffer.c (100%) rename src/video/{morphos => amiga}/SDL_amigaframebuffer.h (100%) rename src/video/{morphos => amiga}/SDL_amigakeyboard.c (100%) rename src/video/{morphos => amiga}/SDL_amigakeyboard.h (100%) rename src/video/{morphos => amiga}/SDL_amigamessagebox.c (100%) rename src/video/{morphos => amiga}/SDL_amigamessagebox.h (100%) rename src/video/{morphos => amiga}/SDL_amigamodes.c (100%) rename src/video/{morphos => amiga}/SDL_amigamodes.h (100%) rename src/video/{morphos => amiga}/SDL_amigamouse.c (100%) rename src/video/{morphos => amiga}/SDL_amigamouse.h (100%) rename src/video/{morphos => amiga}/SDL_amigashape.c (100%) rename src/video/{morphos => amiga}/SDL_amigashape.h (100%) rename src/video/{morphos => amiga}/SDL_amigavideo.c (100%) rename src/video/{morphos => amiga}/SDL_amigavideo.h (100%) rename src/video/{morphos => amiga}/SDL_amigawindow.c (100%) rename src/video/{morphos => amiga}/SDL_amigawindow.h (100%) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 621b30eea5..e407444962 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3970,7 +3970,7 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "amigaos4/SDL_os4messagebox.h" #endif #if SDL_VIDEO_DRIVER_AMIGA -#include "morphos/SDL_amigamessagebox.h" +#include "amiga/SDL_amigamessagebox.h" #endif #if SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" diff --git a/src/video/morphos/SDL_amigaclipboard.c b/src/video/amiga/SDL_amigaclipboard.c similarity index 100% rename from src/video/morphos/SDL_amigaclipboard.c rename to src/video/amiga/SDL_amigaclipboard.c diff --git a/src/video/morphos/SDL_amigaclipboard.h b/src/video/amiga/SDL_amigaclipboard.h similarity index 100% rename from src/video/morphos/SDL_amigaclipboard.h rename to src/video/amiga/SDL_amigaclipboard.h diff --git a/src/video/morphos/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c similarity index 100% rename from src/video/morphos/SDL_amigaevents.c rename to src/video/amiga/SDL_amigaevents.c diff --git a/src/video/morphos/SDL_amigaevents.h b/src/video/amiga/SDL_amigaevents.h similarity index 100% rename from src/video/morphos/SDL_amigaevents.h rename to src/video/amiga/SDL_amigaevents.h diff --git a/src/video/morphos/SDL_amigaframebuffer.c b/src/video/amiga/SDL_amigaframebuffer.c similarity index 100% rename from src/video/morphos/SDL_amigaframebuffer.c rename to src/video/amiga/SDL_amigaframebuffer.c diff --git a/src/video/morphos/SDL_amigaframebuffer.h b/src/video/amiga/SDL_amigaframebuffer.h similarity index 100% rename from src/video/morphos/SDL_amigaframebuffer.h rename to src/video/amiga/SDL_amigaframebuffer.h diff --git a/src/video/morphos/SDL_amigakeyboard.c b/src/video/amiga/SDL_amigakeyboard.c similarity index 100% rename from src/video/morphos/SDL_amigakeyboard.c rename to src/video/amiga/SDL_amigakeyboard.c diff --git a/src/video/morphos/SDL_amigakeyboard.h b/src/video/amiga/SDL_amigakeyboard.h similarity index 100% rename from src/video/morphos/SDL_amigakeyboard.h rename to src/video/amiga/SDL_amigakeyboard.h diff --git a/src/video/morphos/SDL_amigamessagebox.c b/src/video/amiga/SDL_amigamessagebox.c similarity index 100% rename from src/video/morphos/SDL_amigamessagebox.c rename to src/video/amiga/SDL_amigamessagebox.c diff --git a/src/video/morphos/SDL_amigamessagebox.h b/src/video/amiga/SDL_amigamessagebox.h similarity index 100% rename from src/video/morphos/SDL_amigamessagebox.h rename to src/video/amiga/SDL_amigamessagebox.h diff --git a/src/video/morphos/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c similarity index 100% rename from src/video/morphos/SDL_amigamodes.c rename to src/video/amiga/SDL_amigamodes.c diff --git a/src/video/morphos/SDL_amigamodes.h b/src/video/amiga/SDL_amigamodes.h similarity index 100% rename from src/video/morphos/SDL_amigamodes.h rename to src/video/amiga/SDL_amigamodes.h diff --git a/src/video/morphos/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c similarity index 100% rename from src/video/morphos/SDL_amigamouse.c rename to src/video/amiga/SDL_amigamouse.c diff --git a/src/video/morphos/SDL_amigamouse.h b/src/video/amiga/SDL_amigamouse.h similarity index 100% rename from src/video/morphos/SDL_amigamouse.h rename to src/video/amiga/SDL_amigamouse.h diff --git a/src/video/morphos/SDL_amigashape.c b/src/video/amiga/SDL_amigashape.c similarity index 100% rename from src/video/morphos/SDL_amigashape.c rename to src/video/amiga/SDL_amigashape.c diff --git a/src/video/morphos/SDL_amigashape.h b/src/video/amiga/SDL_amigashape.h similarity index 100% rename from src/video/morphos/SDL_amigashape.h rename to src/video/amiga/SDL_amigashape.h diff --git a/src/video/morphos/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c similarity index 100% rename from src/video/morphos/SDL_amigavideo.c rename to src/video/amiga/SDL_amigavideo.c diff --git a/src/video/morphos/SDL_amigavideo.h b/src/video/amiga/SDL_amigavideo.h similarity index 100% rename from src/video/morphos/SDL_amigavideo.h rename to src/video/amiga/SDL_amigavideo.h diff --git a/src/video/morphos/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c similarity index 100% rename from src/video/morphos/SDL_amigawindow.c rename to src/video/amiga/SDL_amigawindow.c diff --git a/src/video/morphos/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h similarity index 100% rename from src/video/morphos/SDL_amigawindow.h rename to src/video/amiga/SDL_amigawindow.h From 5e2055ef078a4763d638d33f52c2f4d580d23119 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:58:11 +0100 Subject: [PATCH 066/214] Update --- src/video/amiga/SDL_amigaevents.c | 57 ++++++++----------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index a6e38fb21e..8338eab67f 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -177,10 +177,9 @@ AMIGA_TranslateUnicode(UWORD code, UWORD qualifier) static void AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) { - //SDL_Scancode sc; - //UWORD code = m->Code; SDL_Scancode s; - UWORD rawkey = m->Code & 0x0F; + UWORD code = m->Code; + UWORD rawkey = m->Code & 0x7F; switch (code) { @@ -209,47 +208,19 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) break; default: - /*sc = AMIGA_ScanCodeToSDL(code & ~(IECODE_UP_PREFIX)); - - if (sc != SDL_SCANCODE_UNKNOWN) - { - SDL_SendKeyboardKey(code & IECODE_UP_PREFIX ? SDL_RELEASED : SDL_PRESSED, sc); - } - else - {*/ - /*WCHAR keycode; - TEXT buffer[8]; - ULONG length; - - GetAttr(IMSGA_UCS4, m, (ULONG *)&keycode); - length = UTF8_Encode(keycode, buffer); - - D("[AMIGA_DispatchRawKey] Converted %ld (UCS-4: %ld) to UTF-8...\n", code, keycode); - - if (length > 0) - { - buffer[length] = '\0'; - SDL_SendKeyboardText(buffer); - }*/ - - if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0]) { - - s = amiga_scancode_table[rawkey]; - - if (imsg->Code <= 127) { - - char text[2]; - - text[0] = AMIGA_TranslateUnicode(_this, imsg->Code, imsg->Qualifier); - text[1] = '\0'; - - SDL_SendKeyboardKey(SDL_PRESSED, s); - SDL_SendKeyboardText(text); - } else { - SDL_SendKeyboardKey(SDL_RELEASED, s); - } + if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0])) { + s = amiga_scancode_table[rawkey]; + if (m->Code <= 127) { + char text[2]; + text[0] = AMIGA_TranslateUnicode(m->Code, m->Qualifier); + text[1] = '\0'; + + SDL_SendKeyboardKey(SDL_PRESSED, s); + SDL_SendKeyboardText(text); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, s); } - //} + } break; } } From c7e3a1b4455465a64a894c5995b37890c7f72a77 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 17:00:02 +0100 Subject: [PATCH 067/214] Update SDL_amigakeyboard.c --- src/video/amiga/SDL_amigakeyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigakeyboard.c b/src/video/amiga/SDL_amigakeyboard.c index 6f10b54552..a8beed019f 100644 --- a/src/video/amiga/SDL_amigakeyboard.c +++ b/src/video/amiga/SDL_amigakeyboard.c @@ -46,7 +46,7 @@ static SDL_Keycode AMIGA_MapRawKey(UWORD code) } } -static void AMIGA_UpdateKeymap() +static void AMIGA_UpdateKeymap(_THIS) { int i; SDL_Scancode scancode; @@ -78,7 +78,7 @@ static void AMIGA_UpdateKeymap() void AMIGA_InitKeyboard(_THIS) { - AMIGA_UpdateKeymap(); + AMIGA_UpdateKeymap(_THIS); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command"); From c3732038178145b46f414732443e444a135cdeb3 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 21:08:21 +0100 Subject: [PATCH 068/214] Update sdl-stubs.c Need to rework --- src/core/morphos/devenv/sdl-stubs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/morphos/devenv/sdl-stubs.c b/src/core/morphos/devenv/sdl-stubs.c index 26ad6d3b9d..5ed30aa3b3 100644 --- a/src/core/morphos/devenv/sdl-stubs.c +++ b/src/core/morphos/devenv/sdl-stubs.c @@ -3,7 +3,7 @@ #include /* SDL_string.c */ -/* + int SDL_sscanf(const char *text, const char *fmt, ...) { @@ -13,9 +13,9 @@ SDL_sscanf(const char *text, const char *fmt, ...) rc = SDL_vsscanf(text, fmt, ap); va_end(ap); return rc; -}*/ +} -/*int +int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) { va_list ap; @@ -26,7 +26,7 @@ SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) va_end(ap); return retval; -}*/ +} /* SDL_error.c */ @@ -42,7 +42,7 @@ SDL_SetError(const char *fmt, ...) } /* SDL_log.c */ -/* + void SDL_Log(const char *fmt, ...) { @@ -122,4 +122,3 @@ SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...) SDL_LogMessageV(category, priority, fmt, ap); va_end(ap); } -*/ \ No newline at end of file From ca5d52792db46a87a127eb44cca81a0f91871053 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 5 Mar 2020 21:12:15 +0100 Subject: [PATCH 069/214] Update TODO.MORPHOS --- TODO.MORPHOS | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index beefab187c..f844d1bb1d 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -1,18 +1,24 @@ TODO -1) Merge with last SDL 2 - - Done - - Need more and more tests +1) Compile SDL library + - Make -f makefile.mos + + Not working, lot of errors here with stubs (in devenv) + Need Fix to continue.... + +2) Test, test and fix :-) - -2) fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) +Bugs in SDL2.0.3 Itix : +- fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) - Detection = ok (begin fix 02/03/2020) - Crash when open it :-( -3) check keyboard (all keys a-z doesnt work on SDL2 itix) - - begin fix but need code improvement and optimization. (03/03/2020) +- check keyboard (all keys a-z doesnt work on SDL2 itix) + - FIX now but need code improvement and optimization. (05/03/2020) + + - check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) -4) check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) + - Test / test.... BeWorld From ad395cdc56d66dbdfe2b07e79a446860fa1ee745 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 6 Mar 2020 18:46:22 +0100 Subject: [PATCH 070/214] Update Makefile.mos --- test/Makefile.mos | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Makefile.mos b/test/Makefile.mos index cbf590bda4..da3d5acdf4 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -1,8 +1,8 @@ -# Makefile to build the AmigaOS4 SDL tests +# Makefile to build the MorphOS SDL tests -CC = ppc-morphos-gcc -CFLAGS = -noixemul -O2 -Wall -g -I../include -DHAVE_OPENGL -LIBS = -L../ -lSDL2 -lSDL2_test -noixemul -lm +CC = ppc-morphos-gcc-9 +CFLAGS = -noixemul -O2 -Wall -g -I../include +LIBS = -L../src/core/morphos/devenv/lib/ -lSDL -noixemul -lm TARGETS = \ checkkeys \ From b127bbd579598e498a681585a2e36200ef3fd3ad Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 6 Mar 2020 23:16:11 +0100 Subject: [PATCH 071/214] MOS: fix AHIAUD_OpenDevice --- src/audio/ahi/SDL_ahi_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/ahi/SDL_ahi_audio.c b/src/audio/ahi/SDL_ahi_audio.c index 61359da2e0..9feb61ae7b 100644 --- a/src/audio/ahi/SDL_ahi_audio.c +++ b/src/audio/ahi/SDL_ahi_audio.c @@ -182,7 +182,7 @@ AHIAUD_ThreadInit(_THIS) } static int -AHIAUD_OpenDevice(_THIS, const char *devname, int iscapture) +AHIAUD_OpenDevice(_THIS, void * handle, const char *devname, int iscapture) { struct SDL_PrivateAudioData *hidden; SDL_AudioFormat test_format; From 86b146209df683d9b8d5c4e86d93e3c26832fbf4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 7 Mar 2020 13:07:24 +0100 Subject: [PATCH 072/214] Update Makefile.mos --- Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.mos b/Makefile.mos index 89f1cc8c0a..d138f6834a 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -58,7 +58,7 @@ COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') -all: $(LIBRARY) headers lib +all: $(LIBRARY) lib sdk: all mkdir -p /usr/local/bin From 5284d5cf03f9cf102af63de3cbe35d224d954728 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:43:58 +0100 Subject: [PATCH 073/214] Update morphos config --- include/SDL_config_morphos.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 64459e48ba..90ce2326c7 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -113,16 +113,28 @@ #define HAVE_ICONV 1 #define HAVE_STDIO_H 1 #define HAVE_LIMITS_H 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 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 SDL_DYNAMIC_API 1 #define HAVE_ALTIVEC_H 1 +#define SDL_ENABLE_ALTIVEC_H 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_AHI 1 From b10512e262348e6f6a366ce3b4840e5668a7034d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:44:39 +0100 Subject: [PATCH 074/214] Update begin_code.h --- include/begin_code.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/begin_code.h b/include/begin_code.h index 77084bdeeb..170d69ec55 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -68,7 +68,7 @@ # define DECLSPEC # endif # else -# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MORPHOS__) +# if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # else # define DECLSPEC From 7f7da34e711823bb28f2efa4e34d7d5d57efa142 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:45:41 +0100 Subject: [PATCH 075/214] bak to GCC 4 --- Makefile.mos | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index d138f6834a..42770278ea 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -3,9 +3,9 @@ # Enable debug with -D__SDL_DEBUG CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG -CC = ppc-morphos-gcc-9 -noixemul +CC = ppc-morphos-gcc-4 -noixemul INCLUDE = -I./include -CFLAGS = -maltivec -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) +CFLAGS = -cstd=c99 -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) AR = ar RANLIB = ranlib @@ -89,15 +89,15 @@ install-iso: # mkdir -p $(ISOPATH)MorphOS/Libs/ # @cp sdl2.library $(ISOPATH)MorphOS/Libs/ -#src/video/SDL_blit_N.o: src/video/SDL_blit_N.c -# ppc-morphos-gcc-4 $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c +src/video/SDL_blit_N.o: src/video/SDL_blit_N.c + ppc-morphos-gcc-4 $(CFLAGS) -fvec -faltivec -o $@ -c src/video/SDL_blit_N.c src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.c - ppc-morphos-gcc-9 $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c $^ + ppc-morphos-gcc-4 $(CFLAGS) -fvec -faltivec -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) - @ppc-morphos-gcc-9 -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + @ppc-morphos-gcc-4 -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c $(TARGET): $(OBJECTS) $(ARCHIVING) From fa03c40ed0aae99e465adc7373f8b053d1fdc862 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:46:49 +0100 Subject: [PATCH 076/214] MOS : update SDK files --- sdk/clib/sdl2_protos.h | 123 +++++---- sdk/fd/sdl2_lib.fd | 103 ++++--- sdk/ppcinline/sdl2.h | 589 +++++++++++++++++++++-------------------- 3 files changed, 414 insertions(+), 401 deletions(-) diff --git a/sdk/clib/sdl2_protos.h b/sdk/clib/sdl2_protos.h index 633958e178..14b95fd723 100644 --- a/sdk/clib/sdl2_protos.h +++ b/sdk/clib/sdl2_protos.h @@ -573,7 +573,7 @@ int SDL_GL_GetSwapInterval(void); void SDL_GL_SwapWindow(SDL_Window * window); void SDL_GL_DeleteContext(SDL_GLContext context); -/* 2.0.3 to 2.0.4 */ +/* 2.0.4 */ float SDL_sqrtf(float x); double SDL_tan(double x); float SDL_tanf(float x); @@ -592,7 +592,7 @@ int SDL_WarpMouseGlobal(int x, int y); int SDL_CaptureMouse(SDL_bool enabled); Uint32 SDL_GetGlobalMouseState(int *x, int *y); -/* 2.04 to 2.06 */ +/* 2.06 */ void SDL_MemoryBarrierReleaseFunction(void); void SDL_MemoryBarrierAcquireFunction(void); Uint32 SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); @@ -635,37 +635,62 @@ 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.6 to 2.0.11 */ -SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate); +/* 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); -SDL_bool SDL_HasARMSIMD(void); -size_t SDL_SIMDGetAlignment(void); -void * SDL_SIMDAlloc(const size_t len); -void SDL_SIMDFree(void *ptr); -SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); char *SDL_GameControllerMappingForDeviceIndex(int joystick_index); -SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); -SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller); int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); -void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); -void SDL_LockJoysticks(void); -void SDL_UnlockJoysticks(void); int SDL_JoystickGetDevicePlayerIndex(int device_index); -SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index); int SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); -void SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); 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); -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); +/* 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); @@ -677,51 +702,33 @@ int SDL_RenderFillRectsF(SDL_Renderer * renderer, const SDL_FRect * rects, int c 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); -void *SDL_RenderGetMetalLayer(SDL_Renderer * renderer); -void *SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); - -void *SDL_LoadFile(const char *file, size_t *datasize); -int SDL_RWclose(SDL_RWops *context); -size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num); -size_t SDL_RWread(SDL_RWops *context,void *ptr, size_t size, size_t maxnum); -Sint64 SDL_RWtell(SDL_RWops *context); +Sint64 SDL_RWsize(SDL_RWops *context); Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence); -Sint64 SDL_RWsize(SDL_RWops *context); +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); -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); -char *SDL_strtokr(char *s1, const char *s2, char **saveptr); -wchar_t *SDL_wcsdup(const wchar_t *wstr); +/* 2.0.11 */ +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); + + -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); -double SDL_exp(double x); -float SDL_expf(float x); -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); -SDL_bool SDL_HasColorKey(SDL_Surface * surface); -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); -SDL_bool SDL_IsTablet(void) -SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); -SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); -SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex); #endif diff --git a/sdk/fd/sdl2_lib.fd b/sdk/fd/sdl2_lib.fd index 2bdfd2dcf8..ede4c39e9e 100644 --- a/sdk/fd/sdl2_lib.fd +++ b/sdk/fd/sdl2_lib.fd @@ -526,70 +526,26 @@ 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,src_rate,dst_format,dst_channels,dst_rate)(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_HasAVX512F()(sysv,r12base) -SDL_HasARMSIMD()(sysv,r12base) -SDL_SIMDGetAlignment()(sysv,r12base) -SDL_SIMDAlloc(len)(sysv,r12base) -SDL_SIMDFree(ptr)(sysv,r12base) -SDL_GameControllerTypeForIndex(joystick_index)(sysv,r12base) -SDL_GameControllerMappingForDeviceIndex(joystick_index)(sysv,r12base) -SDL_GameControllerFromPlayerIndex(player_index)(sysv,r12base) -SDL_GameControllerGetType(gamecontroller)(sysv,r12base) -SDL_GameControllerGetPlayerIndex(gamecontroller)(sysv,r12base) -SDL_GameControllerSetPlayerIndex(gamecontroller,player_index)(sysv,r12base) -SDL_GameControllerRumble(gamecontroller,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) SDL_LockJoysticks()(sysv,r12base) SDL_UnlockJoysticks()(sysv,r12base) -SDL_JoystickGetDevicePlayerIndex(device_index)(sysv,r12base) -SDL_JoystickFromPlayerIndex(player_index)(sysv,r12base) -SDL_JoystickGetPlayerIndex(joystick)(sysv,r12base) -SDL_JoystickSetPlayerIndex(joystick,player_index)(sysv,r12base) -SDL_JoystickRumble(joystick,low_frequency_rumble,high_frequency_rumble,duration_ms)(sysv,r12base) -SDL_SetTextureScaleMode(texture,scaleMode)(sysv,r12base) -SDL_GetTextureScaleMode(texture,scaleMode)(sysv,r12base) -SDL_LockTextureToSurface(texture,rect,surface)(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_RenderGetMetalLayer(renderer)(sysv,r12base) -SDL_RenderGetMetalCommandEncoder(renderer)(sysv,r12base) -SDL_LoadFile(file,datasize)(sysv,r12base) -SDL_RWclose(context)(sysv,r12base) -SDL_RWwrite(context,ptr,size,num)(sysv,r12base) -SDL_RWread(context,ptr,size,maxnum)(sysv,r12base) -SDL_RWtell(context)(sysv,r12base) -SDL_RWseek(context,offset,whence)(sysv,r12base) -SDL_RWsize(context)(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_strtokr(s1,s2,saveptr)(sysv,r12base) -SDL_wcsdup(wstr)(sysv,r12base) -SDL_wcsstr(haystack,needle)(sysv,r12base) -SDL_wcsncmp(str1,str2,maxlen)(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_exp(x)(sysv,r12base) -SDL_expf(x)(sysv,r12base) SDL_fabsf(x)(sysv,r12base) SDL_floorf(x)(sysv,r12base) SDL_fmod(x,y)(sysv,r12base) @@ -599,12 +555,55 @@ SDL_log10(x)(sysv,r12base) SDL_log10f(x)(sysv,r12base) SDL_powf(x,y)(sysv,r12base) SDL_scalbnf(x,n)(sysv,r12base) -SDL_HasColorKey(surface)(sysv,r12base) SDL_SetYUVConversionMode(mode)(sysv,r12base) SDL_GetYUVConversionMode()(sysv,r12base) SDL_GetYUVConversionModeForResolution(width,height)(sysv,r12base) -SDL_IsTablet()(sysv,r12base)(sysv,r12base) -SDL_CreateThreadWithStackSize(fn,name,stacksize,data)(sysv,r12base) -SDL_GetTouchDeviceType(touchID)(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) \ No newline at end of file diff --git a/sdk/ppcinline/sdl2.h b/sdk/ppcinline/sdl2.h index c34e4413b8..b114c8a8ed 100644 --- a/sdk/ppcinline/sdl2.h +++ b/sdk/ppcinline/sdl2.h @@ -501,10 +501,9 @@ ({ \ const char * __t__p0 = __p0;\ const char * __t__p1 = __p1;\ - va_list __t__p2 = __p2;\ 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, __t__p2));\ + (((int (*)(const char *, const char *, va_list ))*(void**)(__base - 358))(__t__p0, __t__p1, __p2));\ }) #define SDL_vsnprintf(__p0, __p1, __p2, __p3) \ @@ -512,10 +511,9 @@ char * __t__p0 = __p0;\ size_t __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3 = __p3;\ 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, __t__p3));\ + (((int (*)(char *, size_t , const char *, va_list ))*(void**)(__base - 364))(__t__p0, __t__p1, __t__p2, __p3));\ }) #define SDL_acos(__p0) \ @@ -1804,10 +1802,9 @@ int __t__p0 = __p0;\ SDL_LogPriority __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3 = __p3;\ 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, __t__p3));\ + (((void (*)(int , SDL_LogPriority , const char *, va_list ))*(void**)(__base - 1294))(__t__p0, __t__p1, __t__p2, __p3));\ }) #define SDL_LogGetOutputFunction(__p0, __p1) \ @@ -4599,17 +4596,30 @@ (((SDL_bool (*)(SDL_Renderer *))*(void**)(__base - 3160))(__t__p0));\ }) -#define SDL_NewAudioStream(__p0, __p1, __p2, __p3, __p4, __p5) \ +#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 int __t__p2 = __p2;\ - const SDL_AudioFormat __t__p3 = __p3;\ - const Uint8 __t__p4 = __p4;\ - const int __t__p5 = __p5;\ + 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 int , const SDL_AudioFormat , const Uint8 , const int ))*(void**)(__base - 3166))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5));\ + (((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) \ @@ -4664,644 +4674,641 @@ (((void (*)(SDL_AudioStream *))*(void**)(__base - 3202))(__t__p0));\ }) -#define SDL_HasAVX512F() \ +#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");\ - (((SDL_bool (*)(void))*(void**)(__base - 3208))());\ + (((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_HasARMSIMD() \ +#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");\ - (((SDL_bool (*)(void))*(void**)(__base - 3214))());\ + (((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_SIMDGetAlignment() \ +#define SDL_GetNumAllocations() \ ({ \ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((size_t (*)(void))*(void**)(__base - 3220))());\ + (((int (*)(void))*(void**)(__base - 3232))());\ }) -#define SDL_SIMDAlloc(__p0) \ +#define SDL_RenderGetMetalLayer(__p0) \ ({ \ - const size_t __t__p0 = __p0;\ + SDL_Renderer * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void *(*)(const size_t ))*(void**)(__base - 3226))(__t__p0));\ + (((void *(*)(SDL_Renderer *))*(void**)(__base - 3238))(__t__p0));\ }) -#define SDL_SIMDFree(__p0) \ +#define SDL_RenderGetMetalCommandEncoder(__p0) \ ({ \ - void * __t__p0 = __p0;\ + SDL_Renderer * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void (*)(void *))*(void**)(__base - 3232))(__t__p0));\ + (((void *(*)(SDL_Renderer *))*(void**)(__base - 3244))(__t__p0));\ }) -#define SDL_GameControllerTypeForIndex(__p0) \ +#define SDL_acosf(__p0) \ ({ \ - int __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_GameControllerType (*)(int ))*(void**)(__base - 3238))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3250))(__t__p0));\ }) -#define SDL_GameControllerMappingForDeviceIndex(__p0) \ +#define SDL_asinf(__p0) \ ({ \ - int __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((char *(*)(int ))*(void**)(__base - 3244))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3256))(__t__p0));\ }) -#define SDL_GameControllerFromPlayerIndex(__p0) \ +#define SDL_atanf(__p0) \ ({ \ - int __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_GameController *(*)(int ))*(void**)(__base - 3250))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3262))(__t__p0));\ }) -#define SDL_GameControllerGetType(__p0) \ +#define SDL_atan2f(__p0, __p1) \ ({ \ - SDL_GameController * __t__p0 = __p0;\ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_GameControllerType (*)(SDL_GameController *))*(void**)(__base - 3256))(__t__p0));\ + (((float (*)(float , float ))*(void**)(__base - 3268))(__t__p0, __t__p1));\ }) -#define SDL_GameControllerGetPlayerIndex(__p0) \ +#define SDL_ceilf(__p0) \ ({ \ - SDL_GameController * __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_GameController *))*(void**)(__base - 3262))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3274))(__t__p0));\ }) -#define SDL_GameControllerSetPlayerIndex(__p0, __p1) \ +#define SDL_copysignf(__p0, __p1) \ ({ \ - SDL_GameController * __t__p0 = __p0;\ - int __t__p1 = __p1;\ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void (*)(SDL_GameController *, int ))*(void**)(__base - 3268))(__t__p0, __t__p1));\ + (((float (*)(float , float ))*(void**)(__base - 3280))(__t__p0, __t__p1));\ }) -#define SDL_GameControllerRumble(__p0, __p1, __p2, __p3) \ +#define SDL_fabsf(__p0) \ ({ \ - SDL_GameController * __t__p0 = __p0;\ - Uint16 __t__p1 = __p1;\ - Uint16 __t__p2 = __p2;\ - Uint32 __t__p3 = __p3;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_GameController *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3274))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((float (*)(float ))*(void**)(__base - 3286))(__t__p0));\ }) -#define SDL_LockJoysticks() \ +#define SDL_floorf(__p0) \ ({ \ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void (*)(void))*(void**)(__base - 3280))());\ + (((float (*)(float ))*(void**)(__base - 3292))(__t__p0));\ }) -#define SDL_UnlockJoysticks() \ +#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");\ - (((void (*)(void))*(void**)(__base - 3286))());\ + (((double (*)(double , double ))*(void**)(__base - 3298))(__t__p0, __t__p1));\ }) -#define SDL_JoystickGetDevicePlayerIndex(__p0) \ +#define SDL_fmodf(__p0, __p1) \ ({ \ - int __t__p0 = __p0;\ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(int ))*(void**)(__base - 3292))(__t__p0));\ + (((float (*)(float , float ))*(void**)(__base - 3304))(__t__p0, __t__p1));\ }) -#define SDL_JoystickFromPlayerIndex(__p0) \ +#define SDL_logf(__p0) \ ({ \ - int __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_Joystick *(*)(int ))*(void**)(__base - 3298))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3310))(__t__p0));\ }) -#define SDL_JoystickGetPlayerIndex(__p0) \ +#define SDL_log10(__p0) \ ({ \ - SDL_Joystick * __t__p0 = __p0;\ + double __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Joystick *))*(void**)(__base - 3304))(__t__p0));\ + (((double (*)(double ))*(void**)(__base - 3316))(__t__p0));\ }) -#define SDL_JoystickSetPlayerIndex(__p0, __p1) \ +#define SDL_log10f(__p0) \ ({ \ - SDL_Joystick * __t__p0 = __p0;\ - int __t__p1 = __p1;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void (*)(SDL_Joystick *, int ))*(void**)(__base - 3310))(__t__p0, __t__p1));\ + (((float (*)(float ))*(void**)(__base - 3322))(__t__p0));\ }) -#define SDL_JoystickRumble(__p0, __p1, __p2, __p3) \ +#define SDL_powf(__p0, __p1) \ ({ \ - SDL_Joystick * __t__p0 = __p0;\ - Uint16 __t__p1 = __p1;\ - Uint16 __t__p2 = __p2;\ - Uint32 __t__p3 = __p3;\ + float __t__p0 = __p0;\ + float __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Joystick *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3316))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((float (*)(float , float ))*(void**)(__base - 3328))(__t__p0, __t__p1));\ }) -#define SDL_SetTextureScaleMode(__p0, __p1) \ +#define SDL_scalbnf(__p0, __p1) \ ({ \ - SDL_Texture * __t__p0 = __p0;\ - SDL_ScaleMode __t__p1 = __p1;\ + float __t__p0 = __p0;\ + int __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Texture *, SDL_ScaleMode ))*(void**)(__base - 3322))(__t__p0, __t__p1));\ + (((float (*)(float , int ))*(void**)(__base - 3334))(__t__p0, __t__p1));\ }) -#define SDL_GetTextureScaleMode(__p0, __p1) \ +#define SDL_SetYUVConversionMode(__p0) \ ({ \ - SDL_Texture * __t__p0 = __p0;\ - SDL_ScaleMode * __t__p1 = __p1;\ + SDL_YUV_CONVERSION_MODE __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Texture *, SDL_ScaleMode *))*(void**)(__base - 3328))(__t__p0, __t__p1));\ + (((void (*)(SDL_YUV_CONVERSION_MODE ))*(void**)(__base - 3340))(__t__p0));\ }) -#define SDL_LockTextureToSurface(__p0, __p1, __p2) \ +#define SDL_GetYUVConversionMode() \ ({ \ - 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 - 3334))(__t__p0, __t__p1, __t__p2));\ + (((SDL_YUV_CONVERSION_MODE (*)(void))*(void**)(__base - 3346))());\ }) -#define SDL_RenderDrawPointF(__p0, __p1, __p2) \ +#define SDL_GetYUVConversionModeForResolution(__p0, __p1) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - float __t__p1 = __p1;\ - float __t__p2 = __p2;\ + int __t__p0 = __p0;\ + int __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *, float , float ))*(void**)(__base - 3340))(__t__p0, __t__p1, __t__p2));\ + (((SDL_YUV_CONVERSION_MODE (*)(int , int ))*(void**)(__base - 3352))(__t__p0, __t__p1));\ }) -#define SDL_RenderDrawPointsF(__p0, __p1, __p2) \ +#define SDL_HasAVX512F() \ ({ \ - 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 - 3346))(__t__p0, __t__p1, __t__p2));\ + (((SDL_bool (*)(void))*(void**)(__base - 3358))());\ }) -#define SDL_RenderDrawLineF(__p0, __p1, __p2, __p3, __p4) \ +#define SDL_GameControllerMappingForDeviceIndex(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - float __t__p1 = __p1;\ - float __t__p2 = __p2;\ - float __t__p3 = __p3;\ - float __t__p4 = __p4;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *, float , float , float , float ))*(void**)(__base - 3352))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ + (((char *(*)(int ))*(void**)(__base - 3364))(__t__p0));\ }) -#define SDL_RenderDrawLinesF(__p0, __p1, __p2) \ +#define SDL_GameControllerGetPlayerIndex(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - const SDL_FPoint * __t__p1 = __p1;\ - int __t__p2 = __p2;\ + SDL_GameController * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *, const SDL_FPoint *, int ))*(void**)(__base - 3358))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_GameController *))*(void**)(__base - 3370))(__t__p0));\ }) -#define SDL_RenderDrawRectF(__p0, __p1) \ +#define SDL_GameControllerRumble(__p0, __p1, __p2, __p3) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - const SDL_FRect * __t__p1 = __p1;\ + 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_Renderer *, const SDL_FRect *))*(void**)(__base - 3364))(__t__p0, __t__p1));\ + (((int (*)(SDL_GameController *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3376))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_RenderDrawRectsF(__p0, __p1, __p2) \ +#define SDL_JoystickGetDevicePlayerIndex(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - const SDL_FRect * __t__p1 = __p1;\ - int __t__p2 = __p2;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3370))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(int ))*(void**)(__base - 3382))(__t__p0));\ }) -#define SDL_RenderFillRectF(__p0, __p1) \ +#define SDL_JoystickGetPlayerIndex(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - const SDL_FRect * __t__p1 = __p1;\ + SDL_Joystick * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *, const SDL_FRect *))*(void**)(__base - 3376))(__t__p0, __t__p1));\ + (((int (*)(SDL_Joystick *))*(void**)(__base - 3388))(__t__p0));\ }) -#define SDL_RenderFillRectsF(__p0, __p1, __p2) \ +#define SDL_JoystickRumble(__p0, __p1, __p2, __p3) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - const SDL_FRect * __t__p1 = __p1;\ - int __t__p2 = __p2;\ + 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_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3382))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_Joystick *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 3394))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_RenderCopyF(__p0, __p1, __p2, __p3) \ +#define SDL_wcsdup(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ - SDL_Texture * __t__p1 = __p1;\ - const SDL_Rect * __t__p2 = __p2;\ - const SDL_FRect * __t__p3 = __p3;\ + const wchar_t * __t__p0 = __p0;\ 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 - 3388))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((wchar_t *(*)(const wchar_t *))*(void**)(__base - 3400))(__t__p0));\ }) -#define SDL_RenderCopyExF(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ +#define SDL_exp(__p0) \ ({ \ - 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;\ + double __t__p0 = __p0;\ 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 - 3394))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + (((double (*)(double ))*(void**)(__base - 3406))(__t__p0));\ }) -#define SDL_RenderFlush(__p0) \ +#define SDL_expf(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ + float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_Renderer *))*(void**)(__base - 3400))(__t__p0));\ + (((float (*)(float ))*(void**)(__base - 3412))(__t__p0));\ }) -#define SDL_RenderGetMetalLayer(__p0) \ +#define SDL_HasColorKey(__p0) \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ + SDL_Surface * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void *(*)(SDL_Renderer *))*(void**)(__base - 3406))(__t__p0));\ + (((SDL_bool (*)(SDL_Surface *))*(void**)(__base - 3418))(__t__p0));\ }) -#define SDL_RenderGetMetalCommandEncoder(__p0) \ +#define SDL_IsTablet() \ ({ \ - SDL_Renderer * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void *(*)(SDL_Renderer *))*(void**)(__base - 3412))(__t__p0));\ + (((SDL_bool (*)(void))*(void**)(__base - 3424))());\ }) -#define SDL_LoadFile(__p0, __p1) \ +#define SDL_CreateThreadWithStackSize(__p0, __p1, __p2, __p3) \ ({ \ - const char * __t__p0 = __p0;\ - size_t * __t__p1 = __p1;\ + 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");\ - (((void *(*)(const char *, size_t *))*(void**)(__base - 3418))(__t__p0, __t__p1));\ + (((SDL_Thread *(*)(SDL_ThreadFunction , const char *, const size_t , void *))*(void**)(__base - 3430))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_RWclose(__p0) \ +#define SDL_GetDisplayOrientation(__p0) \ ({ \ - SDL_RWops * __t__p0 = __p0;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_RWops *))*(void**)(__base - 3424))(__t__p0));\ + (((SDL_DisplayOrientation (*)(int ))*(void**)(__base - 3436))(__t__p0));\ }) -#define SDL_RWwrite(__p0, __p1, __p2, __p3) \ +#define SDL_SIMDGetAlignment() \ ({ \ - 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 - 3430))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((size_t (*)(void))*(void**)(__base - 3442))());\ }) -#define SDL_RWread(__p0, __p1, __p2, __p3) \ +#define SDL_SIMDAlloc(__p0) \ ({ \ - SDL_RWops * __t__p0 = __p0;\ - void * __t__p1 = __p1;\ - size_t __t__p2 = __p2;\ - size_t __t__p3 = __p3;\ + const size_t __t__p0 = __p0;\ 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 - 3436))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((void *(*)(const size_t ))*(void**)(__base - 3448))(__t__p0));\ }) -#define SDL_RWtell(__p0) \ +#define SDL_SIMDFree(__p0) \ ({ \ - SDL_RWops * __t__p0 = __p0;\ + void * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3442))(__t__p0));\ + (((void (*)(void *))*(void**)(__base - 3454))(__t__p0));\ }) -#define SDL_RWseek(__p0, __p1, __p2) \ +#define SDL_RenderDrawPointF(__p0, __p1, __p2) \ ({ \ - SDL_RWops * __t__p0 = __p0;\ - Sint64 __t__p1 = __p1;\ - int __t__p2 = __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");\ - (((Sint64 (*)(SDL_RWops *, Sint64 , int ))*(void**)(__base - 3448))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_Renderer *, float , float ))*(void**)(__base - 3460))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_RWsize(__p0) \ +#define SDL_RenderDrawPointsF(__p0, __p1, __p2) \ ({ \ - SDL_RWops * __t__p0 = __p0;\ + 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");\ - (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3454))(__t__p0));\ + (((int (*)(SDL_Renderer *, const SDL_FPoint *, int ))*(void**)(__base - 3466))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_GetMemoryFunctions(__p0, __p1, __p2, __p3) \ +#define SDL_RenderDrawLineF(__p0, __p1, __p2, __p3, __p4) \ ({ \ - SDL_malloc_func * __t__p0 = __p0;\ - SDL_calloc_func * __t__p1 = __p1;\ - SDL_realloc_func * __t__p2 = __p2;\ - SDL_free_func * __t__p3 = __p3;\ + 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");\ - (((void (*)(SDL_malloc_func *, SDL_calloc_func *, SDL_realloc_func *, SDL_free_func *))*(void**)(__base - 3460))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_Renderer *, float , float , float , float ))*(void**)(__base - 3472))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4));\ }) -#define SDL_SetMemoryFunctions(__p0, __p1, __p2, __p3) \ +#define SDL_RenderDrawLinesF(__p0, __p1, __p2) \ ({ \ - SDL_malloc_func __t__p0 = __p0;\ - SDL_calloc_func __t__p1 = __p1;\ - SDL_realloc_func __t__p2 = __p2;\ - SDL_free_func __t__p3 = __p3;\ + 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_malloc_func , SDL_calloc_func , SDL_realloc_func , SDL_free_func ))*(void**)(__base - 3466))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_Renderer *, const SDL_FPoint *, int ))*(void**)(__base - 3478))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_GetNumAllocations() \ +#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 (*)(void))*(void**)(__base - 3472))());\ + (((int (*)(SDL_Renderer *, const SDL_FRect *))*(void**)(__base - 3484))(__t__p0, __t__p1));\ }) -#define SDL_strtokr(__p0, __p1, __p2) \ +#define SDL_RenderDrawRectsF(__p0, __p1, __p2) \ ({ \ - char * __t__p0 = __p0;\ - const char * __t__p1 = __p1;\ - char ** __t__p2 = __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");\ - (((char *(*)(char *, const char *, char **))*(void**)(__base - 3478))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3490))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_wcsdup(__p0) \ +#define SDL_RenderFillRectF(__p0, __p1) \ ({ \ - const wchar_t * __t__p0 = __p0;\ + 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");\ - (((wchar_t *(*)(const wchar_t *))*(void**)(__base - 3484))(__t__p0));\ + (((int (*)(SDL_Renderer *, const SDL_FRect *))*(void**)(__base - 3496))(__t__p0, __t__p1));\ }) -#define SDL_wcsstr(__p0, __p1) \ +#define SDL_RenderFillRectsF(__p0, __p1, __p2) \ ({ \ - const wchar_t * __t__p0 = __p0;\ - const wchar_t * __t__p1 = __p1;\ + 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");\ - (((wchar_t *(*)(const wchar_t *, const wchar_t *))*(void**)(__base - 3490))(__t__p0, __t__p1));\ + (((int (*)(SDL_Renderer *, const SDL_FRect *, int ))*(void**)(__base - 3502))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_wcsncmp(__p0, __p1, __p2) \ +#define SDL_RenderCopyF(__p0, __p1, __p2, __p3) \ ({ \ - const wchar_t * __t__p0 = __p0;\ - const wchar_t * __t__p1 = __p1;\ - size_t __t__p2 = __p2;\ + 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 (*)(const wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 3496))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_Renderer *, SDL_Texture *, const SDL_Rect *, const SDL_FRect *))*(void**)(__base - 3508))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_acosf(__p0) \ +#define SDL_RenderCopyExF(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ ({ \ - float __t__p0 = __p0;\ + 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");\ - (((float (*)(float ))*(void**)(__base - 3502))(__t__p0));\ + (((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_asinf(__p0) \ +#define SDL_RenderFlush(__p0) \ ({ \ - float __t__p0 = __p0;\ + SDL_Renderer * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3508))(__t__p0));\ + (((int (*)(SDL_Renderer *))*(void**)(__base - 3520))(__t__p0));\ }) -#define SDL_atanf(__p0) \ +#define SDL_RWsize(__p0) \ ({ \ - float __t__p0 = __p0;\ + SDL_RWops * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3514))(__t__p0));\ + (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3526))(__t__p0));\ }) -#define SDL_atan2f(__p0, __p1) \ +#define SDL_RWseek(__p0, __p1, __p2) \ ({ \ - float __t__p0 = __p0;\ - float __t__p1 = __p1;\ + 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");\ - (((float (*)(float , float ))*(void**)(__base - 3520))(__t__p0, __t__p1));\ + (((Sint64 (*)(SDL_RWops *, Sint64 , int ))*(void**)(__base - 3532))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_ceilf(__p0) \ +#define SDL_RWtell(__p0) \ ({ \ - float __t__p0 = __p0;\ + SDL_RWops * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3526))(__t__p0));\ + (((Sint64 (*)(SDL_RWops *))*(void**)(__base - 3538))(__t__p0));\ }) -#define SDL_copysignf(__p0, __p1) \ +#define SDL_RWread(__p0, __p1, __p2, __p3) \ ({ \ - float __t__p0 = __p0;\ - float __t__p1 = __p1;\ + 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");\ - (((float (*)(float , float ))*(void**)(__base - 3532))(__t__p0, __t__p1));\ + (((size_t (*)(SDL_RWops *, void *, size_t , size_t ))*(void**)(__base - 3544))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_exp(__p0) \ +#define SDL_RWwrite(__p0, __p1, __p2, __p3) \ ({ \ - double __t__p0 = __p0;\ + 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");\ - (((double (*)(double ))*(void**)(__base - 3538))(__t__p0));\ + (((size_t (*)(SDL_RWops *, const void *, size_t , size_t ))*(void**)(__base - 3550))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) -#define SDL_expf(__p0) \ +#define SDL_RWclose(__p0) \ ({ \ - float __t__p0 = __p0;\ + SDL_RWops * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3544))(__t__p0));\ + (((int (*)(SDL_RWops *))*(void**)(__base - 3556))(__t__p0));\ }) -#define SDL_fabsf(__p0) \ +#define SDL_LoadFile(__p0, __p1) \ ({ \ - float __t__p0 = __p0;\ + const char * __t__p0 = __p0;\ + size_t * __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3550))(__t__p0));\ + (((void *(*)(const char *, size_t *))*(void**)(__base - 3562))(__t__p0, __t__p1));\ }) -#define SDL_floorf(__p0) \ +#define SDL_GetTouchDeviceType(__p0) \ ({ \ - float __t__p0 = __p0;\ + SDL_TouchID __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3556))(__t__p0));\ + (((SDL_TouchDeviceType (*)(SDL_TouchID ))*(void**)(__base - 3568))(__t__p0));\ }) -#define SDL_fmod(__p0, __p1) \ +#define SDL_HasARMSIMD() \ ({ \ - 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 - 3562))(__t__p0, __t__p1));\ + (((SDL_bool (*)(void))*(void**)(__base - 3574))());\ }) -#define SDL_fmodf(__p0, __p1) \ +#define SDL_GameControllerTypeForIndex(__p0) \ ({ \ - float __t__p0 = __p0;\ - float __t__p1 = __p1;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float , float ))*(void**)(__base - 3568))(__t__p0, __t__p1));\ + (((SDL_GameControllerType (*)(int ))*(void**)(__base - 3580))(__t__p0));\ }) -#define SDL_logf(__p0) \ +#define SDL_GameControllerFromPlayerIndex(__p0) \ ({ \ - float __t__p0 = __p0;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3574))(__t__p0));\ + (((SDL_GameController *(*)(int ))*(void**)(__base - 3586))(__t__p0));\ }) -#define SDL_log10(__p0) \ +#define SDL_GameControllerGetType(__p0) \ ({ \ - double __t__p0 = __p0;\ + SDL_GameController * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((double (*)(double ))*(void**)(__base - 3580))(__t__p0));\ + (((SDL_GameControllerType (*)(SDL_GameController *))*(void**)(__base - 3592))(__t__p0));\ }) -#define SDL_log10f(__p0) \ +#define SDL_GameControllerSetPlayerIndex(__p0, __p1) \ ({ \ - float __t__p0 = __p0;\ + SDL_GameController * __t__p0 = __p0;\ + int __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 3586))(__t__p0));\ + (((void (*)(SDL_GameController *, int ))*(void**)(__base - 3598))(__t__p0, __t__p1));\ }) -#define SDL_powf(__p0, __p1) \ +#define SDL_JoystickFromPlayerIndex(__p0) \ ({ \ - float __t__p0 = __p0;\ - float __t__p1 = __p1;\ + int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float , float ))*(void**)(__base - 3592))(__t__p0, __t__p1));\ + (((SDL_Joystick *(*)(int ))*(void**)(__base - 3604))(__t__p0));\ }) -#define SDL_scalbnf(__p0, __p1) \ +#define SDL_JoystickSetPlayerIndex(__p0, __p1) \ ({ \ - float __t__p0 = __p0;\ + SDL_Joystick * __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 - 3598))(__t__p0, __t__p1));\ + (((SDL_Joystick *(*)(SDL_Joystick *, int ))*(void**)(__base - 3610))(__t__p0, __t__p1));\ }) -#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 - 3604))(__t__p0));\ - }) - -#define SDL_SetYUVConversionMode(__p0) \ +#define SDL_SetTextureScaleMode(__p0, __p1) \ ({ \ - SDL_YUV_CONVERSION_MODE __t__p0 = __p0;\ + SDL_Texture * __t__p0 = __p0;\ + SDL_ScaleMode __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((void (*)(SDL_YUV_CONVERSION_MODE ))*(void**)(__base - 3610))(__t__p0));\ + (((int (*)(SDL_Texture *, SDL_ScaleMode ))*(void**)(__base - 3616))(__t__p0, __t__p1));\ }) -#define SDL_GetYUVConversionMode() \ +#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");\ - (((SDL_YUV_CONVERSION_MODE (*)(void))*(void**)(__base - 3616))());\ + (((int (*)(SDL_Texture *, SDL_ScaleMode *))*(void**)(__base - 3622))(__t__p0, __t__p1));\ }) -#define SDL_GetYUVConversionModeForResolution(__p0, __p1) \ +#define SDL_LockTextureToSurface(__p0, __p1, __p2) \ ({ \ - int __t__p0 = __p0;\ - int __t__p1 = __p1;\ + 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");\ - (((SDL_YUV_CONVERSION_MODE (*)(int , int ))*(void**)(__base - 3622))(__t__p0, __t__p1));\ + (((int (*)(SDL_Texture *, const SDL_Rect *, SDL_Surface **))*(void**)(__base - 3628))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_IsTablet() \ +#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");\ - (((SDL_bool (*)(void) SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data))*(void**)(__base - 3628))());\ + (((wchar_t *(*)(const wchar_t *, const wchar_t *))*(void**)(__base - 3634))(__t__p0, __t__p1));\ }) -#define SDL_GetTouchDeviceType(__p0) \ +#define SDL_wcsncmp(__p0, __p1, __p2) \ ({ \ - SDL_TouchID __t__p0 = __p0;\ + 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");\ - (((SDL_TouchDeviceType (*)(SDL_TouchID ))*(void**)(__base - 3640))(__t__p0));\ + (((int (*)(const wchar_t *, const wchar_t *, size_t ))*(void**)(__base - 3640))(__t__p0, __t__p1, __t__p2));\ }) -#define SDL_GetDisplayOrientation(__p0) \ +#define SDL_strtokr(__p0, __p1, __p2) \ ({ \ - int __t__p0 = __p0;\ + 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");\ - (((SDL_DisplayOrientation (*)(int ))*(void**)(__base - 3646))(__t__p0));\ + (((char *(*)(char *, const char *, char **))*(void**)(__base - 3646))(__t__p0, __t__p1, __t__p2));\ }) #endif /* !_PPCINLINE_SDL2_H */ From 08d871883332d5155c8abeb13c607257e4a4d005 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:48:01 +0100 Subject: [PATCH 077/214] Update AHI files --- src/audio/ahi/SDL_ahi_audio.c | 109 ++++++++-------------------------- src/audio/ahi/SDL_ahi_audio.h | 3 - 2 files changed, 24 insertions(+), 88 deletions(-) diff --git a/src/audio/ahi/SDL_ahi_audio.c b/src/audio/ahi/SDL_ahi_audio.c index 9feb61ae7b..beaf9b712e 100644 --- a/src/audio/ahi/SDL_ahi_audio.c +++ b/src/audio/ahi/SDL_ahi_audio.c @@ -54,8 +54,6 @@ AHIAUD_PlayDevice(_THIS) struct SDL_PrivateAudioData *hidden = this->hidden; struct AHIRequest *req; ULONG current, current2; - - printf("[%s] PlayDevice... !\n", __FUNCTION__); current = hidden->current_buffer; current2 = current ^ 1; @@ -64,71 +62,23 @@ AHIAUD_PlayDevice(_THIS) req->ahir_Std.io_Data = hidden->buffers[current]; req->ahir_Std.io_Length = this->spec.size; req->ahir_Std.io_Offset = 0; -// req->ahir_Std.io_Command = CMD_WRITE; 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 : - //printf("[%s] AMIAUD_CONVERT_NONE... !\n", __FUNCTION__); - break; - case AMIAUD_CONVERT_8: { - - ULONG *buf4 = hidden->buffers[current]; - do { - *buf4++ ^= 0x80808080; - *buf4++ ^= 0x80808080; - this->spec.size -= 8; - } - while (this->spec.size >=8); - break; - } - case AMIAUD_CONVERT_16: - { - WORD *buf = hidden->buffers[current]; - - do - { - buf[0] = buf[0] - 32768; - buf[1] = buf[1] - 32768; - buf[2] = buf[2] - 32768; - buf[3] = buf[3] - 32768; - buf += 4; - this->spec.size -= 8; - } - while (this->spec.size > 8); - } - break; - - case AMIAUD_CONVERT_U16LSB: - { - UWORD *buf = hidden->buffers[current]; - do - { - UWORD sample = *buf; - *buf++ = ((sample >> 8) | (sample << 8)) - 32768; - *buf++ = ((sample >> 8) | (sample << 8)) - 32768; - *buf++ = ((sample >> 8) | (sample << 8)) - 32768; - *buf++ = ((sample >> 8) | (sample << 8)) - 32768; - this->spec.size -= 8; - } - while (this->spec.size > 8); - } - 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; + 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); - hidden->current_buffer = current2; - hidden->playing = 1; - } static Uint8 * @@ -182,7 +132,7 @@ AHIAUD_ThreadInit(_THIS) } static int -AHIAUD_OpenDevice(_THIS, void * handle, const char *devname, int iscapture) +AHIAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { struct SDL_PrivateAudioData *hidden; SDL_AudioFormat test_format; @@ -191,43 +141,32 @@ AHIAUD_OpenDevice(_THIS, void * handle, const char *devname, int iscapture) 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 : - convert = AMIAUD_CONVERT_8; - case AUDIO_S8 : - - sample_format = this->spec.channels == 1 ? AHIST_M8S : AHIST_S8S; break; - + case AUDIO_U8: + case AUDIO_S8: + sample_format = this->spec.channels == 1 ? AHIST_M8S : AHIST_S8S; break; break; - #if BYTEORDER == LITTLE_ENDIAN - #error Not implemented - #else - case AUDIO_S16LSB: - convert = AMIAUD_CONVERT_SWAP16; - case AUDIO_U16LSB: - convert = AMIAUD_CONVERT_U16LSB; - case AUDIO_U16MSB: - convert = AMIAUD_CONVERT_16;; - case AUDIO_S16MSB: - sample_format = this->spec.channels == 1 ? AHIST_M16S : AHIST_S16S; - 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; - #endif + case AUDIO_S32LSB://convert = AMIAUD_CONVERT_SWAP32; + case AUDIO_S32MSB: sample_format = this->spec.channels == 1 ? AHIST_M32S : AHIST_S32S; break; default: - printf("[%s] unsupported SDL format 0x%ld\n", __FUNCTION__, test_format); + D("[%s] unsupported SDL format 0x%ld\n", __FUNCTION__, test_format); test_format = SDL_NextAudioFormat(); break; } @@ -236,7 +175,7 @@ AHIAUD_OpenDevice(_THIS, void * handle, const char *devname, int iscapture) if (sample_format < 0) return SDL_SetError("Unsupported audio format"); - D("[%s] AHI sample format is %ld - and samples are %ld\n", __FUNCTION__, sample_format,this->spec.samples); + D("[%s] AHI sample format is %ld\n", __FUNCTION__, sample_format); if (this->spec.channels > 2) this->spec.channels = 2; @@ -244,7 +183,7 @@ AHIAUD_OpenDevice(_THIS, void * handle, const char *devname, int iscapture) if (this->spec.samples > 1024) { this->spec.samples = MAX(this->spec.freq / 20, 256); - this->spec.samples = (this->spec.samples + 0x7) & ~0x7; + this->spec.samples = (this->spec.samples + 7) & ~7; } /* Update the fragment size as size in bytes */ diff --git a/src/audio/ahi/SDL_ahi_audio.h b/src/audio/ahi/SDL_ahi_audio.h index 2670391add..b9985afb85 100644 --- a/src/audio/ahi/SDL_ahi_audio.h +++ b/src/audio/ahi/SDL_ahi_audio.h @@ -33,10 +33,7 @@ typedef enum { AMIAUD_CONVERT_NONE, - AMIAUD_CONVERT_8, AMIAUD_CONVERT_SWAP16, - AMIAUD_CONVERT_U16LSB, - AMIAUD_CONVERT_16, AMIAUD_CONVERT_SWAP32 } CONVTYPE; From d24ea53c19d12a41f81e1b33ad00fe45092ab0e3 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:50:03 +0100 Subject: [PATCH 078/214] Update SDL_stubs.h --- src/core/morphos/SDL_stubs.h | 110 +++++++++++++++++------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/src/core/morphos/SDL_stubs.h b/src/core/morphos/SDL_stubs.h index 612a3adcd2..1cf7e98e08 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 @@ -532,7 +532,6 @@ STUB(SDL_SetWindowShape) STUB(SDL_GetShapedWindowMode) -// Version 2.0.4 STUB(SDL_CaptureMouse) STUB(SDL_WarpMouseGlobal) STUB(SDL_GetGlobalMouseState) @@ -551,7 +550,6 @@ STUB(SDL_tan) STUB(SDL_tanf) -// Version 2.0.4 STUB(SDL_MemoryBarrierReleaseFunction) STUB(SDL_MemoryBarrierAcquireFunction) STUB(SDL_DequeueAudio) @@ -588,7 +586,7 @@ STUB(SDL_LoadFile_RW) STUB(SDL_RenderSetIntegerScale) STUB(SDL_RenderGetIntegerScale) - /* 2.0.11*/ + STUB(SDL_NewAudioStream) STUB(SDL_AudioStreamPut) STUB(SDL_AudioStreamGet) @@ -596,63 +594,21 @@ STUB(SDL_AudioStreamFlush) STUB(SDL_AudioStreamClear) STUB(SDL_FreeAudioStream) - STUB(SDL_HasAVX512F) - STUB(SDL_HasARMSIMD) - STUB(SDL_SIMDGetAlignment) - STUB(SDL_SIMDAlloc) - STUB(SDL_SIMDFree) - STUB(SDL_GameControllerTypeForIndex) - STUB(SDL_GameControllerMappingForDeviceIndex) - STUB(SDL_GameControllerFromPlayerIndex) - STUB(SDL_GameControllerGetType) - STUB(SDL_GameControllerGetPlayerIndex) - STUB(SDL_GameControllerSetPlayerIndex) - STUB(SDL_GameControllerRumble) STUB(SDL_LockJoysticks) STUB(SDL_UnlockJoysticks) - STUB(SDL_JoystickGetDevicePlayerIndex) - STUB(SDL_JoystickFromPlayerIndex) - STUB(SDL_JoystickGetPlayerIndex) - STUB(SDL_JoystickSetPlayerIndex) - STUB(SDL_JoystickRumble) - STUB(SDL_SetTextureScaleMode) - STUB(SDL_GetTextureScaleMode) - STUB(SDL_LockTextureToSurface) - 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_RenderGetMetalLayer) - STUB(SDL_RenderGetMetalCommandEncoder) - STUB(SDL_LoadFile) - STUB(SDL_RWclose) - STUB(SDL_RWwrite) - STUB(SDL_RWread) - STUB(SDL_RWtell) - STUB(SDL_RWseek) - STUB(SDL_RWsize) + STUB(SDL_GetMemoryFunctions) STUB(SDL_SetMemoryFunctions) STUB(SDL_GetNumAllocations) - STUB(SDL_strtokr) - STUB(SDL_wcsdup) - STUB(SDL_wcsstr) - STUB(SDL_wcsncmp) + + 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_exp) - STUB(SDL_expf) STUB(SDL_fabsf) STUB(SDL_floorf) STUB(SDL_fmod) @@ -662,15 +618,62 @@ STUB(SDL_log10f) STUB(SDL_powf) STUB(SDL_scalbnf) - STUB(SDL_HasColorKey) 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_GetTouchDeviceType) 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) + #if 0 STUB(SDL_GL_LoadLibrary) STUB(SDL_GL_GetProcAddress) @@ -723,6 +726,3 @@ STUB(SDL_HapticRumblePlay) STUB(SDL_HapticRumbleStop) #endif - - - From 87d2b552399a525d5363baec996ef26c8d030665 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:50:25 +0100 Subject: [PATCH 079/214] Update SDL_functions.h --- src/core/morphos/SDL_functions.h | 129 ++++++++++++++----------------- 1 file changed, 59 insertions(+), 70 deletions(-) diff --git a/src/core/morphos/SDL_functions.h b/src/core/morphos/SDL_functions.h index 6d7d7d7795..ff5f723413 100644 --- a/src/core/morphos/SDL_functions.h +++ b/src/core/morphos/SDL_functions.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 @@ -470,8 +470,6 @@ 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); @@ -489,7 +487,6 @@ 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); @@ -511,7 +508,6 @@ 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); @@ -519,88 +515,35 @@ 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.6 to 2.0.11 */ -SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate); +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); -SDL_bool SDL_HasAVX512F(void); -SDL_bool SDL_HasARMSIMD(void); -size_t SDL_SIMDGetAlignment(void); -void * SDL_SIMDAlloc(const size_t len); -void SDL_SIMDFree(void *ptr); -SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); -char *SDL_GameControllerMappingForDeviceIndex(int joystick_index); -SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); -SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller); -int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); -void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); -int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); -void SDL_LockJoysticks(void); -void SDL_UnlockJoysticks(void); -int SDL_JoystickGetDevicePlayerIndex(int device_index); -SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index); -int SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); -void SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); -int SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); - -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); -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); +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); - -void *SDL_LoadFile(const char *file, size_t *datasize); -int SDL_RWclose(SDL_RWops *context); -size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num); -size_t SDL_RWread(SDL_RWops *context,void *ptr, size_t size, size_t maxnum); -Sint64 SDL_RWtell(SDL_RWops *context); -Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence); -Sint64 SDL_RWsize(SDL_RWops *context); - -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); -char *SDL_strtokr(char *s1, const char *s2, char **saveptr); -wchar_t *SDL_wcsdup(const wchar_t *wstr); -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); - 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); -double SDL_exp(double x); -float SDL_expf(float x); float SDL_fabsf(float x); float SDL_floorf(float x); double SDL_fmod(double x, double y); @@ -609,13 +552,59 @@ 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); - -SDL_bool SDL_HasColorKey(SDL_Surface * surface); +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); -SDL_bool SDL_IsTablet(void) +/* 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); -SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex); \ No newline at end of file +/* 2.0.11 */ +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); From 8d40eb4501634bf150c2774d73816e5d85a8c69c Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:52:03 +0100 Subject: [PATCH 080/214] bak to GCC4 --- src/core/morphos/devenv/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index b56f7b25f0..1821a3b830 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -1,8 +1,8 @@ # Makefile to build the SDL 2 -CC = ppc-morphos-gcc-9 -noixemul +CC = ppc-morphos-gcc-4 -noixemul INCLUDE = -I../../../../include -I../../../../sdk -CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE +CFLAGS = -cstd=c99 -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE AR = ar RANLIB = ranlib From 54b91383ae9787bbab24fac93076d1d8c76358be Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:53:43 +0100 Subject: [PATCH 081/214] Update SDL_video.c --- src/video/SDL_video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index e407444962..caaa649d8a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -150,7 +150,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 @@ -1158,7 +1158,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 @@ -1395,7 +1395,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 \ From 1f2722e84b595ed5a3dc83074f2e3c6f05db58ab Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:54:19 +0100 Subject: [PATCH 082/214] Update SDL_amigamodes --- src/video/amiga/SDL_amigamodes.c | 14 ++++++++++++++ src/video/amiga/SDL_amigamodes.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index bfabf60f9c..b2347af972 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -434,4 +434,18 @@ AMIGA_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) 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 index fe2a096202..1ec5d185cf 100644 --- a/src/video/amiga/SDL_amigamodes.h +++ b/src/video/amiga/SDL_amigamodes.h @@ -38,6 +38,7 @@ 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); +extern int AMIGA_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); #endif /* _SDL_amigamodes_h */ From 0971563e5db4efc833ddf7e7e87d7a927764d905 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:55:19 +0100 Subject: [PATCH 083/214] Update SDL_amigamouse.c --- src/video/amiga/SDL_amigamouse.c | 71 ++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c index c5f62d960a..60f2b54239 100644 --- a/src/video/amiga/SDL_amigamouse.c +++ b/src/video/amiga/SDL_amigamouse.c @@ -182,41 +182,50 @@ AMIGA_WarpMouse(SDL_Window * window, int x, int y) struct Window *win; D("[%s]\n", __FUNCTION__); - if ((win = data->win)) - { - struct MsgPort port; - struct IOStdReq req; + 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); + port.mp_Flags = PA_IGNORE; + NEWLIST(&port.mp_MsgList); - req.io_Message.mn_ReplyPort = &port; - req.io_Device = NULL; - req.io_Unit = NULL; + 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); + 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); } } From 4f0dd01b09b67475d29be30e1ef1fc99e0ff7025 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:55:45 +0100 Subject: [PATCH 084/214] Update SDL_amigavideo.c --- src/video/amiga/SDL_amigavideo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index ad3ef54ae0..b65b4161ab 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -392,7 +392,11 @@ AMIGA_CreateDevice(int devindex) 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; From 0ea521ebebf14ef29cf994d1e1f03bf9f650ab4d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:57:00 +0100 Subject: [PATCH 085/214] Update SDL_amigawindow.c add AMIGA_CloseWindow add AMIGA_SetWindowResizable add AMIGA_SetWindowOpacity TEST ONLY ! --- src/video/amiga/SDL_amigawindow.c | 91 ++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 0bd536078a..a62e124e90 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -98,7 +98,18 @@ AMIGA_CloseWindows(_THIS) } void -AMIGA_OpenWindows(_THIS) +AMIGA_CloseWindow(_THIS, SDL_WindowData *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; @@ -692,5 +703,83 @@ AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) return SDL_FALSE; } } +void +AMIGA_SetWindowResizable (_THIS, SDL_Window * window, SDL_bool resizable) +{ + if (window->flags & SDL_WINDOW_FOREIGN) { + D("Cannot modify native window '%s'\n", window->title); + return; + } + + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (data->win) { + D("Closing system window '%s' before re-creation\n", window->title); + AMIGA_CloseWindow(_this, window); + } + + data->win = AMIGA_CreateWindow(_this, window); + + if (data->win) { + //OS4_CreateIconifyGadgetForWindow(_this, window); + + // Make sure the new window is active + AMIGA_ShowWindow(_this, window); + + //if ((window->flags & SDL_WINDOW_OPENGL) && data->glContext) { + // OS4_UpdateGlWindowPointer(_this, window); + //} + } else { + D("Failed to re-create window '%s'\n", window->title); + } +} + +int +AMIGA_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + struct Window *syswin = ((SDL_WindowData *) window->driverdata)->win; + LONG ret; + + UBYTE value = opacity * 255; + + D("Not supported yet - Setting window '%s' opaqueness to %d\n", window->title, value); + + // Maybe with TransparencyControl + + /*ret = SetWindowAttrs( + syswin, + WA_Opaqueness, value, + TAG_DONE); + + if (ret) { + D("Failed to set window opaqueness to %d\n", value); + return -1; + } +*/ + return 0; +} + +int +AMIGA_GetWindowBordersSize(_THIS, SDL_Window * window, int * top, int * left, int * bottom, int * right) +{ + struct Window *syswin = ((SDL_WindowData *) window->driverdata)->win; + + if (top) { + *top = syswin->BorderTop; + } + + if (left) { + *left = syswin->BorderLeft; + } + + if (bottom) { + *bottom = syswin->BorderBottom; + } + + if (right) { + *right = syswin->BorderRight; + } + + return 0; +} /* vi: set ts=4 sw=4 expandtab: */ From 230d7f8bc314e2f0057455a4cfdaaf82a9c824ac Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:57:42 +0100 Subject: [PATCH 086/214] add SDL_MORPHOS_JoystickDriver --- src/joystick/SDL_joystick.c | 3 +++ src/joystick/SDL_sysjoystick.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index fcab42cfec..64b40a71de 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -91,6 +91,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #if defined(SDL_JOYSTICK_AMIGAINPUT) &SDL_AMIGAINPUT_JoystickDriver, #endif +#ifdef SDL_JOYSTICK_MORPHOS + &SDL_MORPHOS_JoystickDriver, +#endif #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) &SDL_DUMMY_JoystickDriver #endif diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 01d427f0da..5b346011cf 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -159,6 +159,7 @@ 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; #endif /* SDL_sysjoystick_h_ */ From 300774661aea884229788179ef2fa52f2ce6e06b Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:58:34 +0100 Subject: [PATCH 087/214] Update SDL_sysjoystick --- src/joystick/morphos/SDL_sysjoystick.c | 104 +++++++++++++---------- src/joystick/morphos/SDL_sysjoystick_c.h | 10 --- 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 2c846cfa40..133648eb00 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -37,12 +37,29 @@ #include #define BUFFER_OFFSET(buffer, offset) (((int32 *)buffer)[offset]) +#define BUFFER_SIZE (256) -static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, /*SENSORS_Type, SensorType_HID_Gamepad,*/ TAG_DONE }; +static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, SENSORS_Type, SensorType_HID_Gamepad, TAG_DONE }; static struct sensordata *sensors; extern APTR threadpool; +static char *va(char *fmt, ...) { + va_list ap; + static char string[2][BUFFER_SIZE]; + static unsigned int index = 0; + char *buf; + + buf = string[index & 1]; + index++; + + va_start(ap, fmt); + vsnprintf(buf, BUFFER_SIZE, fmt, ap); + va_end(ap); + + return buf; +} + static void sensor_events(struct sensordata *sensors, struct MsgPort *port) { struct SensorsNotificationMessage *snm; @@ -107,7 +124,7 @@ static void sensor_events(struct sensordata *sensors, struct MsgPort *port) /* Function to scan the system for joysticks. * It should return 0, or -1 on an unrecoverable fatal error. */ -int +static int SDL_SYS_JoystickInit(void) { struct sensordata *s = SDL_malloc(sizeof(*s)); @@ -140,10 +157,16 @@ SDL_SYS_JoystickInit(void) while ((sensor = NextSensor(sensor, sensorlist, NULL))) { - CONST_STRPTR name = "", serial = NULL; - size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + CONST_STRPTR name = "", *serial = NULL; + ULONG *id; + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) + + GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); + + serial = va("#%lu", id); + + if (id > 0) { size_t namelen = strlen(name) + 1; struct joystick_hwdata *hwdata = SDL_malloc(sizeof(*hwdata) + namelen); @@ -176,7 +199,7 @@ SDL_SYS_JoystickInit(void) return rc; } -int SDL_SYS_NumJoysticks() +static int SDL_SYS_JoystickGetCount(void) { return sensors->joystick_count; } @@ -200,25 +223,21 @@ static struct joystick_hwdata *GetByIndex(int index) return hwdata; } -void SDL_SYS_JoystickDetect() +static void SDL_SYS_JoystickDetect(void) { } -SDL_bool SDL_SYS_JoystickNeedsPolling() -{ - return SDL_FALSE; -} - /* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +SDL_SYS_JoystickGetDeviceName(int device_index) { struct joystick_hwdata *hwdata = GetByIndex(device_index); return hwdata->name; } /* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static +SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) { return device_index; } @@ -334,7 +353,7 @@ static void GetJoyData(SDL_Joystick * joystick, struct joystick_hwdata *hwdata, This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ -int +static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { struct joystick_hwdata *hwdata = GetByIndex(device_index); @@ -346,22 +365,27 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) while ((sensor = NextSensor(sensor, sensorlist, NULL))) { - CONST_STRPTR name = "", serial = NULL; - size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + CONST_STRPTR name = ""; + ULONG *id; + //size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) + GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); + + //if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) + if (id > 0 && strcmp(hwdata->name, name) == 0) { - SDL_JoystickGUID guid; + /*SDL_JoystickGUID guid; strncpy((char *)&guid, serial, sizeof(guid)); if (memcmp(&hwdata->guid, &guid, sizeof(guid)) == 0) - { + {*/ GetJoyData(joystick, hwdata, sensor); rc = 0; break; - } + /*}*/ } } @@ -371,23 +395,12 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) return rc; } -/* Function to determine is this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -void +static void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { struct joystick_hwdata *hwdata = joystick->hwdata; struct sensornotify *sn; - void *buffer; + void *buffer; int naxe = 0, nbutton = 0; ForeachNode(&hwdata->notifylist, sn) @@ -427,7 +440,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) hwdata->axisData[naxe] = sval; } - // TODO : sn->values[1] ?? for SANSORS_HIDInput_Z_Index + // TODO : sn->values[2] ?? for SANSORS_HIDInput_Z_Index naxe++; break; @@ -456,7 +469,7 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) } /* Function to perform any system-specific joystick related cleanup */ -void +static void SDL_SYS_JoystickQuit(void) { struct joystick_hwdata *hwdata, *tmp; @@ -470,19 +483,20 @@ SDL_SYS_JoystickQuit(void) Signal(s->sensorport->mp_SigTask, SIGBREAKF_CTRL_C); } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +static SDL_JoystickGUID +SDL_SYS_JoystickGetDeviceGUID( int device_index ) { struct joystick_hwdata *hwdata = GetByIndex(device_index); return hwdata->guid; } -static -int +static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { return 0; } -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +static SDL_JoystickGUID +SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) { return joystick->hwdata->guid; } @@ -502,13 +516,13 @@ SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) SDL_JoystickDriver SDL_AMIGAINPUT_JoystickDriver = { SDL_SYS_JoystickInit, - SDL_SYS_NumJoysticks, + SDL_SYS_JoystickGetCount, SDL_SYS_JoystickDetect, - SDL_SYS_JoystickNameForDeviceIndex, + SDL_SYS_JoystickGetDeviceName, SDL_SYS_JoystickGetDevicePlayerIndex, SDL_SYS_JoystickSetDevicePlayerIndex, - SDL_SYS_JoystickGetGUID, - SDL_SYS_GetInstanceIdOfDeviceIndex, + SDL_SYS_JoystickGetDeviceGUID, + SDL_SYS_JoystickGetDeviceInstanceID, SDL_SYS_JoystickOpen, SDL_SYS_JoystickRumble, SDL_SYS_JoystickUpdate, diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 517028a276..b423de0591 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -44,16 +44,6 @@ struct sensordata struct Task *notifytask; }; -/*struct joystick_hwdata -{ - struct MinNode node; - struct MinList notifylist; - - ULONG attached; - SDL_JoystickGUID guid; - TEXT name[0]; -};*/ - struct joystick_hwdata { struct MinNode node; From 869454e8d1b5791267332c99b580fa71e2eb2a63 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 13:10:13 +0100 Subject: [PATCH 088/214] Update SDL_amigawindow.h --- src/video/amiga/SDL_amigawindow.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h index 8e9cafaba5..6fe89c4eec 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -90,6 +90,11 @@ extern SDL_bool AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_Sys extern void AMIGA_ShowWindow_Internal(SDL_Window * window); extern void AMIGA_HideWindow_Internal(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: */ From 1d9ea1c276ef0a40f23c23a0402826d7bfac4f14 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 9 Mar 2020 13:12:47 +0100 Subject: [PATCH 089/214] Update SDL_sysjoystick.c --- src/joystick/morphos/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 133648eb00..1c73bbeab1 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -513,7 +513,7 @@ SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) D("Not implemented\n"); } -SDL_JoystickDriver SDL_AMIGAINPUT_JoystickDriver = +SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = { SDL_SYS_JoystickInit, SDL_SYS_JoystickGetCount, From 74663b92ec95a6436ebf73369f6e0355b1773d66 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 9 Mar 2020 15:02:31 +0100 Subject: [PATCH 090/214] removed SDL_DYNAMIC_API from SDL_config_morphos.h --- include/SDL_config_morphos.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 90ce2326c7..3dfb9615f7 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -131,8 +131,6 @@ #define HAVE_EXP 1 #define HAVE_EXPF 1 - -#define SDL_DYNAMIC_API 1 #define HAVE_ALTIVEC_H 1 #define SDL_ENABLE_ALTIVEC_H 1 @@ -171,6 +169,11 @@ #define SDL_VIDEO_RENDER_SW 1 +/* Maybe later */ +#ifndef SDL_VIDEO_RENDER_OGL +//#define SDL_VIDEO_RENDER_OGL 1 +#endif + /* Need or not... */ #define SDL_HAVE_YUV 1 @@ -191,4 +194,4 @@ #define D(fmt, ...) #endif -#endif /* _SDL_config_amiga_h */ +#endif /* _SDL_config_morphos_h */ From f64c0bb2ce94a5e9ba9150157e5c629805f70eee Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 9 Mar 2020 16:49:14 +0100 Subject: [PATCH 091/214] adjusted AMIGA_TranslateUnicode for MorphOS --- src/video/amiga/SDL_amigaevents.c | 139 +++++++----------------------- 1 file changed, 29 insertions(+), 110 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 8338eab67f..ccd51bf6ab 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -48,92 +48,6 @@ #include #include -/*static SDL_Scancode -AMIGA_ScanCodeToSDL(UWORD code) -{ - switch (code) - { - case RAWKEY_KP_0: return SDL_SCANCODE_KP_0; - case RAWKEY_KP_1: return SDL_SCANCODE_KP_1; - case RAWKEY_KP_2: return SDL_SCANCODE_KP_2; - case RAWKEY_KP_3: return SDL_SCANCODE_KP_3; - case RAWKEY_KP_4 : return SDL_SCANCODE_KP_4; - case RAWKEY_KP_5 : return SDL_SCANCODE_KP_5; - case RAWKEY_KP_6 : return SDL_SCANCODE_KP_6; - case RAWKEY_KP_7 : return SDL_SCANCODE_KP_7; - case RAWKEY_KP_8 : return SDL_SCANCODE_KP_8; - case RAWKEY_KP_9 : return SDL_SCANCODE_KP_9; - case RAWKEY_KP_DECIMAL : return SDL_SCANCODE_KP_PERIOD; - case RAWKEY_KP_ENTER : return SDL_SCANCODE_KP_ENTER; - case RAWKEY_KP_MINUS : return SDL_SCANCODE_KP_MINUS; - case RAWKEY_KP_DIVIDE : return SDL_SCANCODE_KP_DIVIDE; - case RAWKEY_KP_MULTIPLY: return SDL_SCANCODE_KP_MULTIPLY; - case RAWKEY_KP_PLUS : return SDL_SCANCODE_KP_PLUS; - - case RAWKEY_BACKSPACE : return SDL_SCANCODE_BACKSPACE; - case RAWKEY_TAB : return SDL_SCANCODE_TAB; - case RAWKEY_RETURN : return SDL_SCANCODE_RETURN; - case RAWKEY_ESCAPE : return SDL_SCANCODE_ESCAPE; - case RAWKEY_DELETE : return SDL_SCANCODE_DELETE; - case RAWKEY_INSERT : return SDL_SCANCODE_INSERT; - case RAWKEY_PAGEUP : return SDL_SCANCODE_PAGEUP; - case RAWKEY_PAGEDOWN : return SDL_SCANCODE_PAGEDOWN; - case RAWKEY_HOME : return SDL_SCANCODE_HOME; - case RAWKEY_END : return SDL_SCANCODE_END; - case RAWKEY_UP : return SDL_SCANCODE_UP; - case RAWKEY_DOWN : return SDL_SCANCODE_DOWN; - case RAWKEY_LEFT : return SDL_SCANCODE_LEFT; - case RAWKEY_RIGHT : return SDL_SCANCODE_RIGHT; - - case RAWKEY_F1 : return SDL_SCANCODE_F1; - case RAWKEY_F2 : return SDL_SCANCODE_F2; - case RAWKEY_F3 : return SDL_SCANCODE_F3; - case RAWKEY_F4 : return SDL_SCANCODE_F4; - case RAWKEY_F5 : return SDL_SCANCODE_F5; - case RAWKEY_F6 : return SDL_SCANCODE_F6; - case RAWKEY_F7 : return SDL_SCANCODE_F7; - case RAWKEY_F8 : return SDL_SCANCODE_F8; - case RAWKEY_F9 : return SDL_SCANCODE_F9; - case RAWKEY_F10 : return SDL_SCANCODE_F10; - case RAWKEY_F11 : return SDL_SCANCODE_F11; - case RAWKEY_F12 : return SDL_SCANCODE_F12; - - case RAWKEY_HELP : return SDL_SCANCODE_HELP; - - case RAWKEY_LSHIFT : return SDL_SCANCODE_LSHIFT; - case RAWKEY_RSHIFT : return SDL_SCANCODE_RSHIFT; - case RAWKEY_LALT : return SDL_SCANCODE_LALT; - case RAWKEY_RALT : return SDL_SCANCODE_RALT; - case RAWKEY_LAMIGA : return SDL_SCANCODE_LGUI; - case RAWKEY_RAMIGA : return SDL_SCANCODE_RGUI; - case RAWKEY_CONTROL : return SDL_SCANCODE_LCTRL; - case RAWKEY_CAPSLOCK : return SDL_SCANCODE_CAPSLOCK; - - case RAWKEY_SCRLOCK : return SDL_SCANCODE_SCROLLLOCK; - case RAWKEY_PRTSCREEN : return SDL_SCANCODE_PRINTSCREEN; - case RAWKEY_NUMLOCK : return SDL_SCANCODE_NUMLOCKCLEAR; - case RAWKEY_PAUSE : return SDL_SCANCODE_PAUSE; - -#if 0 - case RAWKEY_MEDIA1 : return SDL_SCANCODE_VOLUMEUP; - case RAWKEY_MEDIA2 : return SDL_SCANCODE_VOLUMEDOWN; - case RAWKEY_MEDIA3 : return SDL_SCANCODE_WWW; - case RAWKEY_MEDIA4 : return SDL_SCANCODE_MAIL; - case RAWKEY_MEDIA5 : return SDL_SCANCODE_CALCULATOR; - case RAWKEY_MEDIA6 : return SDL_SCANCODE_COMPUTER; -#else - case RAWKEY_CDTV_STOP : return SDL_SCANCODE_AUDIOSTOP; - case RAWKEY_CDTV_PLAY : return SDL_SCANCODE_AUDIOPLAY; - case RAWKEY_CDTV_PREV : return SDL_SCANCODE_AUDIOPREV; - case RAWKEY_CDTV_NEXT : return SDL_SCANCODE_AUDIONEXT; - case RAWKEY_CDTV_REW : return SDL_SCANCODE_AC_BACK; - case RAWKEY_CDTV_FF : return SDL_SCANCODE_AC_FORWARD; -#endif - } - - return SDL_SCANCODE_UNKNOWN; -}*/ - static void AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) { @@ -153,25 +67,29 @@ AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *d SDL_SendMouseButton(data->window, 0, state, i); } -static char -AMIGA_TranslateUnicode(UWORD code, UWORD qualifier) +static int +AMIGA_TranslateUnicode(struct IntuiMessage *m, char *buffer) { - struct InputEvent ie; - WORD res; - char buffer[10]; - - ie.ie_Class = IECLASS_RAWKEY; - ie.ie_SubClass = 0; - ie.ie_Code = code & ~(IECODE_UP_PREFIX); - ie.ie_Qualifier = qualifier; - ie.ie_EventAddress = NULL; - - res = MapRawKey(&ie, buffer, sizeof(buffer), 0); - - if (res != 1) - return 0; - else - return buffer[0]; + 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 @@ -211,12 +129,13 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0])) { s = amiga_scancode_table[rawkey]; if (m->Code <= 127) { - char text[2]; - text[0] = AMIGA_TranslateUnicode(m->Code, m->Qualifier); - text[1] = '\0'; - - SDL_SendKeyboardKey(SDL_PRESSED, s); - SDL_SendKeyboardText(text); + char text[10]; + int length = AMIGA_TranslateUnicode(m, text); + if (length > 0) { + text[length] = '\0'; + SDL_SendKeyboardText(text); + } + SDL_SendKeyboardKey(SDL_PRESSED, s); } else { SDL_SendKeyboardKey(SDL_RELEASED, s); } From 2a3ed111d646a8fc44eacc3487a83786a42325f1 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 9 Mar 2020 17:37:02 +0100 Subject: [PATCH 092/214] removed the unused SDL_functions.h --- src/core/morphos/SDL_functions.h | 610 ------------------------------- 1 file changed, 610 deletions(-) delete mode 100644 src/core/morphos/SDL_functions.h diff --git a/src/core/morphos/SDL_functions.h b/src/core/morphos/SDL_functions.h deleted file mode 100644 index ff5f723413..0000000000 --- a/src/core/morphos/SDL_functions.h +++ /dev/null @@ -1,610 +0,0 @@ -/* - 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. -*/ - -/* - * Collection of SDL 2 functions to generate shared library calls. - * - */ - -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_sscanf(const char *text, const char *fmt, ...); -int SDL_vsscanf(const char *text, const char *fmt, va_list ap); -int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); -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_assert_state SDL_ReportAssertion(SDL_assert_data *, 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_assert_data * 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, -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); -int SDL_SetError(const char *fmt, ...); -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_Log(const char *fmt, ...); -void SDL_LogVerbose(int category, const char *fmt, ...); -void SDL_LogDebug(int category, const char *fmt, ...); -void SDL_LogInfo(int category, const char *fmt, ...); -void SDL_LogWarn(int category, const char *fmt, ...); -void SDL_LogError(int category, const char *fmt, ...); -void SDL_LogCritical(int category, const char *fmt, ...); -void SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...); -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); -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); -SDL_GLContext SDL_GL_CreateContext(SDL_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); -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); -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); -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.11 */ -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); From f0de5a026b511d56bfd43d7e3f221a93eb7872c9 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 9 Mar 2020 18:36:11 +0100 Subject: [PATCH 093/214] fixed the MorphOS SDK headers --- sdk/fd/sdl2_lib.fd | 2 +- sdk/ppcinline/sdl2.h | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sdk/fd/sdl2_lib.fd b/sdk/fd/sdl2_lib.fd index ede4c39e9e..171c37761e 100644 --- a/sdk/fd/sdl2_lib.fd +++ b/sdk/fd/sdl2_lib.fd @@ -5,7 +5,7 @@ * general SDL_InitTGL(glcptr,tglptr)(base,sysv) SDL_SetExitPointer(exitfunc)(base,sysv) -SDL_SetError(fmt,va_list)(sysv,r12base) +SDL_VSetError(fmt,va_list)(sysv,r12base) SDL_GetPlatform()(sysv,r12base) SDL_Init(flags)(sysv,r12base) SDL_InitSubSystem(flags)(sysv,r12base) diff --git a/sdk/ppcinline/sdl2.h b/sdk/ppcinline/sdl2.h index b114c8a8ed..10a4c7ee8d 100644 --- a/sdk/ppcinline/sdl2.h +++ b/sdk/ppcinline/sdl2.h @@ -31,6 +31,15 @@ (((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;\ + va_list __t__p1 = __p1;\ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((int (*)(const char *, va_list ))*(void**)(__base - 40))(__t__p0, __t__p1));\ + }) + #define SDL_GetPlatform() \ ({ \ long __base = (long)(SDL2_BASE_NAME);\ @@ -501,9 +510,10 @@ ({ \ const char * __t__p0 = __p0;\ const char * __t__p1 = __p1;\ + va_list __t__p2 = __p2;\ 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));\ + (((int (*)(const char *, const char *, va_list ))*(void**)(__base - 358))(__t__p0, __t__p1, __t__p2));\ }) #define SDL_vsnprintf(__p0, __p1, __p2, __p3) \ @@ -511,9 +521,10 @@ char * __t__p0 = __p0;\ size_t __t__p1 = __p1;\ const char * __t__p2 = __p2;\ + va_list __t__p3 = __p3;\ 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));\ + (((int (*)(char *, size_t , const char *, va_list ))*(void**)(__base - 364))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_acos(__p0) \ @@ -1802,9 +1813,10 @@ int __t__p0 = __p0;\ SDL_LogPriority __t__p1 = __p1;\ const char * __t__p2 = __p2;\ + va_list __t__p3 = __p3;\ 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));\ + (((void (*)(int , SDL_LogPriority , const char *, va_list ))*(void**)(__base - 1294))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_LogGetOutputFunction(__p0, __p1) \ From fd94ce95cfbe32a9ddf904bfd599593ce5ed8cb1 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 9 Mar 2020 19:10:33 +0100 Subject: [PATCH 094/214] updated the MOS Makefiles to support GCC9 and build the headers by default --- Makefile.mos | 13 +++++++------ src/core/morphos/devenv/Makefile | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 42770278ea..b29972f97f 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -3,9 +3,10 @@ # Enable debug with -D__SDL_DEBUG CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG -CC = ppc-morphos-gcc-4 -noixemul +CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 +#CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I./include -CFLAGS = -cstd=c99 -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) +CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) AR = ar RANLIB = ranlib @@ -58,7 +59,7 @@ COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') -all: $(LIBRARY) lib +all: $(LIBRARY) headers lib sdk: all mkdir -p /usr/local/bin @@ -90,14 +91,14 @@ install-iso: # @cp sdl2.library $(ISOPATH)MorphOS/Libs/ src/video/SDL_blit_N.o: src/video/SDL_blit_N.c - ppc-morphos-gcc-4 $(CFLAGS) -fvec -faltivec -o $@ -c 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 - ppc-morphos-gcc-4 $(CFLAGS) -fvec -faltivec -o $@ -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) - @ppc-morphos-gcc-4 -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + @$(CC) -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c $(TARGET): $(OBJECTS) $(ARCHIVING) diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index 1821a3b830..c2afe5767f 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -1,8 +1,9 @@ # Makefile to build the SDL 2 -CC = ppc-morphos-gcc-4 -noixemul +CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 +#CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I../../../../include -I../../../../sdk -CFLAGS = -cstd=c99 -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE +CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE AR = ar RANLIB = ranlib From c5e78b5facdb203824f0e70806028079b09851fb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 11 Mar 2020 19:45:13 +0100 Subject: [PATCH 095/214] Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - change sdk directory - add Szilárd Biró in version - clean makefile --- Makefile.mos | 19 ++++++----------- src/core/morphos/SDL_amigaversion.h | 6 +++--- src/core/morphos/SDL_amigaversion.rev | 1 - src/core/morphos/devenv/Makefile | 21 ++++++++----------- .../core/morphos/sdk}/clib/sdl2_protos.h | 0 {sdk => src/core/morphos/sdk}/fd/sdl2_lib.fd | 0 .../core/morphos/sdk}/ppcinline/sdl2.h | 0 {sdk => src/core/morphos/sdk}/proto/sdl2.h | 0 8 files changed, 18 insertions(+), 29 deletions(-) delete mode 100644 src/core/morphos/SDL_amigaversion.rev rename {sdk => src/core/morphos/sdk}/clib/sdl2_protos.h (100%) rename {sdk => src/core/morphos/sdk}/fd/sdl2_lib.fd (100%) rename {sdk => src/core/morphos/sdk}/ppcinline/sdl2.h (100%) rename {sdk => src/core/morphos/sdk}/proto/sdl2.h (100%) diff --git a/Makefile.mos b/Makefile.mos index b29972f97f..9bff8750ac 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -20,7 +20,7 @@ STRIPPING = @$(ECHE) "stripping $(BOLD)$@$(NRML)..." ARCHIVING = @$(ECHE) "archiving $(BOLD)$@$(NRML)..." HEADERING = @$(ECHE) "creating headers files $(BOLD)$@$(NRML)..." -TARGET = libSDL.a +TARGET = libSDL2.a LIBRARY = sdl2.library SOURCES = \ @@ -68,13 +68,13 @@ sdk: all mkdir -p /usr/local/ppc-morphos/lib/libb32 cp sdl2-config /usr/local/bin cp include/*.h /usr/local/include/SDL2 - cp src/core/morphos/devenv/lib/libSDL.a /usr/local/lib/libSDL2.a - cp src/core/morphos/devenv/lib/libb32/libSDL.a /usr/local/lib/libb32/libSDL2.a + 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=sdk/fd/sdl2_lib.fd --clib=sdk/clib/sdl2_protos.h --proto=sdk/proto/sdl2.h - @cvinclude.pl --fd=sdk/fd/sdl2_lib.fd --clib=sdk/clib/sdl2_protos.h --inline=sdk/ppcinline/sdl2.h + @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; @@ -83,13 +83,6 @@ install: $(LIBRARY) lib cp $(LIBRARY) Libs: -flushlib $(LIBRARY) -install-iso: - @echo "not for the ISO.. skipping" - -#install-iso: $(LIBRARY) lib -# mkdir -p $(ISOPATH)MorphOS/Libs/ -# @cp sdl2.library $(ISOPATH)MorphOS/Libs/ - 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 @@ -107,7 +100,7 @@ $(TARGET): $(OBJECTS) $(LIBRARY): $(TARGET) $(COREOBJECTS) $(LINKING) - @$(CC) -nostartfiles -mresident32 -Wl,-Map=sdl2.map $(COREOBJECTS) -o $@.db -L. -lSDL -lm + @$(CC) -nostartfiles -mresident32 -Wl,-Map=sdl2.map $(COREOBJECTS) -o $@.db -L. -lSDL2 -lm $(STRIPPING) @ppc-morphos-strip -o $@ --remove-section=.comment $@.db diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index 68a46f18ec..20554d1098 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,6 +1,6 @@ #define VERSION 53 #define REVISION 0 -#define DATE "02.03.2020" +#define DATE "11.03.2020" #define VERS "sdl2.library 53.0" -#define VSTRING "sdl2.library 53.0 (04.03.2020) © Ilkka Lehtoranta, Bruno Peloille\r\n" -#define VERSTAG "\0$VER: sdl2.library 53.0 (04.03.2020) © Ilkka Lehtoranta, Bruno Peloille" +#define VSTRING "sdl2.library 53.0 (11.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" +#define VERSTAG "\0$VER: sdl2.library 53.0 (11.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" diff --git a/src/core/morphos/SDL_amigaversion.rev b/src/core/morphos/SDL_amigaversion.rev deleted file mode 100644 index d00491fd7e..0000000000 --- a/src/core/morphos/SDL_amigaversion.rev +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index c2afe5767f..f79b0bee88 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -2,7 +2,7 @@ CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 #CC = ppc-morphos-gcc-9 -noixemul -INCLUDE = -I../../../../include -I../../../../sdk +INCLUDE = -I../../../../include -I../sdk CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE AR = ar RANLIB = ranlib @@ -16,7 +16,7 @@ LINKING = @$(ECHE) "linking $(BOLD)$@$(NRML)..." STRIPPING = @$(ECHE) "stripping $(BOLD)$@$(NRML)..." ARCHIVING = @$(ECHE) "archiving $(BOLD)$@$(NRML)..." -all: lib/libSDL.a lib/libb32/libSDL.a lib/libb32/libSDL-nc.a +all: lib/libSDL2.a lib/libb32/libSDL2.a lib/libb32/libSDL2-nc.a lib: all @@ -35,35 +35,32 @@ sdl-startup-brel-nc.o: sdl-startup.c sdl-stubs.c $(COMPILING) @$(CC) $(CFLAGS) -mresident32 -o $@ -c sdl-startup.c -D__NO_SDL_CONSTRUCTORS -lib/libSDL.a: sdl-startup.o ../../../../sdk/fd/sdl2_lib.fd +lib/libSDL2.a: sdl-startup.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=$@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --gluelib=$@ @$(AR) cru $@ sdl-startup.o @ppc-morphos-ranlib $@ -lib/libb32/libSDL.a: sdl-startup-brel.o ../../../../sdk/fd/sdl2_lib.fd +lib/libb32/libSDL2.a: sdl-startup-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=$@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --brelgluelib=$@ @$(AR) cru $@ sdl-startup-brel.o @ppc-morphos-ranlib $@ -lib/libb32/libSDL-nc.a: sdl-startup-brel-nc.o ../../../../sdk/fd/sdl2_lib.fd +lib/libb32/libSDL2-nc.a: sdl-startup-brel-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=$@ + @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --brelgluelib=$@ @$(AR) cru $@ sdl-startup-brel-nc.o @ppc-morphos-ranlib $@ -install-iso: - @echo "Nothing to install-iso here." - clean: @-rm -rf lib *.s *.o dump: - objdump --disassemble-all --reloc lib/libSDL.a >lib/libSDL.s + objdump --disassemble-all --reloc lib/libSDL2.a >lib/libSDL2.s diff --git a/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h similarity index 100% rename from sdk/clib/sdl2_protos.h rename to src/core/morphos/sdk/clib/sdl2_protos.h diff --git a/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd similarity index 100% rename from sdk/fd/sdl2_lib.fd rename to src/core/morphos/sdk/fd/sdl2_lib.fd diff --git a/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h similarity index 100% rename from sdk/ppcinline/sdl2.h rename to src/core/morphos/sdk/ppcinline/sdl2.h diff --git a/sdk/proto/sdl2.h b/src/core/morphos/sdk/proto/sdl2.h similarity index 100% rename from sdk/proto/sdl2.h rename to src/core/morphos/sdk/proto/sdl2.h From 62fa7b61b6fc7c82f0cd1925c1e9a010f0806eff Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 12 Mar 2020 22:18:07 +0100 Subject: [PATCH 096/214] Fix change toggle between window to fullscreen Quick patch to fix this bug. --- src/video/SDL_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index caaa649d8a..0f76fc610a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2798,10 +2798,12 @@ SDL_OnWindowFocusLost(SDL_Window * window) } SDL_UpdateWindowGrab(window); - +#ifndef __MORPHOS__ +/* FIX BUG WITH SWITCHING WINDOW/FULLSCREEN_MASK */ if (ShouldMinimizeOnFocusLoss(window)) { SDL_MinimizeWindow(window); } +#endif } /* !!! FIXME: is this different than SDL_GetKeyboardFocus()? From fa8998cdec60a2d05ee9bdd8dcfb70a7f73ab06b Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 12 Mar 2020 22:30:08 +0100 Subject: [PATCH 097/214] Add Joystick support with lowlevel (degraded mode for MorphOS) --- include/SDL_config_morphos.h | 5 +- src/core/morphos/SDL_library.c | 3 + src/joystick/SDL_joystick.c | 3 + src/joystick/SDL_sysjoystick.h | 1 + src/joystick/amiga/SDL_sysjoystick.c | 504 +++++++++++++++++++++++ src/joystick/morphos/SDL_sysjoystick.c | 4 + src/joystick/morphos/SDL_sysjoystick_c.h | 2 + 7 files changed, 520 insertions(+), 2 deletions(-) create mode 100644 src/joystick/amiga/SDL_sysjoystick.c diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 3dfb9615f7..8fa071924d 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -142,9 +142,10 @@ /* Enable haptic drivers */ #define SDL_HAPTIC_DUMMY 1 -/* Enable input drivers */ +/* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ #define SDL_JOYSTICK_AMIGA 1 -#define SDL_JOYSTICK_MORPHOS 1 +/* Enable MORPHOS SENSORS JOYSTICK/GAMEPAD */ +//#define SDL_JOYSTICK_MORPHOS 1 /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c index 8463353c95..42dbc68486 100644 --- a/src/core/morphos/SDL_library.c +++ b/src/core/morphos/SDL_library.c @@ -58,6 +58,9 @@ struct Library *IConvBase = NULL; struct Library *ThreadPoolBase = NULL; struct Library *DynLoadBase = NULL; +//SDL_JOYSTICK_AMIGA +struct Library *LowLevelBase = NULL; + struct timerequest GlobalTimeReq; u_int32_t DataL1LineSize = 0; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 64b40a71de..7b4dce649e 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -94,6 +94,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #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 diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 5b346011cf..041cfb10d7 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -160,6 +160,7 @@ 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..1dca884cb9 --- /dev/null +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -0,0 +1,504 @@ +/* + 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. +*/ + +#ifdef SDL_JOYSTICK_AMIGA + +#include "../../SDL_internal.h" + +#include "SDL_joystick.h" +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" + +#define USE_INLINE_STDARG +#include +#define NO_LOWLEVEL_EXT +#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 */ + +/* Directions/Axis differences */ +#define MOS_PLUS 32767 /* was 127, changed by Henes (20040801) */ +#define MOS_MINUS -32768 /* was -127 */ + +#ifndef JP_TYPE_ANALOGUE +#define JP_TYPE_ANALOGUE (14<<28) /* port has analogue joystick */ +#define JP_XAXIS_MASK (255<<0) /* horizontal position */ +#define JP_YAXIS_MASK (255<<8) /* vertical position */ +#define JP_ANALOGUE_PORT_MAGIC (1<<16) /* port offset to force analogue readout */ +#endif + + +extern struct Library *LowLevelBase; + +static const unsigned long 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("SDL_SYS_JoystickGetCount()\n"); + return SDL_numjoysticks; +} + +static void SDL_SYS_JoystickDetect() +{ +} + +static int SDL_SYS_JoystickInit(void) +{ + D("SDL_SYS_JoystickInit()\n"); + + int numjoysticks = 0; + unsigned long joyflag = 0L; + + 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++; + } + + //free((void *)SDL_JoyNames); + //SDL_JoyNames = malloc(numjoysticks * MAX_JOY_NAME); + SDL_numjoysticks = numjoysticks; + return numjoysticks; + } + else + { + /* failed to open lowlevel.library! */ + SDL_SetError("Unable to open lowlevel.library"); + return 0; + } + } + else + { + return SDL_numjoysticks; + } +} + +const char *SDL_SYS_JoystickGetDeviceName(int device_index) +{ + const char *name = NULL; + + D("SDL_SYS_JoystickGetDeviceName()\n"); + + if (LowLevelBase && device_index < MAX_JOYSTICKS) + { + unsigned long 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) +{ + unsigned long temp; + + D("SDL_SYS_JoystickOpen()"); + + 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 = 3; // ?? + joystick->nhats = 1; // ?? + } + + joystick->nballs = 0; + joystick->naxes = 2; /* FIXME: even for JP_TYPE_NOTAVAIL ? */ + 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; +#endif + + return 0; +} + + +static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) +{ + ULONG data; +#ifndef NO_LOWLEVEL_EXT + ULONG data_ext; +#endif + int i; + + if(!LowLevelBase) + { + if(SDL_JoystickInit() < 1) + { + D("Initialize Joysticks first!\n"); + return; + } + } + + data = ReadJoyPort(PortIndex(joystick->instance_id)); +#ifndef NO_LOWLEVEL_EXT + if (joystick->hwdata->supports_analog) + data_ext = ReadJoyPort(PortIndex(joystick->instance_id) + JP_ANALOGUE_PORT_MAGIC); +#endif + + /* 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); + } + } + else +#endif + { + if((joystick->hwdata->joystate & (JPF_JOY_DOWN|JPF_JOY_UP)) != (data & (JPF_JOY_DOWN|JPF_JOY_UP))) + { + Sint16 value; + + /* UP and DOWN direction */ + if(data & JPF_JOY_DOWN) + { + value = MOS_PLUS; + } + else if(data & JPF_JOY_UP) + { + value = MOS_MINUS; + } + else + { + value = 0; + } + + SDL_PrivateJoystickAxis(joystick, 1, value); + } + + if((joystick->hwdata->joystate & (JPF_JOY_LEFT|JPF_JOY_RIGHT)) != (data & (JPF_JOY_LEFT|JPF_JOY_RIGHT))) + { + Sint16 value; + + /* LEFT and RIGHT direction */ + if(data & JPF_JOY_LEFT) + { + value = MOS_MINUS; + } + else if(data & JPF_JOY_RIGHT) + { + value = MOS_PLUS; + } + else + { + value = 0; + } + + SDL_PrivateJoystickAxis(joystick, 0, value); + } + } + + /* 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) +{ + + if(LowLevelBase) /* ne to reinitialize */ + { + SetJoyPortAttrs(PortIndex(joystick->instance_id), 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) +{ + if(LowLevelBase) + { + CloseLibrary(LowLevelBase); + LowLevelBase = NULL; + } + + return; +} + +static int SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) +{ + return device_index; +} + +static void SDL_SYS_JoystickSetDevicePlayerIndex(int device_index) +{ + D("Not implemented\n"); +} + +static SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int 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) +{ + return device_index; +} + +static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 hig_frequence_rumble, Uint32 duration_ms) +{ + 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 \ No newline at end of file diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 1c73bbeab1..62d716b549 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifdef SDL_JOYSTICK_MORPHOS + #include "../../SDL_internal.h" #include "SDL_joystick.h" @@ -530,3 +533,4 @@ SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = SDL_SYS_JoystickQuit, }; +#endif \ No newline at end of file diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index b423de0591..95227a6eeb 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifdef SDL_JOYSTICK_MORPHOS #ifndef SDL_SYSJOYSTICK_C_H #define SDL_SYSJOYSTICK_C_H @@ -77,3 +78,4 @@ struct sensornotify }; #endif +#endif \ No newline at end of file From 54e3822364689010ef5598c5aae3bcf2bbdae3df Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 12 Mar 2020 23:01:07 +0100 Subject: [PATCH 098/214] Fix compile --- Makefile.mos | 7 ++++--- src/joystick/amiga/SDL_sysjoystick.c | 4 ++-- src/joystick/morphos/SDL_sysjoystick.c | 5 ++--- src/joystick/morphos/SDL_sysjoystick_c.h | 5 ++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 9bff8750ac..416ea4e894 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -37,6 +37,7 @@ SOURCES = \ 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 \ @@ -59,13 +60,13 @@ COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') -all: $(LIBRARY) headers lib +all: $(LIBRARY) lib sdk: all mkdir -p /usr/local/bin mkdir -p /usr/local/include/SDL2 - mkdir -p /usr/local/ppc-morphos/lib - mkdir -p /usr/local/ppc-morphos/lib/libb32 + mkdir -p /usr/local/lib + mkdir -p /usr/local/lib/libb32 cp sdl2-config /usr/local/bin cp include/*.h /usr/local/include/SDL2 cp src/core/morphos/devenv/lib/libSDL2.a /usr/local/lib/libSDL2.a diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 1dca884cb9..e6722154fa 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -19,10 +19,10 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifdef SDL_JOYSTICK_AMIGA - #include "../../SDL_internal.h" +#ifdef SDL_JOYSTICK_AMIGA + #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 62d716b549..21805eea3e 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -19,14 +19,13 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifdef SDL_JOYSTICK_MORPHOS +#include "SDL_sysjoystick_c.h" -#include "../../SDL_internal.h" +#ifdef SDL_JOYSTICK_MORPHOS #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" -#include "SDL_sysjoystick_c.h" #include #include diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 95227a6eeb..3f12332abc 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -19,9 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ +#include "../../SDL_internal.h" + #ifdef SDL_JOYSTICK_MORPHOS -#ifndef SDL_SYSJOYSTICK_C_H -#define SDL_SYSJOYSTICK_C_H #ifndef EXEC_LISTS_H #include @@ -77,5 +77,4 @@ struct sensornotify DOUBLE values[0]; }; -#endif #endif \ No newline at end of file From e898bd1946554addd7e911ee5c9624df0ced21ed Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 12 Mar 2020 23:07:23 +0100 Subject: [PATCH 099/214] Fix inline file Fix bug with va_list --- src/core/morphos/sdk/ppcinline/sdl2.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index 10a4c7ee8d..f39535f9fe 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -34,7 +34,8 @@ #define SDL_VSetError(__p0, __p1) \ ({ \ const char * __t__p0 = __p0;\ - va_list __t__p1 = __p1;\ + va_list __t__p1;\ + va_copy(__t__p1, __p1);\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ (((int (*)(const char *, va_list ))*(void**)(__base - 40))(__t__p0, __t__p1));\ @@ -510,7 +511,8 @@ ({ \ const char * __t__p0 = __p0;\ const char * __t__p1 = __p1;\ - va_list __t__p2 = __p2;\ + va_list __t__p2; \ + va_copy(__t__p2, __p2);\ 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, __t__p2));\ @@ -521,7 +523,8 @@ char * __t__p0 = __p0;\ size_t __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3 = __p3;\ + va_list __t__p3; \ + va_copy(__t__p3, __p3);\ 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, __t__p3));\ @@ -1813,7 +1816,8 @@ int __t__p0 = __p0;\ SDL_LogPriority __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3 = __p3;\ + va_list __t__p3; \ + va_copy(__t__p3, __p3);\ 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, __t__p3));\ From bb9044b092663ebf6edc644ba1169f5c8ba7546a Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 13 Mar 2020 09:46:19 +0100 Subject: [PATCH 100/214] Update SDL_sysjoystick.c Fix buttuns and hats when detect UNKNOW joystick. --- src/joystick/amiga/SDL_sysjoystick.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index e6722154fa..25331b6865 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -260,8 +260,12 @@ static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) } else if((temp & JP_TYPE_MASK) == JP_TYPE_NOTAVAIL) { - joystick->nbuttons = 3; // ?? - joystick->nhats = 1; // ?? + joystick->nbuttons = 0; + joystick->nhats = 0; + } else { + // Default, same as + joystick->nbuttons = 3; + joystick->nhats = 1; } joystick->nballs = 0; @@ -501,4 +505,4 @@ SDL_JoystickDriver SDL_AMIGA_JoystickDriver = SDL_SYS_JoystickQuit, }; -#endif \ No newline at end of file +#endif From a0c529f17c1f8112369847b738bd5bbed5743321 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 14 Mar 2020 11:23:44 +0100 Subject: [PATCH 101/214] Somes fixes -Use SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS to fix ToggleFullscreen -Fix Mouse Relative position - add AMIGA_HandleActivation --- src/video/SDL_video.c | 5 ++-- src/video/amiga/SDL_amigaevents.c | 50 ++++++++++++++++++++++--------- src/video/amiga/SDL_amigavideo.c | 16 ++++++---- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0f76fc610a..571ed39879 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2798,12 +2798,11 @@ SDL_OnWindowFocusLost(SDL_Window * window) } SDL_UpdateWindowGrab(window); -#ifndef __MORPHOS__ -/* FIX BUG WITH SWITCHING WINDOW/FULLSCREEN_MASK */ + if (ShouldMinimizeOnFocusLoss(window)) { SDL_MinimizeWindow(window); } -#endif + } /* !!! FIXME: is this different than SDL_GetKeyboardFocus()? diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index ccd51bf6ab..d9dd39db2c 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -133,9 +133,9 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) int length = AMIGA_TranslateUnicode(m, text); if (length > 0) { text[length] = '\0'; + SDL_SendKeyboardKey(SDL_PRESSED, s); SDL_SendKeyboardText(text); } - SDL_SendKeyboardKey(SDL_PRESSED, s); } else { SDL_SendKeyboardKey(SDL_RELEASED, s); } @@ -149,10 +149,13 @@ AMIGA_MouseMove(const struct IntuiMessage *m, SDL_WindowData *data) { SDL_Mouse *mouse = SDL_GetMouse(); - if (!mouse->relative_mode || mouse->relative_mode_warp) + if (!SDL_GetRelativeMouseMode()) { struct Screen *s = data->win->WScreen; - SDL_SendMouseMotion(data->window, 0, 0, s->MouseX, s->MouseY); + 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 { @@ -198,6 +201,34 @@ static void AMIGA_GadgetEvent(_THIS, const struct IntuiMessage *m) } } +static void +AMIGA_HandleActivation(_THIS, struct IntuiMessage *m, SDL_bool activated) +{ + SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; + //D("[%s]\n", __FUNCTION__); + if(data->window) { + if (activated) { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + //OS4_SyncKeyModifiers(_this); + 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_DispatchEvent(_THIS, struct IntuiMessage *m) { @@ -228,20 +259,11 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) break; case IDCMP_ACTIVEWINDOW: - SDL_SetKeyboardFocus(data->window); - SDL_SetMouseFocus(data->window); + AMIGA_HandleActivation(_this, m, SDL_TRUE); break; case IDCMP_INACTIVEWINDOW: - if (SDL_GetKeyboardFocus() == data->window) - { - SDL_SetKeyboardFocus(NULL); - } - - if (SDL_GetMouseFocus() == data->window) - { - SDL_SetMouseFocus(NULL); - } + AMIGA_HandleActivation(_this, m, SDL_FALSE); break; case IDCMP_CHANGEWINDOW: diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index b65b4161ab..fbfa8feb38 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -24,6 +24,7 @@ #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" @@ -136,16 +137,19 @@ AMIGA_Available(void) static int AMIGA_VideoInit(_THIS) { - int rc = -1; D("[%s]\n", __FUNCTION__); - if ((rc = AMIGA_InitModes(_this)) == 0) + if (AMIGA_InitModes(_this) < 0) { - AMIGA_InitKeyboard(_this); - AMIGA_InitMouse(_this); + return SDL_SetError("Failed to initialize modes"); } - return rc; + AMIGA_InitKeyboard(_this); + AMIGA_InitMouse(_this); + + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); + + return 0; } static void @@ -342,7 +346,7 @@ AMIGA_CreateDevice(int devindex) device->VideoInit = AMIGA_VideoInit; device->VideoQuit = AMIGA_VideoQuit; device->GetDisplayModes = AMIGA_GetDisplayModes; - //device->GetDisplayBounds = X11_GetDisplayBounds; + //device->GetDisplayBounds = AMIGA_GetDisplayBounds;; device->SetDisplayMode = AMIGA_SetDisplayMode; device->SuspendScreenSaver = AMIGA_SuspendScreenSaver; device->PumpEvents = AMIGA_PumpEvents; From 6cb959d0cda190d977bf46867b008e8b80645d72 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 14 Mar 2020 17:39:51 +0100 Subject: [PATCH 102/214] Disable Resize Gadget on Window TODO later --- src/video/amiga/SDL_amigawindow.c | 94 +------------------------------ src/video/amiga/SDL_amigawindow.h | 6 +- 2 files changed, 5 insertions(+), 95 deletions(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index a62e124e90..4a97174f2f 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -97,18 +97,6 @@ AMIGA_CloseWindows(_THIS) } } -void -AMIGA_CloseWindow(_THIS, SDL_WindowData *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; @@ -453,8 +441,8 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) else flags |= WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET; - if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) - flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; + //if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) + // flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; if (data->window_title == NULL) data->window_title = AMIGA_ConvertText(window->title, MIBENUM_UTF_8, MIBENUM_SYSTEM); @@ -703,83 +691,5 @@ AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) return SDL_FALSE; } } -void -AMIGA_SetWindowResizable (_THIS, SDL_Window * window, SDL_bool resizable) -{ - if (window->flags & SDL_WINDOW_FOREIGN) { - D("Cannot modify native window '%s'\n", window->title); - return; - } - - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - - if (data->win) { - D("Closing system window '%s' before re-creation\n", window->title); - AMIGA_CloseWindow(_this, window); - } - - data->win = AMIGA_CreateWindow(_this, window); - - if (data->win) { - //OS4_CreateIconifyGadgetForWindow(_this, window); - - // Make sure the new window is active - AMIGA_ShowWindow(_this, window); - - //if ((window->flags & SDL_WINDOW_OPENGL) && data->glContext) { - // OS4_UpdateGlWindowPointer(_this, window); - //} - } else { - D("Failed to re-create window '%s'\n", window->title); - } -} - -int -AMIGA_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) -{ - struct Window *syswin = ((SDL_WindowData *) window->driverdata)->win; - LONG ret; - - UBYTE value = opacity * 255; - - D("Not supported yet - Setting window '%s' opaqueness to %d\n", window->title, value); - - // Maybe with TransparencyControl - - /*ret = SetWindowAttrs( - syswin, - WA_Opaqueness, value, - TAG_DONE); - - if (ret) { - D("Failed to set window opaqueness to %d\n", value); - return -1; - } -*/ - return 0; -} -int -AMIGA_GetWindowBordersSize(_THIS, SDL_Window * window, int * top, int * left, int * bottom, int * right) -{ - struct Window *syswin = ((SDL_WindowData *) window->driverdata)->win; - - if (top) { - *top = syswin->BorderTop; - } - - if (left) { - *left = syswin->BorderLeft; - } - - if (bottom) { - *bottom = syswin->BorderBottom; - } - - if (right) { - *right = syswin->BorderRight; - } - - 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 index 6fe89c4eec..7fb0d6a4b6 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -90,9 +90,9 @@ extern SDL_bool AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_Sys extern void AMIGA_ShowWindow_Internal(SDL_Window * window); extern void AMIGA_HideWindow_Internal(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); +//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 */ From bfbbc67e8e9fadb16715d8980b428421367bd127 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 14 Mar 2020 14:29:11 +0100 Subject: [PATCH 103/214] Fix Keyboard --- src/video/amiga/SDL_amigaevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index d9dd39db2c..c27ba927e6 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -131,9 +131,9 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) 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_SendKeyboardKey(SDL_PRESSED, s); SDL_SendKeyboardText(text); } } else { From cf14b101fe363c1e0f5d25c091d93b051737eafe Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 14 Mar 2020 22:51:15 +0100 Subject: [PATCH 104/214] Fix compiling --- src/video/amiga/SDL_amigavideo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index fbfa8feb38..fdfdf3dbab 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -397,9 +397,9 @@ AMIGA_CreateDevice(int devindex) device->ShowMessageBox = AMIGA_ShowMessageBox; - device->SetWindowResizable = AMIGA_SetWindowResizable; - device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; - device->SetWindowOpacity = AMIGA_SetWindowOpacity; + //device->SetWindowResizable = AMIGA_SetWindowResizable; + //device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; + //device->SetWindowOpacity = AMIGA_SetWindowOpacity; device->free = AMIGA_DeleteDevice; From 9acc6e5d80b1618a3437b63f37efaf39e9059cf1 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 10:20:09 +0100 Subject: [PATCH 105/214] Update TODO.MORPHOS --- TODO.MORPHOS | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index f844d1bb1d..b827041109 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -1,24 +1,20 @@ TODO -1) Compile SDL library +1) Compile SDL2.library (test with SDK 3.14 and MOS 3.13) - Make -f makefile.mos - - Not working, lot of errors here with stubs (in devenv) - Need Fix to continue.... - -2) Test, test and fix :-) + +2) Done + - fix togglefullscreen + - fix mouse position in window mode + - add joystick support with lowlevel.library (take in powersdl) + - fix keymap/keybord problem -Bugs in SDL2.0.3 Itix : -- fix and test sensors joystick (my PS4 gamepad doesnt work on SDL2 itix) - - Detection = ok (begin fix 02/03/2020) - - Crash when open it :-( - -- check keyboard (all keys a-z doesnt work on SDL2 itix) - - FIX now but need code improvement and optimization. (05/03/2020) - - - check SDL_WINDOW_FULLSCREEN (doesnt work on SDL2 itix) - - - Test / test.... +3) List of fix/add need +- add GCC9 support +- fix sensors joystick +- fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) +- fix window rezizable, bug with top border (bug see in ScummVM) +- add OpenGL support BeWorld From 49ebc7f67fc7b8831f39d24685715573083b1565 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 16:00:44 +0100 Subject: [PATCH 106/214] Fix setWindowGrab (by BSzili) Fix mouse lock into window --- src/video/amiga/SDL_amigawindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 4a97174f2f..7486b0eae5 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -636,7 +636,7 @@ AMIGA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) data->grabbed = grabbed ? 1 : 0; - if (grabbed) + if (grabbed && (data->win->Flags & WFLG_WINDOWACTIVE) == 0) AMIGA_WindowToFront(data->win); DoMethod((Object *)data->win, grabbed ? WM_ObtainEvents : WM_ReleaseEvents); From 5eba8562376205c065a5c47d06262681a2975105 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 16:03:08 +0100 Subject: [PATCH 107/214] Update TODO.MORPHOS --- TODO.MORPHOS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index b827041109..d0a00c289c 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -8,12 +8,12 @@ TODO - fix mouse position in window mode - add joystick support with lowlevel.library (take in powersdl) - fix keymap/keybord problem + - fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) 3) List of fix/add need - add GCC9 support - fix sensors joystick -- fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) - fix window rezizable, bug with top border (bug see in ScummVM) - add OpenGL support From bd523f40a60560c37cd9201b0e7fadf212e8a70f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 17:02:46 +0100 Subject: [PATCH 108/214] Fix resizable window (by BSzili) Fix window resize ! --- src/video/amiga/SDL_amigaevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index c27ba927e6..3bb646de37 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -185,7 +185,7 @@ AMIGA_ChangeWindow(const struct IntuiMessage *m, SDL_WindowData *data) { data->curr_w = w->Width; data->curr_h = w->Height; - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, data->curr_w, data->curr_h); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, (data->curr_w - w->BorderLeft - w->BorderRight), (data->curr_h - w->BorderTop - w->BorderBottom)); } } From dcca47b979e4788a78cc1fc534a176ec009f9790 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 17:04:48 +0100 Subject: [PATCH 109/214] Update TODO.MORPHOS --- TODO.MORPHOS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index d0a00c289c..e274060df1 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -9,12 +9,13 @@ TODO - add joystick support with lowlevel.library (take in powersdl) - fix keymap/keybord problem - fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) + - fix window rezizable, bug with top border (bug see in ScummVM) 3) List of fix/add need - add GCC9 support - fix sensors joystick -- fix window rezizable, bug with top border (bug see in ScummVM) -- add OpenGL support +- add OpenGL/TinyGL support +- hardware accelerated blitting and scaling with CGX functions BeWorld From 9d322910ea83a0a9aecd9a635609c3bb4105ca24 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 17:08:18 +0100 Subject: [PATCH 110/214] re-activate Resizable window --- src/video/amiga/SDL_amigawindow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 7486b0eae5..28bcec5658 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -441,8 +441,8 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) else flags |= WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET; - //if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) - // flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; + if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) + flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; if (data->window_title == NULL) data->window_title = AMIGA_ConvertText(window->title, MIBENUM_UTF_8, MIBENUM_SYSTEM); From c7162d2733f752641aaac59aa9ed5feef327c740 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Mar 2020 17:30:07 +0100 Subject: [PATCH 111/214] Update SDL_amigawindow.c --- src/video/amiga/SDL_amigawindow.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 28bcec5658..ce59ddf801 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -441,7 +441,9 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) else flags |= WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET; - if (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen) + SDL_bool win_resizable = (window->flags & SDL_WINDOW_RESIZABLE && !fullscreen); + + if (win_resizable) flags |= WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM; if (data->window_title == NULL) @@ -453,10 +455,10 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) WA_Left, left, WA_Top, top, WA_InnerWidth, w, WA_InnerHeight, h, - WA_MinWidth, min_w, - WA_MinHeight, min_h, - WA_MaxWidth, max_w, - WA_MaxHeight, max_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, From 692939e7b8f18c8bdbf4af5cc8eab54635e9bb01 Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 18 Mar 2020 08:36:12 +0100 Subject: [PATCH 112/214] work in progress TinyGL support --- src/video/amiga/SDL_amigaevents.c | 8 +- src/video/amiga/SDL_amigagl_wrapper.c | 3326 +++++++++++++++++++++++++ src/video/amiga/SDL_amigamodes.c | 18 +- src/video/amiga/SDL_amigamodes.h | 2 +- src/video/amiga/SDL_amigaopengl.c | 225 ++ src/video/amiga/SDL_amigaopengl.h | 56 + src/video/amiga/SDL_amigavideo.c | 22 +- src/video/amiga/SDL_amigawindow.c | 2 +- 8 files changed, 3637 insertions(+), 22 deletions(-) create mode 100644 src/video/amiga/SDL_amigagl_wrapper.c create mode 100644 src/video/amiga/SDL_amigaopengl.c create mode 100644 src/video/amiga/SDL_amigaopengl.h diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 3bb646de37..f9f18f7855 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -28,6 +28,7 @@ #include "SDL_amigavideo.h" #include "SDL_amigawindow.h" +#include "SDL_amigaopengl.h" #include "SDL_timer.h" #include "SDL_syswm.h" @@ -170,7 +171,7 @@ AMIGA_MouseMove(const struct IntuiMessage *m, SDL_WindowData *data) } static void -AMIGA_ChangeWindow(const struct IntuiMessage *m, SDL_WindowData *data) +AMIGA_ChangeWindow(_THIS, const struct IntuiMessage *m, SDL_WindowData *data) { struct Window *w = data->win; @@ -186,6 +187,9 @@ AMIGA_ChangeWindow(const struct IntuiMessage *m, SDL_WindowData *data) 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)); + /*if (data->glContext)*/ { + AMIGA_GL_ResizeContext(_this, data); + } } } @@ -267,7 +271,7 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) break; case IDCMP_CHANGEWINDOW: - AMIGA_ChangeWindow(m, data); + AMIGA_ChangeWindow(_this, m, data); break; case IDCMP_GADGETUP: diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c new file mode 100644 index 0000000000..a0ad2f91f2 --- /dev/null +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -0,0 +1,3326 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org + + MorphOS/TinyGL version by LouiSe@louise.amiga.hu + + 20040205 updated with new tinygl.library functions + + 20040202 returncodes fixe + +*/ + +#include "SDL_config.h" + +/* wrapper functions for TinyGL (MorphOS) */ + +#if SDL_VIDEO_DRIVER_AMIGA + +void glBegin(void) __attribute__((alias("AmiglBegin"))); +void glBindTexture(void) __attribute__((alias("AmiglBindTexture"))); +void glBlendFunc(void) __attribute__((alias("AmiglBlendFunc"))); +void glColor4f(void) __attribute__((alias("AmiglColor4f"))); +void glDisable(void) __attribute__((alias("AmiglDisable"))); +void glEnable(void) __attribute__((alias("AmiglEnable"))); +void glEnd(void) __attribute__((alias("AmiglEnd"))); +void glFlush(void) __attribute__((alias("AmiglFlush"))); +void glGenTextures(void) __attribute__((alias("AmiglGenTextures"))); +void glGetString(void) __attribute__((alias("AmiglGetString"))); +void glLoadIdentity(void) __attribute__((alias("AmiglLoadIdentity"))); +void glMatrixMode(void) __attribute__((alias("AmiglMatrixMode"))); +void glOrtho(void) __attribute__((alias("AmiglOrtho"))); +void glPixelStorei(void) __attribute__((alias("AmiglPixelStorei"))); +void glPopAttrib(void) __attribute__((alias("AmiglPopAttrib"))); +void glPopClientAttrib(void) __attribute__((alias("AmiglPopClientAttrib"))); +void glPopMatrix(void) __attribute__((alias("AmiglPopMatrix"))); +void glPushAttrib(void) __attribute__((alias("AmiglPushAttrib"))); +void glPushClientAttrib(void) __attribute__((alias("AmiglPushClientAttrib"))); +void glPushMatrix(void) __attribute__((alias("AmiglPushMatrix"))); +void glTexCoord2f(void) __attribute__((alias("AmiglTexCoord2f"))); +void glTexEnvf(void) __attribute__((alias("AmiglTexEnvf"))); +void glTexImage2D(void) __attribute__((alias("AmiglTexImage2D"))); +void glTexParameteri(void) __attribute__((alias("AmiglTexParameteri"))); +void glTexSubImage2D(void) __attribute__((alias("AmiglTexSubImage2D"))); +void glVertex2i(void) __attribute__((alias("AmiglVertex2i"))); +void glViewport(void) __attribute__((alias("AmiglViewport"))); + +#include +#define TGL_ADDON_FUNCTIONS 1 +#define TGL_DUMMY_FUNCTIONS 1 +#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 + } + +void AmiglColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { + glColorMask(red, green, blue, alpha); +} + + void AmiglAlphaFunc( GLenum func, GLclampf ref ) { + glAlphaFunc(func, ref); + } + + void AmiglBlendFunc( GLenum sfactor, GLenum dfactor ) { + glBlendFunc(sfactor, dfactor); + } + +static void AmiglLogicOp( GLenum opcode ) { + glLogicOp(opcode); +} + + void AmiglCullFace( GLenum mode ) { + glCullFace(mode); + } + + void AmiglFrontFace( GLenum mode ) { + glFrontFace(mode); + } + + void AmiglPointSize( GLfloat size ) { + glPointSize(size); + } + + void AmiglLineWidth( GLfloat width ) { + glLineWidth(width); + } + +void AmiglLineStipple( GLint factor, GLushort pattern ) { + glLineStipple(factor, pattern); +} + + void AmiglPolygonMode( GLenum face, GLenum mode ) { + glPolygonMode(face, mode); + } + + 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); +#endif + } + + void AmiglScissor( GLint x, GLint y, GLsizei width, GLsizei height) { + glScissor(x, y, width, height); + } + +void AmiglClipPlane( GLenum plane, const GLdouble *equation ) { + glClipPlane(plane, (GLdouble *)equation); +} + +static void AmiglGetClipPlane( GLenum plane, GLdouble *equation ) { + glGetClipPlane(plane, equation); + } + + void AmiglDrawBuffer( GLenum mode ) { + glDrawBuffer(mode); + } + + void AmiglReadBuffer( GLenum mode ) { + glReadBuffer(mode); + } + + void AmiglEnable( GLenum cap ) { + glEnable(cap); + } + + void AmiglDisable( GLenum cap ) { + glDisable(cap); + } + + GLboolean AmiglIsEnabled( GLenum cap ) { + return glIsEnabled(cap); + } + + void AmiglEnableClientState( GLenum cap ) { /* 1.1 */ + glEnableClientState(cap); + } + + void AmiglDisableClientState( GLenum cap ) { /* 1.1 */ + glDisableClientState(cap); + } + +static void AmiglGetBooleanv( GLenum pname, GLboolean *params ) { +#ifndef __MORPHOS__ + glGetBooleanv(pname, params); +#endif + } + + void AmiglGetDoublev( GLenum pname, GLdouble *params ) { + glGetDoublev(pname, params); + } + + void AmiglGetFloatv( GLenum pname, GLfloat *params ) { + glGetFloatv(pname, params); + } + + void AmiglGetIntegerv( GLenum pname, GLint *params ) { + glGetIntegerv(pname, params); + } + + void AmiglPushAttrib( GLbitfield mask ) { + glPushAttrib(mask); + } + + void AmiglPopAttrib( void ) { + glPopAttrib(); + } + + void AmiglPushClientAttrib( GLbitfield mask ) { /* 1.1 */ + glPushClientAttrib(mask); + } + + 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(); + } + +void AmiglFlush( void ) { + glFlush(); +} + +static void AmiglHint( GLenum target, GLenum mode ) { + glHint(target, mode); + } + +/* + * Depth Buffer + */ + + void AmiglClearDepth( GLclampd depth ) { + glClearDepth(depth); + } + + void AmiglDepthFunc( GLenum func ) { + glDepthFunc(func); + } + + void AmiglDepthMask( GLboolean flag ) { + glDepthMask(flag); + } + + void AmiglDepthRange( GLclampd near_val, GLclampd far_val ) { + glDepthRange(near_val, far_val); + } + +/* + * Transformation + */ + + void AmiglMatrixMode( GLenum mode ) { + glMatrixMode(mode); + } + + 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); + } + + 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); + } + + void AmiglViewport( GLint x, GLint y, GLsizei width, GLsizei height ) { + glViewport(x, y, width, height); + } + + void AmiglPushMatrix( void ) { + glPushMatrix(); + } + + void AmiglPopMatrix( void ) { + glPopMatrix(); + } + + void AmiglLoadIdentity( void ) { + glLoadIdentity(); + } + + void AmiglLoadMatrixd( const GLdouble *m ) { + glLoadMatrixd(m); + } + + void AmiglLoadMatrixf( const GLfloat *m ) { + glLoadMatrixf(m); + } + + void AmiglMultMatrixd( const GLdouble *m ) { + glMultMatrixd(m); + } + + void AmiglMultMatrixf( const GLfloat *m ) { + glMultMatrixf(m); + } + +static void AmiglRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { + glRotated(angle, x, y, z); + } + + void AmiglRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { + glRotatef(angle, x, y, z); + } + + void AmiglScaled( GLdouble x, GLdouble y, GLdouble z ) { + glScaled(x, y, z); + } + + 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 + */ + + GLboolean AmiglIsList( GLuint list ) { + return glIsList(list); + } + + void AmiglDeleteLists( GLuint list, GLsizei range ) { + glDeleteLists(list, range); + } + + GLuint AmiglGenLists( GLsizei range ) { + return glGenLists(range); + } + + void AmiglNewList( GLuint list, GLenum mode ) { + glNewList(list, mode); + } + + void AmiglEndList( void ) { + glEndList(); + } + + void AmiglCallList( GLuint list ) { + glCallList(list); + } + + void AmiglCallLists( GLsizei n, GLenum type, GLvoid *lists ) { + glCallLists(n, type, lists); + } + + void AmiglListBase( GLuint base ) { + glListBase(base); + } + +/* + * Drawing Functions + */ + + void AmiglBegin( GLenum mode ) { + glBegin(mode); + } + + 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); + } + + void AmiglVertex3d( GLdouble x, GLdouble y, GLdouble z ) { glVertex3d(x, y, z); } + void AmiglVertex3f( GLfloat x, GLfloat y, GLfloat z ) { glVertex3f(x, y, z); } + 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); + } + + void AmiglVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { glVertex4f(x, y, z, w); } + void AmiglVertex4i( GLint x, GLint y, GLint z, GLint w ) + { + glVertex4i(x, y, z, w); + } + + 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); } + + void AmiglVertex3dv( GLdouble *v ) + { + glVertex3dv(v); + } + + void AmiglVertex3fv( GLfloat *v ) { glVertex3fv(v); } + + void AmiglVertex3iv( const GLint *v ) + { + glVertex3iv(v); + } + +static void AmiglVertex3sv( const GLshort *v ) +{ +#ifndef __MORPHOS__ + glVertex3sv(v); +#endif +} + + void AmiglVertex4dv( GLdouble *v ) + { + glVertex4dv(v); + } + + void AmiglVertex4fv( GLfloat *v ) { glVertex4fv(v); } +static void AmiglVertex4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glVertex4iv(v); +#endif + } + +static void AmiglVertex4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glVertex4sv(v); +#endif + } + +static void AmiglNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ) +{ +#ifndef __MORPHOS__ + glNormal3b(nx, ny, nz); +#endif +} + +void AmiglNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +{ + glNormal3d(nx, ny, nz); +} + + 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); +#endif +} + +void AmiglNormal3s( GLshort nx, GLshort ny, GLshort nz ) +{ + glNormal3s(nx, ny, nz); +} + +static void AmiglNormal3bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glNormal3bv(v); +#endif + } + +void AmiglNormal3dv( const GLdouble *v ) +{ + glNormal3dv(v); +} + + void AmiglNormal3fv( GLfloat *v ) { glNormal3fv(v); } + +static void AmiglNormal3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glNormal3iv(v); +#endif + } + + 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 + } + + 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); +#endif + } + +void AmiglColor3d( GLdouble red, GLdouble green, GLdouble blue ) +{ + glColor3d(red, green, blue); +} + + 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); +#endif + } + +static void AmiglColor3s( GLshort red, GLshort green, GLshort blue ) + { +#ifndef __MORPHOS__ + glColor3s(red, green, blue); +#endif + } + + 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); +#endif + } + +static void AmiglColor3us( GLushort red, GLushort green, GLushort blue ) + { +#ifndef __MORPHOS__ + glColor3us(red, green, blue); +#endif + } + + void AmiglColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) + { + glColor4b(red, green, blue, alpha); + } + + void AmiglColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) + { + glColor4d(red, green, blue, alpha); + } + + 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); +#endif + } + +static void AmiglColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha ) + { +#ifndef __MORPHOS__ + glColor4s(red, green, blue, alpha); +#endif + } + + 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); +#endif + } + +static void AmiglColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha ) + { +#ifndef __MORPHOS__ + glColor4us(red, green, blue, alpha); +#endif + } + +static void AmiglColor3bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glColor3bv(v); +#endif + } + + void AmiglColor3dv( const GLdouble *v ) + { + glColor3dv(v); + } + + void AmiglColor3fv( GLfloat *v ) { glColor3fv(v); } + +static void AmiglColor3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glColor3iv(v); +#endif + } + +static void AmiglColor3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glColor3sv(v); +#endif + } + + void AmiglColor3ubv( GLubyte *v ) { glColor3ubv(v); } + +static void AmiglColor3uiv( const GLuint *v ) + { +#ifndef __MORPHOS__ + glColor3uiv(v); +#endif + } + +static void AmiglColor3usv( const GLushort *v ) + { +#ifndef __MORPHOS__ + glColor3usv(v); +#endif + } + +static void AmiglColor4bv( const GLbyte *v ) + { +#ifndef __MORPHOS__ + glColor4bv(v); +#endif + } + + void AmiglColor4dv( const GLdouble *v ) + { + glColor4dv(v); + } + + void AmiglColor4fv( GLfloat *v ) { glColor4fv(v); } + +static void AmiglColor4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glColor4iv(v); +#endif + } + +static void AmiglColor4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glColor4sv(v); +#endif + } + + void AmiglColor4ubv( GLubyte *v ) { glColor4ubv(v); } + +static void AmiglColor4uiv( const GLuint *v ) + { +#ifndef __MORPHOS__ + glColor4uiv(v); +#endif + } + +static void AmiglColor4usv( const GLushort *v ) + { +#ifndef __MORPHOS__ + glColor4usv(v); +#endif + } + + void AmiglTexCoord1d( GLdouble s ) + { + glTexCoord1d(s); + } + + void AmiglTexCoord1f( GLfloat s ) + { + glTexCoord1f(s); + } + +static void AmiglTexCoord1i( GLint s ) + { +#ifndef __MORPHOS__ + glTexCoord1i(s); +#endif + } + +static void AmiglTexCoord1s( GLshort s ) + { +#ifndef __MORPHOS__ + glTexCoord1s(s); +#endif + } + + void AmiglTexCoord2d( GLdouble s, GLdouble t ) + { + glTexCoord2d(s, t); + } + + void AmiglTexCoord2f( GLfloat s, GLfloat t ) { glTexCoord2f(s, t); } + + void AmiglTexCoord2i( GLint s, GLint t ) { glTexCoord2i(s, t); } + +static void AmiglTexCoord2s( GLshort s, GLshort t ) + { +#ifndef __MORPHOS__ + glTexCoord2s(s, t); +#endif + } + +static void AmiglTexCoord3d( GLdouble s, GLdouble t, GLdouble r ) + { +#ifndef __MORPHOS__ + glTexCoord3d(s, t, r); +#endif + } + + 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); +#endif + } + +static void AmiglTexCoord3s( GLshort s, GLshort t, GLshort r ) + { +#ifndef __MORPHOS__ + glTexCoord3s(s, t, r); +#endif + } + +static void AmiglTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) + { + #ifndef __MORPHOS__ + glTexCoord4d(s, t, r, 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); + #endif + } + +static void AmiglTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) + { + #ifndef __MORPHOS__ + glTexCoord4s(s, t, r, q); + #endif + } + +static void AmiglTexCoord1dv( const GLdouble *v ) + { + glTexCoord1dv(v); + } + +static void AmiglTexCoord1fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord1fv(v); +#endif + } + +static void AmiglTexCoord1iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord1iv(v); +#endif + } + +static void AmiglTexCoord1sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord1sv(v); +#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); +#endif + } + +static void AmiglTexCoord3dv( const GLdouble *v ) + { + glTexCoord3dv(v); + } + +static void AmiglTexCoord3fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord3fv(v); +#endif + } + +static void AmiglTexCoord3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord3iv(v); +#endif + } + +static void AmiglTexCoord3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord3sv(v); +#endif + } + +static void AmiglTexCoord4dv( const GLdouble *v ) + { + glTexCoord4dv(v); + } + +static void AmiglTexCoord4fv( const GLfloat *v ) + { +#ifndef __MORPHOS__ + glTexCoord4fv(v); +#endif + } + +static void AmiglTexCoord4iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glTexCoord4iv(v); +#endif + } + +static void AmiglTexCoord4sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glTexCoord4sv(v); +#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); } + +void AmiglRasterPos3i( GLint x, GLint y, GLint z ) +{ +#ifndef __MORPHOS__ + glRasterPos3i(x, y, z); +#endif +} + +void AmiglRasterPos3s( GLshort x, GLshort y, GLshort z ) +{ +#ifndef __MORPHOS__ + glRasterPos3s(x, y, 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); +#endif + } + +void AmiglRasterPos2fv( const GLfloat *v ) +{ + glRasterPos2fv((GLfloat *)v); +} + +static void AmiglRasterPos2iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glRasterPos2iv(v); +#endif + } + +static void AmiglRasterPos2sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glRasterPos2sv(v); +#endif + } + +static void AmiglRasterPos3dv( const GLdouble *v ) + { +#ifndef __MORPHOS__ + glRasterPos3dv(v); +#endif + } + +void AmiglRasterPos3fv( const GLfloat *v ) +{ + glRasterPos3fv((GLfloat *)v); +} + +static void AmiglRasterPos3iv( const GLint *v ) + { +#ifndef __MORPHOS__ + glRasterPos3iv(v); +#endif + } + +static void AmiglRasterPos3sv( const GLshort *v ) + { +#ifndef __MORPHOS__ + glRasterPos3sv(v); +#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 +} + +void AmiglMaterialf( GLenum face, GLenum pname, GLfloat param ) { glMaterialf(face, pname, param); } +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 */ + +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); + } + + GLboolean AmiglAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { +#ifndef __MORPHOS__ + return glAreTexturesResident(n, textures, residences); +#else + return 0; +#endif + } + + 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 ) { + glTexSubImage1D(target, level, xoffset, width, format, type, pixels); + } + +static void AmiglTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ) { + + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + } + +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 */ +static void AmiglBlendEquationEXT( GLenum mode ) { +#ifndef __MORPHOS__ + glBlendEquationEXT(mode); +#endif + } + +/* GL_EXT_blend_color */ +static void AmiglBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { +#ifndef __MORPHOS__ + glBlendColorEXT(red, green, blue, alpha); +#endif + } + +/* GL_EXT_polygon_offset */ +static void AmiglPolygonOffsetEXT( GLfloat factor, GLfloat bias ) { +#ifndef __MORPHOS__ + glPolygonOffsetEXT(factor, bias); +#endif + } + +/* GL_EXT_vertex_array */ + +static void AmiglVertexPointerEXT( GLint size, GLenum type, + GLsizei stride, + GLsizei count, const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glVertexPointerEXT(size, type, stride, count, ptr); +/*#else + glVertexPointer(size, type, stride, count, ptr);*/ +#endif + } + +static void AmiglNormalPointerEXT( GLenum type, GLsizei stride, + GLsizei count, const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glNormalPointerEXT(type, stride, count, ptr); +/*#else + glNormalPointer(type, stride, count, ptr);*/ +#endif + } + +static void AmiglColorPointerEXT( GLint size, GLenum type, + GLsizei stride, + GLsizei count, const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glColorPointerEXT(size, type, stride, count, ptr); +/*#else + glColorPointer(size, type, stride, count, ptr);*/ +#endif + } + +static void AmiglIndexPointerEXT( GLenum type, GLsizei stride, + GLsizei count, const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glIndexPointerEXT(type, stride, count, ptr); +#endif + } + +static void AmiglTexCoordPointerEXT( GLint size, GLenum type, + GLsizei stride, GLsizei count, + const GLvoid *ptr ) { +#ifndef __MORPHOS__ + glTexCoordPointerEXT(size, type, stride, count, ptr); +/*#else + glTexCoordPointer(size, type, stride, count, ptr);*/ +#endif + } + +static void AmiglEdgeFlagPointerEXT( GLsizei stride, GLsizei count, const GLboolean *ptr ) { +#ifndef __MORPHOS__ + glEdgeFlagPointerEXT(stride, count, ptr); +#endif + } + +static void AmiglGetPointervEXT( GLenum pname, void **params ) { +#ifndef __MORPHOS__ + glGetPointervEXT(pname, params); +/*#else + glGetPointerv(pname, params);*/ +#endif + } + +static void AmiglArrayElementEXT( GLint i ) { +#ifndef __MORPHOS__ + glArrayElementEXT(i); +/*#else + glArrayElement(i);*/ +#endif + } + +static void AmiglDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) { +#ifndef __MORPHOS__ + glDrawArraysEXT(mode, first, count); +/*#else + glDrawArrays(mode, first, count);*/ +#endif + } + +/* GL_EXT_texture_object */ + +static void AmiglGenTexturesEXT( GLsizei n, GLuint *textures ) { +#ifndef __MORPHOS__ + glGenTexturesEXT(n, textures); +#endif + } + +static void AmiglDeleteTexturesEXT( GLsizei n, const GLuint *textures) { +#ifndef __MORPHOS__ + glDeleteTexturesEXT(n, textures); +#endif + } + +static void AmiglBindTextureEXT( GLenum target, GLuint texture ) { +#ifndef __MORPHOS__ + glBindTextureEXT(target, texture); +#endif + } + +static void AmiglPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ) { +#ifndef __MORPHOS__ + glPrioritizeTexturesEXT(n, textures, priorities); +#endif + } + + GLboolean AmiglAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ) { +#ifndef __MORPHOS__ + return glAreTexturesResidentEXT(n, textures, residences); +#else + return 0; +#endif + } + + GLboolean AmiglIsTextureEXT( GLuint texture ) { +#ifndef __MORPHOS__ + return glIsTextureEXT(texture); +#else + return 0; +#endif + } + +/* GL_EXT_texture3D */ + +static void AmiglTexImage3DEXT( GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) { +#ifndef __MORPHOS__ + glTexImage3DEXT(target, level, internalFormat, width, height, depth, border, + format, type, pixels); +#endif + } + +static void AmiglTexSubImage3DEXT( 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__ + glTexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, pixels); +#endif + } + +static void AmiglCopyTexSubImage3DEXT( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ) { +#ifndef __MORPHOS__ + glCopyTexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, + x, y, width, height); +#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, 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 + } + +/* GL_SGIS_multitexture */ + +static void AmiglMultiTexCoord1dSGIS(GLenum target, GLdouble s) { +#ifndef __MORPHOS__ + glMultiTexCoord1dSGIS(target, s); +#endif + } +static void AmiglMultiTexCoord1dvSGIS(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1dvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord1fSGIS(GLenum target, GLfloat s) { +#ifndef __MORPHOS__ + glMultiTexCoord1fSGIS(target, s); +#endif + } +static void AmiglMultiTexCoord1fvSGIS(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1fvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord1iSGIS(GLenum target, GLint s) { +#ifndef __MORPHOS__ + glMultiTexCoord1iSGIS(target, s); +#endif + } +static void AmiglMultiTexCoord1ivSGIS(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1ivSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord1sSGIS(GLenum target, GLshort s) { +#ifndef __MORPHOS__ + glMultiTexCoord1sSGIS(target, s); +#endif + } +static void AmiglMultiTexCoord1svSGIS(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1svSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord2dSGIS(GLenum target, GLdouble s, GLdouble t) { +#ifndef __MORPHOS__ + glMultiTexCoord2dSGIS(target, s, t); +#endif + } +static void AmiglMultiTexCoord2dvSGIS(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2dvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord2fSGIS(GLenum target, GLfloat s, GLfloat t) { +#ifndef __MORPHOS__ + glMultiTexCoord2fSGIS(target, s, t); +#endif + } +static void AmiglMultiTexCoord2fvSGIS(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2fvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord2iSGIS(GLenum target, GLint s, GLint t) { +#ifndef __MORPHOS__ + glMultiTexCoord2iSGIS(target, s, t); +#endif + } +static void AmiglMultiTexCoord2ivSGIS(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2ivSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord2sSGIS(GLenum target, GLshort s, GLshort t) { +#ifndef __MORPHOS__ + glMultiTexCoord2sSGIS(target, s, t); +#endif + } +static void AmiglMultiTexCoord2svSGIS(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2svSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord3dSGIS(GLenum target, GLdouble s, GLdouble t, GLdouble r) { +#ifndef __MORPHOS__ + glMultiTexCoord3dSGIS(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3dvSGIS(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3dvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord3fSGIS(GLenum target, GLfloat s, GLfloat t, GLfloat r) { +#ifndef __MORPHOS__ + glMultiTexCoord3fSGIS(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3fvSGIS(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3fvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord3iSGIS(GLenum target, GLint s, GLint t, GLint r) { +#ifndef __MORPHOS__ + glMultiTexCoord3iSGIS(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3ivSGIS(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3ivSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord3sSGIS(GLenum target, GLshort s, GLshort t, GLshort r) { +#ifndef __MORPHOS__ + glMultiTexCoord3sSGIS(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3svSGIS(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3svSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord4dSGIS(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { +#ifndef __MORPHOS__ + glMultiTexCoord4dSGIS(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4dvSGIS(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4dvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord4fSGIS(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { +#ifndef __MORPHOS__ + glMultiTexCoord4fSGIS(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4fvSGIS(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4fvSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord4iSGIS(GLenum target, GLint s, GLint t, GLint r, GLint q) { +#ifndef __MORPHOS__ + glMultiTexCoord4iSGIS(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4ivSGIS(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4ivSGIS(target, v); +#endif + } +static void AmiglMultiTexCoord4sSGIS(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { +#ifndef __MORPHOS__ + glMultiTexCoord4sSGIS(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4svSGIS(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4svSGIS(target, v); +#endif + } + +static void AmiglMultiTexCoordPointerSGIS(GLenum target, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { +#ifndef __MORPHOS__ + glMultiTexCoordPointerSGIS(target, size, type, stride, pointer); +#endif + } + +static void AmiglSelectTextureSGIS(GLenum target) { +#ifndef __MORPHOS__ + glSelectTextureSGIS(target); +#endif + } + +static void AmiglSelectTextureCoordSetSGIS(GLenum target) { +#ifndef __MORPHOS__ + glSelectTextureCoordSetSGIS(target); +#endif + } + +/* GL_EXT_multitexture */ + +static void AmiglMultiTexCoord1dEXT(GLenum target, GLdouble s) { +#ifndef __MORPHOS__ + glMultiTexCoord1dEXT(target, s); +#endif + } +static void AmiglMultiTexCoord1dvEXT(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1dvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord1fEXT(GLenum target, GLfloat s) { +#ifndef __MORPHOS__ + glMultiTexCoord1fEXT(target, s); +#endif + } +static void AmiglMultiTexCoord1fvEXT(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1fvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord1iEXT(GLenum target, GLint s) { +#ifndef __MORPHOS__ + glMultiTexCoord1iEXT(target, s); +#endif + } +static void AmiglMultiTexCoord1ivEXT(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1ivEXT(target, v); +#endif + } +static void AmiglMultiTexCoord1sEXT(GLenum target, GLshort s) { +#ifndef __MORPHOS__ + glMultiTexCoord1sEXT(target, s); +#endif + } +static void AmiglMultiTexCoord1svEXT(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord1svEXT(target, v); +#endif + } +static void AmiglMultiTexCoord2dEXT(GLenum target, GLdouble s, GLdouble t) { +#ifndef __MORPHOS__ + glMultiTexCoord2dEXT(target, s, t); +#endif + } +static void AmiglMultiTexCoord2dvEXT(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2dvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord2fEXT(GLenum target, GLfloat s, GLfloat t) { +#ifndef __MORPHOS__ + glMultiTexCoord2fEXT(target, s, t); +#endif + } +static void AmiglMultiTexCoord2fvEXT(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2fvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord2iEXT(GLenum target, GLint s, GLint t) { +#ifndef __MORPHOS__ + glMultiTexCoord2iEXT(target, s, t); +#endif + } +static void AmiglMultiTexCoord2ivEXT(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2ivEXT(target, v); +#endif + } +static void AmiglMultiTexCoord2sEXT(GLenum target, GLshort s, GLshort t) { +#ifndef __MORPHOS__ + glMultiTexCoord2sEXT(target, s, t); +#endif + } +static void AmiglMultiTexCoord2svEXT(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord2svEXT(target, v); +#endif + } +static void AmiglMultiTexCoord3dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r) { +#ifndef __MORPHOS__ + glMultiTexCoord3dEXT(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3dvEXT(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3dvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord3fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r) { +#ifndef __MORPHOS__ + glMultiTexCoord3fEXT(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3fvEXT(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3fvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord3iEXT(GLenum target, GLint s, GLint t, GLint r) { +#ifndef __MORPHOS__ + glMultiTexCoord3iEXT(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3ivEXT(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3ivEXT(target, v); +#endif + } +static void AmiglMultiTexCoord3sEXT(GLenum target, GLshort s, GLshort t, GLshort r) { +#ifndef __MORPHOS__ + glMultiTexCoord3sEXT(target, s, t, r); +#endif + } +static void AmiglMultiTexCoord3svEXT(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord3svEXT(target, v); +#endif + } +static void AmiglMultiTexCoord4dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { +#ifndef __MORPHOS__ + glMultiTexCoord4dEXT(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4dvEXT(GLenum target, const GLdouble *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4dvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord4fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { +#ifndef __MORPHOS__ + glMultiTexCoord4fEXT(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4fvEXT(GLenum target, const GLfloat *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4fvEXT(target, v); +#endif + } +static void AmiglMultiTexCoord4iEXT(GLenum target, GLint s, GLint t, GLint r, GLint q) { +#ifndef __MORPHOS__ + glMultiTexCoord4iEXT(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4ivEXT(GLenum target, const GLint *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4ivEXT(target, v); +#endif + } +static void AmiglMultiTexCoord4sEXT(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { +#ifndef __MORPHOS__ + glMultiTexCoord4sEXT(target, s, t, r, q); +#endif + } +static void AmiglMultiTexCoord4svEXT(GLenum target, const GLshort *v) { +#ifndef __MORPHOS__ + glMultiTexCoord4svEXT(target, v); +#endif + } +static void AmiglInterleavedTextureCoordSetsEXT( GLint factor ) { +#ifndef __MORPHOS__ + glInterleavedTextureCoordSetsEXT(factor); +#endif + } + +static void AmiglSelectTextureEXT( GLenum target ) { +#ifndef __MORPHOS__ + glSelectTextureEXT(target); +#endif + } + +static void AmiglSelectTextureCoordSetEXT( GLenum target ) { +#ifndef __MORPHOS__ + glSelectTextureCoordSetEXT(target); +#endif + } + +static void AmiglSelectTextureTransformEXT( GLenum target ) { +#ifndef __MORPHOS__ + 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 ) { + glDrawRangeElements(mode, start, end, count, type, indices); + } + +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); +} + +/* 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); + } + +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); + } + + 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); +} + + 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 + * + */ + + 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); + } + + 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 + } + + 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 + * + */ + + 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 + * + */ + + 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) +{ + #if 1 + static CONST struct MyGLFunc table[] = + { + { "glClearColor", AmiglClearColor }, + { "glClear", AmiglClear }, + { "glIndexMask", AmiglIndexMask }, + { "glColorMask", AmiglColorMask }, + { "glAlphaFunc", AmiglAlphaFunc }, + { "glBlendFunc", AmiglBlendFunc }, + { "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 }, + #if 1 + { "glBlendEquationEXT", AmiglBlendEquationEXT }, + { "glBlendColorEXT", AmiglBlendColorEXT }, + { "glPolygonOffsetEXT", AmiglPolygonOffsetEXT }, + { "glVertexPointerEXT", AmiglVertexPointerEXT }, + { "glNormalPointerEXT", AmiglNormalPointerEXT }, + { "glColorPointerEXT", AmiglColorPointerEXT }, + { "glIndexPointerEXT", AmiglIndexPointerEXT }, + { "glTexCoordPointerEXT", AmiglTexCoordPointerEXT }, + { "glEdgeFlagPointerEXT", AmiglEdgeFlagPointerEXT }, + { "glGetPointervEXT", AmiglGetPointervEXT }, + { "glArrayElementEXT", AmiglArrayElementEXT }, + { "glDrawArraysEXT", AmiglDrawArraysEXT }, + { "glGenTexturesEXT", AmiglGenTexturesEXT }, + { "glDeleteTexturesEXT", AmiglDeleteTexturesEXT }, + { "glBindTextureEXT", AmiglBindTextureEXT }, + { "glPrioritizeTexturesEXT", AmiglPrioritizeTexturesEXT }, + { "glAreTexturesResidentEXT", AmiglAreTexturesResidentEXT }, + { "glIsTextureEXT", AmiglIsTextureEXT }, + { "glTexImage3DEXT", AmiglTexImage3DEXT }, + { "glTexSubImage3DEXT", AmiglTexSubImage3DEXT }, + { "glCopyTexSubImage3DEXT", AmiglCopyTexSubImage3DEXT }, + { "glColorTableEXT", AmiglColorTableEXT }, + { "glColorSubTableEXT", AmiglColorSubTableEXT }, + { "glGetColorTableEXT", AmiglGetColorTableEXT }, + { "glGetColorTableParameterfvEXT", AmiglGetColorTableParameterfvEXT }, + { "glGetColorTableParameterivEXT", AmiglGetColorTableParameterivEXT }, + { "glMultiTexCoord1dSGIS", AmiglMultiTexCoord1dSGIS }, + { "glMultiTexCoord1dvSGIS", AmiglMultiTexCoord1dvSGIS }, + { "glMultiTexCoord1fSGIS", AmiglMultiTexCoord1fSGIS }, + { "glMultiTexCoord1fvSGIS", AmiglMultiTexCoord1fvSGIS }, + { "glMultiTexCoord1iSGIS", AmiglMultiTexCoord1iSGIS }, + { "glMultiTexCoord1ivSGIS", AmiglMultiTexCoord1ivSGIS }, + { "glMultiTexCoord1sSGIS", AmiglMultiTexCoord1sSGIS }, + { "glMultiTexCoord1svSGIS", AmiglMultiTexCoord1svSGIS }, + { "glMultiTexCoord2dSGIS", AmiglMultiTexCoord2dSGIS }, + { "glMultiTexCoord2dvSGIS", AmiglMultiTexCoord2dvSGIS }, + { "glMultiTexCoord2fSGIS", AmiglMultiTexCoord2fSGIS }, + { "glMultiTexCoord2fvSGIS", AmiglMultiTexCoord2fvSGIS }, + { "glMultiTexCoord2iSGIS", AmiglMultiTexCoord2iSGIS }, + { "glMultiTexCoord2ivSGIS", AmiglMultiTexCoord2ivSGIS }, + { "glMultiTexCoord2sSGIS", AmiglMultiTexCoord2sSGIS }, + { "glMultiTexCoord2svSGIS", AmiglMultiTexCoord2svSGIS }, + { "glMultiTexCoord3dSGIS", AmiglMultiTexCoord3dSGIS }, + { "glMultiTexCoord3dvSGIS", AmiglMultiTexCoord3dvSGIS }, + { "glMultiTexCoord3fSGIS", AmiglMultiTexCoord3fSGIS }, + { "glMultiTexCoord3fvSGIS", AmiglMultiTexCoord3fvSGIS }, + { "glMultiTexCoord3iSGIS", AmiglMultiTexCoord3iSGIS }, + { "glMultiTexCoord3ivSGIS", AmiglMultiTexCoord3ivSGIS }, + { "glMultiTexCoord3sSGIS", AmiglMultiTexCoord3sSGIS }, + { "glMultiTexCoord3svSGIS", AmiglMultiTexCoord3svSGIS }, + { "glMultiTexCoord4dSGIS", AmiglMultiTexCoord4dSGIS }, + { "glMultiTexCoord4dvSGIS", AmiglMultiTexCoord4dvSGIS }, + { "glMultiTexCoord4fSGIS", AmiglMultiTexCoord4fSGIS }, + { "glMultiTexCoord4fvSGIS", AmiglMultiTexCoord4fvSGIS }, + { "glMultiTexCoord4iSGIS", AmiglMultiTexCoord4iSGIS }, + { "glMultiTexCoord4ivSGIS", AmiglMultiTexCoord4ivSGIS }, + { "glMultiTexCoord4sSGIS", AmiglMultiTexCoord4sSGIS }, + { "glMultiTexCoord4svSGIS", AmiglMultiTexCoord4svSGIS }, + { "glMultiTexCoordPointerSGIS", AmiglMultiTexCoordPointerSGIS }, + { "glSelectTextureSGIS", AmiglSelectTextureSGIS }, + { "glSelectTextureCoordSetSGIS", AmiglSelectTextureCoordSetSGIS }, + { "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 }, + { "glPointParameterfEXT", AmiglPointParameterfEXT }, + { "glPointParameterfvEXT", AmiglPointParameterfvEXT }, + { "glDrawRangeElements", AmiglDrawRangeElements }, + { "glTexImage3D", AmiglTexImage3D }, + { "glTexSubImage3D", AmiglTexSubImage3D }, + { "glCopyTexSubImage3D", AmiglCopyTexSubImage3D }, + { "glLockArraysEXT", AmiglLockArraysEXT }, + { "glUnlockArraysEXT", AmiglUnlockArraysEXT }, + #endif + + { "glActiveTextureARB", AmiglActiveTextureARB }, + { "glMultiTexCoord2fARB", AmiglMultiTexCoord2fARB }, + { "glMultiTexCoord3fARB", AmiglMultiTexCoord3fARB }, + { "glMultiTexCoord4fARB", AmiglMultiTexCoord4fARB }, + { "glMultiTexCoord2fvARB", AmiglMultiTexCoord2fvARB }, + { "glMultiTexCoord3fvARB", AmiglMultiTexCoord3fvARB }, + { "glMultiTexCoord4fvARB", AmiglMultiTexCoord4fvARB }, + { "glMultiTexCoord2dvARB", AmiglMultiTexCoord2dvARB }, + { "glMultiTexCoord3dvARB", AmiglMultiTexCoord3dvARB }, + { "glClientActiveTextureARB", AmiglClientActiveTextureARB }, + + { "gluLookAt", AmigluLookAt }, + { "gluPerspective", AmigluPerspective }, + { "gluPickMatrix", AmigluPickMatrix }, + + #if 0 + { "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); + #endif + + return NULL; +} + +#endif /* SDL_VIDEO_DRIVER_AMIGA */ diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index b2347af972..446c824383 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -328,7 +328,7 @@ AMIGA_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) } int -AMIGA_GetScreen(_THIS, BYTE fullscreen) +AMIGA_GetScreen(_THIS, BYTE fullscreen, SDL_bool support3d) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; struct Screen *screen; @@ -344,11 +344,15 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen) } else { - static const size_t screentags[] = + struct TagItem screentags[] = { - SA_Quiet, TRUE, SA_ShowTitle, FALSE, SA_AutoScroll, TRUE, SA_Title, (size_t)"SDL", - SA_AdaptSize, TRUE, - TAG_DONE + {SA_Quiet, TRUE}, + {SA_ShowTitle, FALSE}, + {SA_AutoScroll, TRUE}, + {SA_Title, (IPTR)"SDL"}, + {SA_AdaptSize, TRUE}, + {support3d ? SA_3DSupport : TAG_IGNORE, TRUE}, + {TAG_DONE} }; D("[%s] Open screen %ldx%ldx%ld\n", __FUNCTION__, data->ScrWidth, data->ScrHeight, data->ScrDepth); @@ -360,7 +364,7 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen) SA_Width, data->ScrWidth, SA_Height, data->ScrHeight, SA_Depth, data->ScrDepth, - TAG_MORE, screentags); + TAG_MORE, (IPTR)screentags); } else { @@ -369,7 +373,7 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen) SA_Height, data->ScrHeight, SA_Depth, data->ScrDepth, SA_MonitorName, data->ScrMonName, - TAG_MORE, screentags); + TAG_MORE, (IPTR)screentags); } data->CustomScreen = screen; diff --git a/src/video/amiga/SDL_amigamodes.h b/src/video/amiga/SDL_amigamodes.h index 1ec5d185cf..e761477eae 100644 --- a/src/video/amiga/SDL_amigamodes.h +++ b/src/video/amiga/SDL_amigamodes.h @@ -37,7 +37,7 @@ typedef struct 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); +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 */ diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c new file mode 100644 index 0000000000..f19bfe0c22 --- /dev/null +++ b/src/video/amiga/SDL_amigaopengl.c @@ -0,0 +1,225 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org + + MorphOS/TinyGL support by LouiSe@louise.amiga.hu + + HISTORY: + + 20040507 Window title (SetCaption) fixed for TGL window + + 20040505 AmigaMesa code removed + GLAInitializeContextScreen() added for fullscreen mode + + 20040501 Debug lines added + + 20040306 updated for new tinyl (AMIGA_GL_Update) + + 20040202 AMIGA_GL_GetAttribute() function fixed + + 20040131 code cleanup + + 20040130 Sixk's patches added + + 20040101 first release + +*/ +#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 + +extern 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("[SDL] AMIGA_GL_LoadLibrary()\n"); + + if (SDL2Base->MyTinyGLBase) { + if (!TinyGLBase) + TinyGLBase = OpenLibrary("tinygl.library", 50); // This is opened only once, closed only at final exit + + if (TinyGLBase) { + *SDL2Base->MyTinyGLBase = TinyGLBase; + return 0; + } + } + + SDL_SetError("Failed to open minigl.library"); + + return -1; +} + +void *AMIGA_GL_GetProcAddress(_THIS, const char *proc) +{ + void *func = NULL; + + D("[SDL] AMIGA_GL_GetProcAddress()\n"); + + func = AmiGetGLProc(proc); + + return func; +} + +void AMIGA_GL_UnloadLibrary(_THIS) +{ + D("[SDL] AMIGA_GL_UnloadLibrary()\n"); + + 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(); + + 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); + + 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) +{ + if (window && context) { + *SDL2Base->MyGLContext = __tglContext = context; + return 0; + } + + return -1; +} + +void AMIGA_GL_GetDrawableSize(_THIS, SDL_Window * window, int *w, int *h) +{ + if (window) { + SDL_WindowData * data = window->driverdata; + + if (w) { + *w = data->win->Width - data->win->BorderLeft - data->win->BorderRight; + } + + if (h) { + *h = data->win->Height - data->win->BorderTop - data->win->BorderBottom; + } + } +} + +int AMIGA_GL_SetSwapInterval(_THIS, int interval) +{ + return 0; // pretend to succeed +} + +int AMIGA_GL_GetSwapInterval(_THIS) +{ + SDL_VideoData *data = _this->driverdata; + + // full screen double buffering is always vsynced + return data->CustomScreen != NULL ? 1 : 0; +} + +int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window) +{ + D("[SDL] AMIGA_GL_SwapWindow()\n"); + + // TODO check the window context + GLASwapBuffers(__tglContext); + return 0; +} + +void +AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context) +{ + if (context) { + GLADestroyContext((GLContext *)context); + } +} + +int AMIGA_GL_ResizeContext(_THIS, SDL_WindowData *data) +{ + //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + + if (vd->CustomScreen) { + // only for window contexts + return -1; + } + + // TODO check the window context + int success = GLAReinitializeContextWindowed(__tglContext, data->win); + 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..12687d7ae1 --- /dev/null +++ b/src/video/amiga/SDL_amigaopengl.h @@ -0,0 +1,56 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org + + MorphOS/TinyGL support by LouiSe@louise.amiga.hu + + HISTORY: + + 20040131 - code cleanup + +*/ + +/* TinyGL implementation of SDL OpenGL support */ + +#include "../../SDL_internal.h" + +#ifndef _SDL_amigaopengl_h +#define _SDL_amigaopengl_h + +/*#include +#include +#include */ + +/* 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_WindowData *data); + +#endif /* _SDL_amigaopengl_h */ diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index fdfdf3dbab..2f5bee676b 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -36,6 +36,7 @@ #include "SDL_amigavideo.h" #include "SDL_amigawindow.h" #include "SDL_amigamessagebox.h" +#include "SDL_amigaopengl.h" #include #include @@ -379,17 +380,16 @@ AMIGA_CreateDevice(int devindex) device->shape_driver.SetWindowShape = AMIGA_SetWindowShape; device->shape_driver.ResizeWindowShape = AMIGA_ResizeWindowShape; -#if SDL_VIDEO_OPENGL_GLX - device->GL_LoadLibrary = X11_GL_LoadLibrary; - device->GL_GetProcAddress = X11_GL_GetProcAddress; - device->GL_UnloadLibrary = X11_GL_UnloadLibrary; - device->GL_CreateContext = X11_GL_CreateContext; - device->GL_MakeCurrent = X11_GL_MakeCurrent; - device->GL_SetSwapInterval = X11_GL_SetSwapInterval; - device->GL_GetSwapInterval = X11_GL_GetSwapInterval; - device->GL_SwapWindow = X11_GL_SwapWindow; - device->GL_DeleteContext = X11_GL_DeleteContext; -#endif + 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; diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index ce59ddf801..532b0dbe25 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -367,7 +367,7 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) 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); + AMIGA_GetScreen(vd->VideoDevice, vd->FullScreen, (window->flags & SDL_WINDOW_OPENGL) != 0); scr = vd->WScreen; From b0afa2ca3198bec389912a6722ff2cb162988a92 Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 18 Mar 2020 08:45:22 +0100 Subject: [PATCH 113/214] implemented SetWindowGammaRamp for MorphOS --- src/video/amiga/SDL_amigavideo.h | 1 + src/video/amiga/SDL_amigawindow.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigavideo.h b/src/video/amiga/SDL_amigavideo.h index 23b5c89ba1..adf53e8015 100644 --- a/src/video/amiga/SDL_amigavideo.h +++ b/src/video/amiga/SDL_amigavideo.h @@ -61,6 +61,7 @@ typedef struct SDL_VideoData ULONG sdlpixfmt; ULONG coltab[256]; + UBYTE gammatable[3][256]; LONG ScreenSaverSuspendCount; diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 532b0dbe25..b4e4999251 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -620,9 +620,23 @@ AMIGA_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _displa int AMIGA_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { - //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *vd = data->videodata; + int i; - #warning implement me + 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; } From c8d68c494367b3fb543d50a3f1975ea11c710779 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 13:01:38 +0100 Subject: [PATCH 114/214] Update SDL_startup.c --- src/core/morphos/SDL_startup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/morphos/SDL_startup.c b/src/core/morphos/SDL_startup.c index 5941ad1cbb..c6809844ed 100644 --- a/src/core/morphos/SDL_startup.c +++ b/src/core/morphos/SDL_startup.c @@ -27,7 +27,9 @@ #include "SDL_library.h" /*********************************************************************/ - +struct SDL_Library *SDL2Base; +struct Library *TinyGLBase; + int ThisRequiresConstructorHandling = 0; /* This function must preserve all registers except r13 */ @@ -54,6 +56,8 @@ 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) From acf1d94cb87156265ee19212610f25e9694d8410 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 13:03:33 +0100 Subject: [PATCH 115/214] Disable glMultiTexCoord3dvARB --- src/video/amiga/SDL_amigagl_wrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index a0ad2f91f2..7bdd52a68a 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -2413,7 +2413,7 @@ static void AmiglUnlockArraysEXT( void ) { #ifdef __MORPHOS__ #define glMultiTexCoord2dvARB(a, v) GLMultiTexCoord2dvARB(__tglContext, a, v) -#define glMultiTexCoord3dvARB(a, v) GLMultiTexCoord3dvARB(__tglContext, a, v) +//#define glMultiTexCoord3dvARB(a, v) GLMultiTexCoord3dvARB(__tglContext, a, v) #endif static void AmiglActiveTextureARB(GLenum unit) { @@ -2449,7 +2449,7 @@ static void AmiglMultiTexCoord2dvARB(GLenum unit, const GLdouble *v) { } static void AmiglMultiTexCoord3dvARB(GLenum unit, const GLdouble *v) { - glMultiTexCoord3dvARB(unit, v); + //glMultiTexCoord3dvARB(unit, v); } static void AmiglClientActiveTextureARB(GLenum unit) { From d5342eded28f6c00e5c5b6e3336ca2ce90265197 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 15:04:55 +0100 Subject: [PATCH 116/214] fix __tglContext --- src/video/amiga/SDL_amigaopengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index f19bfe0c22..5cc47ffd6a 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -64,7 +64,7 @@ #include #include -extern GLContext *__tglContext; +GLContext *__tglContext; extern void *AmiGetGLProc(const char *proc); //struct Screen *DefaultScreen; From b9355b295a8393b428393ec6203c572ca2de24be Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 18 Mar 2020 16:09:22 +0100 Subject: [PATCH 117/214] enabled the OpenGL renderer on MorphOS --- Makefile.mos | 1 + include/SDL_config_morphos.h | 7 +------ src/render/opengl/SDL_glfuncs.h | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 416ea4e894..5fa0efcc73 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -44,6 +44,7 @@ SOURCES = \ 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 \ diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 8fa071924d..2b4eb712dc 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -168,16 +168,11 @@ /* Enable assembly routines */ #define SDL_ALTIVEC_BLITTERS 1 -#define SDL_VIDEO_RENDER_SW 1 - /* Maybe later */ #ifndef SDL_VIDEO_RENDER_OGL -//#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL 1 #endif -/* Need or not... */ -#define SDL_HAVE_YUV 1 - /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL #define SDL_VIDEO_OPENGL 1 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)) From aabfc6ac3a0da1c6a49165d030cfbff8fcda9af0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 16:35:58 +0100 Subject: [PATCH 118/214] Update makefil.mos for test --- test/Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Makefile.mos b/test/Makefile.mos index da3d5acdf4..f5513b7809 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -2,7 +2,7 @@ CC = ppc-morphos-gcc-9 CFLAGS = -noixemul -O2 -Wall -g -I../include -LIBS = -L../src/core/morphos/devenv/lib/ -lSDL -noixemul -lm +LIBS = -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm TARGETS = \ checkkeys \ From 189735d1cf4244f6ab21d3129d17f2046afc885f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 16:43:24 +0100 Subject: [PATCH 119/214] Update Makefile.mos --- Makefile.mos | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 5fa0efcc73..ef7e280371 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -63,15 +63,15 @@ OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') all: $(LIBRARY) lib -sdk: all +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 sdl2-config /usr/local/bin 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 + cp sdl2-config /usr/local/bin headers: $(HEADERING) From 20bbded65a8f4fa2448d594667dc27a37b9c88c0 Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 18 Mar 2020 17:14:54 +0100 Subject: [PATCH 120/214] improved the debug log in SDL_amigaopengl --- src/video/amiga/SDL_amigaopengl.c | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index 5cc47ffd6a..bea98de868 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -73,7 +73,7 @@ extern struct SDL_Library *SDL2Base; int AMIGA_GL_LoadLibrary(_THIS, const char *path) { - D("[SDL] AMIGA_GL_LoadLibrary()\n"); + D("[%s]\n", __FUNCTION__); if (SDL2Base->MyTinyGLBase) { if (!TinyGLBase) @@ -94,16 +94,16 @@ void *AMIGA_GL_GetProcAddress(_THIS, const char *proc) { void *func = NULL; - D("[SDL] AMIGA_GL_GetProcAddress()\n"); - func = AmiGetGLProc(proc); + D("[%s] proc %s func 0x%08lx\n", __FUNCTION__, proc, func); + return func; } void AMIGA_GL_UnloadLibrary(_THIS) { - D("[SDL] AMIGA_GL_UnloadLibrary()\n"); + D("[%s]\n", __FUNCTION__); if (SDL2Base->MyTinyGLBase && *SDL2Base->MyTinyGLBase && TinyGLBase) { CloseLibrary(TinyGLBase); @@ -119,6 +119,8 @@ SDL_GLContext AMIGA_GL_CreateContext(_THIS, SDL_Window * window) GLContext *glcont = GLInit(); + D("[%s] context 0x%08lx\n", __FUNCTION__, glcont); + if (glcont) { int success; struct TagItem tgltags[] = @@ -138,6 +140,8 @@ SDL_GLContext AMIGA_GL_CreateContext(_THIS, SDL_Window * window) success = GLAInitializeContext(glcont, tgltags); + D("[%s] success %d\n", __FUNCTION__, success); + if (success) { *SDL2Base->MyGLContext = __tglContext = glcont; return glcont; @@ -154,6 +158,8 @@ SDL_GLContext AMIGA_GL_CreateContext(_THIS, SDL_Window * window) 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; @@ -164,21 +170,27 @@ AMIGA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 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 } @@ -186,13 +198,15 @@ 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("[SDL] AMIGA_GL_SwapWindow()\n"); + //D("[%s]\n", __FUNCTION__); // TODO check the window context GLASwapBuffers(__tglContext); @@ -202,6 +216,8 @@ int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window) void AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context) { + D("[%s] context 0x%08lx\n", __FUNCTION__, context); + if (context) { GLADestroyContext((GLContext *)context); } @@ -211,6 +227,9 @@ int AMIGA_GL_ResizeContext(_THIS, SDL_WindowData *data) { //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *vd = data->videodata; + int success; + + D("[%s]\n", __FUNCTION__); if (vd->CustomScreen) { // only for window contexts @@ -218,7 +237,9 @@ int AMIGA_GL_ResizeContext(_THIS, SDL_WindowData *data) } // TODO check the window context - int success = GLAReinitializeContextWindowed(__tglContext, data->win); + success = GLAReinitializeContextWindowed(__tglContext, data->win); + D("[%s] success %d\n", __FUNCTION__, success); + return success ? 0 : -1; } From b4593bd309a4bdda585f698c16a479d386eb560e Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 18 Mar 2020 17:17:38 +0100 Subject: [PATCH 121/214] don't bail out when an OpenGL renderer function is missing on MorphOS --- src/render/opengl/SDL_render_gl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 26cfd7cf9c..c4bbf920cd 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -239,7 +239,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); \ From ef9ca8bea5c1a7e05ed8ff53b9a3ea589f50d683 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 21:55:03 +0100 Subject: [PATCH 122/214] fix --- src/core/morphos/sdk/clib/sdl2_protos.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 14b95fd723..2d98e759ef 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -563,7 +563,6 @@ 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); -SDL_GLContext SDL_GL_CreateContext(SDL_Window * int SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context); SDL_Window* SDL_GL_GetCurrentWindow(void); SDL_GLContext SDL_GL_GetCurrentContext(void); From 23c48900bac1948ac35a4e4150dd2971ce56cc4d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 22:14:42 +0100 Subject: [PATCH 123/214] Update SDL_GL functions --- src/core/morphos/sdk/ppcinline/sdl2.h | 128 ++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index f39535f9fe..b9783bf1bd 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -4161,6 +4161,134 @@ (((float (*)(float ))*(void**)(__base - 2932))(__t__p0));\ }) +#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_GetProcAddress(__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 - 3658))(__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_tan(__p0) \ ({ \ double __t__p0 = __p0;\ From 77d5ae9f5b8fbb8ace9e71dd93dc3d7b16dd23fc Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 22:15:53 +0100 Subject: [PATCH 124/214] Add SDL_GL functions --- src/core/morphos/sdk/fd/sdl2_lib.fd | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd index 171c37761e..ebe4251e03 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -606,4 +606,20 @@ 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) \ No newline at end of file +SDL_strtokr(s1,s2,saveptr)(sysv,r12base) +SDL_GL_LoadLibrary(path)(sysv,r12base) +SDL_GL_GetProcAddress(proc)(sysv,r12base) +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) From 02cddf9a52b2ba3ad27109af828a7e884e57e7e0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 18 Mar 2020 22:18:12 +0100 Subject: [PATCH 125/214] Update SDL_GL functions --- src/core/morphos/SDL_stubs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/morphos/SDL_stubs.h b/src/core/morphos/SDL_stubs.h index 1cf7e98e08..971fd97c4d 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -673,8 +673,7 @@ STUB(SDL_wcsstr) STUB(SDL_wcsncmp) STUB(SDL_strtokr) - -#if 0 + STUB(SDL_GL_LoadLibrary) STUB(SDL_GL_GetProcAddress) STUB(SDL_GL_UnloadLibrary) @@ -691,7 +690,6 @@ STUB(SDL_GL_GetSwapInterval) STUB(SDL_GL_SwapWindow) STUB(SDL_GL_DeleteContext) -#endif #if 0 /* Haptic */ From 1e6efa3ff068a4286982e17fc7b2b0e7fa768c17 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 11:16:51 +0100 Subject: [PATCH 126/214] Update sdl-startup.c --- src/core/morphos/devenv/sdl-startup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c index 1793a68390..c704b84a83 100644 --- a/src/core/morphos/devenv/sdl-startup.c +++ b/src/core/morphos/devenv/sdl-startup.c @@ -23,7 +23,7 @@ extern struct Library *SDL2Base; #else void _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 _INIT_4_TinyGLBase(void) __attribute__((alias("__CSTP_init_TinyGLBase"))); //void _EXIT_4_TinyGLBase(void) __attribute__((alias("__DSTP_cleanup_TinyGLBase"))); struct Library *SDL2Base; @@ -45,7 +45,7 @@ void __SDL2_OpenLibError(ULONG version, const char *name) static const char libname[] = "sdl2.library"; static BPTR OldLock, NewLock; -static CONSTRUCTOR_P(init_TinyGLBase, 101) +/*static CONSTRUCTOR_P(init_TinyGLBase, 101) { CONST_STRPTR tglname = "tinygl.library"; @@ -57,7 +57,7 @@ static CONSTRUCTOR_P(init_TinyGLBase, 101) __SDL2_OpenLibError(50, tglname); return (TinyGLBase == NULL); -} +}*/ static CONSTRUCTOR_P(init_SDL2Base, 100) { @@ -70,6 +70,7 @@ static CONSTRUCTOR_P(init_SDL2Base, 100) if(NewLock) { SDL2Base = base; + SDL_InitTGL((void **) &__tglContext, (struct Library **) &TinyGLBase); OldLock = CurrentDir(NewLock); } else From 169a43767e54c895aa436355c3abff19bf8e2f73 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 14:32:02 +0100 Subject: [PATCH 127/214] Test __tglContext --- src/video/amiga/SDL_amigaopengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index bea98de868..5f2e0b85ba 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -231,8 +231,8 @@ int AMIGA_GL_ResizeContext(_THIS, SDL_WindowData *data) D("[%s]\n", __FUNCTION__); - if (vd->CustomScreen) { - // only for window contexts + if (__tglContext == NULL || vd->CustomScreen) { + // only for window contexts and __tglContext exist return -1; } From e926039ce0b125273847903a21514f4b7fc3175f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 14:34:02 +0100 Subject: [PATCH 128/214] Disabled support SDL_VIDEO_RENDER_OGL --- include/SDL_config_morphos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 2b4eb712dc..e3b71ce243 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -170,7 +170,7 @@ /* Maybe later */ #ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 +//#define SDL_VIDEO_RENDER_OGL 1 #endif /* Enable OpenGL support */ From b481a8391feacfe46a78acbb5250645a78524c1e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 14:47:30 +0100 Subject: [PATCH 129/214] Last news at 19032020 --- TODO.MORPHOS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TODO.MORPHOS b/TODO.MORPHOS index e274060df1..63cf6fa0b8 100644 --- a/TODO.MORPHOS +++ b/TODO.MORPHOS @@ -10,12 +10,15 @@ TODO - fix keymap/keybord problem - fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) - fix window rezizable, bug with top border (bug see in ScummVM) - + - add OpenGL/TinyGL support : ok for opengl Window context + 3) List of fix/add need - add GCC9 support - fix sensors joystick -- add OpenGL/TinyGL support - hardware accelerated blitting and scaling with CGX functions +- hardware accelerated opengl renderer = OGL support / need GL_BGRA format for the glTexImage2D input and glReadPixels output + https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=12836&forum=12 +- make a SDL2_mixer.library : same here all is ready but library need expert's help BeWorld From 20a13347f2655446f6647f102061f4b672b12859 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 19 Mar 2020 18:00:48 +0100 Subject: [PATCH 130/214] fix the GL context after window / full screen switches on MorphOS --- src/video/amiga/SDL_amigaevents.c | 2 +- src/video/amiga/SDL_amigaopengl.c | 23 +++++++++++++++++------ src/video/amiga/SDL_amigaopengl.h | 2 +- src/video/amiga/SDL_amigawindow.c | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index f9f18f7855..2fd2be9581 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -188,7 +188,7 @@ AMIGA_ChangeWindow(_THIS, const struct IntuiMessage *m, SDL_WindowData *data) 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)); /*if (data->glContext)*/ { - AMIGA_GL_ResizeContext(_this, data); + AMIGA_GL_ResizeContext(_this, data->window); } } } diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index 5f2e0b85ba..2a899f49da 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -223,21 +223,32 @@ AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context) } } -int AMIGA_GL_ResizeContext(_THIS, SDL_WindowData *data) +int AMIGA_GL_ResizeContext(_THIS, SDL_Window *window) { - //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *vd = data->videodata; int success; D("[%s]\n", __FUNCTION__); - if (__tglContext == NULL || vd->CustomScreen) { - // only for window contexts and __tglContext exist + if (__tglContext == NULL) { + // only if __tglContext exists + D("[%s] no OpenGL context\n", __FUNCTION__); return -1; } - // TODO check the window context - success = GLAReinitializeContextWindowed(__tglContext, data->win); + 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; diff --git a/src/video/amiga/SDL_amigaopengl.h b/src/video/amiga/SDL_amigaopengl.h index 12687d7ae1..8fd625b6f7 100644 --- a/src/video/amiga/SDL_amigaopengl.h +++ b/src/video/amiga/SDL_amigaopengl.h @@ -51,6 +51,6 @@ 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_WindowData *data); +extern int AMIGA_GL_ResizeContext(_THIS, SDL_Window *window); #endif /* _SDL_amigaopengl_h */ diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index b4e4999251..c20fc89e6d 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -614,6 +614,7 @@ AMIGA_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _displa AMIGA_OpenWindows(_this); //AMIGA_UpdateWindowState(_this, window); + AMIGA_GL_ResizeContext(_this, window); } From 72586dca0b2ac2f602386eb96920422a23eba769 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 19:04:37 +0100 Subject: [PATCH 131/214] add headers of tinygl for MorphOS --- include/SDL_opengl.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 96ae3f4c7d..913078f80e 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 + #else #ifndef __IPHONEOS__ /* No OpenGL on iOS. */ From fc05b471282c17015ba807a3843d6ad5672de619 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 20:00:25 +0100 Subject: [PATCH 132/214] add include SDL_opengl_glext.h --- include/SDL_opengl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 913078f80e..032cc3f633 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -49,6 +49,7 @@ #include #include #include +#include "SDL_opengl_glext.h" #else From 60abb21d243174f1c09dbf33c4e6de7b62672c3d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 20:08:55 +0100 Subject: [PATCH 133/214] GLuint64EXT and GLuint64 redeclared on MorphOS --- include/SDL_opengl_glext.h | 4 ++++ 1 file changed, 4 insertions(+) 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); From e9eb94b9e18b8c3e44eb1ec0f19bf5fcb6a7cbbc Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 19 Mar 2020 20:30:42 +0100 Subject: [PATCH 134/214] Update Haptic to library --- src/core/morphos/SDL_stubs.h | 2 - src/core/morphos/sdk/fd/sdl2_lib.fd | 30 ++++ src/core/morphos/sdk/ppcinline/sdl2.h | 250 ++++++++++++++++++++++++++ 3 files changed, 280 insertions(+), 2 deletions(-) diff --git a/src/core/morphos/SDL_stubs.h b/src/core/morphos/SDL_stubs.h index 971fd97c4d..e4aaedac69 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -691,7 +691,6 @@ STUB(SDL_GL_SwapWindow) STUB(SDL_GL_DeleteContext) -#if 0 /* Haptic */ STUB(SDL_NumHaptics) STUB(SDL_HapticName) @@ -723,4 +722,3 @@ STUB(SDL_HapticRumbleInit) STUB(SDL_HapticRumblePlay) STUB(SDL_HapticRumbleStop) -#endif diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd index ebe4251e03..13c0c26d75 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -623,3 +623,33 @@ 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) \ No newline at end of file diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index b9783bf1bd..1f5ee2e726 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -1700,6 +1700,256 @@ (((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;\ From bce9e61dd58673d6b46ffd80a9755dc3a2c31e9e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 20 Mar 2020 21:00:22 +0100 Subject: [PATCH 135/214] Fix building OpenGL --- include/SDL_opengl.h | 1 - src/render/opengl/SDL_render_gl.c | 5 +++++ src/render/opengl/SDL_shaders_gl.c | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 032cc3f633..2c489cfd21 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -46,7 +46,6 @@ #elif defined(__MORPHOS__) -#include #include #include #include "SDL_opengl_glext.h" diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index c4bbf920cd..6293e99771 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -24,6 +24,11 @@ #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" 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" From a1df1c473bdce17c3512fe2a5c657468e285a10f Mon Sep 17 00:00:00 2001 From: BSzili Date: Fri, 20 Mar 2020 16:27:09 +0100 Subject: [PATCH 136/214] big SDL_amigagl_wrapper cleanup --- src/video/amiga/SDL_amigagl_wrapper.c | 917 +++++++++----------------- 1 file changed, 295 insertions(+), 622 deletions(-) diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index 7bdd52a68a..a0cc4a0d93 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -33,37 +33,7 @@ #if SDL_VIDEO_DRIVER_AMIGA -void glBegin(void) __attribute__((alias("AmiglBegin"))); -void glBindTexture(void) __attribute__((alias("AmiglBindTexture"))); -void glBlendFunc(void) __attribute__((alias("AmiglBlendFunc"))); -void glColor4f(void) __attribute__((alias("AmiglColor4f"))); -void glDisable(void) __attribute__((alias("AmiglDisable"))); -void glEnable(void) __attribute__((alias("AmiglEnable"))); -void glEnd(void) __attribute__((alias("AmiglEnd"))); -void glFlush(void) __attribute__((alias("AmiglFlush"))); -void glGenTextures(void) __attribute__((alias("AmiglGenTextures"))); -void glGetString(void) __attribute__((alias("AmiglGetString"))); -void glLoadIdentity(void) __attribute__((alias("AmiglLoadIdentity"))); -void glMatrixMode(void) __attribute__((alias("AmiglMatrixMode"))); -void glOrtho(void) __attribute__((alias("AmiglOrtho"))); -void glPixelStorei(void) __attribute__((alias("AmiglPixelStorei"))); -void glPopAttrib(void) __attribute__((alias("AmiglPopAttrib"))); -void glPopClientAttrib(void) __attribute__((alias("AmiglPopClientAttrib"))); -void glPopMatrix(void) __attribute__((alias("AmiglPopMatrix"))); -void glPushAttrib(void) __attribute__((alias("AmiglPushAttrib"))); -void glPushClientAttrib(void) __attribute__((alias("AmiglPushClientAttrib"))); -void glPushMatrix(void) __attribute__((alias("AmiglPushMatrix"))); -void glTexCoord2f(void) __attribute__((alias("AmiglTexCoord2f"))); -void glTexEnvf(void) __attribute__((alias("AmiglTexEnvf"))); -void glTexImage2D(void) __attribute__((alias("AmiglTexImage2D"))); -void glTexParameteri(void) __attribute__((alias("AmiglTexParameteri"))); -void glTexSubImage2D(void) __attribute__((alias("AmiglTexSubImage2D"))); -void glVertex2i(void) __attribute__((alias("AmiglVertex2i"))); -void glViewport(void) __attribute__((alias("AmiglViewport"))); - #include -#define TGL_ADDON_FUNCTIONS 1 -#define TGL_DUMMY_FUNCTIONS 1 #include #include #include @@ -111,15 +81,15 @@ static void AmiglIndexMask( GLuint mask ) { #endif } -void AmiglColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { +static void AmiglColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { glColorMask(red, green, blue, alpha); } - void AmiglAlphaFunc( GLenum func, GLclampf ref ) { +static void AmiglAlphaFunc( GLenum func, GLclampf ref ) { glAlphaFunc(func, ref); } - void AmiglBlendFunc( GLenum sfactor, GLenum dfactor ) { +static void AmiglBlendFunc( GLenum sfactor, GLenum dfactor ) { glBlendFunc(sfactor, dfactor); } @@ -127,36 +97,38 @@ static void AmiglLogicOp( GLenum opcode ) { glLogicOp(opcode); } - void AmiglCullFace( GLenum mode ) { +static void AmiglCullFace( GLenum mode ) { glCullFace(mode); } - void AmiglFrontFace( GLenum mode ) { +static void AmiglFrontFace( GLenum mode ) { glFrontFace(mode); } - void AmiglPointSize( GLfloat size ) { +static void AmiglPointSize( GLfloat size ) { glPointSize(size); } - void AmiglLineWidth( GLfloat width ) { +static void AmiglLineWidth( GLfloat width ) { glLineWidth(width); } -void AmiglLineStipple( GLint factor, GLushort pattern ) { +static void AmiglLineStipple( GLint factor, GLushort pattern ) { glLineStipple(factor, pattern); } - void AmiglPolygonMode( GLenum face, GLenum mode ) { +static void AmiglPolygonMode( GLenum face, GLenum mode ) { glPolygonMode(face, mode); } - void AmiglPolygonOffset( GLfloat factor, GLfloat units ) { +static void AmiglPolygonOffset( GLfloat factor, GLfloat units ) { glPolygonOffset(factor, units); } static void AmiglPolygonStipple( const GLubyte *mask ) { +#ifndef __MORPHOS__ glPolygonStipple(mask); +#endif } static void AmiglGetPolygonStipple( GLubyte *mask ) { @@ -172,14 +144,16 @@ static void AmiglEdgeFlag( GLboolean flag ) { static void AmiglEdgeFlagv( const GLboolean *flag ) { #ifndef __MORPHOS__ glEdgeFlagv(flag); +#else + glEdgeFlag(*flag); #endif } - void AmiglScissor( GLint x, GLint y, GLsizei width, GLsizei height) { +static void AmiglScissor( GLint x, GLint y, GLsizei width, GLsizei height) { glScissor(x, y, width, height); } -void AmiglClipPlane( GLenum plane, const GLdouble *equation ) { +static void AmiglClipPlane( GLenum plane, const GLdouble *equation ) { glClipPlane(plane, (GLdouble *)equation); } @@ -187,31 +161,31 @@ static void AmiglGetClipPlane( GLenum plane, GLdouble *equation ) { glGetClipPlane(plane, equation); } - void AmiglDrawBuffer( GLenum mode ) { +static void AmiglDrawBuffer( GLenum mode ) { glDrawBuffer(mode); } - void AmiglReadBuffer( GLenum mode ) { +static void AmiglReadBuffer( GLenum mode ) { glReadBuffer(mode); } - void AmiglEnable( GLenum cap ) { +static void AmiglEnable( GLenum cap ) { glEnable(cap); } - void AmiglDisable( GLenum cap ) { +static void AmiglDisable( GLenum cap ) { glDisable(cap); } - GLboolean AmiglIsEnabled( GLenum cap ) { +static GLboolean AmiglIsEnabled( GLenum cap ) { return glIsEnabled(cap); } - void AmiglEnableClientState( GLenum cap ) { /* 1.1 */ +static void AmiglEnableClientState( GLenum cap ) { /* 1.1 */ glEnableClientState(cap); } - void AmiglDisableClientState( GLenum cap ) { /* 1.1 */ +static void AmiglDisableClientState( GLenum cap ) { /* 1.1 */ glDisableClientState(cap); } @@ -221,31 +195,31 @@ static void AmiglGetBooleanv( GLenum pname, GLboolean *params ) { #endif } - void AmiglGetDoublev( GLenum pname, GLdouble *params ) { +static void AmiglGetDoublev( GLenum pname, GLdouble *params ) { glGetDoublev(pname, params); } - void AmiglGetFloatv( GLenum pname, GLfloat *params ) { +static void AmiglGetFloatv( GLenum pname, GLfloat *params ) { glGetFloatv(pname, params); } - void AmiglGetIntegerv( GLenum pname, GLint *params ) { +static void AmiglGetIntegerv( GLenum pname, GLint *params ) { glGetIntegerv(pname, params); } - void AmiglPushAttrib( GLbitfield mask ) { +static void AmiglPushAttrib( GLbitfield mask ) { glPushAttrib(mask); } - void AmiglPopAttrib( void ) { +static void AmiglPopAttrib( void ) { glPopAttrib(); } - void AmiglPushClientAttrib( GLbitfield mask ) { /* 1.1 */ +static void AmiglPushClientAttrib( GLbitfield mask ) { /* 1.1 */ glPushClientAttrib(mask); } - void AmiglPopClientAttrib( void ) { /* 1.1 */ +static void AmiglPopClientAttrib( void ) { /* 1.1 */ glPopClientAttrib(); } @@ -265,7 +239,7 @@ static void AmiglFinish( void ) { glFinish(); } -void AmiglFlush( void ) { +static void AmiglFlush( void ) { glFlush(); } @@ -277,19 +251,19 @@ static void AmiglHint( GLenum target, GLenum mode ) { * Depth Buffer */ - void AmiglClearDepth( GLclampd depth ) { +static void AmiglClearDepth( GLclampd depth ) { glClearDepth(depth); } - void AmiglDepthFunc( GLenum func ) { +static void AmiglDepthFunc( GLenum func ) { glDepthFunc(func); } - void AmiglDepthMask( GLboolean flag ) { +static void AmiglDepthMask( GLboolean flag ) { glDepthMask(flag); } - void AmiglDepthRange( GLclampd near_val, GLclampd far_val ) { +static void AmiglDepthRange( GLclampd near_val, GLclampd far_val ) { glDepthRange(near_val, far_val); } @@ -297,47 +271,47 @@ static void AmiglHint( GLenum target, GLenum mode ) { * Transformation */ - void AmiglMatrixMode( GLenum mode ) { +static void AmiglMatrixMode( GLenum mode ) { glMatrixMode(mode); } - void AmiglOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) { +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); } - void AmiglFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble 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); } - void AmiglViewport( GLint x, GLint y, GLsizei width, GLsizei height ) { +static void AmiglViewport( GLint x, GLint y, GLsizei width, GLsizei height ) { glViewport(x, y, width, height); } - void AmiglPushMatrix( void ) { +static void AmiglPushMatrix( void ) { glPushMatrix(); } - void AmiglPopMatrix( void ) { +static void AmiglPopMatrix( void ) { glPopMatrix(); } - void AmiglLoadIdentity( void ) { +static void AmiglLoadIdentity( void ) { glLoadIdentity(); } - void AmiglLoadMatrixd( const GLdouble *m ) { +static void AmiglLoadMatrixd( const GLdouble *m ) { glLoadMatrixd(m); } - void AmiglLoadMatrixf( const GLfloat *m ) { +static void AmiglLoadMatrixf( const GLfloat *m ) { glLoadMatrixf(m); } - void AmiglMultMatrixd( const GLdouble *m ) { +static void AmiglMultMatrixd( const GLdouble *m ) { glMultMatrixd(m); } - void AmiglMultMatrixf( const GLfloat *m ) { +static void AmiglMultMatrixf( const GLfloat *m ) { glMultMatrixf(m); } @@ -345,15 +319,15 @@ static void AmiglRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { glRotated(angle, x, y, z); } - void AmiglRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { +static void AmiglRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { glRotatef(angle, x, y, z); } - void AmiglScaled( GLdouble x, GLdouble y, GLdouble z ) { +static void AmiglScaled( GLdouble x, GLdouble y, GLdouble z ) { glScaled(x, y, z); } - void AmiglScalef( GLfloat x, GLfloat y, GLfloat z ) { +static void AmiglScalef( GLfloat x, GLfloat y, GLfloat z ) { glScalef(x, y, z); } @@ -369,35 +343,35 @@ static void AmiglTranslatef( GLfloat x, GLfloat y, GLfloat z ) { * Display Lists */ - GLboolean AmiglIsList( GLuint list ) { +static GLboolean AmiglIsList( GLuint list ) { return glIsList(list); } - void AmiglDeleteLists( GLuint list, GLsizei range ) { +static void AmiglDeleteLists( GLuint list, GLsizei range ) { glDeleteLists(list, range); } - GLuint AmiglGenLists( GLsizei range ) { +static GLuint AmiglGenLists( GLsizei range ) { return glGenLists(range); } - void AmiglNewList( GLuint list, GLenum mode ) { +static void AmiglNewList( GLuint list, GLenum mode ) { glNewList(list, mode); } - void AmiglEndList( void ) { +static void AmiglEndList( void ) { glEndList(); } - void AmiglCallList( GLuint list ) { +static void AmiglCallList( GLuint list ) { glCallList(list); } - void AmiglCallLists( GLsizei n, GLenum type, GLvoid *lists ) { +static void AmiglCallLists( GLsizei n, GLenum type, GLvoid *lists ) { glCallLists(n, type, lists); } - void AmiglListBase( GLuint base ) { +static void AmiglListBase( GLuint base ) { glListBase(base); } @@ -405,11 +379,11 @@ static void AmiglTranslatef( GLfloat x, GLfloat y, GLfloat z ) { * Drawing Functions */ - void AmiglBegin( GLenum mode ) { +static void AmiglBegin( GLenum mode ) { glBegin(mode); } - void AmiglEnd( void ) { +static void AmiglEnd( void ) { glEnd(); } @@ -421,9 +395,9 @@ static void AmiglVertex2s( GLshort x, GLshort y ) glVertex2s(x, y); } - void AmiglVertex3d( GLdouble x, GLdouble y, GLdouble z ) { glVertex3d(x, y, z); } - void AmiglVertex3f( GLfloat x, GLfloat y, GLfloat z ) { glVertex3f(x, y, z); } - void AmiglVertex3i( GLint x, GLint y, GLint z ) +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); } @@ -438,13 +412,13 @@ static void AmiglVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) glVertex4d(x, y, z, w); } - void AmiglVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { glVertex4f(x, y, z, w); } - void AmiglVertex4i( GLint x, GLint y, GLint z, GLint 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); } - void AmiglVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) +static void AmiglVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) { glVertex4s(x, y, z, w); } @@ -463,14 +437,14 @@ static void AmiglVertex2iv( const GLint *v ) static void AmiglVertex2sv( const GLshort *v ) { glVertex2sv(v); } - void AmiglVertex3dv( GLdouble *v ) +static void AmiglVertex3dv( GLdouble *v ) { glVertex3dv(v); } - void AmiglVertex3fv( GLfloat *v ) { glVertex3fv(v); } +static void AmiglVertex3fv( GLfloat *v ) { glVertex3fv(v); } - void AmiglVertex3iv( const GLint *v ) +static void AmiglVertex3iv( const GLint *v ) { glVertex3iv(v); } @@ -479,19 +453,23 @@ static void AmiglVertex3sv( const GLshort *v ) { #ifndef __MORPHOS__ glVertex3sv(v); +#else + glVertex3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } - void AmiglVertex4dv( GLdouble *v ) +static void AmiglVertex4dv( GLdouble *v ) { glVertex4dv(v); } - void AmiglVertex4fv( GLfloat *v ) { glVertex4fv(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 } @@ -499,6 +477,8 @@ 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 } @@ -506,24 +486,28 @@ static void AmiglNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ) { #ifndef __MORPHOS__ glNormal3b(nx, ny, nz); +#else + glNormal3f((GLfloat)nx, (GLfloat)ny, (GLfloat)nz); #endif } -void AmiglNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +static void AmiglNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ) { glNormal3d(nx, ny, nz); } - void AmiglNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ) { glNormal3f(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 } -void AmiglNormal3s( GLshort nx, GLshort ny, GLshort nz ) +static void AmiglNormal3s( GLshort nx, GLshort ny, GLshort nz ) { glNormal3s(nx, ny, nz); } @@ -532,24 +516,28 @@ static void AmiglNormal3bv( const GLbyte *v ) { #ifndef __MORPHOS__ glNormal3bv(v); +#else + glNormal3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } -void AmiglNormal3dv( const GLdouble *v ) +static void AmiglNormal3dv( const GLdouble *v ) { glNormal3dv(v); } - void AmiglNormal3fv( GLfloat *v ) { glNormal3fv(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 } - void AmiglNormal3sv( const GLshort *v ) +static void AmiglNormal3sv( const GLshort *v ) { glNormal3sv(v); } @@ -568,9 +556,11 @@ static void AmiglIndexf( GLfloat c ) #endif } - void AmiglIndexi( GLint c ) +static void AmiglIndexi( GLint c ) { +#ifndef __MORPHOS__ glIndexi(c); +#endif } static void AmiglIndexs( GLshort c ) @@ -626,20 +616,24 @@ static void AmiglColor3b( GLbyte red, GLbyte green, GLbyte blue ) { #ifndef __MORPHOS__ glColor3b(red, green, blue); +#else + glColor3ub((GLubyte)red, (GLubyte)green, (GLubyte)blue); #endif } -void AmiglColor3d( GLdouble red, GLdouble green, GLdouble blue ) +static void AmiglColor3d( GLdouble red, GLdouble green, GLdouble blue ) { glColor3d(red, green, blue); } - void AmiglColor3f( GLfloat red, GLfloat green, GLfloat blue ) { glColor3f(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 } @@ -647,14 +641,18 @@ 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 } - void AmiglColor3ub( GLubyte red, GLubyte green, GLubyte blue ) { glColor3ub(red, green, blue); } +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 } @@ -662,25 +660,29 @@ 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 } - void AmiglColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) +static void AmiglColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) { glColor4b(red, green, blue, alpha); } - void AmiglColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) +static void AmiglColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) { glColor4d(red, green, blue, alpha); } - void AmiglColor4f( GLfloat red, GLfloat green,GLfloat blue, GLfloat alpha ) { glColor4f(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 } @@ -688,16 +690,20 @@ static void AmiglColor4s( GLshort red, GLshort green, GLshort blue, GLshort alph { #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 } - void AmiglColor4ub( GLubyte red, GLubyte green, +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 } @@ -705,6 +711,8 @@ static void AmiglColor4us( GLushort red, GLushort green, GLushort blue, GLushort { #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 } @@ -712,20 +720,24 @@ static void AmiglColor3bv( const GLbyte *v ) { #ifndef __MORPHOS__ glColor3bv(v); +#else + glColor3ubv((const GLubyte *)v); #endif } - void AmiglColor3dv( const GLdouble *v ) +static void AmiglColor3dv( const GLdouble *v ) { glColor3dv(v); } - void AmiglColor3fv( GLfloat *v ) { glColor3fv(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 } @@ -733,15 +745,19 @@ 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 } - void AmiglColor3ubv( GLubyte *v ) { glColor3ubv(v); } +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 } @@ -749,6 +765,8 @@ 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 } @@ -756,20 +774,24 @@ static void AmiglColor4bv( const GLbyte *v ) { #ifndef __MORPHOS__ glColor4bv(v); +#else + glColor4ubv((const GLubyte *)v); #endif } - void AmiglColor4dv( const GLdouble *v ) +static void AmiglColor4dv( const GLdouble *v ) { glColor4dv(v); } - void AmiglColor4fv( GLfloat *v ) { glColor4fv(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 } @@ -777,15 +799,19 @@ 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 } - void AmiglColor4ubv( GLubyte *v ) { glColor4ubv(v); } +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 } @@ -793,15 +819,17 @@ 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 } - void AmiglTexCoord1d( GLdouble s ) +static void AmiglTexCoord1d( GLdouble s ) { glTexCoord1d(s); } - void AmiglTexCoord1f( GLfloat s ) +static void AmiglTexCoord1f( GLfloat s ) { glTexCoord1f(s); } @@ -810,6 +838,8 @@ static void AmiglTexCoord1i( GLint s ) { #ifndef __MORPHOS__ glTexCoord1i(s); +#else + glTexCoord2f((GLfloat)s, 0.0f); #endif } @@ -817,22 +847,26 @@ static void AmiglTexCoord1s( GLshort s ) { #ifndef __MORPHOS__ glTexCoord1s(s); +#else + glTexCoord2f((GLfloat)s, 0.0f); #endif } - void AmiglTexCoord2d( GLdouble s, GLdouble t ) +static void AmiglTexCoord2d( GLdouble s, GLdouble t ) { glTexCoord2d(s, t); } - void AmiglTexCoord2f( GLfloat s, GLfloat t ) { glTexCoord2f(s, t); } +static void AmiglTexCoord2f( GLfloat s, GLfloat t ) { glTexCoord2f(s, t); } - void AmiglTexCoord2i( GLint s, GLint t ) { glTexCoord2i(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 } @@ -840,10 +874,12 @@ static void AmiglTexCoord3d( GLdouble s, GLdouble t, GLdouble r ) { #ifndef __MORPHOS__ glTexCoord3d(s, t, r); +#else + glTexCoord3f((GLfloat)s, (GLfloat)t, (GLfloat)r); #endif } - void AmiglTexCoord3f( GLfloat s, GLfloat t, GLfloat r ) +static void AmiglTexCoord3f( GLfloat s, GLfloat t, GLfloat r ) { glTexCoord3f(s, t, r); } @@ -852,6 +888,8 @@ static void AmiglTexCoord3i( GLint s, GLint t, GLint r ) { #ifndef __MORPHOS__ glTexCoord3i(s, t, r); +#else + glTexCoord3f((GLfloat)s, (GLfloat)t, (GLfloat)r); #endif } @@ -859,14 +897,18 @@ 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__ +#ifndef __MORPHOS__ glTexCoord4d(s, t, r, q); - #endif +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif } static void AmiglTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) @@ -876,16 +918,20 @@ static void AmiglTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) static void AmiglTexCoord4i( GLint s, GLint t, GLint r, GLint q ) { - #ifndef __MORPHOS__ +#ifndef __MORPHOS__ glTexCoord4i(s, t, r, q); - #endif +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif } static void AmiglTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) { - #ifndef __MORPHOS__ +#ifndef __MORPHOS__ glTexCoord4s(s, t, r, q); - #endif +#else + glTexCoord4f((GLfloat)s, (GLfloat)t, (GLfloat)r, (GLfloat)q); +#endif } static void AmiglTexCoord1dv( const GLdouble *v ) @@ -897,6 +943,8 @@ static void AmiglTexCoord1fv( const GLfloat *v ) { #ifndef __MORPHOS__ glTexCoord1fv(v); +#else + glTexCoord1f(v[0]); #endif } @@ -904,6 +952,8 @@ static void AmiglTexCoord1iv( const GLint *v ) { #ifndef __MORPHOS__ glTexCoord1iv(v); +#else + glTexCoord1f((GLfloat)v[0]); #endif } @@ -911,6 +961,8 @@ static void AmiglTexCoord1sv( const GLshort *v ) { #ifndef __MORPHOS__ glTexCoord1sv(v); +#else + glTexCoord1f((GLfloat)v[0]); #endif } @@ -930,6 +982,8 @@ static void AmiglTexCoord2sv( const GLshort *v ) { #ifndef __MORPHOS__ glTexCoord2sv(v); +#else + glTexCoord2f((GLfloat)v[0], (GLfloat)v[1]); #endif } @@ -942,6 +996,8 @@ static void AmiglTexCoord3fv( const GLfloat *v ) { #ifndef __MORPHOS__ glTexCoord3fv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } @@ -949,6 +1005,8 @@ static void AmiglTexCoord3iv( const GLint *v ) { #ifndef __MORPHOS__ glTexCoord3iv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } @@ -956,6 +1014,8 @@ static void AmiglTexCoord3sv( const GLshort *v ) { #ifndef __MORPHOS__ glTexCoord3sv(v); +#else + glTexCoord3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } @@ -968,6 +1028,8 @@ 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 } @@ -975,6 +1037,8 @@ 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 } @@ -982,6 +1046,8 @@ 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 } @@ -1003,17 +1069,21 @@ static void AmiglRasterPos3d( GLdouble x, GLdouble y, GLdouble z ) { glRaster static void AmiglRasterPos3f( GLfloat x, GLfloat y, GLfloat z ) { glRasterPos3f(x, y, z); } -void AmiglRasterPos3i( GLint x, GLint y, GLint 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 } -void AmiglRasterPos3s( GLshort x, GLshort y, GLshort z ) +static void AmiglRasterPos3s( GLshort x, GLshort y, GLshort z ) { #ifndef __MORPHOS__ glRasterPos3s(x, y, z); +#else + glRasterPos3f((GLfloat)x, (GLfloat)y, (GLfloat)z); #endif } @@ -1049,10 +1119,12 @@ static void AmiglRasterPos2dv( const GLdouble *v ) { #ifndef __MORPHOS__ glRasterPos2dv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); #endif } -void AmiglRasterPos2fv( const GLfloat *v ) +static void AmiglRasterPos2fv( const GLfloat *v ) { glRasterPos2fv((GLfloat *)v); } @@ -1061,6 +1133,8 @@ static void AmiglRasterPos2iv( const GLint *v ) { #ifndef __MORPHOS__ glRasterPos2iv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); #endif } @@ -1068,6 +1142,8 @@ static void AmiglRasterPos2sv( const GLshort *v ) { #ifndef __MORPHOS__ glRasterPos2sv(v); +#else + glRasterPos2f((GLfloat)v[0], (GLfloat)v[1]); #endif } @@ -1075,10 +1151,12 @@ static void AmiglRasterPos3dv( const GLdouble *v ) { #ifndef __MORPHOS__ glRasterPos3dv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } -void AmiglRasterPos3fv( const GLfloat *v ) +static void AmiglRasterPos3fv( const GLfloat *v ) { glRasterPos3fv((GLfloat *)v); } @@ -1087,6 +1165,8 @@ static void AmiglRasterPos3iv( const GLint *v ) { #ifndef __MORPHOS__ glRasterPos3iv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } @@ -1094,6 +1174,8 @@ static void AmiglRasterPos3sv( const GLshort *v ) { #ifndef __MORPHOS__ glRasterPos3sv(v); +#else + glRasterPos3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]); #endif } @@ -1240,8 +1322,8 @@ static void AmiglLightModeliv( GLenum pname, const GLint *params ) #endif } -void AmiglMaterialf( GLenum face, GLenum pname, GLfloat param ) { glMaterialf(face, pname, param); } -void AmiglMateriali( GLenum face, GLenum pname, GLint param ) +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); } @@ -1516,7 +1598,7 @@ static void AmiglGetTexImage( GLenum target, GLint level, /* 1.1 functions */ -void AmiglGenTextures( GLsizei n, GLuint *textures ) { +static void AmiglGenTextures( GLsizei n, GLuint *textures ) { glGenTextures(n, textures); } @@ -1532,7 +1614,7 @@ static void AmiglPrioritizeTextures( GLsizei n, const GLuint *textures, const GL glPrioritizeTextures(n, textures, priorities); } - GLboolean AmiglAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { +static GLboolean AmiglAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { #ifndef __MORPHOS__ return glAreTexturesResident(n, textures, residences); #else @@ -1540,7 +1622,7 @@ static void AmiglPrioritizeTextures( GLsizei n, const GLuint *textures, const GL #endif } - GLboolean AmiglIsTexture( GLuint texture ) { +static GLboolean AmiglIsTexture( GLuint texture ) { return glIsTexture(texture); } @@ -1758,184 +1840,20 @@ static void AmiglPopName( void ) { * 1.0 Extensions */ -/* GL_EXT_blend_minmax */ +/* GL_EXT_blend_minmax Imaging subset */ static void AmiglBlendEquationEXT( GLenum mode ) { #ifndef __MORPHOS__ glBlendEquationEXT(mode); #endif } -/* GL_EXT_blend_color */ +/* 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_polygon_offset */ -static void AmiglPolygonOffsetEXT( GLfloat factor, GLfloat bias ) { -#ifndef __MORPHOS__ - glPolygonOffsetEXT(factor, bias); -#endif - } - -/* GL_EXT_vertex_array */ - -static void AmiglVertexPointerEXT( GLint size, GLenum type, - GLsizei stride, - GLsizei count, const GLvoid *ptr ) { -#ifndef __MORPHOS__ - glVertexPointerEXT(size, type, stride, count, ptr); -/*#else - glVertexPointer(size, type, stride, count, ptr);*/ -#endif - } - -static void AmiglNormalPointerEXT( GLenum type, GLsizei stride, - GLsizei count, const GLvoid *ptr ) { -#ifndef __MORPHOS__ - glNormalPointerEXT(type, stride, count, ptr); -/*#else - glNormalPointer(type, stride, count, ptr);*/ -#endif - } - -static void AmiglColorPointerEXT( GLint size, GLenum type, - GLsizei stride, - GLsizei count, const GLvoid *ptr ) { -#ifndef __MORPHOS__ - glColorPointerEXT(size, type, stride, count, ptr); -/*#else - glColorPointer(size, type, stride, count, ptr);*/ -#endif - } - -static void AmiglIndexPointerEXT( GLenum type, GLsizei stride, - GLsizei count, const GLvoid *ptr ) { -#ifndef __MORPHOS__ - glIndexPointerEXT(type, stride, count, ptr); -#endif - } - -static void AmiglTexCoordPointerEXT( GLint size, GLenum type, - GLsizei stride, GLsizei count, - const GLvoid *ptr ) { -#ifndef __MORPHOS__ - glTexCoordPointerEXT(size, type, stride, count, ptr); -/*#else - glTexCoordPointer(size, type, stride, count, ptr);*/ -#endif - } - -static void AmiglEdgeFlagPointerEXT( GLsizei stride, GLsizei count, const GLboolean *ptr ) { -#ifndef __MORPHOS__ - glEdgeFlagPointerEXT(stride, count, ptr); -#endif - } - -static void AmiglGetPointervEXT( GLenum pname, void **params ) { -#ifndef __MORPHOS__ - glGetPointervEXT(pname, params); -/*#else - glGetPointerv(pname, params);*/ -#endif - } - -static void AmiglArrayElementEXT( GLint i ) { -#ifndef __MORPHOS__ - glArrayElementEXT(i); -/*#else - glArrayElement(i);*/ -#endif - } - -static void AmiglDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) { -#ifndef __MORPHOS__ - glDrawArraysEXT(mode, first, count); -/*#else - glDrawArrays(mode, first, count);*/ -#endif - } - -/* GL_EXT_texture_object */ - -static void AmiglGenTexturesEXT( GLsizei n, GLuint *textures ) { -#ifndef __MORPHOS__ - glGenTexturesEXT(n, textures); -#endif - } - -static void AmiglDeleteTexturesEXT( GLsizei n, const GLuint *textures) { -#ifndef __MORPHOS__ - glDeleteTexturesEXT(n, textures); -#endif - } - -static void AmiglBindTextureEXT( GLenum target, GLuint texture ) { -#ifndef __MORPHOS__ - glBindTextureEXT(target, texture); -#endif - } - -static void AmiglPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ) { -#ifndef __MORPHOS__ - glPrioritizeTexturesEXT(n, textures, priorities); -#endif - } - - GLboolean AmiglAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ) { -#ifndef __MORPHOS__ - return glAreTexturesResidentEXT(n, textures, residences); -#else - return 0; -#endif - } - - GLboolean AmiglIsTextureEXT( GLuint texture ) { -#ifndef __MORPHOS__ - return glIsTextureEXT(texture); -#else - return 0; -#endif - } - -/* GL_EXT_texture3D */ - -static void AmiglTexImage3DEXT( GLenum target, GLint level, - GLenum internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels ) { -#ifndef __MORPHOS__ - glTexImage3DEXT(target, level, internalFormat, width, height, depth, border, - format, type, pixels); -#endif - } - -static void AmiglTexSubImage3DEXT( 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__ - glTexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, - width, height, depth, format, type, pixels); -#endif - } - -static void AmiglCopyTexSubImage3DEXT( GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint zoffset, GLint x, - GLint y, GLsizei width, - GLsizei height ) { -#ifndef __MORPHOS__ - glCopyTexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, - x, y, width, height); -#endif - } - /* GL_EXT_color_table */ static void AmiglColorTableEXT( GLenum target, GLenum internalformat, @@ -1980,372 +1898,122 @@ static void AmiglGetColorTableParameterivEXT( GLenum target, #endif } -/* GL_SGIS_multitexture */ -static void AmiglMultiTexCoord1dSGIS(GLenum target, GLdouble s) { -#ifndef __MORPHOS__ - glMultiTexCoord1dSGIS(target, s); -#endif - } -static void AmiglMultiTexCoord1dvSGIS(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ - glMultiTexCoord1dvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord1fSGIS(GLenum target, GLfloat s) { -#ifndef __MORPHOS__ - glMultiTexCoord1fSGIS(target, s); -#endif - } -static void AmiglMultiTexCoord1fvSGIS(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ - glMultiTexCoord1fvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord1iSGIS(GLenum target, GLint s) { -#ifndef __MORPHOS__ - glMultiTexCoord1iSGIS(target, s); -#endif - } -static void AmiglMultiTexCoord1ivSGIS(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ - glMultiTexCoord1ivSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord1sSGIS(GLenum target, GLshort s) { -#ifndef __MORPHOS__ - glMultiTexCoord1sSGIS(target, s); -#endif - } -static void AmiglMultiTexCoord1svSGIS(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ - glMultiTexCoord1svSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord2dSGIS(GLenum target, GLdouble s, GLdouble t) { -#ifndef __MORPHOS__ - glMultiTexCoord2dSGIS(target, s, t); -#endif - } -static void AmiglMultiTexCoord2dvSGIS(GLenum target, const GLdouble *v) { #ifndef __MORPHOS__ - glMultiTexCoord2dvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord2fSGIS(GLenum target, GLfloat s, GLfloat t) { -#ifndef __MORPHOS__ - glMultiTexCoord2fSGIS(target, s, t); -#endif - } -static void AmiglMultiTexCoord2fvSGIS(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ - glMultiTexCoord2fvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord2iSGIS(GLenum target, GLint s, GLint t) { -#ifndef __MORPHOS__ - glMultiTexCoord2iSGIS(target, s, t); -#endif - } -static void AmiglMultiTexCoord2ivSGIS(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ - glMultiTexCoord2ivSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord2sSGIS(GLenum target, GLshort s, GLshort t) { -#ifndef __MORPHOS__ - glMultiTexCoord2sSGIS(target, s, t); -#endif - } -static void AmiglMultiTexCoord2svSGIS(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ - glMultiTexCoord2svSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord3dSGIS(GLenum target, GLdouble s, GLdouble t, GLdouble r) { -#ifndef __MORPHOS__ - glMultiTexCoord3dSGIS(target, s, t, r); -#endif - } -static void AmiglMultiTexCoord3dvSGIS(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ - glMultiTexCoord3dvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord3fSGIS(GLenum target, GLfloat s, GLfloat t, GLfloat r) { -#ifndef __MORPHOS__ - glMultiTexCoord3fSGIS(target, s, t, r); -#endif - } -static void AmiglMultiTexCoord3fvSGIS(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ - glMultiTexCoord3fvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord3iSGIS(GLenum target, GLint s, GLint t, GLint r) { -#ifndef __MORPHOS__ - glMultiTexCoord3iSGIS(target, s, t, r); -#endif - } -static void AmiglMultiTexCoord3ivSGIS(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ - glMultiTexCoord3ivSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord3sSGIS(GLenum target, GLshort s, GLshort t, GLshort r) { -#ifndef __MORPHOS__ - glMultiTexCoord3sSGIS(target, s, t, r); -#endif - } -static void AmiglMultiTexCoord3svSGIS(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ - glMultiTexCoord3svSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord4dSGIS(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { -#ifndef __MORPHOS__ - glMultiTexCoord4dSGIS(target, s, t, r, q); -#endif - } -static void AmiglMultiTexCoord4dvSGIS(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ - glMultiTexCoord4dvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord4fSGIS(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { -#ifndef __MORPHOS__ - glMultiTexCoord4fSGIS(target, s, t, r, q); -#endif - } -static void AmiglMultiTexCoord4fvSGIS(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ - glMultiTexCoord4fvSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord4iSGIS(GLenum target, GLint s, GLint t, GLint r, GLint q) { -#ifndef __MORPHOS__ - glMultiTexCoord4iSGIS(target, s, t, r, q); -#endif - } -static void AmiglMultiTexCoord4ivSGIS(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ - glMultiTexCoord4ivSGIS(target, v); -#endif - } -static void AmiglMultiTexCoord4sSGIS(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { -#ifndef __MORPHOS__ - glMultiTexCoord4sSGIS(target, s, t, r, q); -#endif - } -static void AmiglMultiTexCoord4svSGIS(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ - glMultiTexCoord4svSGIS(target, v); -#endif - } - -static void AmiglMultiTexCoordPointerSGIS(GLenum target, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { -#ifndef __MORPHOS__ - glMultiTexCoordPointerSGIS(target, size, type, stride, pointer); -#endif - } - -static void AmiglSelectTextureSGIS(GLenum target) { -#ifndef __MORPHOS__ - glSelectTextureSGIS(target); -#endif - } - -static void AmiglSelectTextureCoordSetSGIS(GLenum target) { -#ifndef __MORPHOS__ - glSelectTextureCoordSetSGIS(target); -#endif - } - /* GL_EXT_multitexture */ static void AmiglMultiTexCoord1dEXT(GLenum target, GLdouble s) { -#ifndef __MORPHOS__ glMultiTexCoord1dEXT(target, s); -#endif } static void AmiglMultiTexCoord1dvEXT(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ glMultiTexCoord1dvEXT(target, v); -#endif } static void AmiglMultiTexCoord1fEXT(GLenum target, GLfloat s) { -#ifndef __MORPHOS__ glMultiTexCoord1fEXT(target, s); -#endif } static void AmiglMultiTexCoord1fvEXT(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ glMultiTexCoord1fvEXT(target, v); -#endif } static void AmiglMultiTexCoord1iEXT(GLenum target, GLint s) { -#ifndef __MORPHOS__ glMultiTexCoord1iEXT(target, s); -#endif } static void AmiglMultiTexCoord1ivEXT(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ glMultiTexCoord1ivEXT(target, v); -#endif } static void AmiglMultiTexCoord1sEXT(GLenum target, GLshort s) { -#ifndef __MORPHOS__ glMultiTexCoord1sEXT(target, s); -#endif } static void AmiglMultiTexCoord1svEXT(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ glMultiTexCoord1svEXT(target, v); -#endif } static void AmiglMultiTexCoord2dEXT(GLenum target, GLdouble s, GLdouble t) { -#ifndef __MORPHOS__ glMultiTexCoord2dEXT(target, s, t); -#endif } static void AmiglMultiTexCoord2dvEXT(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ glMultiTexCoord2dvEXT(target, v); -#endif } static void AmiglMultiTexCoord2fEXT(GLenum target, GLfloat s, GLfloat t) { -#ifndef __MORPHOS__ glMultiTexCoord2fEXT(target, s, t); -#endif } static void AmiglMultiTexCoord2fvEXT(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ glMultiTexCoord2fvEXT(target, v); -#endif } static void AmiglMultiTexCoord2iEXT(GLenum target, GLint s, GLint t) { -#ifndef __MORPHOS__ glMultiTexCoord2iEXT(target, s, t); -#endif } static void AmiglMultiTexCoord2ivEXT(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ glMultiTexCoord2ivEXT(target, v); -#endif } static void AmiglMultiTexCoord2sEXT(GLenum target, GLshort s, GLshort t) { -#ifndef __MORPHOS__ glMultiTexCoord2sEXT(target, s, t); -#endif } static void AmiglMultiTexCoord2svEXT(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ glMultiTexCoord2svEXT(target, v); -#endif } static void AmiglMultiTexCoord3dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r) { -#ifndef __MORPHOS__ glMultiTexCoord3dEXT(target, s, t, r); -#endif } static void AmiglMultiTexCoord3dvEXT(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ glMultiTexCoord3dvEXT(target, v); -#endif } static void AmiglMultiTexCoord3fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r) { -#ifndef __MORPHOS__ glMultiTexCoord3fEXT(target, s, t, r); -#endif } static void AmiglMultiTexCoord3fvEXT(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ glMultiTexCoord3fvEXT(target, v); -#endif } static void AmiglMultiTexCoord3iEXT(GLenum target, GLint s, GLint t, GLint r) { -#ifndef __MORPHOS__ glMultiTexCoord3iEXT(target, s, t, r); -#endif } static void AmiglMultiTexCoord3ivEXT(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ glMultiTexCoord3ivEXT(target, v); -#endif } static void AmiglMultiTexCoord3sEXT(GLenum target, GLshort s, GLshort t, GLshort r) { -#ifndef __MORPHOS__ glMultiTexCoord3sEXT(target, s, t, r); -#endif } static void AmiglMultiTexCoord3svEXT(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ glMultiTexCoord3svEXT(target, v); -#endif } static void AmiglMultiTexCoord4dEXT(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { -#ifndef __MORPHOS__ glMultiTexCoord4dEXT(target, s, t, r, q); -#endif } static void AmiglMultiTexCoord4dvEXT(GLenum target, const GLdouble *v) { -#ifndef __MORPHOS__ glMultiTexCoord4dvEXT(target, v); -#endif } static void AmiglMultiTexCoord4fEXT(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { -#ifndef __MORPHOS__ glMultiTexCoord4fEXT(target, s, t, r, q); -#endif } static void AmiglMultiTexCoord4fvEXT(GLenum target, const GLfloat *v) { -#ifndef __MORPHOS__ glMultiTexCoord4fvEXT(target, v); -#endif } static void AmiglMultiTexCoord4iEXT(GLenum target, GLint s, GLint t, GLint r, GLint q) { -#ifndef __MORPHOS__ glMultiTexCoord4iEXT(target, s, t, r, q); -#endif } static void AmiglMultiTexCoord4ivEXT(GLenum target, const GLint *v) { -#ifndef __MORPHOS__ glMultiTexCoord4ivEXT(target, v); -#endif } static void AmiglMultiTexCoord4sEXT(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { -#ifndef __MORPHOS__ glMultiTexCoord4sEXT(target, s, t, r, q); -#endif } static void AmiglMultiTexCoord4svEXT(GLenum target, const GLshort *v) { -#ifndef __MORPHOS__ glMultiTexCoord4svEXT(target, v); -#endif } static void AmiglInterleavedTextureCoordSetsEXT( GLint factor ) { -#ifndef __MORPHOS__ glInterleavedTextureCoordSetsEXT(factor); -#endif } static void AmiglSelectTextureEXT( GLenum target ) { -#ifndef __MORPHOS__ glSelectTextureEXT(target); -#endif } static void AmiglSelectTextureCoordSetEXT( GLenum target ) { -#ifndef __MORPHOS__ glSelectTextureCoordSetEXT(target); -#endif } static void AmiglSelectTextureTransformEXT( GLenum target ) { -#ifndef __MORPHOS__ glSelectTextureTransformEXT(target); -#endif } +#endif /* GL_EXT_point_parameters */ #ifdef __MORPHOS__ @@ -2456,6 +2124,34 @@ 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(GLContext *context, GLenum target, GLenum value, GLint * data) { + glGetBufferParameteriv(target, value, data); +} + /* The GLU API */ /* @@ -2477,7 +2173,7 @@ static void AmigluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, G gluPerspective(fovy, aspect, zNear, zFar); } -void AmigluPickMatrix( GLdouble x, GLdouble y, GLdouble width, GLdouble height, const GLint viewport[4] ) +static void AmigluPickMatrix( GLdouble x, GLdouble y, GLdouble width, GLdouble height, const GLint viewport[4] ) { gluPickMatrix(x, y, width, height, (GLint *)viewport); } @@ -2487,7 +2183,7 @@ static void AmigluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdou gluOrtho2D(left, right, bottom, top); } - GLint AmigluProject( GLdouble objx, GLdouble objy, GLdouble objz, +static GLint AmigluProject( GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], const GLint viewport[4], @@ -2497,7 +2193,7 @@ static void AmigluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdou return gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz); } - GLint AmigluUnProject( GLdouble winx, GLdouble winy, +static GLint AmigluUnProject( GLdouble winx, GLdouble winy, GLdouble winz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], @@ -2522,7 +2218,7 @@ static const GLubyte* AmigluErrorString( GLenum errorCode ) { * */ - GLint AmigluScaleImage( GLenum format, +static GLint AmigluScaleImage( GLenum format, GLint widthin, GLint heightin, GLenum typein, const void *datain, GLint widthout, GLint heightout, @@ -2530,7 +2226,7 @@ static const GLubyte* AmigluErrorString( GLenum errorCode ) { return gluScaleImage(format, widthin, heightin, typein, datain, widthout, heightout, typeout, dataout); } - GLint AmigluBuild1DMipmaps( GLenum target, GLint components, +static GLint AmigluBuild1DMipmaps( GLenum target, GLint components, GLint width, GLenum format, GLenum type, const void *data ) { #ifndef __MORPHOS__ @@ -2540,7 +2236,7 @@ static const GLubyte* AmigluErrorString( GLenum errorCode ) { #endif } - GLint AmigluBuild2DMipmaps( GLenum target, GLint components, +static GLint AmigluBuild2DMipmaps( GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, void *data ) { @@ -2554,7 +2250,7 @@ static const GLubyte* AmigluErrorString( GLenum errorCode ) { * */ - GLUquadricObj* AmigluNewQuadric( void ) { +static GLUquadricObj* AmigluNewQuadric( void ) { return gluNewQuadric(); } @@ -2740,7 +2436,7 @@ static void AmigluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void *fn ) * */ - GLUtriangulatorObj* AmigluNewTess( void ) { +static GLUtriangulatorObj* AmigluNewTess( void ) { return gluNewTess(); } @@ -2797,7 +2493,6 @@ struct MyGLFunc void *AmiGetGLProc(const char *proc) { - #if 1 static CONST struct MyGLFunc table[] = { { "glClearColor", AmiglClearColor }, @@ -3137,68 +2832,34 @@ void *AmiGetGLProc(const char *proc) { "glLoadName", AmiglLoadName }, { "glPushName", AmiglPushName }, { "glPopName", AmiglPopName }, - #if 1 + { "glBlendEquationEXT", AmiglBlendEquationEXT }, { "glBlendColorEXT", AmiglBlendColorEXT }, - { "glPolygonOffsetEXT", AmiglPolygonOffsetEXT }, - { "glVertexPointerEXT", AmiglVertexPointerEXT }, - { "glNormalPointerEXT", AmiglNormalPointerEXT }, - { "glColorPointerEXT", AmiglColorPointerEXT }, - { "glIndexPointerEXT", AmiglIndexPointerEXT }, - { "glTexCoordPointerEXT", AmiglTexCoordPointerEXT }, - { "glEdgeFlagPointerEXT", AmiglEdgeFlagPointerEXT }, - { "glGetPointervEXT", AmiglGetPointervEXT }, - { "glArrayElementEXT", AmiglArrayElementEXT }, - { "glDrawArraysEXT", AmiglDrawArraysEXT }, - { "glGenTexturesEXT", AmiglGenTexturesEXT }, - { "glDeleteTexturesEXT", AmiglDeleteTexturesEXT }, - { "glBindTextureEXT", AmiglBindTextureEXT }, - { "glPrioritizeTexturesEXT", AmiglPrioritizeTexturesEXT }, - { "glAreTexturesResidentEXT", AmiglAreTexturesResidentEXT }, - { "glIsTextureEXT", AmiglIsTextureEXT }, - { "glTexImage3DEXT", AmiglTexImage3DEXT }, - { "glTexSubImage3DEXT", AmiglTexSubImage3DEXT }, - { "glCopyTexSubImage3DEXT", AmiglCopyTexSubImage3DEXT }, + { "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 }, - { "glMultiTexCoord1dSGIS", AmiglMultiTexCoord1dSGIS }, - { "glMultiTexCoord1dvSGIS", AmiglMultiTexCoord1dvSGIS }, - { "glMultiTexCoord1fSGIS", AmiglMultiTexCoord1fSGIS }, - { "glMultiTexCoord1fvSGIS", AmiglMultiTexCoord1fvSGIS }, - { "glMultiTexCoord1iSGIS", AmiglMultiTexCoord1iSGIS }, - { "glMultiTexCoord1ivSGIS", AmiglMultiTexCoord1ivSGIS }, - { "glMultiTexCoord1sSGIS", AmiglMultiTexCoord1sSGIS }, - { "glMultiTexCoord1svSGIS", AmiglMultiTexCoord1svSGIS }, - { "glMultiTexCoord2dSGIS", AmiglMultiTexCoord2dSGIS }, - { "glMultiTexCoord2dvSGIS", AmiglMultiTexCoord2dvSGIS }, - { "glMultiTexCoord2fSGIS", AmiglMultiTexCoord2fSGIS }, - { "glMultiTexCoord2fvSGIS", AmiglMultiTexCoord2fvSGIS }, - { "glMultiTexCoord2iSGIS", AmiglMultiTexCoord2iSGIS }, - { "glMultiTexCoord2ivSGIS", AmiglMultiTexCoord2ivSGIS }, - { "glMultiTexCoord2sSGIS", AmiglMultiTexCoord2sSGIS }, - { "glMultiTexCoord2svSGIS", AmiglMultiTexCoord2svSGIS }, - { "glMultiTexCoord3dSGIS", AmiglMultiTexCoord3dSGIS }, - { "glMultiTexCoord3dvSGIS", AmiglMultiTexCoord3dvSGIS }, - { "glMultiTexCoord3fSGIS", AmiglMultiTexCoord3fSGIS }, - { "glMultiTexCoord3fvSGIS", AmiglMultiTexCoord3fvSGIS }, - { "glMultiTexCoord3iSGIS", AmiglMultiTexCoord3iSGIS }, - { "glMultiTexCoord3ivSGIS", AmiglMultiTexCoord3ivSGIS }, - { "glMultiTexCoord3sSGIS", AmiglMultiTexCoord3sSGIS }, - { "glMultiTexCoord3svSGIS", AmiglMultiTexCoord3svSGIS }, - { "glMultiTexCoord4dSGIS", AmiglMultiTexCoord4dSGIS }, - { "glMultiTexCoord4dvSGIS", AmiglMultiTexCoord4dvSGIS }, - { "glMultiTexCoord4fSGIS", AmiglMultiTexCoord4fSGIS }, - { "glMultiTexCoord4fvSGIS", AmiglMultiTexCoord4fvSGIS }, - { "glMultiTexCoord4iSGIS", AmiglMultiTexCoord4iSGIS }, - { "glMultiTexCoord4ivSGIS", AmiglMultiTexCoord4ivSGIS }, - { "glMultiTexCoord4sSGIS", AmiglMultiTexCoord4sSGIS }, - { "glMultiTexCoord4svSGIS", AmiglMultiTexCoord4svSGIS }, - { "glMultiTexCoordPointerSGIS", AmiglMultiTexCoordPointerSGIS }, - { "glSelectTextureSGIS", AmiglSelectTextureSGIS }, - { "glSelectTextureCoordSetSGIS", AmiglSelectTextureCoordSetSGIS }, +#ifndef __MORPHOS__ { "glMultiTexCoord1dEXT", AmiglMultiTexCoord1dEXT }, { "glMultiTexCoord1dvEXT", AmiglMultiTexCoord1dvEXT }, { "glMultiTexCoord1fEXT", AmiglMultiTexCoord1fEXT }, @@ -3235,6 +2896,7 @@ void *AmiGetGLProc(const char *proc) { "glSelectTextureEXT", AmiglSelectTextureEXT }, { "glSelectTextureCoordSetEXT", AmiglSelectTextureCoordSetEXT }, { "glSelectTextureTransformEXT", AmiglSelectTextureTransformEXT }, +#endif { "glPointParameterfEXT", AmiglPointParameterfEXT }, { "glPointParameterfvEXT", AmiglPointParameterfvEXT }, { "glDrawRangeElements", AmiglDrawRangeElements }, @@ -3243,7 +2905,6 @@ void *AmiGetGLProc(const char *proc) { "glCopyTexSubImage3D", AmiglCopyTexSubImage3D }, { "glLockArraysEXT", AmiglLockArraysEXT }, { "glUnlockArraysEXT", AmiglUnlockArraysEXT }, - #endif { "glActiveTextureARB", AmiglActiveTextureARB }, { "glMultiTexCoord2fARB", AmiglMultiTexCoord2fARB }, @@ -3256,11 +2917,24 @@ void *AmiGetGLProc(const char *proc) { "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 }, + { "gluLookAt", AmigluLookAt }, { "gluPerspective", AmigluPerspective }, { "gluPickMatrix", AmigluPickMatrix }, - #if 0 +#ifndef __MORPHOS__ { "gluOrtho2D", AmigluOrtho2D }, { "gluProject", AmigluProject }, { "gluUnProject", AmigluUnProject }, @@ -3302,7 +2976,7 @@ void *AmiGetGLProc(const char *proc) { "gluNextContour", AmigluNextContour }, { "gluTessVertex", AmigluTessVertex }, { "gluGetString", AmigluGetString }, - #endif +#endif { NULL, NULL } }; @@ -3318,7 +2992,6 @@ void *AmiGetGLProc(const char *proc) tb++; } while (tb->name); - #endif return NULL; } From f86f7c55e0b494a9ac4f46a65cfb4ba623ac72f5 Mon Sep 17 00:00:00 2001 From: BSzili Date: Fri, 20 Mar 2020 17:09:08 +0100 Subject: [PATCH 137/214] duplicate SDL_GL_GetProcAddress in the link library --- src/core/morphos/devenv/Makefile | 24 ++++++++++++++++++------ src/core/morphos/devenv/sdl-startup.c | 12 ++++++++++++ src/core/morphos/sdk/clib/sdl2_protos.h | 2 +- src/core/morphos/sdk/fd/sdl2_lib.fd | 4 +++- src/core/morphos/sdk/ppcinline/sdl2.h | 8 -------- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index f79b0bee88..726ee549f4 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -27,36 +27,48 @@ 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 -lib/libSDL2.a: sdl-startup.o ../sdk/fd/sdl2_lib.fd +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) cru $@ sdl-startup.o + @$(AR) cru $@ sdl-startup.o SDL_amigagl_wrapper.o @ppc-morphos-ranlib $@ -lib/libb32/libSDL2.a: sdl-startup-brel.o ../sdk/fd/sdl2_lib.fd +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) cru $@ sdl-startup-brel.o + @$(AR) cru $@ sdl-startup-brel.o SDL_amigagl_wrapper-brel.o @ppc-morphos-ranlib $@ -lib/libb32/libSDL2-nc.a: sdl-startup-brel-nc.o ../sdk/fd/sdl2_lib.fd +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) cru $@ sdl-startup-brel-nc.o + @$(AR) cru $@ sdl-startup-brel-nc.o SDL_amigagl_wrapper-nc.o @ppc-morphos-ranlib $@ clean: diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c index c704b84a83..2632706ff0 100644 --- a/src/core/morphos/devenv/sdl-startup.c +++ b/src/core/morphos/devenv/sdl-startup.c @@ -243,3 +243,15 @@ 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; +} \ No newline at end of file diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 2d98e759ef..450abba4e2 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -556,7 +556,7 @@ int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode 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_GetProcAddress(const char *proc); void SDL_GL_UnloadLibrary(void); SDL_bool SDL_GL_ExtensionSupported(const char *extension); void SDL_GL_ResetAttributes(void); diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd index 13c0c26d75..aa08d89875 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -608,7 +608,9 @@ 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) -SDL_GL_GetProcAddress(proc)(sysv,r12base) +##private +private1()() +##public SDL_GL_UnloadLibrary()(sysv,r12base) SDL_GL_ExtensionSupported(extension)(sysv,r12base) SDL_GL_ResetAttributes()(sysv,r12base) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index 1f5ee2e726..f82f68ec55 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -4419,14 +4419,6 @@ (((int (*)(const char *))*(void**)(__base - 3652))(__t__p0));\ }) -#define SDL_GL_GetProcAddress(__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 - 3658))(__t__p0));\ - }) - #define SDL_GL_UnloadLibrary() \ ({ \ long __base = (long)(SDL2_BASE_NAME);\ From d3beef4bcf9d32b49d18c37a5c80dcf1efb06086 Mon Sep 17 00:00:00 2001 From: BSzili Date: Fri, 20 Mar 2020 18:51:48 +0100 Subject: [PATCH 138/214] allow AMIGA_GL_MakeCurrent to set the current context to NULL --- src/video/amiga/SDL_amigaopengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index 2a899f49da..f1648236a7 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -160,7 +160,7 @@ AMIGA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { D("[%s] context 0x%08lx\n", __FUNCTION__, context); - if (window && context) { + /*if (window && context)*/ { *SDL2Base->MyGLContext = __tglContext = context; return 0; } From 88848cc662561d2da129e6b78a994a1e30bde51c Mon Sep 17 00:00:00 2001 From: BSzili Date: Sat, 21 Mar 2020 16:13:22 +0100 Subject: [PATCH 139/214] forgot to close the context in AMIGA_GL_DeleteContext --- src/video/amiga/SDL_amigaopengl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index f1648236a7..a7497ebe09 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -220,6 +220,7 @@ AMIGA_GL_DeleteContext(_THIS, SDL_GLContext context) if (context) { GLADestroyContext((GLContext *)context); + GLClose(context); } } From 4886f7f4b8417ed2fe43c9eb3e8cdb18feaba553 Mon Sep 17 00:00:00 2001 From: BSzili Date: Sat, 21 Mar 2020 17:03:41 +0100 Subject: [PATCH 140/214] fixed a mistake and added the shader functions to SDL_amigagl_wrapper --- src/video/amiga/SDL_amigagl_wrapper.c | 128 +++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index a0cc4a0d93..c52c8e1356 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -2148,10 +2148,109 @@ static void AmiglDeleteBuffers(GLsizei n, const GLuint *buffers) { glDeleteBuffers(n, buffers); } -static void AmiglGetBufferParameteriv(GLContext *context, GLenum target, GLenum value, GLint * data) { +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 */ /* @@ -2930,6 +3029,33 @@ void *AmiGetGLProc(const char *proc) { "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 }, From fc408310cc7ba818baf77b09fc6ee1512988fd5f Mon Sep 17 00:00:00 2001 From: BSzili Date: Sun, 22 Mar 2020 17:38:00 +0100 Subject: [PATCH 141/214] enabled analog and rumble for lowlevel.library --- src/joystick/amiga/SDL_sysjoystick.c | 99 ++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 26 deletions(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 25331b6865..5cd587f346 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -24,12 +24,12 @@ #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 -#define NO_LOWLEVEL_EXT #ifndef NO_LOWLEVEL_EXT #include #endif @@ -58,7 +58,7 @@ extern struct Library *LowLevelBase; -static const unsigned long joybut[] = +static const ULONG joybut[] = { JPF_BUTTON_RED, JPF_BUTTON_BLUE, @@ -75,6 +75,7 @@ struct joystick_hwdata #ifndef NO_LOWLEVEL_EXT ULONG joystate_ext; ULONG supports_analog; + Uint32 effect_expiration; #endif }; @@ -101,20 +102,21 @@ static Uint8 SDL_numjoysticks = 0; static int SDL_SYS_JoystickGetCount(void) { - D("SDL_SYS_JoystickGetCount()\n"); + D("[%s]\n", __FUNCTION__); return SDL_numjoysticks; } static void SDL_SYS_JoystickDetect() { + D("[%s]\n", __FUNCTION__); } static int SDL_SYS_JoystickInit(void) { - D("SDL_SYS_JoystickInit()\n"); - int numjoysticks = 0; - unsigned long joyflag = 0L; + ULONG joyflag = 0; + + D("[%s]\n", __FUNCTION__); if (SDL_numjoysticks == 0) { @@ -137,13 +139,9 @@ static int SDL_SYS_JoystickInit(void) break; } - - numjoysticks++; - } + } - //free((void *)SDL_JoyNames); - //SDL_JoyNames = malloc(numjoysticks * MAX_JOY_NAME); SDL_numjoysticks = numjoysticks; return numjoysticks; } @@ -160,15 +158,15 @@ static int SDL_SYS_JoystickInit(void) } } -const char *SDL_SYS_JoystickGetDeviceName(int device_index) +static const char *SDL_SYS_JoystickGetDeviceName(int device_index) { const char *name = NULL; - D("SDL_SYS_JoystickGetDeviceName()\n"); + D("[%s] device_index %d\n", __FUNCTION__, device_index); if (LowLevelBase && device_index < MAX_JOYSTICKS) { - unsigned long joyflag; + ULONG joyflag; joyflag = ReadJoyPort(PortIndex(device_index)); @@ -212,9 +210,9 @@ const char *SDL_SYS_JoystickGetDeviceName(int device_index) static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { - unsigned long temp; + ULONG temp; - D("SDL_SYS_JoystickOpen()"); + D("[%s] joystick 0x%08lx device_index %d\n", __FUNCTION__, joystick, device_index); if(!LowLevelBase) { @@ -225,7 +223,6 @@ static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) } } - joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata)); if ( joystick->hwdata == NULL ) @@ -287,9 +284,11 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) { ULONG data; #ifndef NO_LOWLEVEL_EXT - ULONG data_ext; + ULONG data_ext = 0; #endif - int i; + int i, index; + + D("[%s] joystick 0x%08lx\n", __FUNCTION__, joystick); if(!LowLevelBase) { @@ -300,10 +299,12 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) } } - data = ReadJoyPort(PortIndex(joystick->instance_id)); + index = PortIndex(joystick->instance_id); + + data = ReadJoyPort(index); #ifndef NO_LOWLEVEL_EXT if (joystick->hwdata->supports_analog) - data_ext = ReadJoyPort(PortIndex(joystick->instance_id) + JP_ANALOGUE_PORT_MAGIC); + data_ext = ReadJoyPort(index + JP_ANALOGUE_PORT_MAGIC); #endif /* only send an event when something changed */ @@ -428,15 +429,31 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) joystick->hwdata->joystate = data; #ifndef NO_LOWLEVEL_EXT joystick->hwdata->joystate_ext = data_ext; + + /* Rumble */ + if (joystick->hwdata->effect_expiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, joystick->hwdata->effect_expiration)) { + SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); + joystick->hwdata->effect_expiration = 0; + } + } #endif } static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) { + D("[%s] joystick 0x%08lx\n", __FUNCTION__, joystick); if(LowLevelBase) /* ne to reinitialize */ { - SetJoyPortAttrs(PortIndex(joystick->instance_id), SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); + int index = PortIndex(joystick->instance_id); + SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); +#ifndef NO_LOWLEVEL_EXT + if (joystick->hwdata->effect_expiration) { + SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); + } +#endif } if(joystick->hwdata) @@ -450,6 +467,8 @@ static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) /* Function to perform any system-specific joystick related cleanup */ static void SDL_SYS_JoystickQuit(void) { + D("[%s]\n", __FUNCTION__); + if(LowLevelBase) { CloseLibrary(LowLevelBase); @@ -461,16 +480,20 @@ static void SDL_SYS_JoystickQuit(void) 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) +static void SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) { - D("Not implemented\n"); + 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); @@ -480,12 +503,36 @@ static SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index) 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 hig_frequence_rumble, Uint32 duration_ms) +static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - return 0; + D("[%s] joystick 0x%08lx low %d high %d ms %d\n", __FUNCTION__, joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); + + if (!LowLevelBase) { + return SDL_Unsupported(); + } + +#ifndef NO_LOWLEVEL_EXT + if (joystick) { + int index = PortIndex(joystick->instance_id); + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + SetJoyPortAttrs(index, SJA_RumbleSetSlowMotor, low_frequency_rumble >> 8, SJA_RumbleSetFastMotor, low_frequency_rumble >> 8, TAG_END); + joystick->hwdata->effect_expiration = SDL_GetTicks() + duration_ms; + if (!joystick->hwdata->effect_expiration) { + joystick->hwdata->effect_expiration = 1; + } + } else { + SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); + joystick->hwdata->effect_expiration = 0; + } + } +#endif + + return 0; } SDL_JoystickDriver SDL_AMIGA_JoystickDriver = From 2176d1b34d8bebe13da1bff0edeadfdb6cfc8c47 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 22 Mar 2020 20:39:01 +0100 Subject: [PATCH 142/214] Fix (by BSzilli) --- src/joystick/amiga/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 5cd587f346..7c2f510964 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -448,7 +448,7 @@ static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) if(LowLevelBase) /* ne to reinitialize */ { int index = PortIndex(joystick->instance_id); - SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); + //SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); #ifndef NO_LOWLEVEL_EXT if (joystick->hwdata->effect_expiration) { SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); From e6751d1429c420c2c79f6f32392db548f8f6ff31 Mon Sep 17 00:00:00 2001 From: BSzili Date: Tue, 24 Mar 2020 09:03:28 +0100 Subject: [PATCH 143/214] removed the lowlevel d-pad axis hack, the analog stick is now independent from it --- src/joystick/amiga/SDL_sysjoystick.c | 67 +++------------------------- 1 file changed, 6 insertions(+), 61 deletions(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 7c2f510964..b04da3a8b1 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -44,20 +44,6 @@ /* The maximum number of joysticks we'll detect */ #define MAX_JOYSTICKS 4 /* lowlevel.library is limited to 4 ports */ -/* Directions/Axis differences */ -#define MOS_PLUS 32767 /* was 127, changed by Henes (20040801) */ -#define MOS_MINUS -32768 /* was -127 */ - -#ifndef JP_TYPE_ANALOGUE -#define JP_TYPE_ANALOGUE (14<<28) /* port has analogue joystick */ -#define JP_XAXIS_MASK (255<<0) /* horizontal position */ -#define JP_YAXIS_MASK (255<<8) /* vertical position */ -#define JP_ANALOGUE_PORT_MAGIC (1<<16) /* port offset to force analogue readout */ -#endif - - -extern struct Library *LowLevelBase; - static const ULONG joybut[] = { JPF_BUTTON_RED, @@ -266,14 +252,16 @@ static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) } joystick->nballs = 0; - joystick->naxes = 2; /* FIXME: even for JP_TYPE_NOTAVAIL ? */ + 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)) + if (LowLevelBase->lib_Version > 50 || (LowLevelBase->lib_Version >= 50 && LowLevelBase->lib_Revision >= 17)) { joystick->hwdata->supports_analog = 1; + joystick->naxes = 2; + } #endif return 0; @@ -358,62 +346,19 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) SDL_PrivateJoystickAxis(joystick, 1, value); } } - else #endif - { - if((joystick->hwdata->joystate & (JPF_JOY_DOWN|JPF_JOY_UP)) != (data & (JPF_JOY_DOWN|JPF_JOY_UP))) - { - Sint16 value; - - /* UP and DOWN direction */ - if(data & JPF_JOY_DOWN) - { - value = MOS_PLUS; - } - else if(data & JPF_JOY_UP) - { - value = MOS_MINUS; - } - else - { - value = 0; - } - - SDL_PrivateJoystickAxis(joystick, 1, value); - } - - if((joystick->hwdata->joystate & (JPF_JOY_LEFT|JPF_JOY_RIGHT)) != (data & (JPF_JOY_LEFT|JPF_JOY_RIGHT))) - { - Sint16 value; - - /* LEFT and RIGHT direction */ - if(data & JPF_JOY_LEFT) - { - value = MOS_MINUS; - } - else if(data & JPF_JOY_RIGHT) - { - value = MOS_PLUS; - } - else - { - value = 0; - } - - SDL_PrivateJoystickAxis(joystick, 0, value); - } - } /* 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])) { From 05cecb98cd346290e7fc50c051fe2a83a7c189fa Mon Sep 17 00:00:00 2001 From: BSzili Date: Tue, 24 Mar 2020 17:03:53 +0100 Subject: [PATCH 144/214] replaced ranlib with the s ar option --- Makefile.mos | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index ef7e280371..8823e07ccb 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -7,8 +7,7 @@ CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 #CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I./include CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) -AR = ar -RANLIB = ranlib +AR = ppc-morphos-ar ECHE = echo -e BOLD = \033[1m @@ -97,8 +96,7 @@ src/core/morphos/SDL_library.o: src/core/morphos/SDL_library.c src/core/morphos/ $(TARGET): $(OBJECTS) $(ARCHIVING) - @$(AR) crv $@ $^ - $(RANLIB) $@ + @$(AR) crvs $@ $^ $(LIBRARY): $(TARGET) $(COREOBJECTS) $(LINKING) From 762aa404c7dccb30b043c64811479ddefe172fbb Mon Sep 17 00:00:00 2001 From: BSzili Date: Tue, 24 Mar 2020 17:25:54 +0100 Subject: [PATCH 145/214] implemented SDL_setenv for MorphOS --- src/core/morphos/devenv/sdl-startup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c index 2632706ff0..201d48bfe6 100644 --- a/src/core/morphos/devenv/sdl-startup.c +++ b/src/core/morphos/devenv/sdl-startup.c @@ -174,6 +174,25 @@ char *SDL_getenv(const char *name) 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. From e43ae6be55be0e0e784d8dcbcd548168888d5597 Mon Sep 17 00:00:00 2001 From: BSzili Date: Tue, 24 Mar 2020 17:35:01 +0100 Subject: [PATCH 146/214] make the tests build for MorphOS --- test/Makefile.mos | 25 +++++++++++++++++++------ test/helloworld.c | 5 +++++ test/sdl2benchmark.c | 4 ++++ test/testvulkan.c | 2 +- test/torturethread.c | 2 ++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/test/Makefile.mos b/test/Makefile.mos index f5513b7809..a1e0bc00d4 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -1,8 +1,9 @@ # Makefile to build the MorphOS SDL tests -CC = ppc-morphos-gcc-9 +AR = ppc-morphos-ar +CC = ppc-morphos-gcc CFLAGS = -noixemul -O2 -Wall -g -I../include -LIBS = -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm +LIBS = -L. -lSDL2test -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm TARGETS = \ checkkeys \ @@ -26,7 +27,6 @@ TARGETS = \ testfile \ testfilesystem \ testgamecontroller \ - testgesture \ testgl2 \ testgles \ testgles2 \ @@ -55,7 +55,6 @@ TARGETS = \ testrumble \ testscale \ testsem \ - testsensor \ testshader \ testshape \ testsprite2 \ @@ -69,8 +68,22 @@ TARGETS = \ testwm2 \ testyuv \ torturethread \ - -all: $(TARGETS) + +# 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) 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/testvulkan.c b/test/testvulkan.c index d6e7c152d1..881308e988 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); From 726b07df5440d2cc9c8ee43c7dea993dc6586d39 Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 25 Mar 2020 18:28:42 +0100 Subject: [PATCH 147/214] enabled the OpenGL test on MorphOS --- test/Makefile.mos | 4 ++-- test/testgl2.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/Makefile.mos b/test/Makefile.mos index a1e0bc00d4..11ae4c29b9 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -2,7 +2,7 @@ AR = ppc-morphos-ar CC = ppc-morphos-gcc -CFLAGS = -noixemul -O2 -Wall -g -I../include +CFLAGS = -noixemul -O2 -Wall -g -I../include -DHAVE_OPENGL LIBS = -L. -lSDL2test -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm TARGETS = \ @@ -296,4 +296,4 @@ testvulkan: testvulkan.o $(CC) -o $@ $^ $(LIBS) clean: - rm -f $(TARGETS) *.o + rm -f $(TARGETS) *.o $(COBJS) $(TESTLIB) 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 { \ From 82fd1be34c526052a92ce34e92835ecadd467317 Mon Sep 17 00:00:00 2001 From: BSzili Date: Wed, 25 Mar 2020 19:31:21 +0100 Subject: [PATCH 148/214] stop the log spam by AMIGA_GL_GetDrawableSize --- src/video/amiga/SDL_amigaopengl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index a7497ebe09..147820a82c 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -170,19 +170,19 @@ AMIGA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) void AMIGA_GL_GetDrawableSize(_THIS, SDL_Window * window, int *w, int *h) { - D("[%s]\n", __FUNCTION__); + //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); + //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); + //D("[%s] h %d\n", __FUNCTION__, *h); } } } From b324bd0057aea2e12dae7596f3a75bda9aea9b0b Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 07:09:25 +0100 Subject: [PATCH 149/214] AMIGA_GL_DeleteContext can be called after AMIGA_GL_UnloadLibrary --- src/video/amiga/SDL_amigaopengl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index 147820a82c..d9a23733c7 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -218,6 +218,11 @@ 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); From 75a8f9e3d84362b12dfa6b74d77988a9cfbfae1d Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 07:29:24 +0100 Subject: [PATCH 150/214] better debug log in SDL_SYS_JoystickUpdate --- src/joystick/amiga/SDL_sysjoystick.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index b04da3a8b1..3aa13e3b1a 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -94,7 +94,7 @@ static int SDL_SYS_JoystickGetCount(void) static void SDL_SYS_JoystickDetect() { - D("[%s]\n", __FUNCTION__); + //D("[%s]\n", __FUNCTION__); } static int SDL_SYS_JoystickInit(void) @@ -276,16 +276,14 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) #endif int i, index; - D("[%s] joystick 0x%08lx\n", __FUNCTION__, joystick); - - if(!LowLevelBase) + /*if(!LowLevelBase) { if(SDL_JoystickInit() < 1) { D("Initialize Joysticks first!\n"); return; } - } + }*/ index = PortIndex(joystick->instance_id); @@ -295,6 +293,8 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) 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 */ From 79bf41724833ee355b03ca2a8658e008535c1d55 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 18:03:04 +0100 Subject: [PATCH 151/214] rumble duration is now handled by SDL --- src/joystick/amiga/SDL_sysjoystick.c | 26 +++----------------------- src/joystick/morphos/SDL_sysjoystick.c | 2 +- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 3aa13e3b1a..75c249f4e8 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -61,7 +61,6 @@ struct joystick_hwdata #ifndef NO_LOWLEVEL_EXT ULONG joystate_ext; ULONG supports_analog; - Uint32 effect_expiration; #endif }; @@ -374,15 +373,6 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) joystick->hwdata->joystate = data; #ifndef NO_LOWLEVEL_EXT joystick->hwdata->joystate_ext = data_ext; - - /* Rumble */ - if (joystick->hwdata->effect_expiration) { - Uint32 now = SDL_GetTicks(); - if (SDL_TICKS_PASSED(now, joystick->hwdata->effect_expiration)) { - SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); - joystick->hwdata->effect_expiration = 0; - } - } #endif } @@ -394,11 +384,6 @@ static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) { int index = PortIndex(joystick->instance_id); //SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); -#ifndef NO_LOWLEVEL_EXT - if (joystick->hwdata->effect_expiration) { - SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); - } -#endif } if(joystick->hwdata) @@ -452,9 +437,9 @@ static SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) return device_index; } -static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +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 ms %d\n", __FUNCTION__, joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); + D("[%s] joystick 0x%08lx low %d high %d\n", __FUNCTION__, joystick, low_frequency_rumble, high_frequency_rumble); if (!LowLevelBase) { return SDL_Unsupported(); @@ -464,15 +449,10 @@ static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_ if (joystick) { int index = PortIndex(joystick->instance_id); - if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + 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); - joystick->hwdata->effect_expiration = SDL_GetTicks() + duration_ms; - if (!joystick->hwdata->effect_expiration) { - joystick->hwdata->effect_expiration = 1; - } } else { SetJoyPortAttrs(index, SJA_RumbleOff, 0, TAG_END); - joystick->hwdata->effect_expiration = 0; } } #endif diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 21805eea3e..3480b3258f 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -492,7 +492,7 @@ SDL_SYS_JoystickGetDeviceGUID( int device_index ) return hwdata->guid; } static int -SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { return 0; } From f84bb9861698af05ae75b7151d5a8b9de2a6faa4 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 20:21:49 +0100 Subject: [PATCH 152/214] removed sdl2-tc-userdata-replacement.diff.txt --- .../sdl2-tc-userdata-replacement.diff.txt | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt diff --git a/src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt b/src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt deleted file mode 100644 index 46ed4050d9..0000000000 --- a/src/thread/morphos/sdl2-tc-userdata-replacement.diff.txt +++ /dev/null @@ -1,95 +0,0 @@ -Index: sdl2-main/src/thread/morphos/SDL_systhread.c -=================================================================== -RCS file: /home/cvs/root/morphos/morphoswb/libs/sdl2/sdl2-main/src/thread/morphos/SDL_systhread.c,v -retrieving revision 1.1 -diff -u -r1.1 SDL_systhread.c ---- sdl2-main/src/thread/morphos/SDL_systhread.c 11 Sep 2014 15:48:16 -0000 1.1 -+++ sdl2-main/src/thread/morphos/SDL_systhread.c 25 May 2015 18:49:10 -0000 -@@ -51,8 +51,6 @@ - { - struct Task *t = SysBase->ThisTask; - t->tc_Node.ln_Name = (STRPTR)name; -- t->tc_UserData = NULL; -- D("[%s] tc_UserData is 0x%08lx.\n", __FUNCTION__, t->tc_UserData); - } - - SDL_threadID -Index: sdl2-main/src/thread/morphos/SDL_systls.c -=================================================================== -RCS file: /home/cvs/root/morphos/morphoswb/libs/sdl2/sdl2-main/src/thread/morphos/SDL_systls.c,v -retrieving revision 1.1 -diff -u -r1.1 SDL_systls.c ---- sdl2-main/src/thread/morphos/SDL_systls.c 11 Sep 2014 15:48:16 -0000 1.1 -+++ sdl2-main/src/thread/morphos/SDL_systls.c 25 May 2015 18:49:10 -0000 -@@ -25,21 +25,69 @@ - - #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() - { -- return (SDL_TLSData *)SysBase->ThisTask->tc_UserData; -+ 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) - { -- SysBase->ThisTask->tc_UserData = 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; - } - From bade6cdc0b10e129a76271d2088b2074c2015483 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 20:22:35 +0100 Subject: [PATCH 153/214] replaced AMIGA with __MORPHOS__ --- src/cpuinfo/SDL_cpuinfo.c | 2 +- src/file/SDL_rwops.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 41d4a8be27..b171d510e8 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -971,7 +971,7 @@ SDL_GetSystemRAM(void) } } #endif -#ifdef AMIGA +#ifdef __MORPHOS__ SDL_SystemRAM = AvailMem(MEMF_FAST | MEMF_TOTAL); // Exclude possible chip ram. #endif #endif diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index a83769dc6b..3978cd15bf 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -66,12 +66,11 @@ #include "nacl_io/nacl_io.h" #endif -#if defined(AMIGA) +#ifdef __MORPHOS__ #include "../core/morphos/SDL_library.h" #include "../core/morphos/SDL_misc.h" #include -#if defined(__MORPHOS__) #undef SDLCALL #define SDLCALL __saveds @@ -88,7 +87,6 @@ asm " .size __restore_r13, __end__restore_r13 - __restore_r13\n" ); #endif -#endif #ifdef __WIN32__ From 65a3f67623e22264b29a11105f097dd460b74ec1 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 20:23:50 +0100 Subject: [PATCH 154/214] license update in a couple files --- src/video/amiga/SDL_amigagl_wrapper.c | 44 ++++++++------------ src/video/amiga/SDL_amigaopengl.c | 59 ++++++++------------------- src/video/amiga/SDL_amigaopengl.h | 48 ++++++++-------------- 3 files changed, 54 insertions(+), 97 deletions(-) diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index c52c8e1356..0780b8a36f 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -1,30 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@libsdl.org - - MorphOS/TinyGL version by LouiSe@louise.amiga.hu - - 20040205 updated with new tinygl.library functions - - 20040202 returncodes fixe - + 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" diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index d9a23733c7..afc134e313 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -1,45 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@libsdl.org - - MorphOS/TinyGL support by LouiSe@louise.amiga.hu - - HISTORY: - - 20040507 Window title (SetCaption) fixed for TGL window - - 20040505 AmigaMesa code removed - GLAInitializeContextScreen() added for fullscreen mode - - 20040501 Debug lines added - - 20040306 updated for new tinyl (AMIGA_GL_Update) - - 20040202 AMIGA_GL_GetAttribute() function fixed - - 20040131 code cleanup - - 20040130 Sixk's patches added - - 20040101 first release - + 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" diff --git a/src/video/amiga/SDL_amigaopengl.h b/src/video/amiga/SDL_amigaopengl.h index 8fd625b6f7..3b77b812d1 100644 --- a/src/video/amiga/SDL_amigaopengl.h +++ b/src/video/amiga/SDL_amigaopengl.h @@ -1,30 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@libsdl.org - - MorphOS/TinyGL support by LouiSe@louise.amiga.hu - - HISTORY: - - 20040131 - code cleanup - + 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 */ @@ -34,10 +26,6 @@ #ifndef _SDL_amigaopengl_h #define _SDL_amigaopengl_h -/*#include -#include -#include */ - /* OpenGL functions */ extern int AMIGA_GL_LoadLibrary(_THIS, const char *path); extern void *AMIGA_GL_GetProcAddress(_THIS, const char *proc); From b5c72c2d484c293fea90ec63f201707b3394d710 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 20:34:05 +0100 Subject: [PATCH 155/214] changed AMIGA to __MORPHOS__ in SDL_rwops.h --- include/SDL_rwops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 2536a0c648..31f2d7ef61 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -116,7 +116,7 @@ typedef struct SDL_RWops size_t left; } buffer; } windowsio; -#elif defined(AMIGA) +#elif defined(__MORPHOS__) struct { Uint8 AppendMode : 1, NoSeek : 1, IsAtEnd : 1, autoclose : 1; From b30d5a5c1eb2dce96331a3505182f7ca3f0d4802 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 20:52:44 +0100 Subject: [PATCH 156/214] fixed the MorphOS RWOPS to pass every test --- include/SDL_rwops.h | 2 +- src/file/SDL_rwops.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 31f2d7ef61..ee92bf5984 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -120,7 +120,7 @@ typedef struct SDL_RWops struct { Uint8 AppendMode : 1, NoSeek : 1, IsAtEnd : 1, autoclose : 1; - Uint8 Writable : 1; + Uint8 Writable : 1, Readable : 1; union { diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index 3978cd15bf..cfc88aba2f 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -366,7 +366,8 @@ amiga_file_open(SDL_RWops *context, const char *filename, const char *mode) fh = Open(filename, mode); - context->hidden.amigaio.Writable = (flag_w || flag_a) ? 1 : 0; + 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; @@ -449,9 +450,16 @@ 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 ((result = Read(context->hidden.amigaio.fp.dos, ptr, rsize)) != rsize) + if (context->hidden.amigaio.Readable) { - SDL_Error(SDL_EFWRITE); + if ((result = Read(context->hidden.amigaio.fp.dos, ptr, rsize)) != rsize) + { + SDL_Error(SDL_EFWRITE); + } + } + else + { + result = 0; } return result / size; From 8683e450e8d13e21211795525f358407dc2327c8 Mon Sep 17 00:00:00 2001 From: BSzili Date: Thu, 26 Mar 2020 21:30:33 +0100 Subject: [PATCH 157/214] switched to the internal iconv implementation for MorphOS --- include/SDL_config_morphos.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index e3b71ce243..1c8741b6a4 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -109,8 +109,8 @@ #define HAVE_TANF 1 #define HAVE_WCHAR_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_ICONV 1 +//#define HAVE_ICONV_H 1 +//#define HAVE_ICONV 1 #define HAVE_STDIO_H 1 #define HAVE_LIMITS_H 1 #define HAVE_ATANF 1 From b7d6b4f65f8160b3e669cad93621a0b5f28405d5 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 30 Mar 2020 06:40:31 +0200 Subject: [PATCH 158/214] return MBs in SDL_GetSystemRAM on MorphOS --- src/cpuinfo/SDL_cpuinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index b171d510e8..97e8dd81e8 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -972,7 +972,9 @@ SDL_GetSystemRAM(void) } #endif #ifdef __MORPHOS__ - SDL_SystemRAM = AvailMem(MEMF_FAST | MEMF_TOTAL); // Exclude possible chip ram. + if (SDL_SystemRAM <= 0) { + SDL_SystemRAM = AvailMem(MEMF_TOTAL) / (1024 * 1024); + } #endif #endif } From bc391c06d0fb9a71beb2ae0d59a71aab878ee0e8 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 1 Apr 2020 14:49:17 +0200 Subject: [PATCH 159/214] Update version for first public beta release --- src/core/morphos/SDL_amigaversion.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index 20554d1098..9cc31f4242 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,6 +1,6 @@ #define VERSION 53 #define REVISION 0 -#define DATE "11.03.2020" +#define DATE "31.03.2020" #define VERS "sdl2.library 53.0" -#define VSTRING "sdl2.library 53.0 (11.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" -#define VERSTAG "\0$VER: sdl2.library 53.0 (11.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" +#define VSTRING "sdl2.library 53.0 beta (31.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" +#define VERSTAG "\0$VER: sdl2.library 53.0 beta (31.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" From a9faadfc015a83db82dc033fe3dc5af31ddbd577 Mon Sep 17 00:00:00 2001 From: BSzili Date: Sun, 5 Apr 2020 13:24:07 +0200 Subject: [PATCH 160/214] fixed amiga_file_size --- src/file/SDL_rwops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index cfc88aba2f..ad9d445d4e 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -402,7 +402,7 @@ amiga_file_size(SDL_RWops * context) { struct FileInfoBlock fib; - if (ExamineFH(context->hidden.amigaio.fp.dos, &fib)) + if (ExamineFH64(context->hidden.amigaio.fp.dos, &fib, TAG_DONE)) return fib.fib_Size64; return -1; From 5cce6ae706c7321bdb40ca319693510f7d30e869 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 10 Apr 2020 11:33:23 +0200 Subject: [PATCH 161/214] Fix GL_SwapWindow when window is hide --- src/video/amiga/SDL_amigaopengl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index afc134e313..d4285d2d81 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -184,7 +184,9 @@ int AMIGA_GL_GetSwapInterval(_THIS) int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window) { //D("[%s]\n", __FUNCTION__); - + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (!data->win) + return -; // TODO check the window context GLASwapBuffers(__tglContext); return 0; From 5e7b7a4854a4a090418c7162111c8f5a729a8037 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 10 Apr 2020 11:36:03 +0200 Subject: [PATCH 162/214] Fix bug when come back from iconify --- src/video/amiga/SDL_amigavideo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 2f5bee676b..0f603300dd 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -125,6 +125,7 @@ AMIGA_ShowApp(_THIS) //AMIGA_GetScreen(_this); AMIGA_OpenWindows(_this); + AMIGA_GL_ResizeContext(_this, _this->current_glwin); } /* Amiga driver bootstrap functions */ From 6c48e97c941308a8c79d16f2aa75ab63fc341d3e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 10 Apr 2020 11:41:10 +0200 Subject: [PATCH 163/214] Update SDL_amigaversion.h --- src/core/morphos/SDL_amigaversion.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index 9cc31f4242..6ab2ec275c 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,6 +1,6 @@ #define VERSION 53 #define REVISION 0 -#define DATE "31.03.2020" +#define DATE "10.04.2020" #define VERS "sdl2.library 53.0" -#define VSTRING "sdl2.library 53.0 beta (31.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" -#define VERSTAG "\0$VER: sdl2.library 53.0 beta (31.03.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" +#define VSTRING "sdl2.library 53.0 (10.04.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" +#define VERSTAG "\0$VER: sdl2.library 53.0 (10.04.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" From 23a920703dd4e1a92dd65ef758bbd50eb3086c10 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 10 Apr 2020 17:57:35 +0200 Subject: [PATCH 164/214] Update SDL_amigaopengl.c --- src/video/amiga/SDL_amigaopengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index d4285d2d81..c27e02e357 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -186,7 +186,7 @@ int AMIGA_GL_SwapWindow(_THIS, SDL_Window * window) //D("[%s]\n", __FUNCTION__); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (!data->win) - return -; + return -1; // TODO check the window context GLASwapBuffers(__tglContext); return 0; From d53454ef9b47272b50df66279b68b439bc764dcf Mon Sep 17 00:00:00 2001 From: BSzili Date: Sat, 11 Apr 2020 13:00:01 +0200 Subject: [PATCH 165/214] removed the args from SDL_SYS_CreateThread on MorphOS --- src/thread/morphos/SDL_systhread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thread/morphos/SDL_systhread.c b/src/thread/morphos/SDL_systhread.c index 924f939449..21d6726567 100644 --- a/src/thread/morphos/SDL_systhread.c +++ b/src/thread/morphos/SDL_systhread.c @@ -40,9 +40,9 @@ RunThread(APTR data, struct MsgPort *port) #endif int -SDL_SYS_CreateThread(SDL_Thread * thread, void *args) +SDL_SYS_CreateThread(SDL_Thread * thread) { - thread->handle = QueueWorkItem(threadpool, (APTR)SDL_RunThread, args); + thread->handle = QueueWorkItem(threadpool, (APTR)SDL_RunThread, thread); return thread->handle == WORKITEM_INVALID ? -1 : 0; } From 9ba914abb3561e78c76a99eb0379ed205dc75da7 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 11 Apr 2020 16:59:28 +0200 Subject: [PATCH 166/214] Update library to 2.0.12 --- Makefile.mos | 5 ++-- src/core/morphos/SDL_amigaversion.h | 9 ++++--- src/core/morphos/SDL_stubs.h | 2 ++ src/core/morphos/sdk/clib/sdl2_protos.h | 7 +++--- src/core/morphos/sdk/fd/sdl2_lib.fd | 4 +++- src/core/morphos/sdk/ppcinline/sdl2.h | 32 ++++++++++++++++++------- 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 8823e07ccb..01c8112c20 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -9,6 +9,8 @@ INCLUDE = -I./include CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) AR = ppc-morphos-ar +AMIGADATE = $(shell date +"%-d.%-m.%Y") + ECHE = echo -e BOLD = \033[1m NRML = \033[22m @@ -70,7 +72,6 @@ sdk: $(LIBRARY) 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 - cp sdl2-config /usr/local/bin headers: $(HEADERING) @@ -92,7 +93,7 @@ src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.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 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + @$(CC) -mcpu=750 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -D__AMIGADATE__=\"$(AMIGADATE)\" -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c $(TARGET): $(OBJECTS) $(ARCHIVING) diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index 6ab2ec275c..f6daef635b 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,6 +1,5 @@ +#define str(s) #s +#define xstr(s) str(s) #define VERSION 53 -#define REVISION 0 -#define DATE "10.04.2020" -#define VERS "sdl2.library 53.0" -#define VSTRING "sdl2.library 53.0 (10.04.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró\r\n" -#define VERSTAG "\0$VER: sdl2.library 53.0 (10.04.2020) © Ilkka Lehtoranta, Bruno Peloille, Szilárd Biró" +#define REVISION 1 +#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_stubs.h b/src/core/morphos/SDL_stubs.h index e4aaedac69..79dfe31451 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -722,3 +722,5 @@ STUB(SDL_HapticRumbleInit) STUB(SDL_HapticRumblePlay) STUB(SDL_HapticRumbleStop) + STUB(SDL_isupper) + STUB(SDL_islower) diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 450abba4e2..58a5e21079 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -710,7 +710,7 @@ int SDL_RWclose(SDL_RWops *context); void *SDL_LoadFile(const char *file, size_t *datasize); SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); -/* 2.0.11 */ +/* 2.0.12 */ SDL_bool SDL_HasARMSIMD(void); SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index); SDL_GameController *SDL_GameControllerFromPlayerIndex(int player_index); @@ -724,9 +724,8 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Sur 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 SDLCALL SDL_isupper(int x); +int SDLCALL SDL_islower(int x); #endif diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd index aa08d89875..4ab7b7dc74 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -654,4 +654,6 @@ 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) \ No newline at end of file +SDL_HapticRumbleStop(haptic)(sysv,r12base) +SDL_isupper(x)(sysv,r12base) +SDL_islower(x)(sysv,r12base) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index f82f68ec55..302f506bd3 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -4403,14 +4403,6 @@ (((int (*)(SDL_Window *, SDL_WindowShapeMode *))*(void**)(__base - 2842))(__t__p0, __t__p1));\ }) -#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_GL_LoadLibrary(__p0) \ ({ \ const char * __t__p0 = __p0;\ @@ -4531,6 +4523,14 @@ (((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;\ @@ -5697,4 +5697,20 @@ (((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));\ + }) + #endif /* !_PPCINLINE_SDL2_H */ From aa13dd6c80dbe5f935d28c56ffaf01e62ed934c4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 12 Apr 2020 18:38:30 +0200 Subject: [PATCH 167/214] Delete TODO.MORPHOS --- TODO.MORPHOS | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 TODO.MORPHOS diff --git a/TODO.MORPHOS b/TODO.MORPHOS deleted file mode 100644 index 63cf6fa0b8..0000000000 --- a/TODO.MORPHOS +++ /dev/null @@ -1,24 +0,0 @@ -TODO - -1) Compile SDL2.library (test with SDK 3.14 and MOS 3.13) - - Make -f makefile.mos - -2) Done - - fix togglefullscreen - - fix mouse position in window mode - - add joystick support with lowlevel.library (take in powersdl) - - fix keymap/keybord problem - - fix MouseWrap (pointer escape the window when SDL_SetRelativeMouseMode(SDL_TRUE)), bug see in ZGloom (Window mode) - - fix window rezizable, bug with top border (bug see in ScummVM) - - add OpenGL/TinyGL support : ok for opengl Window context - -3) List of fix/add need - -- add GCC9 support -- fix sensors joystick -- hardware accelerated blitting and scaling with CGX functions -- hardware accelerated opengl renderer = OGL support / need GL_BGRA format for the glTexImage2D input and glReadPixels output - https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=12836&forum=12 -- make a SDL2_mixer.library : same here all is ready but library need expert's help - -BeWorld From 3a2427d90cd03e644299ebf69bc77af5bfe32977 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 15 Apr 2020 13:15:46 +0200 Subject: [PATCH 168/214] Fix Window resize --- src/video/amiga/SDL_amigawindow.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index c20fc89e6d..743a96a83a 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -250,8 +250,8 @@ AMIGA_SetWindowMinimumSize(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) { - min_w += scr->WBorLeft + scr->WBorRight; - min_h += scr->WBorTop + scr->WBorBottom; + min_w += data->win->BorderLeft + data->win->BorderRight; + min_h += data->win->BorderTop + data->win->BorderBottom; } if (vd->CustomScreen == NULL) @@ -277,8 +277,8 @@ AMIGA_SetWindowMaximumSize(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) { - max_w += scr->WBorLeft + scr->WBorRight; - max_h += scr->WBorTop + scr->WBorBottom; + max_w += data->win->BorderLeft + data->win->BorderRight; + max_h += data->win->BorderTop + data->win->BorderBottom; } if (vd->CustomScreen == NULL) @@ -304,8 +304,8 @@ AMIGA_SetWindowSize(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) { - w += scr->WBorLeft + scr->WBorRight; - h += scr->WBorTop + scr->WBorBottom; + w += data->win->BorderLeft + data->win->BorderRight; + h += data->win->BorderTop + data->win->BorderBottom; } if (vd->CustomScreen == NULL) From 24745b83cd9fd58d36a2d90b3044ec83e75aa880 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 17 Apr 2020 11:20:41 +0200 Subject: [PATCH 169/214] Fix ShowMessageBox --- src/video/amiga/SDL_amigavideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 0f603300dd..589fc51eeb 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -396,7 +396,7 @@ AMIGA_CreateDevice(int devindex) device->GetClipboardText = AMIGA_GetClipboardText; device->HasClipboardText = AMIGA_HasClipboardText; - device->ShowMessageBox = AMIGA_ShowMessageBox; + //device->ShowMessageBox = AMIGA_ShowMessageBox; //device->SetWindowResizable = AMIGA_SetWindowResizable; //device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; From 50476a09771b1cbf11d8e2f9def0f260e5ee14ea Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 20 Apr 2020 21:00:20 +0200 Subject: [PATCH 170/214] Add SetWindowResizable --- src/video/amiga/SDL_amigavideo.c | 2 +- src/video/amiga/SDL_amigawindow.c | 53 +++++++++++++++++++++++++++---- src/video/amiga/SDL_amigawindow.h | 8 +++-- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 589fc51eeb..43e51027dd 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -398,7 +398,7 @@ AMIGA_CreateDevice(int devindex) //device->ShowMessageBox = AMIGA_ShowMessageBox; - //device->SetWindowResizable = AMIGA_SetWindowResizable; + device->SetWindowResizable = AMIGA_SetWindowResizable; //device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; //device->SetWindowOpacity = AMIGA_SetWindowOpacity; diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 743a96a83a..bc2c290300 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -107,7 +107,7 @@ void AMIGA_OpenWindows(_THIS) { if (wd->win == NULL && !(wd->window->flags & SDL_WINDOW_FOREIGN) && (wd->winflags & SDL_AMIGA_WINDOW_SHOWN)) { - AMIGA_ShowWindow_Internal(wd->window); + AMIGA_ShowWindow_Internal(_this, wd->window); } } } @@ -300,7 +300,7 @@ AMIGA_SetWindowSize(_THIS, SDL_Window * window) { SDL_VideoData *vd = data->videodata; struct Screen *scr = vd->WScreen; - size_t bh = 0, h = window->h, w = window->w; + size_t bh = 0, h = window->h, w = window->w; if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) { @@ -346,7 +346,7 @@ AMIGA_WindowToFront(struct Window *win) } void -AMIGA_ShowWindow_Internal(SDL_Window * window) +AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *vd = data->videodata; @@ -497,6 +497,7 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) if (data->grabbed > 0) DoMethod((Object *)data->win, WM_ObtainEvents); } + } else if (data->win) { @@ -507,14 +508,13 @@ AMIGA_ShowWindow_Internal(SDL_Window * window) void AMIGA_ShowWindow(_THIS, SDL_Window * window) { - //SDL_WindowData *data = (SDL_WindowData *) window->driverdata; D("[%s]\n", __FUNCTION__); - AMIGA_ShowWindow_Internal(window); + AMIGA_ShowWindow_Internal(_this, window); } void -AMIGA_HideWindow_Internal(SDL_Window * window) +AMIGA_HideWindow_Internal(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; D("[%s] 0x%08lx\n", __FUNCTION__, data->win); @@ -533,7 +533,7 @@ AMIGA_HideWindow(_THIS, SDL_Window * window) D("[%s]\n", __FUNCTION__); data->winflags &= ~SDL_AMIGA_WINDOW_SHOWN; - AMIGA_HideWindow_Internal(window); + AMIGA_HideWindow_Internal(_this, window); } void @@ -709,4 +709,43 @@ AMIGA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) } } +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) + { + 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); + } +} /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h index 7fb0d6a4b6..bb3cf7b600 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -66,6 +66,7 @@ typedef struct 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); @@ -87,10 +88,11 @@ 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(SDL_Window * window); -extern void AMIGA_HideWindow_Internal(SDL_Window * window); +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 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); From 44c7e85fbac6fd9b8c3d52e48c9f77f9deda2f2d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 20 Apr 2020 22:06:42 +0200 Subject: [PATCH 171/214] Implement SetWindowOpacity --- src/video/amiga/SDL_amigavideo.c | 2 +- src/video/amiga/SDL_amigawindow.c | 23 +++++++++++++++++++++++ src/video/amiga/SDL_amigawindow.h | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 43e51027dd..3f4a2080f2 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -400,7 +400,7 @@ AMIGA_CreateDevice(int devindex) device->SetWindowResizable = AMIGA_SetWindowResizable; //device->GetWindowBordersSize = AMIGA_GetWindowBordersSize; - //device->SetWindowOpacity = AMIGA_SetWindowOpacity; + device->SetWindowOpacity = AMIGA_SetWindowOpacity; device->free = AMIGA_DeleteDevice; diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index bc2c290300..ee38eb0e04 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -748,4 +748,27 @@ AMIGA_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) 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 index bb3cf7b600..b6ea1affae 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -93,7 +93,7 @@ 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_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); //extern int AMIGA_GetWindowBordersSize(_THIS, SDL_Window * window, int * top, int * left, int * bottom, int * right); From e581376bad4b57a3ee6541a3d8f687d3dec431a6 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 21 Apr 2020 09:16:44 +0200 Subject: [PATCH 172/214] Fix compilation and put logs --- src/joystick/morphos/SDL_sysjoystick.c | 54 +++++++++++++++--------- src/joystick/morphos/SDL_sysjoystick_c.h | 2 + 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 3480b3258f..18fc021cbf 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -23,7 +23,6 @@ #ifdef SDL_JOYSTICK_MORPHOS -#include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" @@ -131,12 +130,12 @@ SDL_SYS_JoystickInit(void) { struct sensordata *s = SDL_malloc(sizeof(*s)); int rc = -1; - D("[SDL_SYS_JoystickInit]\n"); + D("[%s]\n", __FUNCTION__); if (s) { s->notifytask = SysBase->ThisTask; - D("[SDL_SYS_JoystickInit] Create sensor events worker thread...\n"); + D("[%s] Create sensor events worker thread...\n", __FUNCTION__); if (QueueWorkItem(threadpool, (THREADFUNC)sensor_events, s) == WORKITEM_INVALID) { @@ -154,21 +153,25 @@ SDL_SYS_JoystickInit(void) while (s->sensorport == NULL) Wait(SIGF_SINGLE); - D("[SDL_SYS_JoystickInit] Obtain sensor list...\n"); + D("[%s] Obtain sensor list...\n", __FUNCTION__); sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; while ((sensor = NextSensor(sensor, sensorlist, NULL))) { - CONST_STRPTR name = "", *serial = NULL; - ULONG *id; - + CONST_STRPTR name = "", serial = NULL; GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - - GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); + + size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + + //ULONG *id; - serial = va("#%lu", id); + //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); + + //serial = va("#%lu", id); + + D("[%s] name=%s, serial=%s\n", __FUNCTION__, name, serial); - if (id > 0) + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) { size_t namelen = strlen(name) + 1; struct joystick_hwdata *hwdata = SDL_malloc(sizeof(*hwdata) + namelen); @@ -191,7 +194,7 @@ SDL_SYS_JoystickInit(void) ReleaseSensorsList(sensorlist, NULL); - D("[SDL_SYS_JoystickInit] Found %ld joysticks...\n", count); + D("[%s] Found %ld joysticks...\n", __FUNCTION__, count); s->joystick_count = count; rc = count; @@ -203,6 +206,7 @@ SDL_SYS_JoystickInit(void) static int SDL_SYS_JoystickGetCount(void) { + D("[%s]\n", __FUNCTION__); return sensors->joystick_count; } @@ -233,6 +237,7 @@ static void SDL_SYS_JoystickDetect(void) static const char * SDL_SYS_JoystickGetDeviceName(int device_index) { + D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = GetByIndex(device_index); return hwdata->name; } @@ -241,6 +246,7 @@ SDL_SYS_JoystickGetDeviceName(int device_index) static SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) { + D("[%s]\n", __FUNCTION__); return device_index; } @@ -358,6 +364,7 @@ static void GetJoyData(SDL_Joystick * joystick, struct joystick_hwdata *hwdata, static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { + D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = GetByIndex(device_index); int rc = -1; @@ -367,27 +374,28 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) while ((sensor = NextSensor(sensor, sensorlist, NULL))) { - CONST_STRPTR name = ""; - ULONG *id; - //size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; + CONST_STRPTR name = "", serial = NULL; + + size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); + //ULONG *id; + //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); - //if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) - if (id > 0 && strcmp(hwdata->name, name) == 0) + D("[%s] name=%s, serial=%s\n", __FUNCTION__, name, serial); + if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) { - /*SDL_JoystickGUID guid; + SDL_JoystickGUID guid; strncpy((char *)&guid, serial, sizeof(guid)); if (memcmp(&hwdata->guid, &guid, sizeof(guid)) == 0) - {*/ + { GetJoyData(joystick, hwdata, sensor); rc = 0; break; - /*}*/ + } } } @@ -400,6 +408,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) static void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { + D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = joystick->hwdata; struct sensornotify *sn; void *buffer; @@ -454,6 +463,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) void SDL_SYS_JoystickClose(SDL_Joystick * joystick) { + D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = joystick->hwdata; if (hwdata) @@ -474,6 +484,7 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) static void SDL_SYS_JoystickQuit(void) { + D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata, *tmp; struct sensordata *s = sensors; @@ -491,6 +502,7 @@ SDL_SYS_JoystickGetDeviceGUID( int device_index ) struct joystick_hwdata *hwdata = GetByIndex(device_index); return hwdata->guid; } + static int SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 3f12332abc..feb9025233 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -23,6 +23,8 @@ #ifdef SDL_JOYSTICK_MORPHOS +#include "SDL_joystick.h" + #ifndef EXEC_LISTS_H #include #endif From 988c4a3ab84226f8b1a620672dd1544080f6c2e5 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 23 Apr 2020 08:22:56 +0200 Subject: [PATCH 173/214] Fix warnings and add GCC9 support --- Makefile.mos | 10 ++++----- src/core/morphos/devenv/Makefile | 20 +++++++----------- src/file/SDL_rwops.c | 8 +++---- src/joystick/amiga/SDL_sysjoystick.c | 2 +- src/thread/morphos/SDL_systhread.c | 22 +++++++++++++------- src/video/SDL_blit_N.c | 30 +++++++++++++-------------- src/video/amiga/SDL_amigaevents.c | 2 +- src/video/amiga/SDL_amigagl_wrapper.c | 15 ++++++++++++-- src/video/amiga/SDL_amigashape.c | 2 +- src/video/amiga/SDL_amigavideo.c | 2 +- 10 files changed, 62 insertions(+), 51 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index 01c8112c20..e39a6520d3 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -3,11 +3,11 @@ # Enable debug with -D__SDL_DEBUG CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG -CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 -#CC = ppc-morphos-gcc-9 -noixemul +#CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 +CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I./include CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) -AR = ppc-morphos-ar +AR = ppc-morphos-ar AMIGADATE = $(shell date +"%-d.%-m.%Y") @@ -93,7 +93,7 @@ src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.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 -O2 $(INCLUDE) -Wall -fno-strict-aliasing -D__AMIGADATE__=\"$(AMIGADATE)\" -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + @$(CC) -mcpu=750 $(INCLUDE) -Wall -fno-strict-aliasing -D__AMIGADATE__=\"$(AMIGADATE)\" -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c $(TARGET): $(OBJECTS) $(ARCHIVING) @@ -110,4 +110,4 @@ clean: @cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi; dump: - objdump --disassemble-all --reloc $(LIBRARY).db >$(LIBRARY).s + ppc-morphos-objdump --disassemble-all --reloc $(LIBRARY).db >$(LIBRARY).s diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index 726ee549f4..52c0586aef 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -1,11 +1,10 @@ -# Makefile to build the SDL 2 +# Makefile to build the SDL 2 Library -CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 -#CC = ppc-morphos-gcc-9 -noixemul +#CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 +CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I../../../../include -I../sdk CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE -AR = ar -RANLIB = ranlib +AR = ppc-morphos-ar ECHE = echo -e BOLD = \033[1m @@ -52,27 +51,24 @@ lib/libSDL2.a: sdl-startup.o SDL_amigagl_wrapper.o ../sdk/fd/sdl2_lib.fd @mkdir -p lib @-rm -f $@ @cvinclude.pl --fd=../sdk/fd/sdl2_lib.fd --clib=../sdk/clib/sdl2_protos.h --gluelib=$@ - @$(AR) cru $@ sdl-startup.o SDL_amigagl_wrapper.o - @ppc-morphos-ranlib $@ + @$(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) cru $@ sdl-startup-brel.o SDL_amigagl_wrapper-brel.o - @ppc-morphos-ranlib $@ + @$(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) cru $@ sdl-startup-brel-nc.o SDL_amigagl_wrapper-nc.o - @ppc-morphos-ranlib $@ + @$(AR) crus $@ sdl-startup-brel-nc.o SDL_amigagl_wrapper-nc.o clean: @-rm -rf lib *.s *.o dump: - objdump --disassemble-all --reloc lib/libSDL2.a >lib/libSDL2.s + ppc-morphos-objdump --disassemble-all --reloc lib/libSDL2.a >lib/libSDL2.s diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index ad9d445d4e..0f0e76b662 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -448,7 +448,7 @@ 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__); + //D("[%s]\n", __FUNCTION__); if (context->hidden.amigaio.Readable) { @@ -469,7 +469,7 @@ 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__); + //D("[%s]\n", __FUNCTION__); if (context->hidden.amigaio.Writable) { @@ -537,9 +537,7 @@ SDL_RWops * SDL_RWFromFP_clib_REAL(void *fp, } return(rwops); } -#endif - -#ifdef HAVE_STDIO_H +#elif defined(HAVE_STDIO_H) #ifdef HAVE_FOPEN64 #define fopen fopen64 diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 75c249f4e8..5070220a78 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -292,7 +292,7 @@ static void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) 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); + //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 */ diff --git a/src/thread/morphos/SDL_systhread.c b/src/thread/morphos/SDL_systhread.c index 21d6726567..3850e19915 100644 --- a/src/thread/morphos/SDL_systhread.c +++ b/src/thread/morphos/SDL_systhread.c @@ -64,13 +64,21 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { ssize_t pri = 0; - switch (priority) - { - case SDL_THREAD_PRIORITY_LOW: pri = -5; break; - case SDL_THREAD_PRIORITY_NORMAL: pri = 0; break; - case SDL_THREAD_PRIORITY_HIGH: pri = 5; break; - } - + 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; } diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 4e799f54dc..911a5a5c52 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -68,16 +68,7 @@ GetL3CacheSize(void) return result; } -#else -static size_t -GetL3CacheSize(void) -{ - /* XXX: Just guess G4 */ - return 2097152; -} -#endif /* __MACOSX__ */ - -#if defined(__MORPHOS__) +#elif defined(__MORPHOS__) #include #include @@ -87,7 +78,7 @@ SDL_IsG5(void) size_t is_g5 = 0; char *cpu_family; - if (NewGetSystemAttrs(&cpu_family, sizeof(cpu_family), SYSTEMINFOTYPE_CPUFAMILYNAME, TAG_DONE)) + if (NewGetSystemAttrsA(&cpu_family, sizeof(cpu_family), SYSTEMINFOTYPE_CPUFAMILYNAME, NULL)) { if (cpu_family && stricmp(cpu_family, "G5") == 0) is_g5 = 1; @@ -95,7 +86,14 @@ SDL_IsG5(void) return is_g5; } -#endif +#else +static size_t +GetL3CacheSize(void) +{ + /* XXX: Just guess G4 */ + return 2097152; +} +#endif /* __MACOSX__ */ #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) \ @@ -942,12 +940,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() ? 4 : 0) - #else +#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 +#endif ); } } diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 2fd2be9581..abafffd642 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -148,7 +148,7 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) static void AMIGA_MouseMove(const struct IntuiMessage *m, SDL_WindowData *data) { - SDL_Mouse *mouse = SDL_GetMouse(); + //SDL_Mouse *mouse = SDL_GetMouse(); if (!SDL_GetRelativeMouseMode()) { diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index 0780b8a36f..da501cde3d 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -1622,7 +1622,11 @@ 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, @@ -1630,8 +1634,11 @@ static void AmiglTexSubImage2D( GLenum target, GLint level, 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, @@ -1854,7 +1861,7 @@ static void AmiglColorTableEXT( GLenum target, GLenum internalformat, #ifndef __MORPHOS__ glColorTableEXT(target, internalformat, width, format, type, table); #else - glColorTable(target, internalformat, width, format, type, table); + glColorTable(target, internalformat, width, format, type, (GLvoid *)table); #endif } @@ -2022,7 +2029,11 @@ static void AmiglPointParameterfvEXT( GLenum pname, GLfloat *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, diff --git a/src/video/amiga/SDL_amigashape.c b/src/video/amiga/SDL_amigashape.c index a2efdb0503..0e6629854e 100644 --- a/src/video/amiga/SDL_amigashape.c +++ b/src/video/amiga/SDL_amigashape.c @@ -84,7 +84,7 @@ AMIGA_ShapeToRegion(struct Region *region, SDL_Surface *shape, const SDL_WindowS for (x = 0; x < shape->w; x++) { - Uint32 pixel_value, mask_value; + Uint32 pixel_value = 0, mask_value = 0; Uint8 *pixel = (Uint8 *)(pixels) + (y * pitch) + (x * bpr); Uint8 r, g, b, alpha; diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 3f4a2080f2..5cb2d53360 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -157,7 +157,7 @@ AMIGA_VideoInit(_THIS) static void AMIGA_VideoQuit(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + //SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; D("[%s]\n", __FUNCTION__); AMIGA_CloseWindows(_this); From aa161cb01e65a3e0cef782d7d96b6413f9fb048d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 28 Apr 2020 16:57:50 +0200 Subject: [PATCH 174/214] Fix crash Fix crash when CurrentDir change by chdir Example : OpenTTD --- src/core/morphos/devenv/sdl-startup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c index 201d48bfe6..6be9c92fe9 100644 --- a/src/core/morphos/devenv/sdl-startup.c +++ b/src/core/morphos/devenv/sdl-startup.c @@ -94,9 +94,9 @@ static DESTRUCTOR_P(cleanup_SDL2Base, 100) { if (NewLock) { - CurrentDir(OldLock); - UnLock(NewLock); - //UnLock(CurrentDir(OldLock)); + //CurrentDir(OldLock); + //UnLock(NewLock); + UnLock(CurrentDir(OldLock)); } CloseLibrary(base); @@ -273,4 +273,4 @@ void *SDL_GL_GetProcAddress(const char *proc) D("[%s] proc %s func 0x%08lx\n", __FUNCTION__, proc, func); return func; -} \ No newline at end of file +} From 74361773059a9ece8623ce5dc15020408fcfc004 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 30 Apr 2020 08:13:43 +0200 Subject: [PATCH 175/214] Fix init system cursor --- src/video/amiga/SDL_amigamouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c index 60f2b54239..81fcfd609b 100644 --- a/src/video/amiga/SDL_amigamouse.c +++ b/src/video/amiga/SDL_amigamouse.c @@ -271,7 +271,7 @@ AMIGA_InitMouse(_THIS) mouse->WarpMouse = AMIGA_WarpMouse; mouse->SetRelativeMouseMode = AMIGA_SetRelativeMouseMode; - //SDL_SetDefaultCursor(WIN_CreateDefaultCursor()); + SDL_SetDefaultCursor(AMIGA_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); //SDL_SetDoubleClickTime(GetDoubleClickTime()); } From 03753506d73d1a681268a47172bef7835f452345 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 1 May 2020 18:03:32 +0200 Subject: [PATCH 176/214] Add AMIGA_GetDoubleClickTimeInMillis --- src/video/amiga/SDL_amigamouse.c | 55 +++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c index 81fcfd609b..67ff72471d 100644 --- a/src/video/amiga/SDL_amigamouse.c +++ b/src/video/amiga/SDL_amigamouse.c @@ -24,6 +24,7 @@ #include "SDL_amigavideo.h" #include "../../events/SDL_mouse_c.h" +#include "SDL_hints.h" #include #include @@ -32,7 +33,8 @@ #include #include #include - +#include +#include static SDL_Cursor * AMIGA_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) @@ -183,11 +185,11 @@ AMIGA_WarpMouse(SDL_Window * window, int x, int y) D("[%s]\n", __FUNCTION__); BOOL warpHostPointer; - + warpHostPointer = !SDL_GetRelativeMouseMode() && (window == SDL_GetMouseFocus()); - + if (warpHostPointer) { - + if ((win = data->win)) { struct MsgPort port; @@ -259,10 +261,53 @@ AMIGA_SetRelativeMouseMode(SDL_bool enabled) 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; @@ -272,7 +317,7 @@ AMIGA_InitMouse(_THIS) mouse->SetRelativeMouseMode = AMIGA_SetRelativeMouseMode; SDL_SetDefaultCursor(AMIGA_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); - //SDL_SetDoubleClickTime(GetDoubleClickTime()); + SDL_SetHint(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, SDL_uitoa(AMIGA_GetDoubleClickTimeInMillis(_this), buffer, 10)); } void From 5107c0b68f1ce8f325147801f78b954aaabfa31d Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 1 May 2020 19:46:41 +0200 Subject: [PATCH 177/214] Fix warning compilation --- src/core/morphos/devenv/sdl-startup.c | 4 ++-- src/core/morphos/sdk/clib/sdl2_protos.h | 6 +++--- src/joystick/amiga/SDL_sysjoystick.c | 2 +- src/video/amiga/SDL_amigakeyboard.c | 4 ++-- src/video/amiga/SDL_amigamouse.h | 2 +- src/video/amiga/SDL_amigawindow.c | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/morphos/devenv/sdl-startup.c b/src/core/morphos/devenv/sdl-startup.c index 6be9c92fe9..2f9d213c27 100644 --- a/src/core/morphos/devenv/sdl-startup.c +++ b/src/core/morphos/devenv/sdl-startup.c @@ -21,7 +21,7 @@ #if defined(__NO_SDL_CONSTRUCTORS) extern struct Library *SDL2Base; #else -void _INIT_4_SDL2Base(void) __attribute__((alias("__CSTP_init_SDL2Base"))); +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"))); @@ -111,7 +111,7 @@ static DESTRUCTOR_P(cleanup_SDL2Base, 100) */ #include -void _getenv(void) __attribute__((alias("SDL_getenv"))); +char *_getenv(const char *) __attribute__((alias("SDL_getenv"))); static const char home[] = "PROGDIR:home"; diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 58a5e21079..9e6f8f5c53 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -52,8 +52,8 @@ 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); +//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 *)); @@ -365,7 +365,7 @@ 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_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); diff --git a/src/joystick/amiga/SDL_sysjoystick.c b/src/joystick/amiga/SDL_sysjoystick.c index 5070220a78..cde48a3f23 100644 --- a/src/joystick/amiga/SDL_sysjoystick.c +++ b/src/joystick/amiga/SDL_sysjoystick.c @@ -382,7 +382,7 @@ static void SDL_SYS_JoystickClose(SDL_Joystick *joystick) if(LowLevelBase) /* ne to reinitialize */ { - int index = PortIndex(joystick->instance_id); + //int index = PortIndex(joystick->instance_id); //SetJoyPortAttrs(index, SJA_Type, SJA_TYPE_AUTOSENSE, TAG_END); } diff --git a/src/video/amiga/SDL_amigakeyboard.c b/src/video/amiga/SDL_amigakeyboard.c index a8beed019f..07b7e6ddb4 100644 --- a/src/video/amiga/SDL_amigakeyboard.c +++ b/src/video/amiga/SDL_amigakeyboard.c @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" +#include "../SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" - #include "../../events/scancodes_amiga.h" #include @@ -78,7 +78,7 @@ static void AMIGA_UpdateKeymap(_THIS) void AMIGA_InitKeyboard(_THIS) { - AMIGA_UpdateKeymap(_THIS); + AMIGA_UpdateKeymap(_this); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command"); diff --git a/src/video/amiga/SDL_amigamouse.h b/src/video/amiga/SDL_amigamouse.h index 23e81a0473..147905e4de 100644 --- a/src/video/amiga/SDL_amigamouse.h +++ b/src/video/amiga/SDL_amigamouse.h @@ -23,7 +23,7 @@ #ifndef _SDL_amigamouse_h #define _SDL_amigamouse_h -#include "../../events/SDL_mouse_c.h" +#include "SDL_amigavideo.h" #define IS_SYSTEM_CURSOR(cursor) (cursor == NULL || ((size_t)(cursor)->driverdata) < POINTERTYPE_NUMTYPES) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index ee38eb0e04..4b4bd036b4 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -32,6 +32,7 @@ #include "SDL_amigavideo.h" #include "SDL_amigamodes.h" #include "SDL_amigamouse.h" +#include "SDL_amigaopengl.h" #include From ccf6a2c01f97eadf60b2cc3669f759e48fcd7022 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 3 May 2020 13:15:25 +0200 Subject: [PATCH 178/214] First Version of Sensors Support --- src/joystick/SDL_gamecontrollerdb.h | 3 + src/joystick/SDL_joystick.c | 8 + src/joystick/morphos/SDL_sysjoystick.c | 629 +++++++++-------------- src/joystick/morphos/SDL_sysjoystick_c.h | 60 +-- 4 files changed, 276 insertions(+), 424 deletions(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 11098077f3..688ec96e07 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -846,6 +846,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 "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL }; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 7b4dce649e..fa8569df66 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1468,10 +1468,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/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 18fc021cbf..31d6d42b00 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 @@ -25,6 +25,8 @@ #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "SDL_endian.h" +#include "SDL_joystick.h" #include #include @@ -37,89 +39,22 @@ #include #include -#define BUFFER_OFFSET(buffer, offset) (((int32 *)buffer)[offset]) -#define BUFFER_SIZE (256) +// SDL2 deadzone is around 409, we need 1638 +#define DEADZONE_MIN (-0.05) +#define DEADZONE_MAX (0.05) -static const size_t sensortags[] = { SENSORS_Class, SensorClass_HID, SENSORS_Type, SensorType_HID_Gamepad, TAG_DONE }; -static struct sensordata *sensors; +#define CLAMP(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) -extern APTR threadpool; +//#define HOT_PLUG +#define MAX_JOYSTICKS 32 -static char *va(char *fmt, ...) { - va_list ap; - static char string[2][BUFFER_SIZE]; - static unsigned int index = 0; - char *buf; - - buf = string[index & 1]; - index++; - - va_start(ap, fmt); - vsnprintf(buf, BUFFER_SIZE, fmt, ap); - va_end(ap); - - return buf; -} +APTR sensorlist; +APTR JoySensor[MAX_JOYSTICKS]; +int joystick_count; -static void sensor_events(struct sensordata *sensors, struct MsgPort *port) +static int SDL_SYS_JoystickGetCount(void) { - struct SensorsNotificationMessage *snm; - - sensors->sensorport = port; - - Signal(sensors->notifytask, SIGF_SINGLE); - - for (;;) - { - ULONG sigs = Wait(1 << port->mp_SigBit | SIGBREAKF_CTRL_C); - - if (sigs & SIGBREAKF_CTRL_C) - break; - - snm = (struct SensorsNotificationMessage *)GetMsg(port); - - // a NULL snm->Sensor means it's a class list change notification! - if (snm->Sensor == NULL) - { - } - else - { - struct TagItem *tag, *tags = snm->Notifications; - struct sensornotify *sn = snm->UserData; - - while ((tag = NextTagItem(&tags))) - { - DOUBLE *ptr = (DOUBLE *)tag->ti_Data; - - switch (tag->ti_Tag) - { - case SENSORS_HIDInput_Value: - if (sn->type == SensorType_HIDInput_Trigger) - sn->values[0] = *ptr; - break; - - case SENSORS_HIDInput_Y_Index: - case SENSORS_HIDInput_NS_Value: - sn->values[1] = *ptr; - break; - - case SENSORS_HIDInput_X_Index: - case SENSORS_HIDInput_EW_Value: - sn->values[0] = *ptr; - break; - - case SENSORS_HIDInput_Z_Index: - sn->values[2] = *ptr; - break; - } - } - } - - ReplyMsg(&snm->Msg); - } - - while ((snm = (APTR)GetMsg(port))) - ReplyMsg(&snm->Msg); + return joystick_count; } /* Function to scan the system for joysticks. @@ -128,108 +63,26 @@ static void sensor_events(struct sensordata *sensors, struct MsgPort *port) static int SDL_SYS_JoystickInit(void) { - struct sensordata *s = SDL_malloc(sizeof(*s)); int rc = -1; - D("[%s]\n", __FUNCTION__); - - if (s) - { - s->notifytask = SysBase->ThisTask; - D("[%s] Create sensor events worker thread...\n", __FUNCTION__); - - if (QueueWorkItem(threadpool, (THREADFUNC)sensor_events, s) == WORKITEM_INVALID) - { - SDL_free(s); - } - else - { - APTR sensorlist, sensor = NULL; - ULONG count = 0; - - sensors = s; - - NEWLIST(&s->sensorlist); - - while (s->sensorport == NULL) - Wait(SIGF_SINGLE); - - D("[%s] Obtain sensor list...\n", __FUNCTION__); - sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; - - while ((sensor = NextSensor(sensor, sensorlist, NULL))) - { - CONST_STRPTR name = "", serial = NULL; - GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - - size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; - - //ULONG *id; - - //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); - //serial = va("#%lu", id); - - D("[%s] name=%s, serial=%s\n", __FUNCTION__, name, serial); - - if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) - { - size_t namelen = strlen(name) + 1; - struct joystick_hwdata *hwdata = SDL_malloc(sizeof(*hwdata) + namelen); - - if (hwdata) - { - count++; - - ADDTAIL(&s->sensorlist, hwdata); - NEWLIST(&hwdata->notifylist); - - hwdata->attached = 1; + APTR sensor = NULL; + ULONG count = 0; - // Using strncpy() is intentional - strncpy((char *)&hwdata->guid, serial, sizeof(hwdata->guid)); - strcpy(hwdata->name, name); - } - } - } - - ReleaseSensorsList(sensorlist, NULL); - - D("[%s] Found %ld joysticks...\n", __FUNCTION__, count); - - s->joystick_count = count; - rc = count; - } + 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 int SDL_SYS_JoystickGetCount(void) -{ - D("[%s]\n", __FUNCTION__); - return sensors->joystick_count; -} - -static struct joystick_hwdata *GetByIndex(int index) -{ - struct joystick_hwdata *hwdata = NULL, *ptr; - - - ForeachNode(&sensors->sensorlist, ptr) - { - if (index == 0) - { - hwdata = ptr; - break; - } - - index--; - }; - - return hwdata; -} - -static void SDL_SYS_JoystickDetect(void) +static void +SDL_SYS_JoystickDetect(void) { } @@ -237,124 +90,33 @@ static void SDL_SYS_JoystickDetect(void) static const char * SDL_SYS_JoystickGetDeviceName(int device_index) { - D("[%s]\n", __FUNCTION__); - struct joystick_hwdata *hwdata = GetByIndex(device_index); - return hwdata->name; + 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 +static SDL_JoystickID SDL_SYS_JoystickGetDeviceInstanceID(int device_index) { - D("[%s]\n", __FUNCTION__); return device_index; } -static void set_notify(struct sensordata *s, struct joystick_hwdata *hwdata, APTR sensor, ULONG type) +/* Function to sort Sensors */ +/*static int +SortSensorFunc(const void *a, const void *b) { - struct sensornotify *sn; - int count = 1; - - switch (type) - { - case SensorType_HIDInput_Stick: - case SensorType_HIDInput_AnalogStick: - count = 2; - break; - - case SensorType_HIDInput_3DStick: - count = 3; - break; - } - - sn = SDL_malloc(sizeof(*sn) + count * sizeof(DOUBLE)); - - if (sn) - { - size_t notifytags[] = { SENSORS_Notification_Destination, (size_t)s->sensorport, SENSORS_Notification_SendInitialValue, TRUE, SENSORS_Notification_UserData, (size_t)sn, TAG_DONE }; - struct TagItem tags[4]; - int i; - - sn->type = type; - - for (i = 0; i < count; i++) - sn->values[i] = 0.0; - - tags[0].ti_Data = TRUE; - tags[1].ti_Tag = TAG_IGNORE; - tags[1].ti_Data = TRUE; - tags[2].ti_Tag = TAG_IGNORE; - tags[2].ti_Data = TRUE; - tags[3].ti_Tag = TAG_MORE; - tags[3].ti_Data = (size_t)¬ifytags; - - switch (type) - { - case SensorType_HIDInput_Trigger: - tags[0].ti_Tag = SENSORS_HIDInput_Value; - break; - - case SensorType_HIDInput_Stick: - case SensorType_HIDInput_AnalogStick: - tags[0].ti_Tag = SENSORS_HIDInput_NS_Value; - tags[1].ti_Tag = SENSORS_HIDInput_EW_Value; - break; - - case SensorType_HIDInput_3DStick: - tags[0].ti_Tag = SENSORS_HIDInput_X_Index; - tags[1].ti_Tag = SENSORS_HIDInput_Y_Index; - tags[2].ti_Tag = SENSORS_HIDInput_Z_Index; - break; - } - - sn->notifyptr = StartSensorNotify(sensor, (struct TagItem *)&tags); - - ADDTAIL(&hwdata->notifylist, sn); - } -} - -static void GetJoyData(SDL_Joystick * joystick, struct joystick_hwdata *hwdata, APTR parent) -{ - struct sensordata *s = sensors; - size_t sensortags[] = { SENSORS_Parent, (size_t)parent, SENSORS_Class, SensorClass_HID, TAG_DONE }; - size_t buttons = 0, naxes = 0; - APTR sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; - - while ((sensor = NextSensor(sensor, sensorlist, NULL)) != NULL) - { - SensorType_HIDInput type = SensorType_HIDInput_Unknown; - size_t qt[] = { SENSORS_Type, (size_t)&type, TAG_DONE }; - - if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0) - { - switch (type) - { - case SensorType_HIDInput_Trigger: - buttons++; - break; - - case SensorType_HIDInput_Stick: - case SensorType_HIDInput_AnalogStick: - naxes += 2; - break; - - case SensorType_HIDInput_3DStick: - naxes += 3; - break; - - default: - continue; - } - - set_notify(s, hwdata, sensor, type); - } - } - - ReleaseSensorsList(sensorlist, NULL); - - joystick->naxes = naxes; - joystick->nbuttons = buttons; -} + 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. @@ -365,98 +127,193 @@ static int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { D("[%s]\n", __FUNCTION__); - struct joystick_hwdata *hwdata = GetByIndex(device_index); + APTR sensor = JoySensor[device_index]; int rc = -1; - if (hwdata) - { - APTR sensorlist = ObtainSensorsList((struct TagItem *)&sensortags), sensor = NULL; - - while ((sensor = NextSensor(sensor, sensorlist, NULL))) - { - CONST_STRPTR name = "", serial = NULL; - - size_t qt[] = { SENSORS_HIDInput_Name_Translated, SENSORS_HID_Serial, (size_t)&serial, TAG_DONE }; - - GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - - //ULONG *id; - //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, TAG_DONE); - - D("[%s] name=%s, serial=%s\n", __FUNCTION__, name, serial); - if (GetSensorAttr(sensor, (struct TagItem *)&qt) > 0 && strcmp(hwdata->name, name) == 0) - { - SDL_JoystickGUID guid; - - strncpy((char *)&guid, serial, sizeof(guid)); - - if (memcmp(&hwdata->guid, &guid, sizeof(guid)) == 0) - { - GetJoyData(joystick, hwdata, sensor); - rc = 0; - break; + if (sensor) { + size_t buttons = 0, naxes = 0, nhats = 0, nsticks = 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; + //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, SENSORS_HIDInput_Name, (IPTR)&name, TAG_DONE); + //D("[%s] sensor id: %d name: %s\n", __FUNCTION__, id, name); + 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 += 3; + else + naxes++; + } + break; + case SensorType_HIDInput_Rumble: + if (GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE)) { + D("[%s] rumble sensor: %s\n", __FUNCTION__, name); + } + default: + D("[%s] unknown SensorType: %d\n", __FUNCTION__, type); + continue; } } - } + } - ReleaseSensorsList(sensorlist, NULL); - } +#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; + joystick->hwdata = hwdata; + rc = 0; + } return rc; } static void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { - D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = joystick->hwdata; - struct sensornotify *sn; - void *buffer; - int naxe = 0, nbutton = 0; + int i, j; + Sint16 sval; + double btn_value, x_value, y_value, z_value, ns_value, ew_value; + + 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); + } + } - ForeachNode(&hwdata->notifylist, sn) - { - DOUBLE val; - WORD sval; - - switch (sn->type) - { - case SensorType_HIDInput_Trigger: - val = sn->values[0]; - int buttondata = BUFFER_OFFSET(buffer, hwdata->buttonBufferOffset[nbutton]); - if ((joystick->buttons[nbutton] && val == 0.0) || (joystick->buttons[nbutton] == 0 && val > 0.0)) { - SDL_PrivateJoystickButton(joystick, nbutton, val == 0.0 ? 0 : 1); - hwdata->buttonData[nbutton] = (val == 0.0 ? 0 : 1); - } - - nbutton++; - break; + 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); + } - case SensorType_HIDInput_Stick: - case SensorType_HIDInput_AnalogStick: + j = 0; + for (i = 0; i < hwdata->numSticks; i++) { + switch (hwdata->stickType[i]) { case SensorType_HIDInput_3DStick: - sval = (WORD)(sn->values[0] * 32768.0); + 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, + TAG_DONE); + + if (x_value >= DEADZONE_MAX || x_value <= DEADZONE_MIN) { + sval = (Sint16)(CLAMP(x_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); + } - if (sval !=hwdata->axisData[naxe]) { - SDL_PrivateJoystickAxis(joystick, naxe, sval); - hwdata->axisData[naxe] = sval; + if (y_value >= DEADZONE_MAX || y_value <= DEADZONE_MIN) { + sval = (Sint16)(CLAMP(y_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); } - naxe++; + if (z_value >= DEADZONE_MAX || z_value <= DEADZONE_MIN) { + sval = (Sint16)(CLAMP(z_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+2, sval); + } + + j += 3; + break; - sval = (WORD)(sn->values[1] * 32768.0); + case SensorType_HIDInput_Analog: + GetSensorAttrTags(hwdata->stick[i], SENSORS_HIDInput_Value, (IPTR)&btn_value, TAG_DONE); - if (sval != hwdata->axisData[naxe]) { - SDL_PrivateJoystickAxis(joystick, naxe, sval); - hwdata->axisData[naxe] = sval; + if (btn_value >= DEADZONE_MAX || btn_value <= DEADZONE_MIN) { + sval = (Sint16)(btn_value * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); } - // TODO : sn->values[2] ?? for SANSORS_HIDInput_Z_Index + 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); + - naxe++; + if (ew_value >= DEADZONE_MAX || ew_value <= DEADZONE_MIN) { + sval = (Sint16)(CLAMP(ew_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); + } + + if (ns_value >= DEADZONE_MAX || ns_value <= DEADZONE_MIN) { + sval = (Sint16)(CLAMP(ns_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); + } + + j += 2; break; } } + +#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 */ @@ -465,18 +322,21 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) { D("[%s]\n", __FUNCTION__); struct joystick_hwdata *hwdata = joystick->hwdata; - - if (hwdata) - { - struct sensornotify *sn, *tmp; - - ForeachNodeSafe(&hwdata->notifylist, sn, tmp) - { - if (sn->notifyptr) - EndSensorNotify(sn->notifyptr, NULL); - - SDL_free(sn); + 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; } } @@ -485,22 +345,44 @@ static void SDL_SYS_JoystickQuit(void) { D("[%s]\n", __FUNCTION__); - struct joystick_hwdata *hwdata, *tmp; - struct sensordata *s = sensors; - - ForeachNodeSafe(&s->sensorlist, hwdata, tmp) - { - SDL_free(hwdata); - } - - Signal(s->sensorport->mp_SigTask, SIGBREAKF_CTRL_C); + if (sensorlist) + ReleaseSensorsList(sensorlist, NULL); } static SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) { - struct joystick_hwdata *hwdata = GetByIndex(device_index); - return hwdata->guid; + 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; } static int @@ -509,12 +391,6 @@ SDL_SYS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uin return 0; } -static SDL_JoystickGUID -SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) -{ - return joystick->hwdata->guid; -} - static int SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) { @@ -524,7 +400,6 @@ SDL_SYS_JoystickGetDevicePlayerIndex(int device_index) static void SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) { - D("Not implemented\n"); } SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = @@ -544,4 +419,4 @@ SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = SDL_SYS_JoystickQuit, }; -#endif \ No newline at end of file +#endif diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index feb9025233..1c0ad89b13 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 @@ -25,58 +25,24 @@ #include "SDL_joystick.h" -#ifndef EXEC_LISTS_H -#include -#endif - -typedef unsigned int uint32; -typedef signed int int32; - -#define MAX_JOYSTICKS 32 - -#define MAX_AXES 8 #define MAX_BUTTONS 16 #define MAX_HATS 8 -struct sensordata -{ - struct MsgPort *sensorport; - struct MinList sensorlist; - int joystick_count; - - struct Task *notifytask; -}; +#define MAX_STICKS 8 struct joystick_hwdata { - struct MinNode node; - struct MinList notifylist; - - ULONG attached; - SDL_JoystickGUID guid; - TEXT name[0]; - - //AIN_DeviceHandle *handle; - //APTR context; - - uint32 axisBufferOffset[MAX_AXES]; - int32 axisData[MAX_AXES]; - TEXT axisName[MAX_AXES][32]; - - uint32 buttonBufferOffset[MAX_BUTTONS]; - int32 buttonData[MAX_BUTTONS]; - - uint32 hatBufferOffset[MAX_HATS]; - int32 hatData[MAX_HATS]; -}; - - -struct sensornotify -{ - struct MinNode node; - APTR notifyptr; - ULONG type; - DOUBLE values[0]; + 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 + ULONG stickType[MAX_STICKS]; + int numSticks; + + // hot plug support + struct MsgPort *notifyPort; + APTR sensorsNotify; }; #endif \ No newline at end of file From 764d40272943c79eec31ff5d4e734b8b1533abdb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 3 May 2020 20:02:38 +0200 Subject: [PATCH 179/214] Fix DeadZone detection --- src/joystick/morphos/SDL_sysjoystick.c | 43 ++++++++++---------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 31d6d42b00..8e9c695ce2 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -43,8 +43,12 @@ #define DEADZONE_MIN (-0.05) #define DEADZONE_MAX (0.05) -#define CLAMP(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) +#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 @@ -252,20 +256,14 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) SENSORS_HIDInput_Z_Index, (IPTR)&z_value, TAG_DONE); - if (x_value >= DEADZONE_MAX || x_value <= DEADZONE_MIN) { - sval = (Sint16)(CLAMP(x_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j, sval); - } + sval = (Sint16)(CLAMP(x_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); - if (y_value >= DEADZONE_MAX || y_value <= DEADZONE_MIN) { - sval = (Sint16)(CLAMP(y_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j+1, sval); - } + sval = (Sint16)(CLAMP(y_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); - if (z_value >= DEADZONE_MAX || z_value <= DEADZONE_MIN) { - sval = (Sint16)(CLAMP(z_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j+2, sval); - } + sval = (Sint16)(CLAMP(z_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+2, sval); j += 3; break; @@ -273,10 +271,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) case SensorType_HIDInput_Analog: GetSensorAttrTags(hwdata->stick[i], SENSORS_HIDInput_Value, (IPTR)&btn_value, TAG_DONE); - if (btn_value >= DEADZONE_MAX || btn_value <= DEADZONE_MIN) { - sval = (Sint16)(btn_value * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j, sval); - } + sval = (Sint16)(btn_value * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); j++; break; @@ -287,16 +283,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) SENSORS_HIDInput_NS_Value, (IPTR)&ns_value, TAG_DONE); - - if (ew_value >= DEADZONE_MAX || ew_value <= DEADZONE_MIN) { - sval = (Sint16)(CLAMP(ew_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j, sval); - } + sval = (Sint16)(CLAMP(ew_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j, sval); - if (ns_value >= DEADZONE_MAX || ns_value <= DEADZONE_MIN) { - sval = (Sint16)(CLAMP(ns_value, -1.0, 1.0) * SDL_JOYSTICK_AXIS_MAX); - SDL_PrivateJoystickAxis(joystick, j+1, sval); - } + sval = (Sint16)(CLAMP(ns_value) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+1, sval); j += 2; break; From c86fd8a5477e6620bb825235ecdf8bcf6fa308bd Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Mon, 4 May 2020 12:35:50 +0200 Subject: [PATCH 180/214] Update version --- include/SDL_config_morphos.h | 4 ++-- src/core/morphos/SDL_amigaversion.h | 2 +- src/joystick/morphos/SDL_sysjoystick_c.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 1c8741b6a4..e94888e2fd 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -143,9 +143,9 @@ #define SDL_HAPTIC_DUMMY 1 /* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ -#define SDL_JOYSTICK_AMIGA 1 +//#define SDL_JOYSTICK_AMIGA 1 /* Enable MORPHOS SENSORS JOYSTICK/GAMEPAD */ -//#define SDL_JOYSTICK_MORPHOS 1 +#define SDL_JOYSTICK_MORPHOS 1 /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index f6daef635b..beb4dc642b 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,5 +1,5 @@ #define str(s) #s #define xstr(s) str(s) #define VERSION 53 -#define REVISION 1 +#define REVISION 2 #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/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 1c0ad89b13..4837bfa27c 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -23,6 +23,7 @@ #ifdef SDL_JOYSTICK_MORPHOS +#include #include "SDL_joystick.h" #define MAX_BUTTONS 16 From ccfe8dd63c8d1760331f88ae71f4d271fc9682a8 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 6 May 2020 22:10:44 +0200 Subject: [PATCH 181/214] Fix clapping Bug OpenTTD when game is in state "pause" - Surface (mouse) doesnt update --- src/video/amiga/SDL_amigaframebuffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigaframebuffer.c b/src/video/amiga/SDL_amigaframebuffer.c index ec589e4e73..032d0c2c58 100644 --- a/src/video/amiga/SDL_amigaframebuffer.c +++ b/src/video/amiga/SDL_amigaframebuffer.c @@ -129,10 +129,12 @@ AMIGA_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects if (y + h > window->h) h = window->h - y; - if (y + h < 0 || y > h) + //if (y + h < 0 || y > h) + if (y + h < 0) continue; - if (x + w < 0 || x > w) + //if (x + w < 0 || x > w) + if (x + w < 0) continue; dx = x + offx; From 3ff81ffd1dadf9f7e7ef683e67daff4853902711 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 6 May 2020 22:18:29 +0200 Subject: [PATCH 182/214] Add SDL_HINT_GAMECONTROLLERCONFIG_FILE Add gamecontrollerdb.txt to load first from ENV: --- src/video/amiga/SDL_amigavideo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index 5cb2d53360..a0096c1d22 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -150,7 +150,8 @@ AMIGA_VideoInit(_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; } From 67e09a3dbeba756bd4f88bd6a4c8a4e51eaae045 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 6 May 2020 22:23:42 +0200 Subject: [PATCH 183/214] Add name to joystick Need by SDL_JoystickName --- src/joystick/morphos/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 8e9c695ce2..64c8b5819c 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -206,7 +206,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) //SDL_qsort(hwdata->button, joystick->nbuttons, sizeof(APTR), SortSensorFunc); hwdata->numSticks = nsticks; joystick->hwdata = hwdata; - + joystick->name = (char *)SDL_SYS_JoystickGetDeviceName(device_index); rc = 0; } return rc; From 81c6514ad24dbd10f3bd4fca925ec17646ae25f7 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 14 May 2020 10:32:41 +0200 Subject: [PATCH 184/214] Update AMIGA_UpdateWindowFramebuffer Code from AmigaOS4 version to simplify the function --- src/video/amiga/SDL_amigaframebuffer.c | 86 ++++++++------------------ 1 file changed, 25 insertions(+), 61 deletions(-) diff --git a/src/video/amiga/SDL_amigaframebuffer.c b/src/video/amiga/SDL_amigaframebuffer.c index 032d0c2c58..d7cde14051 100644 --- a/src/video/amiga/SDL_amigaframebuffer.c +++ b/src/video/amiga/SDL_amigaframebuffer.c @@ -84,81 +84,45 @@ AMIGA_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, 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->win) + if (data && data->win && data->fb) { SDL_Framebuffer *fb = data->fb; struct RastPort *rp = data->win->RPort; - int i, x, y, w, h, offx, offy; - - offx = data->win->BorderLeft; - offy = data->win->BorderTop; - - for (i = 0; i < numrects; ++i) - { - int dx, dy; - - x = rects[i].x; - y = rects[i].y; - w = rects[i].w; - h = rects[i].h; - - /* Clipped? */ - if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0) - continue; - - if (x < 0) - { - x += w; - w += rects[i].x; - } - - if (y < 0) - { - y += h; - h += rects[i].y; - } - - if (x + w > window->w) - w = window->w - x; - - if (y + h > window->h) - h = window->h - y; - - //if (y + h < 0 || y > h) - if (y + h < 0) - continue; - - //if (x + w < 0 || x > w) - if (x + w < 0) - continue; - - dx = x + offx; - dy = y + offy; - + 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, x, y, fb->bpr, rp, dx, dy, w, h, RECTFMT_RAW); - else - WriteLUTPixelArray(fb->buffer, x, y, fb->bpr, rp, data->videodata->coltab, dx, dy, w, h, CTABFMT_XRGB8); + 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, x, y, fb->bpr, rp, dx, dy, w, h, RECTFMT_ARGB); - break; + WritePixelArray(fb->buffer, r->x, r->y, fb->bpr, rp, dx, dy, w, h, RECTFMT_ARGB); + break; } } - } - + } return 0; } - - -/* vi: set ts=4 sw=4 expandtab: */ From 2f854f421418e50c67f9bdceca1ffa032bdd4c2a Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 15 May 2020 17:57:24 +0200 Subject: [PATCH 185/214] Add 4 axes for 3DStick Add more debug SensorType --- src/joystick/morphos/SDL_sysjoystick.c | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 64c8b5819c..3bc50ad743 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -174,15 +174,28 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) if (type == SensorType_HIDInput_AnalogStick) naxes += 2; else if (type == SensorType_HIDInput_3DStick) - naxes += 3; + naxes += 4; else naxes++; } break; case SensorType_HIDInput_Rumble: - if (GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE)) { - D("[%s] rumble sensor: %s\n", __FUNCTION__, name); - } + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Rumble Sensor: %s - Sensor=%lu\n", __FUNCTION__, name, sensor); + break; + case SensorType_HIDInput_Battery: + GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); + D("[%s] Battery SensorType: %d\n", __FUNCTION__, name); + + 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; @@ -218,7 +231,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) struct joystick_hwdata *hwdata = joystick->hwdata; int i, j; Sint16 sval; - double btn_value, x_value, y_value, z_value, ns_value, ew_value; + double btn_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); @@ -254,6 +267,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) 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); @@ -265,7 +279,10 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) sval = (Sint16)(CLAMP(z_value) * SDL_JOYSTICK_AXIS_MAX); SDL_PrivateJoystickAxis(joystick, j+2, sval); - j += 3; + sval = (Sint16)(CLAMP(z_rotation) * SDL_JOYSTICK_AXIS_MAX); + SDL_PrivateJoystickAxis(joystick, j+3, sval); + + j += 4; break; case SensorType_HIDInput_Analog: From 273f9bd88af09a06edb1610de93ba879c2edea4f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 16 May 2020 15:41:34 +0200 Subject: [PATCH 186/214] Fix invert Right and Middle mouse buttons --- src/video/amiga/SDL_amigaevents.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index abafffd642..3d863a56df 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -53,18 +53,31 @@ static void AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) { int i = 1, state = SDL_PRESSED; - + switch (m->Code) { - case SELECTUP : i = 1; state = SDL_RELEASED; break; - case SELECTDOWN: i = 1; break; - case MENUUP : i = 2; state = SDL_RELEASED; break; - case MENUDOWN : i = 2; break; - case MIDDLEUP : i = 3; state = SDL_RELEASED; break; - case MIDDLEDOWN: i = 3; break; - default : return; + case SELECTUP: + state = SDL_RELEASED; + // fallthrough + case SELECTDOWN: + i = SDL_BUTTON_LEFT; + break; + case MENUUP: + state = SDL_RELEASED; + // fallthrough + case MENUDOWN : + i = SDL_BUTTON_RIGHT; + break; + case MIDDLEUP: + state = SDL_RELEASED; + // fallthrough + case MIDDLEDOWN: + i = SDL_BUTTON_MIDDLE; + break; + default: + return; } - + SDL_SendMouseButton(data->window, 0, state, i); } From 0410c9c84b2d1d016d3de703795ebaffbfcd0326 Mon Sep 17 00:00:00 2001 From: BSzili Date: Mon, 18 May 2020 08:32:50 +0200 Subject: [PATCH 187/214] further simplified AMIGA_DispatchMouseButtons --- src/video/amiga/SDL_amigaevents.c | 35 ++++++++++--------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 3d863a56df..c1378ca5d4 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -52,33 +52,20 @@ static void AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) { - int i = 1, state = SDL_PRESSED; - - switch (m->Code) + int state = (m->Code & IECODE_UP_PREFIX) ? SDL_RELEASED : SDL_PRESSED; + + switch (m->Code & ~(IECODE_UP_PREFIX)) { - case SELECTUP: - state = SDL_RELEASED; - // fallthrough - case SELECTDOWN: - i = SDL_BUTTON_LEFT; + case IECODE_LBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_LEFT); break; - case MENUUP: - state = SDL_RELEASED; - // fallthrough - case MENUDOWN : - i = SDL_BUTTON_RIGHT; + case IECODE_RBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_RIGHT); break; - case MIDDLEUP: - state = SDL_RELEASED; - // fallthrough - case MIDDLEDOWN: - i = SDL_BUTTON_MIDDLE; + case IECODE_MBUTTON: + SDL_SendMouseButton(data->window, 0, state, SDL_BUTTON_MIDDLE); break; - default: - return; } - - SDL_SendMouseButton(data->window, 0, state, i); } static int @@ -132,11 +119,11 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) break; case RAWKEY_NM_BUTTON_FOURTH: - SDL_SendMouseButton(data->window, 0, SDL_PRESSED, 4); + 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, 4); + SDL_SendMouseButton(data->window, 0, SDL_RELEASED, SDL_BUTTON_X1); break; default: From e83b714e80dd9f0f31d9bee3a1370ed0b4603dff Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 20 May 2020 10:32:24 +0200 Subject: [PATCH 188/214] Add Rumble (experimental) and Battery Sensor --- src/joystick/SDL_joystick.c | 4 ++ src/joystick/SDL_sysjoystick.h | 4 ++ src/joystick/morphos/SDL_sysjoystick.c | 81 +++++++++++++++++++++--- src/joystick/morphos/SDL_sysjoystick_c.h | 12 ++-- 4 files changed, 88 insertions(+), 13 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index fa8569df66..acdba5d52b 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -890,7 +890,11 @@ SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 /* 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 */ diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 041cfb10d7..0747d27d22 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -121,7 +121,11 @@ typedef struct _SDL_JoystickDriver int (*Open)(SDL_Joystick * joystick, int device_index); /* Rumble functionality */ + #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 /* Function to update the state of a joystick - called as a device poll. * This function shouldn't update the joystick structure directly, diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 3bc50ad743..f81310d458 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -149,9 +149,15 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) sensor = NULL; while ((sensor = NextSensor(sensor, hwdata->child_sensors, NULL))) { - ULONG type = SensorType_HIDInput_Unknown; - //GetSensorAttrTags(sensor, SENSORS_HIDInput_ID, (IPTR)&id, SENSORS_HIDInput_Name, (IPTR)&name, TAG_DONE); - //D("[%s] sensor id: %d name: %s\n", __FUNCTION__, id, name); + 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: @@ -180,13 +186,23 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) } break; case SensorType_HIDInput_Rumble: - GetSensorAttrTags(sensor, SENSORS_HID_Name, (IPTR)&name, TAG_DONE); - D("[%s] Rumble Sensor: %s - Sensor=%lu\n", __FUNCTION__, name, sensor); + 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 SensorType: %d\n", __FUNCTION__, name); - + 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); @@ -218,6 +234,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) 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; @@ -310,7 +327,31 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) 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; @@ -393,9 +434,31 @@ SDL_SYS_JoystickGetDeviceGUID( int device_index ) 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) +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; } diff --git a/src/joystick/morphos/SDL_sysjoystick_c.h b/src/joystick/morphos/SDL_sysjoystick_c.h index 4837bfa27c..bf34d3223f 100644 --- a/src/joystick/morphos/SDL_sysjoystick_c.h +++ b/src/joystick/morphos/SDL_sysjoystick_c.h @@ -26,10 +26,10 @@ #include #include "SDL_joystick.h" -#define MAX_BUTTONS 16 -#define MAX_HATS 8 - -#define MAX_STICKS 8 +#define MAX_BUTTONS 16 +#define MAX_HATS 8 +#define MAX_STICKS 8 +#define MAX_RUMBLE 2 struct joystick_hwdata { @@ -38,8 +38,12 @@ struct joystick_hwdata 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; From 01ad86ef4e17efd5daed43b05797e16cb056d9b9 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 20 May 2020 11:10:05 +0200 Subject: [PATCH 189/214] Update SDL_sysjoystick.c --- src/joystick/morphos/SDL_sysjoystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index f81310d458..2e7e6ab538 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -135,7 +135,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) int rc = -1; if (sensor) { - size_t buttons = 0, naxes = 0, nhats = 0, nsticks = 0; + 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)); @@ -248,7 +248,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) struct joystick_hwdata *hwdata = joystick->hwdata; int i, j; Sint16 sval; - double btn_value, x_value, y_value, z_value, ns_value, ew_value, z_rotation; + 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); From 8e15f91a8a81d169529cb709f5c45dae4eda57bf Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:38:32 +0200 Subject: [PATCH 190/214] Update sdl2_protos.h --- src/core/morphos/sdk/clib/sdl2_protos.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 9e6f8f5c53..a15fc26930 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -724,9 +724,8 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Sur 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 SDLCALL SDL_isupper(int x); -int SDLCALL SDL_islower(int x); - +int SDL_isupper(int x); +int SDL_islower(int x); #endif From 80ed4c79ebe10dfaafa9b86e63b108e6aed8c3e0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:26:53 +0200 Subject: [PATCH 191/214] add SDL_HAPTIC_DISABLED --- include/SDL_config_morphos.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index e94888e2fd..aa771ae344 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -140,6 +140,7 @@ #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable haptic drivers */ +#define SDL_HAPTIC_DISABLED 1 #define SDL_HAPTIC_DUMMY 1 /* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ From 82d2c7e2aaed561105b78b491a23f774fbf80ef2 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 23 Jun 2020 20:05:29 +0200 Subject: [PATCH 192/214] Fix SDL_INIT_EVERYTHING Missing SDL_SENSOR_DUMMY --- include/SDL_config_morphos.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index aa771ae344..85e5a28ba4 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -141,7 +141,9 @@ /* Enable haptic drivers */ #define SDL_HAPTIC_DISABLED 1 -#define SDL_HAPTIC_DUMMY 1 + +/* Enable SENSOR */ +#define SDL_SENSOR_DUMMY 1 /* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ //#define SDL_JOYSTICK_AMIGA 1 From 5273a957b3f389b8dab4514acb6f580966823b22 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 11 Aug 2020 15:25:17 +0200 Subject: [PATCH 193/214] Update to GCC9 --- test/Makefile.mos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Makefile.mos b/test/Makefile.mos index 11ae4c29b9..2c154f2221 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -1,7 +1,7 @@ # Makefile to build the MorphOS SDL tests AR = ppc-morphos-ar -CC = ppc-morphos-gcc +CC = ppc-morphos-gcc-9 CFLAGS = -noixemul -O2 -Wall -g -I../include -DHAVE_OPENGL LIBS = -L. -lSDL2test -L../src/core/morphos/devenv/lib/ -lSDL2 -noixemul -lm From 4359bc0451fd41d0042c4663a1db4bd64b84d20f Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:38:32 +0200 Subject: [PATCH 194/214] Fix RaiseWindow Active WindowToFront --- src/video/amiga/SDL_amigawindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 4b4bd036b4..3e1f89a7cb 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -545,7 +545,7 @@ AMIGA_RaiseWindow(_THIS, SDL_Window * window) if (data->win) { - //AMIGA_WindowToFront(data->win); + AMIGA_WindowToFront(data->win); } } From cb69494b95a959ba3cb8d668fdef15a7bdf35471 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:42:52 +0200 Subject: [PATCH 195/214] Add Drag n Drop support Add AppWindow for support Drag and Drop into window (Example : Add game directory to ScummVM) --- src/video/amiga/SDL_amigaevents.c | 39 ++++++++++++++++++++++++------- src/video/amiga/SDL_amigawindow.c | 24 ++++++++++++++++++- src/video/amiga/SDL_amigawindow.h | 1 + 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index c1378ca5d4..746ab08773 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -40,7 +40,9 @@ #include #include #include +#include +#include #include #include #include @@ -352,15 +354,37 @@ 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__); - - if (msg->am_NumArgs == 0 && msg->am_ArgList == NULL) - AMIGA_ShowApp(_this); - -#warning object dragn drop + + 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; + } + } } @@ -393,6 +417,3 @@ AMIGA_PumpEvents(_THIS) if (sigs & SIGBREAKF_CTRL_C) SDL_SendAppEvent(SDL_QUIT); } - - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 3e1f89a7cb..c8ec96acfe 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -73,7 +73,14 @@ static void CloseWindowSafely(SDL_Window *sdlwin, struct Window *win) win->UserPort = NULL; ModifyIDCMP(win, 0); #endif - + + SDL_WindowData *data = (SDL_WindowData *) sdlwin->driverdata; + if (data->appmsg) { + if (RemoveAppWindow(data->appmsg)) { + data->appmsg = NULL; + } + } + CloseWindow(win); Permit(); } @@ -136,6 +143,7 @@ AMIGA_SetupWindowData(_THIS, SDL_Window *window, struct Window *win) wd->videodata = data; wd->first_deltamove = 0; wd->winflags = 0; + wd->appmsg = NULL; if (win) { @@ -495,6 +503,14 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) data->win->UserData = (APTR)data; + + 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); } @@ -718,6 +734,12 @@ static void AMIGA_CloseWindow(SDL_Window *window) if (data->win) { + if (data->appmsg) { + if (RemoveAppWindow(data->appmsg)) { + data->appmsg = NULL; + } + } + struct Window *win = data->win; CloseWindow(win); data->win = NULL; diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h index b6ea1affae..78da23ec7a 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -42,6 +42,7 @@ typedef struct SDL_Window *window; struct Window *win; + struct AppWindow *appmsg; // Localized window title, use SDL_free() to deallocate char *window_title; From f7b7a409b956bd044627cd3e4bc77896970aacdd Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:52:35 +0200 Subject: [PATCH 196/214] Update Copyright to 2020 --- src/audio/ahi/SDL_ahi_audio.c | 2 +- src/audio/ahi/SDL_ahi_audio.h | 2 +- src/core/morphos/SDL_cpu.c | 2 +- src/core/morphos/SDL_cpu.h | 2 +- src/core/morphos/SDL_library.c | 2 +- src/core/morphos/SDL_library.h | 2 +- src/core/morphos/SDL_misc.c | 2 +- src/core/morphos/SDL_misc.h | 2 +- src/core/morphos/SDL_startup.c | 2 +- src/core/morphos/SDL_startup.h | 2 +- src/core/morphos/SDL_stubs.c | 2 +- src/core/morphos/devenv/Makefile | 1 - src/filesystem/amiga/SDL_sysfilesystem.c | 2 +- src/power/morphos/SDL_syspower.c | 2 +- src/thread/morphos/SDL_syscond.c | 2 +- src/thread/morphos/SDL_sysmutex.c | 2 +- src/thread/morphos/SDL_sysmutex_c.h | 2 +- src/thread/morphos/SDL_syssem.c | 2 +- src/thread/morphos/SDL_systhread.c | 2 +- src/thread/morphos/SDL_systhread_c.h | 2 +- src/thread/morphos/SDL_systls.c | 2 +- src/timer/amiga/SDL_systimer.c | 2 +- src/video/amiga/SDL_amigaclipboard.c | 2 +- src/video/amiga/SDL_amigaclipboard.h | 2 +- src/video/amiga/SDL_amigaevents.c | 2 +- src/video/amiga/SDL_amigaevents.h | 2 +- src/video/amiga/SDL_amigaframebuffer.c | 2 +- src/video/amiga/SDL_amigaframebuffer.h | 2 +- src/video/amiga/SDL_amigakeyboard.c | 2 +- src/video/amiga/SDL_amigakeyboard.h | 2 +- src/video/amiga/SDL_amigamessagebox.c | 2 +- src/video/amiga/SDL_amigamessagebox.h | 2 +- src/video/amiga/SDL_amigamodes.c | 2 +- src/video/amiga/SDL_amigamodes.h | 2 +- src/video/amiga/SDL_amigamouse.c | 2 +- src/video/amiga/SDL_amigamouse.h | 2 +- src/video/amiga/SDL_amigashape.c | 2 +- src/video/amiga/SDL_amigashape.h | 2 +- src/video/amiga/SDL_amigavideo.c | 2 +- src/video/amiga/SDL_amigavideo.h | 2 +- src/video/amiga/SDL_amigawindow.c | 2 +- src/video/amiga/SDL_amigawindow.h | 2 +- 42 files changed, 41 insertions(+), 42 deletions(-) diff --git a/src/audio/ahi/SDL_ahi_audio.c b/src/audio/ahi/SDL_ahi_audio.c index beaf9b712e..f75027cf8e 100644 --- a/src/audio/ahi/SDL_ahi_audio.c +++ b/src/audio/ahi/SDL_ahi_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/audio/ahi/SDL_ahi_audio.h b/src/audio/ahi/SDL_ahi_audio.h index b9985afb85..f1f0861d62 100644 --- a/src/audio/ahi/SDL_ahi_audio.h +++ b/src/audio/ahi/SDL_ahi_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_cpu.c b/src/core/morphos/SDL_cpu.c index 7900602d48..017a9601cc 100644 --- a/src/core/morphos/SDL_cpu.c +++ b/src/core/morphos/SDL_cpu.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_cpu.h b/src/core/morphos/SDL_cpu.h index 780086d4f9..4ebb7608ea 100644 --- a/src/core/morphos/SDL_cpu.h +++ b/src/core/morphos/SDL_cpu.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c index 42dbc68486..3f0ab8c138 100644 --- a/src/core/morphos/SDL_library.c +++ b/src/core/morphos/SDL_library.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_library.h b/src/core/morphos/SDL_library.h index f30fd392d0..0343402e6a 100644 --- a/src/core/morphos/SDL_library.h +++ b/src/core/morphos/SDL_library.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_misc.c b/src/core/morphos/SDL_misc.c index efcb0a5336..77b45e0b96 100644 --- a/src/core/morphos/SDL_misc.c +++ b/src/core/morphos/SDL_misc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_misc.h b/src/core/morphos/SDL_misc.h index f20a37a5b7..a3794d451a 100644 --- a/src/core/morphos/SDL_misc.h +++ b/src/core/morphos/SDL_misc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_startup.c b/src/core/morphos/SDL_startup.c index c6809844ed..ecb0955d70 100644 --- a/src/core/morphos/SDL_startup.c +++ b/src/core/morphos/SDL_startup.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_startup.h b/src/core/morphos/SDL_startup.h index 50f3154943..d6d8ff9c1a 100644 --- a/src/core/morphos/SDL_startup.h +++ b/src/core/morphos/SDL_startup.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/SDL_stubs.c b/src/core/morphos/SDL_stubs.c index 5a7ac720e1..f77f715b49 100644 --- a/src/core/morphos/SDL_stubs.c +++ b/src/core/morphos/SDL_stubs.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index 52c0586aef..50ee36b553 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -1,6 +1,5 @@ # Makefile to build the SDL 2 Library -#CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 CC = ppc-morphos-gcc-9 -noixemul INCLUDE = -I../../../../include -I../sdk CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -Wall -Wno-pointer-sign -fno-strict-aliasing -D_LARGEFILE64_SOURCE diff --git a/src/filesystem/amiga/SDL_sysfilesystem.c b/src/filesystem/amiga/SDL_sysfilesystem.c index cc2270ce73..74b3424646 100644 --- a/src/filesystem/amiga/SDL_sysfilesystem.c +++ b/src/filesystem/amiga/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/power/morphos/SDL_syspower.c b/src/power/morphos/SDL_syspower.c index 6cb927e8c6..b435d9794e 100644 --- a/src/power/morphos/SDL_syspower.c +++ b/src/power/morphos/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_syscond.c b/src/thread/morphos/SDL_syscond.c index 64cc634006..5cd97457a2 100644 --- a/src/thread/morphos/SDL_syscond.c +++ b/src/thread/morphos/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_sysmutex.c b/src/thread/morphos/SDL_sysmutex.c index 9622847d66..20426b63c7 100644 --- a/src/thread/morphos/SDL_sysmutex.c +++ b/src/thread/morphos/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_sysmutex_c.h b/src/thread/morphos/SDL_sysmutex_c.h index f868fade80..2f88359373 100644 --- a/src/thread/morphos/SDL_sysmutex_c.h +++ b/src/thread/morphos/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_syssem.c b/src/thread/morphos/SDL_syssem.c index 179b6557a5..b527498dd9 100644 --- a/src/thread/morphos/SDL_syssem.c +++ b/src/thread/morphos/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_systhread.c b/src/thread/morphos/SDL_systhread.c index 3850e19915..bc5d04c8ee 100644 --- a/src/thread/morphos/SDL_systhread.c +++ b/src/thread/morphos/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_systhread_c.h b/src/thread/morphos/SDL_systhread_c.h index c4e884e3ad..a13ed777d3 100644 --- a/src/thread/morphos/SDL_systhread_c.h +++ b/src/thread/morphos/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/thread/morphos/SDL_systls.c b/src/thread/morphos/SDL_systls.c index f19a40429a..73df5b0edd 100644 --- a/src/thread/morphos/SDL_systls.c +++ b/src/thread/morphos/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/timer/amiga/SDL_systimer.c b/src/timer/amiga/SDL_systimer.c index 45dbedbaa2..2433c56994 100644 --- a/src/timer/amiga/SDL_systimer.c +++ b/src/timer/amiga/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaclipboard.c b/src/video/amiga/SDL_amigaclipboard.c index a4bb9b60a7..bf10bc69d5 100644 --- a/src/video/amiga/SDL_amigaclipboard.c +++ b/src/video/amiga/SDL_amigaclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaclipboard.h b/src/video/amiga/SDL_amigaclipboard.h index ebd56cffb1..747360ec46 100644 --- a/src/video/amiga/SDL_amigaclipboard.h +++ b/src/video/amiga/SDL_amigaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 746ab08773..cbfcce1898 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaevents.h b/src/video/amiga/SDL_amigaevents.h index 1af43bdb15..aeeba9d4f4 100644 --- a/src/video/amiga/SDL_amigaevents.h +++ b/src/video/amiga/SDL_amigaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaframebuffer.c b/src/video/amiga/SDL_amigaframebuffer.c index d7cde14051..95d1e5bf34 100644 --- a/src/video/amiga/SDL_amigaframebuffer.c +++ b/src/video/amiga/SDL_amigaframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigaframebuffer.h b/src/video/amiga/SDL_amigaframebuffer.h index d405cdb26c..8c1e64d28a 100644 --- a/src/video/amiga/SDL_amigaframebuffer.h +++ b/src/video/amiga/SDL_amigaframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigakeyboard.c b/src/video/amiga/SDL_amigakeyboard.c index 07b7e6ddb4..e87fbae110 100644 --- a/src/video/amiga/SDL_amigakeyboard.c +++ b/src/video/amiga/SDL_amigakeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigakeyboard.h b/src/video/amiga/SDL_amigakeyboard.h index 6b39ee6072..bb73d65626 100644 --- a/src/video/amiga/SDL_amigakeyboard.h +++ b/src/video/amiga/SDL_amigakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamessagebox.c b/src/video/amiga/SDL_amigamessagebox.c index 6a1da778a9..39a69ba422 100644 --- a/src/video/amiga/SDL_amigamessagebox.c +++ b/src/video/amiga/SDL_amigamessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamessagebox.h b/src/video/amiga/SDL_amigamessagebox.h index 350926213f..6d9f0f5a97 100644 --- a/src/video/amiga/SDL_amigamessagebox.h +++ b/src/video/amiga/SDL_amigamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index 446c824383..fa466fd0b4 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamodes.h b/src/video/amiga/SDL_amigamodes.h index e761477eae..12697dda3b 100644 --- a/src/video/amiga/SDL_amigamodes.h +++ b/src/video/amiga/SDL_amigamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c index 67ff72471d..2950224639 100644 --- a/src/video/amiga/SDL_amigamouse.c +++ b/src/video/amiga/SDL_amigamouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigamouse.h b/src/video/amiga/SDL_amigamouse.h index 147905e4de..529074d92a 100644 --- a/src/video/amiga/SDL_amigamouse.h +++ b/src/video/amiga/SDL_amigamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigashape.c b/src/video/amiga/SDL_amigashape.c index 0e6629854e..6c69a65c1b 100644 --- a/src/video/amiga/SDL_amigashape.c +++ b/src/video/amiga/SDL_amigashape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigashape.h b/src/video/amiga/SDL_amigashape.h index 02a35a9519..eed46f80ce 100644 --- a/src/video/amiga/SDL_amigashape.h +++ b/src/video/amiga/SDL_amigashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index a0096c1d22..a74b3e2077 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigavideo.h b/src/video/amiga/SDL_amigavideo.h index adf53e8015..ae0d77d11f 100644 --- a/src/video/amiga/SDL_amigavideo.h +++ b/src/video/amiga/SDL_amigavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index c8ec96acfe..3aed21689b 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h index 78da23ec7a..6a1925beac 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + 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 From 5666a902cf015310e86ea20245a4965c8c2e4c74 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 14 Oct 2020 11:42:26 +0200 Subject: [PATCH 197/214] Fix --- src/core/morphos/sdk/clib/sdl2_protos.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index a15fc26930..e4fe45c4f8 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -511,7 +511,6 @@ 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(voiud) 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); From c80522defeb6330b8bba1e562cf2e3a142c63531 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 17 Oct 2020 07:51:33 +0200 Subject: [PATCH 198/214] Fix ppcinline file --- src/core/morphos/sdk/ppcinline/sdl2.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index 302f506bd3..8baca41b48 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -4049,12 +4049,11 @@ (((int (*)(SDL_bool ))*(void**)(__base - 2620))(__t__p0));\ }) -#define SDL_GetRelativeMouseMode(__p0) \ +#define SDL_GetRelativeMouseMode() \ ({ \ - voiud __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_bool (*)(voiud ) SDL_bool SDL_GetRelativeMouseMode(void))*(void**)(__base - 2626))(__t__p0));\ + (((SDL_bool (*)(void))*(void**)(__base - 2626))());\ }) #define SDL_CreateCursor(__p0, __p1, __p2, __p3, __p4, __p5) \ From 92732d80fb227b11f14ba7af61ad73dab9687f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20Bir=C3=B3?= Date: Sat, 17 Oct 2020 13:32:15 +0200 Subject: [PATCH 199/214] added the missing argument for SDL_AddVideoDisplay on MorphOS --- src/video/amiga/SDL_amigamodes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index fa466fd0b4..d9458ee3b6 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -194,7 +194,7 @@ AMIGA_InitModes(_THIS) display.driverdata = modedata; display.name = (char *)getv(mon, MA_MonitorName); - SDL_AddVideoDisplay(&display); + SDL_AddVideoDisplay(&display, SDL_FALSE); dispcount++; mode.driverdata = NULL; @@ -240,7 +240,7 @@ AMIGA_InitModes(_THIS) D("[%s] Add video display '%s'\n", __FUNCTION__, display.name); - SDL_AddVideoDisplay(&display); + SDL_AddVideoDisplay(&display, SDL_FALSE); dispcount++; } } From 9fb80375046a03c589a818d8c2f8efc74980ee7e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sat, 17 Oct 2020 18:52:49 +0200 Subject: [PATCH 200/214] Fix and update enable SDL_HAPTIC_DUMMY add SDL_SYS_GetGamepadMapping delete AMIGA_Available --- include/SDL_config_morphos.h | 4 ++-- src/joystick/morphos/SDL_sysjoystick.c | 7 +++++++ src/video/amiga/SDL_amigavideo.c | 10 +--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 85e5a28ba4..01c682c968 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -140,10 +140,10 @@ #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable haptic drivers */ -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DUMMY 1 /* Enable SENSOR */ -#define SDL_SENSOR_DUMMY 1 +#define SDL_SENSOR_DUMMY 1 /* Enable AMIGA (lowlevel.library) JOYSTICK/GAMEPAD */ //#define SDL_JOYSTICK_AMIGA 1 diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 2e7e6ab538..cedbcf629a 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -473,6 +473,12 @@ SDL_SYS_JoystickSetDevicePlayerIndex(int device_index, int player_index) { } +static SDL_bool +SDL_SYS_GetGamepadMapping(int device_index, SDL_GamepadMapping * out) +{ + return SDL_FALSE; +} + SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = { SDL_SYS_JoystickInit, @@ -488,6 +494,7 @@ SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = SDL_SYS_JoystickUpdate, SDL_SYS_JoystickClose, SDL_SYS_JoystickQuit, + SDL_SYS_GetGamepadMapping }; #endif diff --git a/src/video/amiga/SDL_amigavideo.c b/src/video/amiga/SDL_amigavideo.c index a74b3e2077..03a0d54caf 100644 --- a/src/video/amiga/SDL_amigavideo.c +++ b/src/video/amiga/SDL_amigavideo.c @@ -128,14 +128,6 @@ AMIGA_ShowApp(_THIS) AMIGA_GL_ResizeContext(_this, _this->current_glwin); } -/* Amiga driver bootstrap functions */ - -static int -AMIGA_Available(void) -{ - return 1; -} - static int AMIGA_VideoInit(_THIS) { @@ -417,7 +409,7 @@ AMIGA_CreateDevice(int devindex) VideoBootStrap AMIGA_bootstrap = { "amiga", "SDL Amiga video driver", - AMIGA_Available, AMIGA_CreateDevice + AMIGA_CreateDevice }; /* vim: set ts=4 sw=4 expandtab: */ From da3fa8a478b74c318453ab00c2e5e40545fb2c66 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 10 Nov 2020 17:39:22 +0100 Subject: [PATCH 201/214] Fix Thread with relative paths --- src/thread/morphos/SDL_systhread.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/thread/morphos/SDL_systhread.c b/src/thread/morphos/SDL_systhread.c index bc5d04c8ee..5a0f2f9e75 100644 --- a/src/thread/morphos/SDL_systhread.c +++ b/src/thread/morphos/SDL_systhread.c @@ -27,22 +27,28 @@ #include #include +#include #include extern APTR threadpool; -#if 0 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)); } -#endif int SDL_SYS_CreateThread(SDL_Thread * thread) { - thread->handle = QueueWorkItem(threadpool, (APTR)SDL_RunThread, thread); + thread->status = Lock("", SHARED_LOCK); + thread->handle = QueueWorkItem(threadpool, (APTR)RunThread, thread); return thread->handle == WORKITEM_INVALID ? -1 : 0; } From e48c6d07a5d6f9f94faa3537db2d998bf0260e46 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:33:48 +0100 Subject: [PATCH 202/214] MorphOS : Update library --- Makefile.mos | 4 + include/SDL_config_morphos.h | 2 +- src/core/morphos/SDL_stubs.h | 35 +++ src/core/morphos/sdk/clib/sdl2_protos.h | 34 +++ src/core/morphos/sdk/fd/sdl2_lib.fd | 30 +++ src/core/morphos/sdk/ppcinline/sdl2.h | 285 +++++++++++++++++++++++- src/joystick/morphos/SDL_sysjoystick.c | 21 ++ 7 files changed, 398 insertions(+), 13 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index e39a6520d3..cf6cacb912 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -56,6 +56,10 @@ SOURCES = \ src/video/*.c \ src/video/amiga/*.c \ src/video/yuv2rgb/*.c \ + src/misc/*.c \ + src/misc/dummy/*.c \ + src/locale/*.c \ + src/locale/dummy/*.c \ CORESOURCES = src/core/morphos/*.c COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index 01c682c968..d80a07623f 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -173,7 +173,7 @@ /* Maybe later */ #ifndef SDL_VIDEO_RENDER_OGL -//#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL 1 #endif /* Enable OpenGL support */ diff --git a/src/core/morphos/SDL_stubs.h b/src/core/morphos/SDL_stubs.h index 79dfe31451..eac6c83c14 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -724,3 +724,38 @@ 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) + diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index e4fe45c4f8..24dcea5f89 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -726,6 +726,40 @@ char *SDL_strtokr(char *s1, const char *s2, char **saveptr); int SDL_isupper(int x); int SDL_islower(int x); +/* 2.0.13 */ +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); +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); +/* */ + #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 index 4ab7b7dc74..eef6709b07 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -657,3 +657,33 @@ 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_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) \ No newline at end of file diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index 8baca41b48..649f644700 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -34,11 +34,9 @@ #define SDL_VSetError(__p0, __p1) \ ({ \ const char * __t__p0 = __p0;\ - va_list __t__p1;\ - va_copy(__t__p1, __p1);\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(const char *, va_list ))*(void**)(__base - 40))(__t__p0, __t__p1));\ + (((int (*)(const char *, va_list ))*(void**)(__base - 40))(__t__p0, __p1));\ }) #define SDL_GetPlatform() \ @@ -511,11 +509,9 @@ ({ \ const char * __t__p0 = __p0;\ const char * __t__p1 = __p1;\ - va_list __t__p2; \ - va_copy(__t__p2, __p2);\ 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, __t__p2));\ + (((int (*)(const char *, const char *, va_list ))*(void**)(__base - 358))(__t__p0, __t__p1, __p2));\ }) #define SDL_vsnprintf(__p0, __p1, __p2, __p3) \ @@ -523,11 +519,9 @@ char * __t__p0 = __p0;\ size_t __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3; \ - va_copy(__t__p3, __p3);\ 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, __t__p3));\ + (((int (*)(char *, size_t , const char *, va_list ))*(void**)(__base - 364))(__t__p0, __t__p1, __t__p2, __p3));\ }) #define SDL_acos(__p0) \ @@ -2066,11 +2060,9 @@ int __t__p0 = __p0;\ SDL_LogPriority __t__p1 = __p1;\ const char * __t__p2 = __p2;\ - va_list __t__p3; \ - va_copy(__t__p3, __p3);\ 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, __t__p3));\ + (((void (*)(int , SDL_LogPriority , const char *, va_list ))*(void**)(__base - 1294))(__t__p0, __t__p1, __t__p2, __p3));\ }) #define SDL_LogGetOutputFunction(__p0, __p1) \ @@ -5712,4 +5704,273 @@ (((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 - 3994))(__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 - 4000))(__t__p0));\ + }) + +#define SDL_GetPreferredLocales() \ + ({ \ + long __base = (long)(SDL2_BASE_NAME);\ + __asm volatile("mr 12,%0": :"r"(__base):"r12");\ + (((SDL_Locale *(*)(void))*(void**)(__base - 4006))());\ + }) + +#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 - 4012))(__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 - 4018))(__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 - 4024))(__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 - 4030))(__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 - 4036))(__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 - 4042))(__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 - 4048))(__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 - 4054))(__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 - 4060))(__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 - 4066))(__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 - 4072))(__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 - 4078))(__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 - 4084))(__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 - 4090))(__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 - 4096))());\ + }) + +#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 - 4102))(__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 - 4108))(__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 - 4114))(__t__p0, __t__p1));\ + }) + #endif /* !_PPCINLINE_SDL2_H */ diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index cedbcf629a..9235e4f18b 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -479,6 +479,24 @@ 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(); +} + SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = { SDL_SYS_JoystickInit, @@ -491,6 +509,9 @@ SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = SDL_SYS_JoystickGetDeviceInstanceID, SDL_SYS_JoystickOpen, SDL_SYS_JoystickRumble, + SDL_SYS_JoystickRumbleTriggers, + SDL_SYS_JoystickHasLED, + SDL_SYS_JoystickSetLED, SDL_SYS_JoystickUpdate, SDL_SYS_JoystickClose, SDL_SYS_JoystickQuit, From eee96d27c0b45dc1353ac6ac6c49827f43be8b1a Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:46:31 +0100 Subject: [PATCH 203/214] MorphOS : fix GL and add define MORPHOS/AMIGAOS GlBlendModeHack --- src/render/opengl/SDL_render_gl.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index eec03b12e9..b910b3a9ac 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1030,6 +1030,7 @@ GL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te return 0; } +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) static void GlBlendModeHack(GL_RenderData * data, const SDL_BlendMode mode) { @@ -1052,6 +1053,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) @@ -1095,7 +1097,7 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } if (blend != data->drawstate.blend) { - +#if defined(__AMIGAOS4__) || defined(__MORPHOS__) if (data->glBlendFuncSeparate && data->glBlendEquation) { if (blend == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); @@ -1110,7 +1112,18 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } else { GlBlendModeHack(data, blend); } - +#else + 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))); + } +#endif data->drawstate.blend = blend; } @@ -1214,6 +1227,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); } From 8b712f65c600757b6b1c2824ad4c6e7ea9468561 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 15 Nov 2020 18:33:46 +0100 Subject: [PATCH 204/214] Disable SDL_VIDEO_RENDER_OGL Maybe later.... --- include/SDL_config_morphos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_config_morphos.h b/include/SDL_config_morphos.h index d80a07623f..01c682c968 100644 --- a/include/SDL_config_morphos.h +++ b/include/SDL_config_morphos.h @@ -173,7 +173,7 @@ /* Maybe later */ #ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 +//#define SDL_VIDEO_RENDER_OGL 1 #endif /* Enable OpenGL support */ From edca8c0aec357801409570b25d106468651eb66e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 25 Dec 2020 08:51:04 +0100 Subject: [PATCH 205/214] Add dummy SetSensorsEnabled function --- src/joystick/morphos/SDL_sysjoystick.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/joystick/morphos/SDL_sysjoystick.c b/src/joystick/morphos/SDL_sysjoystick.c index 9235e4f18b..f16b7a794a 100644 --- a/src/joystick/morphos/SDL_sysjoystick.c +++ b/src/joystick/morphos/SDL_sysjoystick.c @@ -497,6 +497,12 @@ SDL_SYS_JoystickSetLED(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 bl 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, @@ -512,6 +518,7 @@ SDL_JoystickDriver SDL_MORPHOS_JoystickDriver = SDL_SYS_JoystickRumbleTriggers, SDL_SYS_JoystickHasLED, SDL_SYS_JoystickSetLED, + SDL_SYS_JoystickSetSensorsEnabled, SDL_SYS_JoystickUpdate, SDL_SYS_JoystickClose, SDL_SYS_JoystickQuit, From 44df42102752844adaf648470541f8bed0108c3e Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 25 Dec 2020 08:59:27 +0100 Subject: [PATCH 206/214] MorphOS : update library Library is ready to release 2.0.14 --- src/core/morphos/SDL_amigaversion.h | 2 +- src/core/morphos/SDL_stubs.h | 9 +++ src/core/morphos/sdk/clib/sdl2_protos.h | 13 +++- src/core/morphos/sdk/fd/sdl2_lib.fd | 11 +++- src/core/morphos/sdk/ppcinline/sdl2.h | 84 +++++++++++++++++++++++++ src/render/opengl/SDL_render_gl.c | 16 +---- src/video/amiga/SDL_amigamouse.c | 2 +- 7 files changed, 117 insertions(+), 20 deletions(-) diff --git a/src/core/morphos/SDL_amigaversion.h b/src/core/morphos/SDL_amigaversion.h index beb4dc642b..82ad76180d 100644 --- a/src/core/morphos/SDL_amigaversion.h +++ b/src/core/morphos/SDL_amigaversion.h @@ -1,5 +1,5 @@ #define str(s) #s #define xstr(s) str(s) #define VERSION 53 -#define REVISION 2 +#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_stubs.h b/src/core/morphos/SDL_stubs.h index eac6c83c14..d90b523023 100644 --- a/src/core/morphos/SDL_stubs.h +++ b/src/core/morphos/SDL_stubs.h @@ -759,3 +759,12 @@ 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/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index 24dcea5f89..ee31c3d676 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -726,7 +726,7 @@ 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.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); @@ -758,8 +758,15 @@ 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 index eef6709b07..2521d466d7 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -686,4 +686,13 @@ SDL_GameControllerGetTouchpadFinger(gamecontroller,touchpad,finger,state,x,y,pre SDL_GetNumTouchDevices()(sysv,r12base) SDL_GetTouchDevice(index)(sysv,r12base) SDL_GetNumTouchFingers(touchID)(sysv,r12base) -SDL_GetTouchFinger(touchID,index)(sysv,r12base) \ No newline at end of file +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 index 649f644700..728e84e559 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -5973,4 +5973,88 @@ (((SDL_Finger *(*)(SDL_TouchID , int ))*(void**)(__base - 4114))(__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 - 4120))(__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 - 4126))(__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 - 4132))(__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 - 4138))(__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 - 4144))(__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 - 4150))(__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 - 4156))(__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 - 4162))(__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 - 4168))(__t__p0, __t__p1, __t__p2));\ + }) + #endif /* !_PPCINLINE_SDL2_H */ diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 7cd19858c8..d1684afcaf 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1031,6 +1031,7 @@ GL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te } #if defined(__AMIGAOS4__) || defined(__MORPHOS__) +/* Hack: this is due to missing functionnality in MinGL / Warp3D / TinyGL */ static void GlBlendModeHack(GL_RenderData * data, const SDL_BlendMode mode) { @@ -1098,20 +1099,7 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader if (blend != data->drawstate.blend) { #if defined(__AMIGAOS4__) || defined(__MORPHOS__) - 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))); - } - } else { - GlBlendModeHack(data, blend); - } + GlBlendModeHack(data, blend); #else if (blend == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); diff --git a/src/video/amiga/SDL_amigamouse.c b/src/video/amiga/SDL_amigamouse.c index 2950224639..0a90c1d66c 100644 --- a/src/video/amiga/SDL_amigamouse.c +++ b/src/video/amiga/SDL_amigamouse.c @@ -137,7 +137,7 @@ AMIGA_ShowCursor(SDL_Cursor * cursor) { SDL_VideoDevice *video = SDL_GetVideoDevice(); SDL_VideoData *data = (SDL_VideoData *)video->driverdata; - D("[%s] 0x%08lx\n", __FUNCTION__, cursor); + //D("[%s] 0x%08lx\n", __FUNCTION__, cursor); if (IS_SYSTEM_CURSOR(cursor)) { From 710b4daa1891881a28111401f7e97473e7ee01bb Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Thu, 7 Jan 2021 18:41:26 +0100 Subject: [PATCH 207/214] MORPHOS: add SDL_OpenURL support and fix somes bugs - add GCC10 per defaut - add futur locale support - add OpenURL support - missing 2 functions in fd and clib, regenerated headers --- Makefile.mos | 6 +- src/core/morphos/SDL_library.c | 12 ++-- src/core/morphos/devenv/Makefile | 2 +- src/core/morphos/sdk/clib/sdl2_protos.h | 2 + src/core/morphos/sdk/fd/sdl2_lib.fd | 2 + src/core/morphos/sdk/ppcinline/sdl2.h | 78 +++++++++++++++---------- src/locale/morphos/SDL_syslocale.c | 34 +++++++++++ src/misc/morphos/SDL_sysurl.c | 44 ++++++++++++++ 8 files changed, 142 insertions(+), 38 deletions(-) create mode 100644 src/locale/morphos/SDL_syslocale.c create mode 100644 src/misc/morphos/SDL_sysurl.c diff --git a/Makefile.mos b/Makefile.mos index cf6cacb912..b414180328 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -4,7 +4,7 @@ CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG #CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 -CC = ppc-morphos-gcc-9 -noixemul +CC = ppc-morphos-gcc-10 -noixemul INCLUDE = -I./include CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) AR = ppc-morphos-ar @@ -57,9 +57,9 @@ SOURCES = \ src/video/amiga/*.c \ src/video/yuv2rgb/*.c \ src/misc/*.c \ - src/misc/dummy/*.c \ + src/misc/morphos/*.c \ src/locale/*.c \ - src/locale/dummy/*.c \ + src/locale/morphos/*.c \ CORESOURCES = src/core/morphos/*.c COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g') diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c index 3f0ab8c138..6ac7e2e542 100644 --- a/src/core/morphos/SDL_library.c +++ b/src/core/morphos/SDL_library.c @@ -57,9 +57,10 @@ struct Library *CharsetsBase = NULL; struct Library *IConvBase = NULL; struct Library *ThreadPoolBase = NULL; struct Library *DynLoadBase = NULL; +struct Library *OpenURLBase = NULL; //SDL_JOYSTICK_AMIGA -struct Library *LowLevelBase = NULL; +// struct Library *LowLevelBase = NULL; struct timerequest GlobalTimeReq; @@ -264,12 +265,13 @@ static void UserLibClose(struct SDL_Library *LibBase, struct ExecBase *SysBase) CloseLibrary(IConvBase); CloseLibrary(ThreadPoolBase); CloseLibrary(DynLoadBase); - + CloseLibrary(OpenURLBase); + CyberGfxBase = LibBase->MyCyberGfxBase = NULL; KeymapBase = LibBase->MyKeymapBase = NULL; WorkbenchBase = LibBase->MyWorkbenchBase = NULL; IconBase = LibBase->MyIconBase = NULL; - MUIMasterBase = LibBase->MyMUIMasterBase = NULL; + MUIMasterBase = LibBase->MyMUIMasterBase = NULL; CxBase = LibBase->MyCxBase = NULL; ScreenNotifyBase = LibBase->MyScreenNotifyBase = NULL; @@ -280,6 +282,7 @@ static void UserLibClose(struct SDL_Library *LibBase, struct ExecBase *SysBase) IConvBase = NULL; ThreadPoolBase = NULL; DynLoadBase = NULL; + OpenURLBase = NULL; } /********************************************************************** @@ -386,7 +389,8 @@ struct Library *LIB_Open(void) && ((CharsetsBase = OpenLibrary("charsets.library" , 53)) != NULL) && ((IConvBase = OpenLibrary("iconv.library" , 0)) != NULL) && ((ThreadPoolBase = OpenLibrary("threadpool.library" , 53)) != NULL) - && ((DynLoadBase = OpenLibrary("dynload.library" , 0)) != NULL)) + && ((DynLoadBase = OpenLibrary("dynload.library" , 0)) != NULL) + && ((OpenURLBase = OpenLibrary("openurl.library" , 0)) != NULL)) { LibBase->Alloc = 1; } diff --git a/src/core/morphos/devenv/Makefile b/src/core/morphos/devenv/Makefile index 50ee36b553..594072dc74 100644 --- a/src/core/morphos/devenv/Makefile +++ b/src/core/morphos/devenv/Makefile @@ -1,6 +1,6 @@ # Makefile to build the SDL 2 Library -CC = ppc-morphos-gcc-9 -noixemul +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 diff --git a/src/core/morphos/sdk/clib/sdl2_protos.h b/src/core/morphos/sdk/clib/sdl2_protos.h index ee31c3d676..547f438549 100644 --- a/src/core/morphos/sdk/clib/sdl2_protos.h +++ b/src/core/morphos/sdk/clib/sdl2_protos.h @@ -738,6 +738,8 @@ 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); diff --git a/src/core/morphos/sdk/fd/sdl2_lib.fd b/src/core/morphos/sdk/fd/sdl2_lib.fd index 2521d466d7..60ffa6fc90 100644 --- a/src/core/morphos/sdk/fd/sdl2_lib.fd +++ b/src/core/morphos/sdk/fd/sdl2_lib.fd @@ -666,6 +666,8 @@ 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) diff --git a/src/core/morphos/sdk/ppcinline/sdl2.h b/src/core/morphos/sdk/ppcinline/sdl2.h index 728e84e559..fc441ffde2 100644 --- a/src/core/morphos/sdk/ppcinline/sdl2.h +++ b/src/core/morphos/sdk/ppcinline/sdl2.h @@ -5789,7 +5789,7 @@ double __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((double (*)(double ))*(void**)(__base - 3994))(__t__p0));\ + (((double (*)(double ))*(void**)(__base - 4006))(__t__p0));\ }) #define SDL_truncf(__p0) \ @@ -5797,14 +5797,32 @@ float __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((float (*)(float ))*(void**)(__base - 4000))(__t__p0));\ + (((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 - 4006))());\ + (((SDL_Locale *(*)(void))*(void**)(__base - 4018))());\ }) #define SDL_SIMDRealloc(__p0, __p1) \ @@ -5813,7 +5831,7 @@ 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 - 4012))(__t__p0, __t__p1));\ + (((void *(*)(void *, const size_t ))*(void**)(__base - 4024))(__t__p0, __t__p1));\ }) #define SDL_OpenURL(__p0) \ @@ -5821,7 +5839,7 @@ const char * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(const char *))*(void**)(__base - 4018))(__t__p0));\ + (((int (*)(const char *))*(void**)(__base - 4030))(__t__p0));\ }) #define SDL_HasSurfaceRLE(__p0) \ @@ -5829,7 +5847,7 @@ 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 - 4024))(__t__p0));\ + (((SDL_bool (*)(SDL_Surface *))*(void**)(__base - 4036))(__t__p0));\ }) #define SDL_GameControllerHasLED(__p0) \ @@ -5837,7 +5855,7 @@ 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 - 4030))(__t__p0));\ + (((SDL_bool (*)(SDL_GameController *))*(void**)(__base - 4042))(__t__p0));\ }) #define SDL_GameControllerSetLED(__p0, __p1, __p2, __p3) \ @@ -5848,7 +5866,7 @@ 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 - 4036))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_GameController *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 4048))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_JoystickHasLED(__p0) \ @@ -5856,7 +5874,7 @@ 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 - 4042))(__t__p0));\ + (((SDL_bool (*)(SDL_Joystick *))*(void**)(__base - 4054))(__t__p0));\ }) #define SDL_JoystickSetLED(__p0, __p1, __p2, __p3) \ @@ -5867,7 +5885,7 @@ 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 - 4048))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_Joystick *, Uint8 , Uint8 , Uint8 ))*(void**)(__base - 4060))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_GameControllerRumbleTriggers(__p0, __p1, __p2, __p3) \ @@ -5878,7 +5896,7 @@ 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 - 4054))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_GameController *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 4066))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_JoystickRumbleTriggers(__p0, __p1, __p2, __p3) \ @@ -5889,7 +5907,7 @@ 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 - 4060))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_Joystick *, Uint16 , Uint16 , Uint32 ))*(void**)(__base - 4072))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_GameControllerHasAxis(__p0, __p1) \ @@ -5898,7 +5916,7 @@ 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 - 4066))(__t__p0, __t__p1));\ + (((SDL_bool (*)(SDL_GameController *, SDL_GameControllerAxis ))*(void**)(__base - 4078))(__t__p0, __t__p1));\ }) #define SDL_GameControllerHasButton(__p0, __p1) \ @@ -5907,7 +5925,7 @@ 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 - 4072))(__t__p0, __t__p1));\ + (((SDL_bool (*)(SDL_GameController *, SDL_GameControllerButton ))*(void**)(__base - 4084))(__t__p0, __t__p1));\ }) #define SDL_GameControllerGetNumTouchpads(__p0) \ @@ -5915,7 +5933,7 @@ SDL_GameController * __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_GameController *))*(void**)(__base - 4078))(__t__p0));\ + (((int (*)(SDL_GameController *))*(void**)(__base - 4090))(__t__p0));\ }) #define SDL_GameControllerGetNumTouchpadFingers(__p0, __p1) \ @@ -5924,7 +5942,7 @@ int __t__p1 = __p1;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_GameController *, int ))*(void**)(__base - 4084))(__t__p0, __t__p1));\ + (((int (*)(SDL_GameController *, int ))*(void**)(__base - 4096))(__t__p0, __t__p1));\ }) #define SDL_GameControllerGetTouchpadFinger(__p0, __p1, __p2, __p3, __p4, __p5, __p6) \ @@ -5938,14 +5956,14 @@ 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 - 4090))(__t__p0, __t__p1, __t__p2, __t__p3, __t__p4, __t__p5, __t__p6));\ + (((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 - 4096))());\ + (((int (*)(void))*(void**)(__base - 4108))());\ }) #define SDL_GetTouchDevice(__p0) \ @@ -5953,7 +5971,7 @@ int __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((SDL_TouchID (*)(int ))*(void**)(__base - 4102))(__t__p0));\ + (((SDL_TouchID (*)(int ))*(void**)(__base - 4114))(__t__p0));\ }) #define SDL_GetNumTouchFingers(__p0) \ @@ -5961,7 +5979,7 @@ SDL_TouchID __t__p0 = __p0;\ long __base = (long)(SDL2_BASE_NAME);\ __asm volatile("mr 12,%0": :"r"(__base):"r12");\ - (((int (*)(SDL_TouchID ))*(void**)(__base - 4108))(__t__p0));\ + (((int (*)(SDL_TouchID ))*(void**)(__base - 4120))(__t__p0));\ }) #define SDL_GetTouchFinger(__p0, __p1) \ @@ -5970,7 +5988,7 @@ 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 - 4114))(__t__p0, __t__p1));\ + (((SDL_Finger *(*)(SDL_TouchID , int ))*(void**)(__base - 4126))(__t__p0, __t__p1));\ }) #define SDL_crc32(__p0, __p1, __p2) \ @@ -5980,7 +5998,7 @@ 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 - 4120))(__t__p0, __t__p1, __t__p2));\ + (((Uint32 (*)(Uint32 , const void *, size_t ))*(void**)(__base - 4132))(__t__p0, __t__p1, __t__p2));\ }) #define SDL_GameControllerGetSerial(__p0) \ @@ -5988,7 +6006,7 @@ 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 - 4126))(__t__p0));\ + (((const char *(*)(SDL_GameController *))*(void**)(__base - 4138))(__t__p0));\ }) #define SDL_JoystickGetSerial(__p0) \ @@ -5996,7 +6014,7 @@ 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 - 4132))(__t__p0));\ + (((const char *(*)(SDL_Joystick *))*(void**)(__base - 4144))(__t__p0));\ }) #define SDL_GameControllerHasSensor(__p0, __p1) \ @@ -6005,7 +6023,7 @@ 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 - 4138))(__t__p0, __t__p1));\ + (((SDL_bool (*)(SDL_GameController *, SDL_SensorType ))*(void**)(__base - 4150))(__t__p0, __t__p1));\ }) #define SDL_GameControllerSetSensorEnabled(__p0, __p1, __p2) \ @@ -6015,7 +6033,7 @@ 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 - 4144))(__t__p0, __t__p1, __t__p2));\ + (((int (*)(SDL_GameController *, SDL_SensorType , SDL_bool ))*(void**)(__base - 4156))(__t__p0, __t__p1, __t__p2));\ }) #define SDL_GameControllerIsSensorEnabled(__p0, __p1) \ @@ -6024,7 +6042,7 @@ 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));\ + (((SDL_bool (*)(SDL_GameController *, SDL_SensorType ))*(void**)(__base - 4162))(__t__p0, __t__p1));\ }) #define SDL_GameControllerGetSensorData(__p0, __p1, __p2, __p3) \ @@ -6035,7 +6053,7 @@ 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 - 4156))(__t__p0, __t__p1, __t__p2, __t__p3));\ + (((int (*)(SDL_GameController *, SDL_SensorType , float *, int ))*(void**)(__base - 4168))(__t__p0, __t__p1, __t__p2, __t__p3));\ }) #define SDL_wcscasecmp(__p0, __p1) \ @@ -6044,7 +6062,7 @@ 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 - 4162))(__t__p0, __t__p1));\ + (((int (*)(const wchar_t *, const wchar_t *))*(void**)(__base - 4174))(__t__p0, __t__p1));\ }) #define SDL_wcsncasecmp(__p0, __p1, __p2) \ @@ -6054,7 +6072,7 @@ 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 - 4168))(__t__p0, __t__p1, __t__p2));\ + (((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/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: */ + From 0243a053a182922b18f339f0725180993cab12c9 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Fri, 8 Jan 2021 12:41:34 +0100 Subject: [PATCH 208/214] MorphOS: add new functions GL Fix Test program Add GCC 10 to test programs --- Makefile.mos | 1 - src/render/opengl/SDL_render_gl.c | 9 +++-- src/test/SDL_test_imageBlit.c | 12 +++++++ src/test/SDL_test_imageBlitBlend.c | 8 +++++ src/test/SDL_test_imagePrimitives.c | 6 +++- src/video/SDL_video.c | 3 ++ src/video/amiga/SDL_amigagl_wrapper.c | 47 ++++++++++++++++++--------- test/Makefile.mos | 7 +++- test/controllermap.c | 2 +- 9 files changed, 73 insertions(+), 22 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index b414180328..a7601e94dc 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -3,7 +3,6 @@ # Enable debug with -D__SDL_DEBUG CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG -#CC = ppc-morphos-gcc-4 -noixemul -cstd=c99 CC = ppc-morphos-gcc-10 -noixemul INCLUDE = -I./include CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index d1684afcaf..dc6e51e1d5 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -44,6 +44,9 @@ #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 @@ -244,7 +247,7 @@ GL_LoadFunctions(GL_RenderData * data) #define SDL_PROC(ret,func,params) data->func=func; #else int retval = 0; -#if defined(__AMIGAOS4__) || defined(__MORPHOS__) +#if defined(__AMIGAOS4__) //|| defined(__MORPHOS__) #define SDL_PROC(ret,func,params) \ do { \ data->func = SDL_GL_GetProcAddress(#func); \ @@ -1030,7 +1033,7 @@ GL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te return 0; } -#if defined(__AMIGAOS4__) || defined(__MORPHOS__) +#if defined(__AMIGAOS4__) /* Hack: this is due to missing functionnality in MinGL / Warp3D / TinyGL */ static void GlBlendModeHack(GL_RenderData * data, const SDL_BlendMode mode) @@ -1098,7 +1101,7 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } if (blend != data->drawstate.blend) { -#if defined(__AMIGAOS4__) || defined(__MORPHOS__) +#if defined(__AMIGAOS4__) //|| defined(__MORPHOS__) GlBlendModeHack(data, blend); #else if (blend == SDL_BLENDMODE_NONE) { 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/video/SDL_video.c b/src/video/SDL_video.c index b0542ba3c9..b73b93af55 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3251,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; diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index da501cde3d..0a687e50ad 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -84,6 +84,23 @@ static void AmiglAlphaFunc( GLenum func, GLclampf 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); @@ -118,9 +135,7 @@ static void AmiglPolygonOffset( GLfloat factor, GLfloat units ) { } static void AmiglPolygonStipple( const GLubyte *mask ) { -#ifndef __MORPHOS__ glPolygonStipple(mask); -#endif } static void AmiglGetPolygonStipple( GLubyte *mask ) { @@ -470,7 +485,7 @@ static void AmiglVertex4sv( const GLshort *v ) #ifndef __MORPHOS__ glVertex4sv(v); #else - glVertex4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); + glVertex4f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); #endif } @@ -479,7 +494,7 @@ static void AmiglNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ) #ifndef __MORPHOS__ glNormal3b(nx, ny, nz); #else - glNormal3f((GLfloat)nx, (GLfloat)ny, (GLfloat)nz); + glNormal3f((GLfloat)nx, (GLfloat)ny, (GLfloat)nz); #endif } @@ -550,9 +565,7 @@ static void AmiglIndexf( GLfloat c ) static void AmiglIndexi( GLint c ) { -#ifndef __MORPHOS__ glIndexi(c); -#endif } static void AmiglIndexs( GLshort c ) @@ -1622,11 +1635,11 @@ 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 +#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, @@ -1635,10 +1648,10 @@ static void AmiglTexSubImage2D( GLenum target, GLint level, 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 + 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, @@ -2603,6 +2616,10 @@ void *AmiGetGLProc(const char *proc) { "glColorMask", AmiglColorMask }, { "glAlphaFunc", AmiglAlphaFunc }, { "glBlendFunc", AmiglBlendFunc }, + { "glBlendColor", AmiglBlendColor }, + { "glBlendEquation", AmiglBlendEquation }, + { "glBlendEquationSeparate", AmiglBlendEquationSeparate }, + { "glBlendFuncSeparate", AmiglBlendFuncSeparate }, { "glLogicOp", AmiglLogicOp }, { "glCullFace", AmiglCullFace }, { "glFrontFace", AmiglFrontFace }, diff --git a/test/Makefile.mos b/test/Makefile.mos index 2c154f2221..a850c75e92 100644 --- a/test/Makefile.mos +++ b/test/Makefile.mos @@ -1,7 +1,7 @@ # Makefile to build the MorphOS SDL tests AR = ppc-morphos-ar -CC = ppc-morphos-gcc-9 +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 @@ -27,6 +27,7 @@ TARGETS = \ testfile \ testfilesystem \ testgamecontroller \ + testgesture \ testgl2 \ testgles \ testgles2 \ @@ -62,6 +63,7 @@ TARGETS = \ teststreaming \ testthread \ testtimer \ + testurl \ testver \ testviewport \ testvulkan \ @@ -295,5 +297,8 @@ controllermap: controllermap.o 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) { From 1074d7e5e805447dd558be1ac0a83a7163e69f67 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 9 Feb 2021 20:19:10 +0100 Subject: [PATCH 209/214] MorphOS: little fixes --- src/video/amiga/SDL_amigamodes.c | 2 +- src/video/amiga/SDL_amigaopengl.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index d9458ee3b6..e2af68a80e 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -349,7 +349,7 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen, SDL_bool support3d) {SA_Quiet, TRUE}, {SA_ShowTitle, FALSE}, {SA_AutoScroll, TRUE}, - {SA_Title, (IPTR)"SDL"}, + {SA_Title, (IPTR)"SDL2"}, {SA_AdaptSize, TRUE}, {support3d ? SA_3DSupport : TAG_IGNORE, TRUE}, {TAG_DONE} diff --git a/src/video/amiga/SDL_amigaopengl.c b/src/video/amiga/SDL_amigaopengl.c index c27e02e357..0ec2689012 100644 --- a/src/video/amiga/SDL_amigaopengl.c +++ b/src/video/amiga/SDL_amigaopengl.c @@ -54,16 +54,16 @@ int AMIGA_GL_LoadLibrary(_THIS, const char *path) if (SDL2Base->MyTinyGLBase) { if (!TinyGLBase) - TinyGLBase = OpenLibrary("tinygl.library", 50); // This is opened only once, closed only at final exit + TinyGLBase = OpenLibrary("tinygl.library", 52); // This is opened only once, closed only at final exit if (TinyGLBase) { - *SDL2Base->MyTinyGLBase = TinyGLBase; - return 0; + + *SDL2Base->MyTinyGLBase = TinyGLBase; + return 0; } } - SDL_SetError("Failed to open minigl.library"); - + SDL_SetError("Failed to open tinygl.library"); return -1; } From bf2c692d3bdc66daf487b48a81fbf134dcd76955 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 16 Feb 2021 15:13:14 +0100 Subject: [PATCH 210/214] MorphOS: add menu to window - add GadToolsBase library - Create Menu (pick idea from PowerSDL) - clean some codes --- src/core/morphos/SDL_library.c | 19 +++++++++- src/core/morphos/SDL_library.h | 8 ++++ src/video/amiga/SDL_amigaevents.c | 48 +++++++++++++++++++++--- src/video/amiga/SDL_amigagl_wrapper.c | 2 +- src/video/amiga/SDL_amigawindow.c | 54 ++++++++++++++++----------- src/video/amiga/SDL_amigawindow.h | 3 ++ 6 files changed, 106 insertions(+), 28 deletions(-) diff --git a/src/core/morphos/SDL_library.c b/src/core/morphos/SDL_library.c index 6ac7e2e542..27e3c0be6c 100644 --- a/src/core/morphos/SDL_library.c +++ b/src/core/morphos/SDL_library.c @@ -22,11 +22,15 @@ #include #include +#include +#include + #include #include #include #include #include +#include #include "SDL_amigaversion.h" #include "SDL_library.h" @@ -58,10 +62,20 @@ 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; @@ -266,6 +280,7 @@ static void UserLibClose(struct SDL_Library *LibBase, struct ExecBase *SysBase) CloseLibrary(ThreadPoolBase); CloseLibrary(DynLoadBase); CloseLibrary(OpenURLBase); + CloseLibrary(GadToolsBase); CyberGfxBase = LibBase->MyCyberGfxBase = NULL; KeymapBase = LibBase->MyKeymapBase = NULL; @@ -283,6 +298,7 @@ static void UserLibClose(struct SDL_Library *LibBase, struct ExecBase *SysBase) ThreadPoolBase = NULL; DynLoadBase = NULL; OpenURLBase = NULL; + GadToolsBase = NULL; } /********************************************************************** @@ -390,6 +406,7 @@ struct Library *LIB_Open(void) && ((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; diff --git a/src/core/morphos/SDL_library.h b/src/core/morphos/SDL_library.h index 0343402e6a..196bda2932 100644 --- a/src/core/morphos/SDL_library.h +++ b/src/core/morphos/SDL_library.h @@ -42,6 +42,14 @@ #define __TEXTSEGMENT__ __attribute__((section(".text"))) #endif +enum +{ + MID_PROJECT = 0x0010, + MID_ABOUT, + MID_HIDE, + MID_QUIT +}; + struct CTDT { int (*fp)(void); diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index cbfcce1898..5f3ac3b372 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -25,6 +25,7 @@ #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" @@ -50,6 +51,7 @@ #include #include #include +#include static void AMIGA_DispatchMouseButtons(const struct IntuiMessage *m, const SDL_WindowData *data) @@ -148,7 +150,7 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) } static void -AMIGA_MouseMove(const struct IntuiMessage *m, SDL_WindowData *data) +AMIGA_MouseMove(_THIS, struct IntuiMessage *m, SDL_WindowData *data) { //SDL_Mouse *mouse = SDL_GetMouse(); @@ -189,9 +191,7 @@ AMIGA_ChangeWindow(_THIS, const struct IntuiMessage *m, SDL_WindowData *data) 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)); - /*if (data->glContext)*/ { - AMIGA_GL_ResizeContext(_this, data->window); - } + AMIGA_GL_ResizeContext(_this, data->window); } } @@ -207,6 +207,22 @@ static void AMIGA_GadgetEvent(_THIS, const struct IntuiMessage *m) } } +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-\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_HandleActivation(_THIS, struct IntuiMessage *m, SDL_bool activated) { @@ -242,6 +258,28 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) 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); @@ -253,7 +291,7 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) break; case IDCMP_MOUSEMOVE: - AMIGA_MouseMove(m, data); + AMIGA_MouseMove(_this, m, data); break; case IDCMP_MOUSEBUTTONS: diff --git a/src/video/amiga/SDL_amigagl_wrapper.c b/src/video/amiga/SDL_amigagl_wrapper.c index 0a687e50ad..a4e8df4f9b 100644 --- a/src/video/amiga/SDL_amigagl_wrapper.c +++ b/src/video/amiga/SDL_amigagl_wrapper.c @@ -79,7 +79,7 @@ static void AmiglColorMask( GLboolean red, GLboolean green, GLboolean blue, GLbo static void AmiglAlphaFunc( GLenum func, GLclampf ref ) { glAlphaFunc(func, ref); - } +} static void AmiglBlendFunc( GLenum sfactor, GLenum dfactor ) { glBlendFunc(sfactor, dfactor); diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index 3aed21689b..b594d41095 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -40,10 +40,13 @@ #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__); @@ -81,7 +84,13 @@ static void CloseWindowSafely(SDL_Window *sdlwin, struct Window *win) } } + ClearMenuStrip(win); + CloseWindow(win); + if (data->menu) FreeMenus(data->menu); + if (data->visualinfo) FreeVisualInfo(data->visualinfo); + data->menu = NULL; + data->visualinfo = NULL; Permit(); } } @@ -123,14 +132,15 @@ void AMIGA_OpenWindows(_THIS) 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)); - D("[%s]\n", __FUNCTION__); - - window->driverdata = wd; - + if (wd) { + window->driverdata = wd; + ADDHEAD(&data->windowlist, wd); wd->region = NULL; @@ -221,7 +231,7 @@ AMIGA_SetWindowTitle(_THIS, SDL_Window * window) void AMIGA_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) { - #warning convert this icon to appicon + //#warning convert this icon to appicon } void @@ -388,19 +398,6 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) if (vd->CustomScreen == NULL) barheight = GetSkinInfoAttrA(di, SI_ScreenTitlebarHeight, NULL); - #if 0 - if ((window->flags & SDL_WINDOW_BORDERLESS) == 0 && !fullscreen) - { - border_w = GetSkinInfoAttrA(di, SI_BorderLeft , NULL) + GetSkinInfoAttrA(di, SI_BorderRight, NULL); - border_h = GetSkinInfoAttrA(di, SI_BorderTopTitle, NULL) + GetSkinInfoAttrA(di, window->flags & SDL_WINDOW_RESIZABLE ? SI_BorderBottomSize : SI_BorderBottom, NULL); - - min_w += border_w; - max_w += border_w; - min_h += border_h; - max_h += border_h; - } - #endif - FreeScreenDrawInfo(scr, di); maxheight = scr->Height - barheight; @@ -436,8 +433,19 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) 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); + } + } + } -#warning check this... min_w = MIN(min_w, scr->Width); min_h = MIN(min_h, maxheight); max_w = MIN(max_w, scr->Width); @@ -476,7 +484,7 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) 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, + 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); @@ -502,7 +510,11 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) 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); diff --git a/src/video/amiga/SDL_amigawindow.h b/src/video/amiga/SDL_amigawindow.h index 6a1925beac..b8e8fb5d9a 100644 --- a/src/video/amiga/SDL_amigawindow.h +++ b/src/video/amiga/SDL_amigawindow.h @@ -58,6 +58,9 @@ typedef struct BYTE grabbed; BYTE first_deltamove; BYTE winflags; + + APTR visualinfo; + struct Menu *menu; } SDL_WindowData; /* Is this window shown (not iconified) */ From 1d977a89b52a655077058555a94da84ae3145d01 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 16 Feb 2021 15:17:28 +0100 Subject: [PATCH 211/214] MorphOS : fix - fix window title - fix open menu on window title bar (right click on window title bar) --- src/video/amiga/SDL_amigaevents.c | 79 ++++++++++++++++++------------- src/video/amiga/SDL_amigawindow.c | 4 +- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 5f3ac3b372..49634fe97e 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -149,18 +149,61 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) } } +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) { - //SDL_Mouse *mouse = SDL_GetMouse(); 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); + int mx = s->MouseX; + int my = s->MouseY; + int ws = data->win->LeftEdge + data->win->BorderLeft; + int wy = data->win->TopEdge + data->win->BorderTop; + int wx2 = data->win->LeftEdge + data->win->Width - data->win->BorderRight; + int wy2 = data->win->TopEdge + data->win->Height - data->win->BorderBottom; + int x = mx - ws; + int y = my - wy; SDL_SendMouseMotion(data->window, 0, 0, x, y); - + + if (mx >=ws && my >= wy && mx <= wx2 && my <=wy2) { + data->win->Flags |= WFLG_RMBTRAP; + AMIGA_HandleActivation(_this, m, SDL_TRUE); + }else{ + data->win->Flags &= ~WFLG_RMBTRAP; + AMIGA_HandleActivation(_this, m, SDL_FALSE); + } + } else { @@ -223,34 +266,6 @@ AMIGA_AboutSDL(struct Window *window) EasyRequest(window, &es, NULL, SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, (ULONG)porters, (ULONG)bases); } -static void -AMIGA_HandleActivation(_THIS, struct IntuiMessage *m, SDL_bool activated) -{ - SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; - //D("[%s]\n", __FUNCTION__); - if(data->window) { - if (activated) { - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); - //OS4_SyncKeyModifiers(_this); - 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_DispatchEvent(_THIS, struct IntuiMessage *m) { diff --git a/src/video/amiga/SDL_amigawindow.c b/src/video/amiga/SDL_amigawindow.c index b594d41095..54cfeb9b99 100644 --- a/src/video/amiga/SDL_amigawindow.c +++ b/src/video/amiga/SDL_amigawindow.c @@ -220,7 +220,7 @@ AMIGA_SetWindowTitle(_THIS, SDL_Window * window) 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, (APTR)-1); + SetWindowTitles(data->win, title, title); } data->window_title = title; @@ -374,7 +374,7 @@ AMIGA_ShowWindow_Internal(_THIS, SDL_Window * window) if (data->win == NULL && (data->sdlflags & SDL_WINDOW_MINIMIZED) == 0) { struct Screen *scr; - size_t flags = WFLG_SIMPLE_REFRESH | WFLG_REPORTMOUSE | WFLG_ACTIVATE | WFLG_RMBTRAP; + 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; From 314b26ad4533d7faa9fea84138b0990e240a8ac6 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 16 Feb 2021 15:20:19 +0100 Subject: [PATCH 212/214] MorphOS : add errors catch on OpenScreenTags --- src/video/amiga/SDL_amigamodes.c | 37 +++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/video/amiga/SDL_amigamodes.c b/src/video/amiga/SDL_amigamodes.c index e2af68a80e..e1d427c52a 100644 --- a/src/video/amiga/SDL_amigamodes.c +++ b/src/video/amiga/SDL_amigamodes.c @@ -34,7 +34,7 @@ #include #include #include - +#include static Uint32 AMIGA_SDLPixelFormatToDepth(Uint32 pixfmt) @@ -333,7 +333,8 @@ 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) @@ -351,6 +352,7 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen, SDL_bool support3d) {SA_AutoScroll, TRUE}, {SA_Title, (IPTR)"SDL2"}, {SA_AdaptSize, TRUE}, + {SA_ErrorCode, &openError}, {support3d ? SA_3DSupport : TAG_IGNORE, TRUE}, {TAG_DONE} }; @@ -384,9 +386,34 @@ AMIGA_GetScreen(_THIS, BYTE fullscreen, SDL_bool support3d) if (data->ScrMonName != NULL) screen = LockPubScreen("Workbench"); - if (screen == NULL) - return SDL_SetError("Failed to get screen."); - + 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; } From 59a37e81e50fb9bd11be5f95c96e551dae47dce0 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:38:29 +0100 Subject: [PATCH 213/214] MorphOS: fix - add AMIGADATE in About box - Rework activation of mouse right click in/out window --- Makefile.mos | 7 ++--- src/video/amiga/SDL_amigaevents.c | 49 +++++++++++++++++++------------ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index a7601e94dc..f8f58a2ab8 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -4,12 +4,11 @@ CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG CC = ppc-morphos-gcc-10 -noixemul -INCLUDE = -I./include +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 -AMIGADATE = $(shell date +"%-d.%-m.%Y") - ECHE = echo -e BOLD = \033[1m NRML = \033[22m @@ -96,7 +95,7 @@ src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.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 -D__AMIGADATE__=\"$(AMIGADATE)\" -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c + @$(CC) -mcpu=750 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c $(TARGET): $(OBJECTS) $(ARCHIVING) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 49634fe97e..8d4a865aed 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -186,24 +186,9 @@ AMIGA_MouseMove(_THIS, struct IntuiMessage *m, SDL_WindowData *data) if (!SDL_GetRelativeMouseMode()) { struct Screen *s = data->win->WScreen; - int mx = s->MouseX; - int my = s->MouseY; - int ws = data->win->LeftEdge + data->win->BorderLeft; - int wy = data->win->TopEdge + data->win->BorderTop; - int wx2 = data->win->LeftEdge + data->win->Width - data->win->BorderRight; - int wy2 = data->win->TopEdge + data->win->Height - data->win->BorderBottom; - int x = mx - ws; - int y = my - wy; + 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); - - if (mx >=ws && my >= wy && mx <= wx2 && my <=wy2) { - data->win->Flags |= WFLG_RMBTRAP; - AMIGA_HandleActivation(_this, m, SDL_TRUE); - }else{ - data->win->Flags &= ~WFLG_RMBTRAP; - AMIGA_HandleActivation(_this, m, SDL_FALSE); - } - } else { @@ -212,7 +197,6 @@ AMIGA_MouseMove(_THIS, struct IntuiMessage *m, SDL_WindowData *data) data->first_deltamove = 0; return; } - SDL_SendMouseMotion(data->window, 0, 1, m->MouseX, m->MouseY); } } @@ -260,7 +244,7 @@ AMIGA_AboutSDL(struct Window *window) es.es_StructSize = sizeof(struct EasyStruct); es.es_Flags = 0; es.es_Title = "SDL2"; - es.es_TextFormat = "SDL %ld.%ld.%ld -MorphOS-\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_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); @@ -447,15 +431,42 @@ 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; + } + } } if (sigs & data->ScrNotifySig && data->ScreenNotifyHandle) From a8ef720cce324f0c8d439ed4c0a485c123056f46 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Wed, 24 Feb 2021 20:18:01 +0100 Subject: [PATCH 214/214] MORPHOS: force to show cursor Force to display the cursor when passing over the edges of the window --- src/video/amiga/SDL_amigaevents.c | 51 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/video/amiga/SDL_amigaevents.c b/src/video/amiga/SDL_amigaevents.c index 8d4a865aed..b563ae731f 100644 --- a/src/video/amiga/SDL_amigaevents.c +++ b/src/video/amiga/SDL_amigaevents.c @@ -81,7 +81,7 @@ AMIGA_TranslateUnicode(struct IntuiMessage *m, char *buffer) WCHAR keycode; GetAttr(IMSGA_UCS4, m, (ULONG *)&keycode); - length = UTF8_Encode(keycode, buffer); + length = UTF8_Encode(keycode, buffer); #else struct InputEvent ie; @@ -103,7 +103,7 @@ 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: @@ -133,12 +133,12 @@ AMIGA_DispatchRawKey(struct IntuiMessage *m, const SDL_WindowData *data) default: if (rawkey < sizeof(amiga_scancode_table) / sizeof(amiga_scancode_table[0])) { s = amiga_scancode_table[rawkey]; - if (m->Code <= 127) { + if (m->Code <= 127) { char text[10]; int length = AMIGA_TranslateUnicode(m, text); SDL_SendKeyboardKey(SDL_PRESSED, s); if (length > 0) { - text[length] = '\0'; + text[length] = '\0'; SDL_SendKeyboardText(text); } } else { @@ -153,29 +153,29 @@ static void AMIGA_HandleActivation(_THIS, struct IntuiMessage *m, SDL_bool activated) { SDL_WindowData *data = (SDL_WindowData *)m->IDCMPWindow->UserData; - if(data->window) + if(data->window) { - if (activated) + if (activated) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); - if (SDL_GetKeyboardFocus() != data->window) + if (SDL_GetKeyboardFocus() != data->window) { SDL_SetKeyboardFocus(data->window); - } + } SDL_SetMouseFocus(data->window); - } - else + } + else { - if (SDL_GetKeyboardFocus() == data->window) + if (SDL_GetKeyboardFocus() == data->window) { SDL_SetKeyboardFocus(NULL); - } + } if (SDL_GetMouseFocus() == data->window) { SDL_SetMouseFocus(NULL); } - } + } } } @@ -183,7 +183,7 @@ static void AMIGA_MouseMove(_THIS, struct IntuiMessage *m, SDL_WindowData *data) { - if (!SDL_GetRelativeMouseMode()) + if (!SDL_GetRelativeMouseMode()) { struct Screen *s = data->win->WScreen; int x = (s->MouseX - data->win->LeftEdge - data->win->BorderLeft); @@ -260,13 +260,13 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) case IDCMP_MENUPICK: { struct MenuItem *item = ItemAddress(data->menu, m->Code); - if (item) + if (item) { switch ((ULONG)GTMENUITEM_USERDATA(item)) { case MID_ABOUT: AMIGA_AboutSDL(data->win); - break; + break; case MID_QUIT: SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; @@ -275,7 +275,7 @@ AMIGA_DispatchEvent(_THIS, struct IntuiMessage *m) break; default: break; - } + } } } break; @@ -395,8 +395,8 @@ AMIGA_CheckWBEvents(_THIS) while ((msg = (struct AppMessage *)GetMsg(&data->WBPort)) != NULL) { D("[%s] check AppMessage\n", __FUNCTION__); - - switch (msg->am_Type) { + + switch (msg->am_Type) { case AMTYPE_APPWINDOW: { SDL_Window *window = (SDL_Window *)msg->am_UserData; @@ -405,7 +405,7 @@ AMIGA_CheckWBEvents(_THIS) 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++; @@ -413,7 +413,7 @@ AMIGA_CheckWBEvents(_THIS) } SDL_SendDropComplete(window); } - break; + break; case AMTYPE_APPICON: AMIGA_ShowApp(_this); break; @@ -421,7 +421,7 @@ AMIGA_CheckWBEvents(_THIS) //D("[%s] Unknown AppMsg %d %p\n", __FUNCTION__, msg->am_Type, (APTR)msg->am_UserData); break; } - + } } @@ -448,7 +448,7 @@ AMIGA_PumpEvents(_THIS) AMIGA_DispatchEvent(_this, m); ReplyMsg((struct Message *)m); } - + if (check_mousecoord) { struct Screen *s = wdata->win->WScreen; @@ -464,9 +464,10 @@ AMIGA_PumpEvents(_THIS) } else { - wdata->win->Flags &= ~WFLG_RMBTRAP; + wdata->win->Flags &= ~WFLG_RMBTRAP; + SDL_ShowCursor(TRUE); // force to show system cursor } - } + } } if (sigs & data->ScrNotifySig && data->ScreenNotifyHandle)