Skip to content

Commit

Permalink
MorphOS: sync with SDL 2.30.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BeWorld2018 committed Mar 19, 2024
1 parent 44e1650 commit 4b1ca9c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 32 deletions.
2 changes: 0 additions & 2 deletions Makefile.mos
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ SOURCES = \
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 \
Expand Down
6 changes: 3 additions & 3 deletions include/SDL_config_morphos.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@
/* #undef SDL_AUDIO_DRIVER_ARTS */
/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
#define SDL_AUDIO_DRIVER_DISK 1
/* #undef SDL_AUDIO_DRIVER_DISK */
/* #undef SDL_AUDIO_DRIVER_DSOUND */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* #undef SDL_AUDIO_DRIVER_DUMMY */
/* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */
/* #undef SDL_AUDIO_DRIVER_ESD */
/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
Expand Down Expand Up @@ -298,13 +298,13 @@
/* #undef SDL_JOYSTICK_RAWINPUT */
/* #undef SDL_JOYSTICK_EMSCRIPTEN */
/* #undef SDL_JOYSTICK_VIRTUAL */
#define SDL_JOYSTICK_MORPHOS 1 /* Enable MORPHOS SENSORS JOYSTICK/GAMEPAD */
#define SDL_HAPTIC_DUMMY 1
/* #undef SDL_HAPTIC_ANDROID */
/* #undef SDL_HAPTIC_LINUX */
/* #undef SDL_HAPTIC_IOKIT */
/* #undef SDL_HAPTIC_DINPUT */
/* #undef SDL_HAPTIC_XINPUT */
#define SDL_JOYSTICK_MORPHOS 1 /* Enable MORPHOS SENSORS JOYSTICK/GAMEPAD */

/* Enable various sensor drivers */
/* #undef SDL_SENSOR_ANDROID */
Expand Down
4 changes: 2 additions & 2 deletions src/core/morphos/SDL_mosversion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define str(s) #s
#define xstr(s) str(s)
#define VERSION 53
#define REVISION 13
#define VERSTAG "\0$VER: sdl2.library " xstr(VERSION) "." xstr(REVISION) " (" __AMIGADATE__ ") © Bruno Peloille, Szilárd Biró, Ilkka Lehtoranta"
#define REVISION 14
#define VERSTAG "\0$VER: sdl2.library " xstr(VERSION) "." xstr(REVISION) " (" __AMIGADATE__ ") © Bruno Peloille, Szilárd Biró, Ilkka Lehtoranta"
8 changes: 8 additions & 0 deletions src/core/morphos/SDL_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,15 @@
STUB(SDL_SetTextureUserData)
STUB(SDL_GetTextureUserData)
STUB(SDL_RenderGeometry)
#if defined(GENERATE_STUBS)
extern void *SDL_RenderGeometryRaw_REAL(void *a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l);
void * __saveds LIB_SDL_RenderGeometryRaw(void *a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l)
{
return SDL_RenderGeometryRaw_REAL(a, b, c, d, e, f, g, h, i, j, k, l);
}
#else
STUB(SDL_RenderGeometryRaw)
#endif
STUB(SDL_RenderSetVSync)
STUB(SDL_vasprintf)
STUB(SDL_GetWindowICCProfile)
Expand Down
2 changes: 0 additions & 2 deletions src/core/morphos/devenv/sdl-startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ static DESTRUCTOR_P(cleanup_SDL2Base, 100)
{
if (NewLock)
{
//CurrentDir(OldLock);
//UnLock(NewLock);
UnLock(CurrentDir(OldLock));
}
CloseLibrary(base);
Expand Down
3 changes: 1 addition & 2 deletions src/joystick/SDL_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,8 @@ int SDL_JoystickInit(void)
/* See if we should allow joystick events while in the background */
SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
SDL_JoystickAllowBackgroundEventsChanged, NULL);
#ifndef __MORPHOS__
SDL_InitSteamVirtualGamepadInfo();
#endif

status = -1;
for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
if (SDL_joystick_drivers[i]->Init() >= 0) {
Expand Down
18 changes: 12 additions & 6 deletions src/joystick/morphos/SDL_sysjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ static SDL_JoystickID MORPHOS_JoystickGetDeviceInstanceID(int device_index)

static int MORPHOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
D("[%s]\n", __FUNCTION__);
APTR sensor = JoySensor[device_index];
int rc = -1;

if (sensor) {
size_t buttons = 0, naxes = 0, nhats = 0, nsticks = 0, nrumbles=0;
Expand Down Expand Up @@ -255,10 +257,11 @@ static int MORPHOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
hwdata->numRumbles = nrumbles;
joystick->hwdata = hwdata;
joystick->name = (char *)MORPHOS_JoystickGetDeviceName(device_index);
return 0;
rc = 0;
} else {
SDL_SetError("Failed to open device");
}

return SDL_SetError("Failed to open device");
return rc;
}

