Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-2.30.x' into MorphOS-S…
Browse files Browse the repository at this point in the history
…DL-2.30.1-release
  • Loading branch information
BeWorld2018 committed Apr 3, 2024
2 parents c58e901 + 2f4a7bb commit 25f6a7d
Show file tree
Hide file tree
Showing 37 changed files with 324 additions and 206 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 30)
set(SDL_MICRO_VERSION 1)
set(SDL_MICRO_VERSION 2)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")

# Set defaults preventing destination file conflicts
Expand Down Expand Up @@ -1107,6 +1107,8 @@ if(SDL_LIBC)
check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
check_symbol_exists(elf_aux_info "sys/auxv.h" HAVE_ELF_AUX_INFO)
check_symbol_exists(poll "poll.h" HAVE_POLL)
check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
check_symbol_exists(posix_fallocate "fcntl.h" HAVE_POSIX_FALLOCATE)

check_library_exists(m pow "" HAVE_LIBM)
if(HAVE_LIBM)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.os2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 30
MICRO_VERSION = 1
MICRO_VERSION = 2
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2

Expand Down
2 changes: 1 addition & 1 deletion Makefile.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 30
MICRO_VERSION = 1
MICRO_VERSION = 2
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)

LIBHOME = .
Expand Down
1 change: 0 additions & 1 deletion VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_sdk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_beta.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_core.h" />
Expand Down
3 changes: 0 additions & 3 deletions VisualC-GDK/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
Expand Down
1 change: 0 additions & 1 deletion VisualC/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_sdk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_beta.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_core.h" />
Expand Down
3 changes: 0 additions & 3 deletions VisualC/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
Expand Down
4 changes: 2 additions & 2 deletions Xcode/SDL/Info-Framework.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.30.1</string>
<string>2.30.2</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.30.1</string>
<string>2.30.2</string>
</dict>
</plist>
52 changes: 6 additions & 46 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Xcode/SDL/pkg-support/SDL.info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Title SDL 2.30.1
Title SDL 2.30.2
Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 1;
private static final int SDL_MICRO_VERSION = 2;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,15 @@ public void pollHapticDevices() {
if (haptic == null) {
InputDevice device = InputDevice.getDevice(deviceIds[i]);
Vibrator vib = device.getVibrator();
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
if (vib != null) {
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
}
}
}
}
Expand Down
14 changes: 13 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -3510,7 +3510,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=1
SDL_MICRO_VERSION=2
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
Expand Down Expand Up @@ -19749,6 +19749,18 @@ if test "x$ac_cv_func_poll" = xyes
then :
printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h

fi
ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create"
if test "x$ac_cv_func_memfd_create" = xyes
then :
printf "%s\n" "#define HAVE_MEMFD_CREATE 1" >>confdefs.h

fi
ac_fn_c_check_func "$LINENO" "posix_fallocate" "ac_cv_func_posix_fallocate"
if test "x$ac_cv_func_posix_fallocate" = xyes
then :
printf "%s\n" "#define HAVE_POSIX_FALLOCATE 1" >>confdefs.h

fi
ac_fn_c_check_func "$LINENO" "_Exit" "ac_cv_func__Exit"
if test "x$ac_cv_func__Exit" = xyes
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=1
SDL_MICRO_VERSION=2
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
Expand Down Expand Up @@ -359,7 +359,7 @@ dnl Checks for library functions.
AC_DEFINE(HAVE_MPROTECT, 1, [ ])
],[]),
)
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll memfd_create posix_fallocate _Exit)

AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@
#cmakedefine HAVE_FOPEN64 1
#cmakedefine HAVE_FSEEKO 1
#cmakedefine HAVE_FSEEKO64 1
#cmakedefine HAVE_MEMFD_CREATE 1
#cmakedefine HAVE_POSIX_FALLOCATE 1
#cmakedefine HAVE_SIGACTION 1
#cmakedefine HAVE_SA_SIGACTION 1
#cmakedefine HAVE_SETJMP 1
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@
#undef HAVE_GETAUXVAL
#undef HAVE_ELF_AUX_INFO
#undef HAVE_POLL
#undef HAVE_MEMFD_CREATE
#undef HAVE_POSIX_FALLOCATE
#undef HAVE__EXIT

#else
Expand Down
4 changes: 3 additions & 1 deletion include/SDL_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@
#undef __GDK__
#define __GDK__ 1
#endif
#if defined(__PSP__)
#if defined(__PSP__) || defined(__psp__)
#ifdef __PSP__
#undef __PSP__
#endif
#define __PSP__ 1
#endif
#if defined(PS2)
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct SDL_version
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 30
#define SDL_PATCHLEVEL 1
#define SDL_PATCHLEVEL 2