static int MORPHOS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Expand Down Expand Up @@ -447,7 +450,7 @@ static void MORPHOS_JoystickUpdate(SDL_Joystick *joystick)
}
}

static void MORPHOS_JoystickClose(SDL_Joystick *joystick)
void MORPHOS_JoystickClose(SDL_Joystick *joystick)
{
D("[%s]\n", __FUNCTION__);
struct joystick_hwdata *hwdata = joystick->hwdata;
Expand All @@ -456,17 +459,20 @@ static void MORPHOS_JoystickClose(SDL_Joystick *joystick)
if (hwdata->child_sensors)
{
ReleaseSensorsList(hwdata->child_sensors, NULL);
hwdata->child_sensors = NULL;
}
SDL_free(hwdata);
joystick->hwdata = NULL;
}
}

static void MORPHOS_JoystickQuit(void)
void MORPHOS_JoystickQuit(void)
{
D("[%s]\n", __FUNCTION__);
if (sensorlist)
if (sensorlist) {
ReleaseSensorsList(sensorlist, NULL);
sensorlist = NULL;
}
}

static SDL_bool MORPHOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
Expand Down
17 changes: 3 additions & 14 deletions src/video/morphos/SDL_mosvideo.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <[email protected]>
Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -322,7 +322,6 @@ MOS_CreateDevice()
device->SetDisplayMode = MOS_SetDisplayMode;
device->SuspendScreenSaver = MOS_SuspendScreenSaver;
device->PumpEvents = MOS_PumpEvents;

device->CreateSDLWindow = MOS_CreateWindow;
device->CreateSDLWindowFrom = MOS_CreateWindowFrom;
device->SetWindowTitle = MOS_SetWindowTitle;
Expand All @@ -342,17 +341,14 @@ MOS_CreateDevice()
device->SetWindowFullscreen = MOS_SetWindowFullscreen;
device->SetWindowGammaRamp = MOS_SetWindowGammaRamp;
device->SetWindowMouseGrab = MOS_SetWindowGrab;
//device->SetWindowKeyboardGrab = MOS_SetWindowGrab;
device->DestroyWindow = MOS_DestroyWindow;
device->CreateWindowFramebuffer = MOS_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = MOS_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = MOS_DestroyWindowFramebuffer;
device->GetWindowWMInfo = MOS_GetWindowWMInfo;

device->shape_driver.CreateShaper = MOS_CreateShaper;
device->shape_driver.SetWindowShape = MOS_SetWindowShape;
device->shape_driver.ResizeWindowShape = MOS_ResizeWindowShape;

device->GL_LoadLibrary = MOS_GL_LoadLibrary;
device->GL_GetProcAddress = MOS_GL_GetProcAddress;
device->GL_UnloadLibrary = MOS_GL_UnloadLibrary;
Expand All @@ -363,20 +359,14 @@ MOS_CreateDevice()
device->GL_GetSwapInterval = MOS_GL_GetSwapInterval;
device->GL_SwapWindow = MOS_GL_SwapWindow;
device->GL_DeleteContext = MOS_GL_DeleteContext;

device->SetClipboardText = MOS_SetClipboardText;
device->GetClipboardText = MOS_GetClipboardText;
device->HasClipboardText = MOS_HasClipboardText;

//device->ShowMessageBox = MOS_ShowMessageBox;

device->SetWindowResizable = MOS_SetWindowResizable;
device->GetWindowBordersSize = MOS_GetWindowBordersSize;
device->SetWindowOpacity = MOS_SetWindowOpacity;
device->FlashWindow = MOS_FlashWindow;

device->SetWindowHitTest = MOS_SetWindowHitTest;

device->free = MOS_DeleteDevice;

return device;
Expand All @@ -391,7 +381,6 @@ MOS_CreateDevice()

VideoBootStrap MORPHOS_bootstrap = {
"mos", "SDL MorphOS video driver",
MOS_CreateDevice
MOS_CreateDevice,
MOS_ShowMessageBox
};

/* vim: set ts=4 sw=4 expandtab: */
3 changes: 2 additions & 1 deletion test/Makefile.mos
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ testautomation: testautomation.o \
testautomation_guid.o \
testautomation_joystick.o \
testautomation_keyboard.o \
testautomation_main.o \
testautomation_log.o \
testautomation_main.o \
testautomation_math.o \
testautomation_mouse.o \
testautomation_pixels.o \
Expand Down

0 comments on commit 4b1ca9c

Please sign in to comment.