/**
* Macro to determine SDL version program was compiled against.
Expand Down
79 changes: 39 additions & 40 deletions src/core/linux/SDL_udev.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifdef SDL_USE_LIBUDEV

#include <linux/input.h>
#include <sys/stat.h>

#include "SDL_assert.h"
#include "SDL_evdev_capabilities.h"
Expand Down Expand Up @@ -227,61 +228,59 @@ void SDL_UDEV_Scan(void)

SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class)
{
struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *devs = NULL;
struct udev_list_entry *item = NULL;
SDL_bool found = SDL_FALSE;
struct stat statbuf;
char type;
struct udev_device *dev;
const char* val;
int class_temp;

if (!_this) {
return SDL_FALSE;
}

enumerate = _this->syms.udev_enumerate_new(_this->udev);
if (!enumerate) {
SDL_SetError("udev_enumerate_new() failed");
if (stat(device_path, &statbuf) == -1) {
return SDL_FALSE;
}

_this->syms.udev_enumerate_scan_devices(enumerate);
devs = _this->syms.udev_enumerate_get_list_entry(enumerate);
for (item = devs; item && !found; item = _this->syms.udev_list_entry_get_next(item)) {
const char *path = _this->syms.udev_list_entry_get_name(item);
struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path);
if (dev) {
const char *val = NULL;
const char *existing_path;
if (S_ISBLK(statbuf.st_mode)) {
type = 'b';
}
else if (S_ISCHR(statbuf.st_mode)) {
type = 'c';
}
else {
return SDL_FALSE;
}

existing_path = _this->syms.udev_device_get_devnode(dev);
if (existing_path && SDL_strcmp(device_path, existing_path) == 0) {
int class_temp;
found = SDL_TRUE;
dev = _this->syms.udev_device_new_from_devnum(_this->udev, type, statbuf.st_rdev);

val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID");
if (val) {
*vendor = (Uint16)SDL_strtol(val, NULL, 16);
}
if (!dev) {
return SDL_FALSE;
}

val = _this->syms.udev_device_get_property_value(dev, "ID_MODEL_ID");
if (val) {
*product = (Uint16)SDL_strtol(val, NULL, 16);
}
val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID");
if (val) {
*vendor = (Uint16)SDL_strtol(val, NULL, 16);
}

val = _this->syms.udev_device_get_property_value(dev, "ID_REVISION");
if (val) {
*version = (Uint16)SDL_strtol(val, NULL, 16);
}
val = _this->syms.udev_device_get_property_value(dev, "ID_MODEL_ID");
if (val) {
*product = (Uint16)SDL_strtol(val, NULL, 16);
}

class_temp = device_class(dev);
if (class_temp) {
*class = class_temp;
}
}
_this->syms.udev_device_unref(dev);
}
val = _this->syms.udev_device_get_property_value(dev, "ID_REVISION");
if (val) {
*version = (Uint16)SDL_strtol(val, NULL, 16);
}
_this->syms.udev_enumerate_unref(enumerate);

return found;
class_temp = device_class(dev);
if (class_temp) {
*class = class_temp;
}

_this->syms.udev_device_unref(dev);

return SDL_TRUE;
}

void SDL_UDEV_UnloadLibrary(void)
Expand Down
20 changes: 10 additions & 10 deletions src/file/SDL_rwops.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <stdio.h>
#include <sys/stat.h>
#endif

#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
Expand Down Expand Up @@ -752,16 +751,17 @@ static int SDLCALL mem_close(SDL_RWops *context)
/* Functions to create SDL_RWops structures from various data sources */

#if defined(HAVE_STDIO_H) && !(defined(__WIN32__) || defined(__GDK__))
static SDL_bool SDL_IsRegularFile(FILE *f)
static SDL_bool IsRegularFileOrPipe(FILE *f)
{
#ifdef __WINRT__
struct __stat64 st;
if (_fstat64(_fileno(f), &st) < 0 || (st.st_mode & _S_IFMT) != _S_IFREG) {
if (_fstat64(_fileno(f), &st) < 0 ||
!((st.st_mode & _S_IFMT) == _S_IFREG || (st.st_mode & _S_IFMT) == _S_IFIFO)) {
return SDL_FALSE;
}
#else
struct stat st;
if (fstat(fileno(f), &st) < 0 || !S_ISREG(st.st_mode)) {
if (fstat(fileno(f), &st) < 0 || !(S_ISREG(st.st_mode) || S_ISFIFO(st.st_mode))) {
return SDL_FALSE;
}
#endif
Expand All @@ -782,9 +782,9 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
if (*file == '/') {
FILE *fp = fopen(file, mode);
if (fp) {
if (!SDL_IsRegularFile(fp)) {
if (!IsRegularFileOrPipe(fp)) {
fclose(fp);
SDL_SetError("%s is not a regular file", file);
SDL_SetError("%s is not a regular file or pipe", file);
return NULL;
}
return SDL_RWFromFP(fp, 1);
Expand All @@ -802,9 +802,9 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
fp = fopen(path, mode);
SDL_stack_free(path);
if (fp) {
if (!SDL_IsRegularFile(fp)) {
if (!IsRegularFileOrPipe(fp)) {
fclose(fp);
SDL_SetError("%s is not a regular file", path);
SDL_SetError("%s is not a regular file or pipe", path);
return NULL;
}
return SDL_RWFromFP(fp, 1);
Expand Down Expand Up @@ -886,10 +886,10 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
#endif
if (!fp) {
SDL_SetError("Couldn't open %s", file);
} else if (!SDL_IsRegularFile(fp)) {
} else if (!IsRegularFileOrPipe(fp)) {
fclose(fp);
fp = NULL;
SDL_SetError("%s is not a regular file", file);
SDL_SetError("%s is not a regular file or pipe", file);
} else {
rwops = SDL_RWFromFP(fp, SDL_TRUE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/SDL_gamecontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
SDL_strlcat(mapping_string, "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,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string));
break;
case k_eSwitchDeviceInfoControllerType_SEGA_Genesis:
SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,rightshoulder:b10,righttrigger:a5,start:b6,misc1:b15,", sizeof(mapping_string));
SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string));
break;
case k_eWiiExtensionControllerType_None:
SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,start:b6,x:b2,y:b3,", sizeof(mapping_string));
Expand Down
Loading

0 comments on commit 25f6a7d

Please sign in to comment.