mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #1637 from Azaezel/alpha41/SDLUpdate2.32.10
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
update sdl2 to 2.32.10
This commit is contained in:
commit
7519c5693c
|
|
@ -89,7 +89,7 @@ endif()
|
|||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 32)
|
||||
set(SDL_MICRO_VERSION 6)
|
||||
set(SDL_MICRO_VERSION 10)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
|
|
@ -755,6 +755,11 @@ if(MSVC)
|
|||
if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64")
|
||||
list(APPEND EXTRA_LDFLAGS_BUILD "-CETCOMPAT")
|
||||
endif()
|
||||
|
||||
# for VS >= 17.14 targeting ARM64: inline the Interlocked funcs
|
||||
if(MSVC_VERSION GREATER 1943 AND SDL_CPU_ARM64 AND NOT SDL_LIBC)
|
||||
list(APPEND EXTRA_CFLAGS /forceInterlockedFunctions-)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
|
|
@ -1094,6 +1099,7 @@ if(SDL_LIBC)
|
|||
endforeach()
|
||||
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
|
||||
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
|
||||
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
|
||||
check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
|
||||
|
|
@ -1465,10 +1471,14 @@ elseif(EMSCRIPTEN)
|
|||
elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
|
||||
if(SDL_AUDIO)
|
||||
if(SYSV5 OR SOLARIS OR HPUX)
|
||||
set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
|
||||
file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c)
|
||||
list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES})
|
||||
set(HAVE_SDL_AUDIO TRUE)
|
||||
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
|
||||
check_include_file(sys/audioio.h HAVE_SYS_AUDIOIO_H)
|
||||
if(HAVE_SYS_AUDIOIO_H)
|
||||
set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
|
||||
file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c)
|
||||
list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES})
|
||||
set(HAVE_SDL_AUDIO TRUE)
|
||||
endif()
|
||||
elseif(NETBSD)
|
||||
set(SDL_AUDIO_DRIVER_NETBSD 1)
|
||||
file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 32
|
||||
MICRO_VERSION = 6
|
||||
MICRO_VERSION = 10
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 32
|
||||
MICRO_VERSION = 6
|
||||
MICRO_VERSION = 10
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
|
|
|||
|
|
@ -456,7 +456,10 @@ main(int argc, char *argv[])
|
|||
while (!done) {
|
||||
SDL_Event event;
|
||||
double deltaTime = updateDeltaTime();
|
||||
SDL_bool hasEvents = SDL_FALSE;
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
hasEvents = SDL_TRUE;
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
|
|
@ -466,10 +469,17 @@ main(int argc, char *argv[])
|
|||
spawnEmitterParticle(x, y);
|
||||
}
|
||||
}
|
||||
stepParticles(deltaTime);
|
||||
drawParticles();
|
||||
SDL_GL_SwapWindow(window);
|
||||
SDL_Delay(1);
|
||||
|
||||
/* Only update and render if we have active particles or just received events */
|
||||
if (num_active_particles > 0 || hasEvents) {
|
||||
stepParticles(deltaTime);
|
||||
drawParticles();
|
||||
SDL_GL_SwapWindow(window);
|
||||
SDL_Delay(16); // Target 60 FPS when active
|
||||
} else {
|
||||
/* Idle state - wait for events with longer delay to save CPU */
|
||||
SDL_Delay(100); // Much longer delay when idle
|
||||
}
|
||||
}
|
||||
|
||||
/* delete textures */
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.32.6</string>
|
||||
<string>2.32.10</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.32.6</string>
|
||||
<string>2.32.10</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -9729,7 +9729,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
|
|
@ -9770,7 +9770,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.32.6;
|
||||
MARKETING_VERSION = 2.32.10;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Release;
|
||||
|
|
@ -9814,7 +9814,7 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
|
|
@ -9856,7 +9856,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.32.6;
|
||||
MARKETING_VERSION = 2.32.10;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Debug;
|
||||
|
|
@ -10063,7 +10063,7 @@
|
|||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
|
|
@ -10115,7 +10115,7 @@
|
|||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Title SDL 2.32.6
|
||||
Title SDL 2.32.10
|
||||
Version 1
|
||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
|
|
|||
|
|
@ -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 = 32;
|
||||
private static final int SDL_MICRO_VERSION = 6;
|
||||
private static final int SDL_MICRO_VERSION = 10;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
|
|
|||
17
Engine/lib/sdl/build-scripts/config.guess
vendored
17
Engine/lib/sdl/build-scripts/config.guess
vendored
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268 # see below for rationale
|
||||
|
||||
timestamp='2024-07-27'
|
||||
timestamp='2025-07-10'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
|
@ -60,7 +60,7 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
|
@ -1597,8 +1597,11 @@ EOF
|
|||
*:Unleashed:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
|
||||
;;
|
||||
*:Ironclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-ironclad
|
||||
x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-pc-ironclad-mlibc
|
||||
;;
|
||||
*:[Ii]ronclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -1808,8 +1811,8 @@ fi
|
|||
exit 1
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-format: "%Y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
|
|
|||
28
Engine/lib/sdl/build-scripts/config.sub
vendored
28
Engine/lib/sdl/build-scripts/config.sub
vendored
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
|
||||
|
||||
timestamp='2024-05-27'
|
||||
timestamp='2025-07-10'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
|
@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
|
@ -145,6 +145,7 @@ case $1 in
|
|||
| kfreebsd*-gnu* \
|
||||
| knetbsd*-gnu* \
|
||||
| kopensolaris*-gnu* \
|
||||
| ironclad-* \
|
||||
| linux-* \
|
||||
| managarm-* \
|
||||
| netbsd*-eabi* \
|
||||
|
|
@ -242,7 +243,6 @@ case $1 in
|
|||
| rombug \
|
||||
| semi \
|
||||
| sequent* \
|
||||
| siemens \
|
||||
| sgi* \
|
||||
| siemens \
|
||||
| sim \
|
||||
|
|
@ -261,7 +261,7 @@ case $1 in
|
|||
basic_machine=$field1-$field2
|
||||
basic_os=
|
||||
;;
|
||||
zephyr*)
|
||||
tock* | zephyr*)
|
||||
basic_machine=$field1-unknown
|
||||
basic_os=$field2
|
||||
;;
|
||||
|
|
@ -1194,7 +1194,7 @@ case $cpu-$vendor in
|
|||
xscale-* | xscalee[bl]-*)
|
||||
cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
arm64-* | aarch64le-*)
|
||||
arm64-* | aarch64le-* | arm64_32-*)
|
||||
cpu=aarch64
|
||||
;;
|
||||
|
||||
|
|
@ -1321,6 +1321,7 @@ case $cpu-$vendor in
|
|||
| i960 \
|
||||
| ia16 \
|
||||
| ia64 \
|
||||
| intelgt \
|
||||
| ip2k \
|
||||
| iq2000 \
|
||||
| javascript \
|
||||
|
|
@ -1522,6 +1523,10 @@ EOF
|
|||
kernel=nto
|
||||
os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
|
||||
;;
|
||||
ironclad*)
|
||||
kernel=ironclad
|
||||
os=`echo "$basic_os" | sed -e 's|ironclad|mlibc|'`
|
||||
;;
|
||||
linux*)
|
||||
kernel=linux
|
||||
os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
|
||||
|
|
@ -1976,6 +1981,7 @@ case $os in
|
|||
| atheos* \
|
||||
| auroraux* \
|
||||
| aux* \
|
||||
| banan_os* \
|
||||
| beos* \
|
||||
| bitrig* \
|
||||
| bme* \
|
||||
|
|
@ -2022,7 +2028,6 @@ case $os in
|
|||
| ios* \
|
||||
| iris* \
|
||||
| irix* \
|
||||
| ironclad* \
|
||||
| isc* \
|
||||
| its* \
|
||||
| l4re* \
|
||||
|
|
@ -2118,6 +2123,7 @@ case $os in
|
|||
| sysv* \
|
||||
| tenex* \
|
||||
| tirtos* \
|
||||
| tock* \
|
||||
| toppers* \
|
||||
| tops10* \
|
||||
| tops20* \
|
||||
|
|
@ -2214,6 +2220,8 @@ case $kernel-$os-$obj in
|
|||
;;
|
||||
uclinux-uclibc*- | uclinux-gnu*- )
|
||||
;;
|
||||
ironclad-mlibc*-)
|
||||
;;
|
||||
managarm-mlibc*- | managarm-kernel*- )
|
||||
;;
|
||||
windows*-msvc*-)
|
||||
|
|
@ -2249,6 +2257,8 @@ case $kernel-$os-$obj in
|
|||
;;
|
||||
*-eabi*- | *-gnueabi*-)
|
||||
;;
|
||||
ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
|
||||
;;
|
||||
none--*)
|
||||
# None (no kernel, i.e. freestanding / bare metal),
|
||||
# can be paired with an machine code file format
|
||||
|
|
@ -2347,8 +2357,8 @@ echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
|
|||
exit
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-format: "%Y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
|
|
|||
29
Engine/lib/sdl/configure
vendored
29
Engine/lib/sdl/configure
vendored
|
|
@ -3516,7 +3516,7 @@ orig_CFLAGS="$CFLAGS"
|
|||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=32
|
||||
SDL_MICRO_VERSION=6
|
||||
SDL_MICRO_VERSION=10
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
|
|
@ -19755,6 +19755,12 @@ if test "x$ac_cv_func_sigaction" = xyes
|
|||
then :
|
||||
printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "sigtimedwait" "ac_cv_func_sigtimedwait"
|
||||
if test "x$ac_cv_func_sigtimedwait" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "setjmp" "ac_cv_func_setjmp"
|
||||
if test "x$ac_cv_func_setjmp" = xyes
|
||||
|
|
@ -22422,7 +22428,6 @@ printf %s "checking for NAS audio support... " >&6; }
|
|||
have_nas=yes
|
||||
NAS_CFLAGS="-I/usr/X11R6/include/"
|
||||
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
|
||||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5
|
||||
|
|
@ -28394,7 +28399,8 @@ fi
|
|||
|
||||
if test x$hidapi_support = xyes; then
|
||||
if test x$have_libusb_h = xyes; then
|
||||
printf "%s\n" "#define HAVE_LIBUSB 1" >>confdefs.h
|
||||
|
||||
printf "%s\n" "#define HAVE_LIBUSB 1" >>confdefs.h
|
||||
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
||||
if test x$require_hidapi_libusb = xyes; then
|
||||
|
|
@ -28741,12 +28747,23 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
|
|||
if test x$enable_audio = xyes; then
|
||||
case $ARCH in
|
||||
sysv5|solaris|hpux)
|
||||
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
|
||||
ac_fn_c_check_header_compile "$LINENO" "sys/audioio.h" "ac_cv_header_sys_audioio_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_audioio_h" = xyes
|
||||
then :
|
||||
have_sys_audioio_h=yes
|
||||
else $as_nop
|
||||
have_sys_audioio_h=no
|
||||
fi
|
||||
|
||||
if test x$have_sys_audioio_h = xyes; then
|
||||
|
||||
printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h
|
||||
|
||||
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
|
||||
SUMMARY_audio="${SUMMARY_audio} sun"
|
||||
have_audio=yes
|
||||
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
|
||||
SUMMARY_audio="${SUMMARY_audio} sun"
|
||||
have_audio=yes
|
||||
fi
|
||||
;;
|
||||
netbsd) # Don't use this on OpenBSD, it's busted.
|
||||
|
||||
|
|
|
|||
|
|
@ -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=32
|
||||
SDL_MICRO_VERSION=6
|
||||
SDL_MICRO_VERSION=10
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
|
|
@ -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 memfd_create posix_fallocate _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 sigtimedwait 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)
|
||||
|
|
@ -1247,7 +1247,6 @@ CheckNAS()
|
|||
have_nas=yes
|
||||
NAS_CFLAGS="-I/usr/X11R6/include/"
|
||||
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($have_nas)
|
||||
|
|
@ -3636,7 +3635,7 @@ CheckHIDAPI()
|
|||
|
||||
if test x$hidapi_support = xyes; then
|
||||
if test x$have_libusb_h = xyes; then
|
||||
AC_DEFINE(HAVE_LIBUSB)
|
||||
AC_DEFINE(HAVE_LIBUSB, 1, [ ])
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
|
||||
if test x$require_hidapi_libusb = xyes; then
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
|
||||
|
|
@ -3869,10 +3868,14 @@ case "$host" in
|
|||
if test x$enable_audio = xyes; then
|
||||
case $ARCH in
|
||||
sysv5|solaris|hpux)
|
||||
AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
|
||||
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
|
||||
SUMMARY_audio="${SUMMARY_audio} sun"
|
||||
have_audio=yes
|
||||
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
|
||||
AC_CHECK_HEADER(sys/audioio.h, have_sys_audioio_h=yes, have_sys_audioio_h=no)
|
||||
if test x$have_sys_audioio_h = xyes; then
|
||||
AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
|
||||
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
|
||||
SUMMARY_audio="${SUMMARY_audio} sun"
|
||||
have_audio=yes
|
||||
fi
|
||||
;;
|
||||
netbsd) # Don't use this on OpenBSD, it's busted.
|
||||
AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
|
|||
#define SDL_enabled_assert(condition) \
|
||||
do { \
|
||||
while ( !(condition) ) { \
|
||||
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
|
||||
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \
|
||||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
|
||||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
|
||||
continue; /* go again. */ \
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@
|
|||
#cmakedefine HAVE_MEMFD_CREATE 1
|
||||
#cmakedefine HAVE_POSIX_FALLOCATE 1
|
||||
#cmakedefine HAVE_SIGACTION 1
|
||||
#cmakedefine HAVE_SIGTIMEDWAIT 1
|
||||
#cmakedefine HAVE_SA_SIGACTION 1
|
||||
#cmakedefine HAVE_SETJMP 1
|
||||
#cmakedefine HAVE_NANOSLEEP 1
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@
|
|||
#undef HAVE_FSEEKO
|
||||
#undef HAVE_FSEEKO64
|
||||
#undef HAVE_SIGACTION
|
||||
#undef HAVE_SIGTIMEDWAIT
|
||||
#undef HAVE_SA_SIGACTION
|
||||
#undef HAVE_SETJMP
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
|
@ -216,6 +217,7 @@
|
|||
#undef HAVE__EXIT
|
||||
|
||||
#else
|
||||
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ typedef struct SDL_Keysym
|
|||
{
|
||||
SDL_Scancode scancode; /**< SDL physical key code - see SDL_Scancode for details */
|
||||
SDL_Keycode sym; /**< SDL virtual key code - see SDL_Keycode for details */
|
||||
Uint16 mod; /**< current key modifiers */
|
||||
Uint16 mod; /**< current key modifiers - see SDL_Keymod for details */
|
||||
Uint32 unused;
|
||||
} SDL_Keysym;
|
||||
|
||||
|
|
|
|||
|
|
@ -750,8 +750,12 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
|
|||
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
/* strdup is not ANSI but POSIX, and its prototype might be hidden... */
|
||||
/* not for windows: might conflict with string.h where strdup may have
|
||||
* dllimport attribute: https://github.com/libsdl-org/SDL/issues/12948 */
|
||||
char *strdup(const char *str);
|
||||
#endif
|
||||
|
||||
/* Starting LLVM 16, the analyser errors out if these functions do not have
|
||||
their prototype defined (clang-diagnostic-implicit-function-declaration) */
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ typedef struct SDL_version
|
|||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 32
|
||||
#define SDL_PATCHLEVEL 6
|
||||
#define SDL_PATCHLEVEL 10
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
|
|
|||
|
|
@ -83,6 +83,12 @@ static int (*ALSA_snd_device_name_hint)(int, const char *, void ***);
|
|||
static char *(*ALSA_snd_device_name_get_hint)(const void *, const char *);
|
||||
static int (*ALSA_snd_device_name_free_hint)(void **);
|
||||
static snd_pcm_sframes_t (*ALSA_snd_pcm_avail)(snd_pcm_t *);
|
||||
static int (*ALSA_snd_pcm_info)(snd_pcm_t *, snd_pcm_info_t *);
|
||||
static const char *(*ALSA_snd_pcm_info_get_name)(const snd_pcm_info_t *);
|
||||
static int (*ALSA_snd_pcm_info_get_card)(const snd_pcm_info_t *);
|
||||
static int (*ALSA_snd_card_get_name)(int, char **);
|
||||
static int (*ALSA_snd_pcm_info_malloc)(snd_pcm_info_t **);
|
||||
static int (*ALSA_snd_pcm_info_free)(snd_pcm_info_t *);
|
||||
#ifdef SND_CHMAP_API_VERSION
|
||||
static snd_pcm_chmap_t *(*ALSA_snd_pcm_get_chmap)(snd_pcm_t *);
|
||||
static int (*ALSA_snd_pcm_chmap_print)(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
|
||||
|
|
@ -152,6 +158,12 @@ static int load_alsa_syms(void)
|
|||
SDL_ALSA_SYM(snd_device_name_get_hint);
|
||||
SDL_ALSA_SYM(snd_device_name_free_hint);
|
||||
SDL_ALSA_SYM(snd_pcm_avail);
|
||||
SDL_ALSA_SYM(snd_pcm_info);
|
||||
SDL_ALSA_SYM(snd_pcm_info_get_card);
|
||||
SDL_ALSA_SYM(snd_pcm_info_get_name);
|
||||
SDL_ALSA_SYM(snd_card_get_name);
|
||||
SDL_ALSA_SYM(snd_pcm_info_malloc);
|
||||
SDL_ALSA_SYM(snd_pcm_info_free);
|
||||
#ifdef SND_CHMAP_API_VERSION
|
||||
SDL_ALSA_SYM(snd_pcm_get_chmap);
|
||||
SDL_ALSA_SYM(snd_pcm_chmap_print);
|
||||
|
|
@ -466,6 +478,58 @@ static void ALSA_CloseDevice(_THIS)
|
|||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int ALSA_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
|
||||
{
|
||||
const char *device = "default";
|
||||
snd_pcm_t *pcm_handle;
|
||||
snd_pcm_info_t *pcm_info;
|
||||
snd_pcm_stream_t stream;
|
||||
int card_index;
|
||||
const char *dev_name;
|
||||
char *card_name = NULL;
|
||||
char final_name[256];
|
||||
|
||||
SDL_zero(final_name);
|
||||
stream = iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK;
|
||||
|
||||
if (ALSA_snd_pcm_open(&pcm_handle, device, stream, SND_PCM_NONBLOCK) < 0) {
|
||||
return SDL_SetError("ALSA: Couldn't open default device");
|
||||
}
|
||||
|
||||
if (ALSA_snd_pcm_info_malloc(&pcm_info) < 0) {
|
||||
ALSA_snd_pcm_close(pcm_handle);
|
||||
return SDL_SetError("ALSA: Couldn't allocate pcm_info");
|
||||
}
|
||||
|
||||
if (ALSA_snd_pcm_info(pcm_handle, pcm_info) < 0) {
|
||||
ALSA_snd_pcm_info_free(pcm_info);
|
||||
ALSA_snd_pcm_close(pcm_handle);
|
||||
return SDL_SetError("ALSA: Couldn't get PCM info");
|
||||
}
|
||||
|
||||
card_index = ALSA_snd_pcm_info_get_card(pcm_info);
|
||||
dev_name = ALSA_snd_pcm_info_get_name(pcm_info);
|
||||
|
||||
if (card_index >= 0 && ALSA_snd_card_get_name(card_index, &card_name) >= 0) {
|
||||
SDL_snprintf(final_name, sizeof(final_name), "%s, %s", card_name, dev_name);
|
||||
*name = SDL_strdup(final_name);
|
||||
} else {
|
||||
*name = SDL_strdup(dev_name ? dev_name : "Unknown ALSA Device");
|
||||
}
|
||||
|
||||
if (spec) {
|
||||
SDL_zero(*spec);
|
||||
spec->freq = 48000;
|
||||
spec->format = AUDIO_S16SYS;
|
||||
spec->channels = 2;
|
||||
spec->samples = 512;
|
||||
}
|
||||
|
||||
ALSA_snd_pcm_info_free(pcm_info);
|
||||
ALSA_snd_pcm_close(pcm_handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
int status;
|
||||
|
|
@ -975,6 +1039,7 @@ static SDL_bool ALSA_Init(SDL_AudioDriverImpl *impl)
|
|||
impl->Deinitialize = ALSA_Deinitialize;
|
||||
impl->CaptureFromDevice = ALSA_CaptureFromDevice;
|
||||
impl->FlushCapture = ALSA_FlushCapture;
|
||||
impl->GetDefaultAudioInfo = ALSA_GetDefaultAudioInfo;
|
||||
|
||||
impl->HasCaptureSupport = SDL_TRUE;
|
||||
impl->SupportsNonPow2Samples = SDL_TRUE;
|
||||
|
|
|
|||
|
|
@ -383,7 +383,8 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec
|
|||
|
||||
hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
|
||||
if (hint) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0 ||
|
||||
SDL_strcasecmp(hint, "ambient") == 0) {
|
||||
category = AVAudioSessionCategoryAmbient;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
|
||||
category = AVAudioSessionCategorySoloAmbient;
|
||||
|
|
|
|||
|
|
@ -413,27 +413,32 @@ static int openslES_CreatePCMPlayer(_THIS)
|
|||
SLresult result;
|
||||
int i;
|
||||
|
||||
/* If we want to add floating point audio support (requires API level 21)
|
||||
it can be done as described here:
|
||||
https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
|
||||
*/
|
||||
/* according to https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android,
|
||||
Android's OpenSL ES only supports Uint8 and _littleendian_ Sint16.
|
||||
(and float32, with an extension we use, below.) */
|
||||
if (SDL_GetAndroidSDKVersion() >= 21) {
|
||||
SDL_AudioFormat test_format;
|
||||
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
|
||||
if (SDL_AUDIO_ISSIGNED(test_format)) {
|
||||
switch (test_format) {
|
||||
case AUDIO_U8:
|
||||
case AUDIO_S16LSB:
|
||||
case AUDIO_F32LSB:
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!test_format) {
|
||||
/* Didn't find a compatible format : */
|
||||
LOGI("No compatible audio format, using signed 16-bit audio");
|
||||
test_format = AUDIO_S16SYS;
|
||||
LOGI("No compatible audio format, using signed 16-bit LE audio");
|
||||
test_format = AUDIO_S16LSB;
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
} else {
|
||||
/* Just go with signed 16-bit audio as it's the most compatible */
|
||||
this->spec.format = AUDIO_S16SYS;
|
||||
this->spec.format = AUDIO_S16LSB;
|
||||
}
|
||||
|
||||
/* Update the fragment size as size in bytes */
|
||||
|
|
|
|||
|
|
@ -574,6 +574,25 @@ static SDL_bool get_int_param(const struct spa_pod *param, Uint32 key, int *val)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_AudioFormat SPAFormatToSDL(enum spa_audio_format spafmt)
|
||||
{
|
||||
switch (spafmt) {
|
||||
#define CHECKFMT(spa,sdl) case SPA_AUDIO_FORMAT_##spa: return AUDIO_##sdl
|
||||
CHECKFMT(U8, U8);
|
||||
CHECKFMT(S8, S8);
|
||||
CHECKFMT(S16_LE, S16LSB);
|
||||
CHECKFMT(S16_BE, S16MSB);
|
||||
CHECKFMT(S32_LE, S32LSB);
|
||||
CHECKFMT(S32_BE, S32MSB);
|
||||
CHECKFMT(F32_LE, F32LSB);
|
||||
CHECKFMT(F32_BE, F32MSB);
|
||||
#undef CHECKFMT
|
||||
default: break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Interface node callbacks */
|
||||
static void node_event_info(void *object, const struct pw_node_info *info)
|
||||
{
|
||||
|
|
@ -602,6 +621,15 @@ static void node_event_param(void *object, int seq, uint32_t id, uint32_t index,
|
|||
struct node_object *node = object;
|
||||
struct io_node *io = node->userdata;
|
||||
|
||||
if ((id == SPA_PARAM_Format) && (io->spec.format == 0)) {
|
||||
struct spa_audio_info_raw info;
|
||||
SDL_zero(info);
|
||||
if (spa_format_audio_raw_parse(param, &info) == 0) {
|
||||
/*SDL_Log("Sink Format: %d, Rate: %d Hz, Channels: %d", info.format, info.rate, info.channels);*/
|
||||
io->spec.format = SPAFormatToSDL(info.format);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the default frequency */
|
||||
if (io->spec.freq == 0) {
|
||||
get_range_param(param, SPA_FORMAT_AUDIO_rate, &io->spec.freq, NULL, NULL);
|
||||
|
|
@ -719,7 +747,9 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p
|
|||
/* Begin setting the node properties */
|
||||
io->id = id;
|
||||
io->is_capture = is_capture;
|
||||
io->spec.format = AUDIO_F32; /* Pipewire uses floats internally, other formats require conversion. */
|
||||
if (io->spec.format == 0) {
|
||||
io->spec.format = AUDIO_S16; /* we'll go conservative here if for some reason the format isn't known. */
|
||||
}
|
||||
io->name = io->buf;
|
||||
io->path = io->buf + desc_buffer_len;
|
||||
SDL_strlcpy(io->buf, node_desc, desc_buffer_len);
|
||||
|
|
|
|||
|
|
@ -24,18 +24,12 @@
|
|||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef __NETBSD__
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/audioio.h>
|
||||
#endif
|
||||
#ifdef __SVR4
|
||||
#include <sys/audioio.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SDL_timer.h"
|
||||
|
|
|
|||
|
|
@ -127,7 +127,11 @@
|
|||
#define CPU_CFG2_LSX (1 << 6)
|
||||
#define CPU_CFG2_LASX (1 << 7)
|
||||
|
||||
#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOSX__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
||||
#if !defined(SDL_CPUINFO_DISABLED) && \
|
||||
!((defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))) && \
|
||||
!(defined(__FreeBSD__) && defined(__powerpc__)) && \
|
||||
!(defined(__LINUX__) && defined(__powerpc__) && defined(HAVE_GETAUXVAL)) && \
|
||||
defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
|
||||
/* This is the brute force way of detecting instruction sets...
|
||||
the idea is borrowed from the libmpeg2 library - thanks!
|
||||
*/
|
||||
|
|
@ -356,6 +360,8 @@ static int CPU_haveAltiVec(void)
|
|||
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
|
||||
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
|
||||
return altivec;
|
||||
#elif defined(__LINUX__) && defined(__powerpc__) && defined(HAVE_GETAUXVAL)
|
||||
altivec = getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC;
|
||||
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
|
||||
void (*handler)(int sig);
|
||||
handler = signal(SIGILL, illegal_instruction);
|
||||
|
|
|
|||
|
|
@ -738,21 +738,17 @@ static void SDL_CutEvent(SDL_EventEntry *entry)
|
|||
|
||||
static int SDL_SendWakeupEvent(void)
|
||||
{
|
||||
SDL_Window *wakeup_window;
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
if (_this == NULL || !_this->SendWakeupEvent) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_LockMutex(_this->wakeup_lock);
|
||||
{
|
||||
if (_this->wakeup_window) {
|
||||
_this->SendWakeupEvent(_this, _this->wakeup_window);
|
||||
|
||||
/* No more wakeup events needed until we enter a new wait */
|
||||
_this->wakeup_window = NULL;
|
||||
}
|
||||
/* We only want to do this once while waiting for an event, so set it to NULL atomically here */
|
||||
wakeup_window = (SDL_Window *)SDL_AtomicSetPtr(&_this->wakeup_window, NULL);
|
||||
if (wakeup_window) {
|
||||
_this->SendWakeupEvent(_this, wakeup_window);
|
||||
}
|
||||
SDL_UnlockMutex(_this->wakeup_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1009,18 +1005,7 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
|
|||
int status;
|
||||
SDL_PumpEventsInternal(SDL_TRUE);
|
||||
|
||||
SDL_LockMutex(_this->wakeup_lock);
|
||||
{
|
||||
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
/* If status == 0 we are going to block so wakeup will be needed. */
|
||||
if (status == 0) {
|
||||
_this->wakeup_window = wakeup_window;
|
||||
} else {
|
||||
_this->wakeup_window = NULL;
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(_this->wakeup_lock);
|
||||
|
||||
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
if (status < 0) {
|
||||
/* Got an error: return */
|
||||
break;
|
||||
|
|
@ -1033,8 +1018,6 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
|
|||
if (timeout > 0) {
|
||||
Uint32 elapsed = SDL_GetTicks() - start;
|
||||
if (elapsed >= (Uint32)timeout) {
|
||||
/* Set wakeup_window to NULL without holding the lock. */
|
||||
_this->wakeup_window = NULL;
|
||||
return 0;
|
||||
}
|
||||
loop_timeout = (int)((Uint32)timeout - elapsed);
|
||||
|
|
@ -1049,9 +1032,9 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
|
|||
}
|
||||
}
|
||||
|
||||
SDL_AtomicSetPtr(&_this->wakeup_window, wakeup_window);
|
||||
status = _this->WaitEventTimeout(_this, loop_timeout);
|
||||
/* Set wakeup_window to NULL without holding the lock. */
|
||||
_this->wakeup_window = NULL;
|
||||
SDL_AtomicSetPtr(&_this->wakeup_window, NULL);
|
||||
if (status == 0 && poll_interval != SDL_MAX_SINT16 && loop_timeout == poll_interval) {
|
||||
/* We may have woken up to poll. Try again */
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -630,11 +630,9 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
|||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
|
||||
#define HAVE_DRIVER_BACKEND 1
|
||||
#else
|
||||
#define HAVE_DRIVER_BACKEND 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
|
||||
/* DRIVER HIDAPI Implementation */
|
||||
|
||||
|
|
@ -905,7 +903,7 @@ IsInWhitelist(Uint16 vendor, Uint16 product)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND)
|
||||
#define use_libusb_whitelist_default SDL_TRUE
|
||||
#else
|
||||
#define use_libusb_whitelist_default SDL_FALSE
|
||||
|
|
@ -951,7 +949,7 @@ static const struct hidapi_backend PLATFORM_Backend = {
|
|||
};
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
static const struct hidapi_backend DRIVER_Backend = {
|
||||
(void *)DRIVER_hid_write,
|
||||
(void *)DRIVER_hid_read_timeout,
|
||||
|
|
@ -993,7 +991,7 @@ struct SDL_hid_device_
|
|||
};
|
||||
static char device_magic;
|
||||
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
|
||||
static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
|
||||
{
|
||||
|
|
@ -1019,7 +1017,7 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device)
|
|||
}
|
||||
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
|
||||
#define COPY_IF_EXISTS(var) \
|
||||
if (pSrc->var != NULL) { \
|
||||
|
|
@ -1249,12 +1247,12 @@ Uint32 SDL_hid_device_change_count(void)
|
|||
|
||||
struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
|
||||
{
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
#ifdef HAVE_LIBUSB
|
||||
struct SDL_hid_device_info *usb_devs = NULL;
|
||||
struct SDL_hid_device_info *usb_dev;
|
||||
#endif
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
struct SDL_hid_device_info *driver_devs = NULL;
|
||||
struct SDL_hid_device_info *driver_dev;
|
||||
#endif
|
||||
|
|
@ -1309,7 +1307,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
driver_devs = DRIVER_hid_enumerate(vendor_id, product_id);
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info));
|
||||
|
|
@ -1347,7 +1345,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
if (raw_dev->vendor_id == driver_dev->vendor_id &&
|
||||
raw_dev->product_id == driver_dev->product_id &&
|
||||
|
|
@ -1412,7 +1410,7 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs)
|
|||
|
||||
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
|
||||
{
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
|
|
@ -1428,7 +1426,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
|||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
pDevice = DRIVER_hid_open(vendor_id, product_id, serial_number);
|
||||
if (pDevice != NULL) {
|
||||
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
|
|
@ -1451,7 +1449,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
|||
|
||||
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
|
||||
{
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
|
|
@ -1467,7 +1465,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
|
|||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
pDevice = DRIVER_hid_open_path(path, bExclusive);
|
||||
if (pDevice != NULL) {
|
||||
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@
|
|||
#define SWITCH_GYRO_SCALE 14.2842f
|
||||
#define SWITCH_ACCEL_SCALE 4096.f
|
||||
|
||||
#define SWITCH_GYRO_SCALE_OFFSET 13371.0f
|
||||
#define SWITCH_GYRO_SCALE_MULT 936.0f
|
||||
#define SWITCH_ACCEL_SCALE_OFFSET 16384.0f
|
||||
#define SWITCH_ACCEL_SCALE_MULT 4.0f
|
||||
|
||||
typedef enum
|
||||
|
|
@ -819,7 +817,7 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
SwitchSPIOpData_t readFactoryParams;
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
int attempt;
|
||||
|
||||
|
||||
/* Read User Calibration Info */
|
||||
readUserParams.unAddress = k_unSPIStickUserCalibrationStartOffset;
|
||||
readUserParams.ucLength = k_unSPIStickUserCalibrationLength;
|
||||
|
|
@ -925,6 +923,8 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readParams, sizeof(readParams), &reply)) {
|
||||
Uint8 *pIMUScale;
|
||||
Sint16 sAccelRawX, sAccelRawY, sAccelRawZ, sGyroRawX, sGyroRawY, sGyroRawZ;
|
||||
Sint16 sAccelSensCoeffX, sAccelSensCoeffY, sAccelSensCoeffZ;
|
||||
Sint16 sGyroSensCoeffX, sGyroSensCoeffY, sGyroSensCoeffZ;
|
||||
|
||||
/* IMU scale gives us multipliers for converting raw values to real world values */
|
||||
pIMUScale = reply->spiReadData.rgucReadData;
|
||||
|
|
@ -933,10 +933,18 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
sAccelRawY = (pIMUScale[3] << 8) | pIMUScale[2];
|
||||
sAccelRawZ = (pIMUScale[5] << 8) | pIMUScale[4];
|
||||
|
||||
sAccelSensCoeffX = (pIMUScale[7] << 8) | pIMUScale[6];
|
||||
sAccelSensCoeffY = (pIMUScale[9] << 8) | pIMUScale[8];
|
||||
sAccelSensCoeffZ = (pIMUScale[11] << 8) | pIMUScale[10];
|
||||
|
||||
sGyroRawX = (pIMUScale[13] << 8) | pIMUScale[12];
|
||||
sGyroRawY = (pIMUScale[15] << 8) | pIMUScale[14];
|
||||
sGyroRawZ = (pIMUScale[17] << 8) | pIMUScale[16];
|
||||
|
||||
sGyroSensCoeffX = (pIMUScale[19] << 8) | pIMUScale[18];
|
||||
sGyroSensCoeffY = (pIMUScale[21] << 8) | pIMUScale[20];
|
||||
sGyroSensCoeffZ = (pIMUScale[23] << 8) | pIMUScale[22];
|
||||
|
||||
/* Check for user calibration data. If it's present and set, it'll override the factory settings */
|
||||
readParams.unAddress = k_unSPIIMUUserScaleStartOffset;
|
||||
readParams.ucLength = k_unSPIIMUUserScaleLength;
|
||||
|
|
@ -953,14 +961,14 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
}
|
||||
|
||||
/* Accelerometer scale */
|
||||
ctx->m_IMUScaleData.fAccelScaleX = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawX) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleY = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawY) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleX = SWITCH_ACCEL_SCALE_MULT / ((float)sAccelSensCoeffX - (float)sAccelRawX) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleY = SWITCH_ACCEL_SCALE_MULT / ((float)sAccelSensCoeffY - (float)sAccelRawY) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / ((float)sAccelSensCoeffZ - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY;
|
||||
|
||||
/* Gyro scale */
|
||||
ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * (float)M_PI / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * (float)M_PI / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * (float)M_PI / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / ((float)sGyroSensCoeffX - (float)sGyroRawX) * (float)M_PI / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / ((float)sGyroSensCoeffY - (float)sGyroRawY) * (float)M_PI / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / ((float)sGyroSensCoeffZ - (float)sGyroRawZ) * (float)M_PI / 180.0f;
|
||||
|
||||
} else {
|
||||
/* Use default values */
|
||||
|
|
@ -982,15 +990,17 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
|
|||
{
|
||||
sRawValue -= ctx->m_StickCalData[nStick].axis[nAxis].sCenter;
|
||||
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_StickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax,
|
||||
SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)
|
||||
|
|
@ -1000,15 +1010,17 @@ static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nSt
|
|||
|
||||
sRawValue -= usJoystickCenter;
|
||||
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax,
|
||||
SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
|
|
|
|||
|
|
@ -822,11 +822,12 @@ SDL_bool HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJo
|
|||
|
||||
++SDL_HIDAPI_numjoysticks;
|
||||
|
||||
SDL_PrivateJoystickAdded(joystickID);
|
||||
|
||||
if (pJoystickID) {
|
||||
*pJoystickID = joystickID;
|
||||
}
|
||||
|
||||
SDL_PrivateJoystickAdded(joystickID);
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,32,6,0
|
||||
PRODUCTVERSION 2,32,6,0
|
||||
FILEVERSION 2,32,10,0
|
||||
PRODUCTVERSION 2,32,10,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
|
|
@ -23,12 +23,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 32, 6, 0\0"
|
||||
VALUE "FileVersion", "2, 32, 10, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 32, 6, 0\0"
|
||||
VALUE "ProductVersion", "2, 32, 10, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
|||
|
|
@ -2221,8 +2221,8 @@ SDL_RenderDriver GLES2_RenderDriver = {
|
|||
{ "opengles2",
|
||||
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
|
||||
4,
|
||||
{ SDL_PIXELFORMAT_BGRA32,
|
||||
SDL_PIXELFORMAT_ABGR32,
|
||||
{ SDL_PIXELFORMAT_RGBA32,
|
||||
SDL_PIXELFORMAT_BGRA32,
|
||||
SDL_PIXELFORMAT_BGRX32,
|
||||
SDL_PIXELFORMAT_RGBX32 },
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ typedef struct
|
|||
static int vsync_sema_id = 0;
|
||||
|
||||
/* PRIVATE METHODS */
|
||||
static int vsync_handler(void)
|
||||
static int vsync_handler(int reason)
|
||||
{
|
||||
iSignalSema(vsync_sema_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -826,6 +826,35 @@ static int VITA_GXM_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ClampCliprectToViewport(SDL_Rect *clip, const SDL_Rect *viewport)
|
||||
{
|
||||
int max_x_v, max_y_v, max_x_c, max_y_c;
|
||||
|
||||
if (clip->x < 0) {
|
||||
clip->w += clip->x;
|
||||
clip->x = 0;
|
||||
}
|
||||
|
||||
if (clip->y < 0) {
|
||||
clip->h += clip->y;
|
||||
clip->y = 0;
|
||||
}
|
||||
|
||||
max_x_c = clip->x + clip->w;
|
||||
max_y_c = clip->y + clip->h;
|
||||
|
||||
max_x_v = viewport->x + viewport->w;
|
||||
max_y_v = viewport->y + viewport->h;
|
||||
|
||||
if (max_x_c > max_x_v) {
|
||||
clip->w -= (max_x_v - max_x_c);
|
||||
}
|
||||
|
||||
if (max_y_c > max_y_v) {
|
||||
clip->h -= (max_y_v - max_y_c);
|
||||
}
|
||||
}
|
||||
|
||||
static int SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
||||
{
|
||||
SDL_Texture *texture = cmd->data.draw.texture;
|
||||
|
|
@ -868,9 +897,13 @@ static int SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
|||
data->drawstate.cliprect_enabled_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
if (data->drawstate.cliprect_enabled && data->drawstate.cliprect_dirty) {
|
||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||
set_clip_rectangle(data, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
||||
if ((data->drawstate.cliprect_enabled || data->drawstate.viewport_is_set) && data->drawstate.cliprect_dirty) {
|
||||
SDL_Rect rect;
|
||||
SDL_copyp(&rect, &data->drawstate.cliprect);
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
ClampCliprectToViewport(&rect, &data->drawstate.viewport);
|
||||
}
|
||||
set_clip_rectangle(data, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h);
|
||||
data->drawstate.cliprect_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -925,20 +958,27 @@ static int SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
|||
static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
||||
int w, h;
|
||||
|
||||
StartDrawing(renderer);
|
||||
|
||||
data->drawstate.target = renderer->target;
|
||||
if (!data->drawstate.target) {
|
||||
int w, h;
|
||||
SDL_GL_GetDrawableSize(renderer->window, &w, &h);
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
} else {
|
||||
if (SDL_QueryTexture(renderer->target, NULL, NULL, &w, &h) < 0) {
|
||||
w = data->drawstate.drawablew;
|
||||
h = data->drawstate.drawableh;
|
||||
}
|
||||
}
|
||||
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
}
|
||||
|
||||
while (cmd) {
|
||||
switch (cmd->command) {
|
||||
|
||||
|
|
@ -949,6 +989,16 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c
|
|||
SDL_copyp(viewport, &cmd->data.viewport.rect);
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
data->drawstate.viewport_is_set = viewport->x != 0 || viewport->y != 0 || viewport->w != data->drawstate.drawablew || viewport->h != data->drawstate.drawableh;
|
||||
if (!data->drawstate.cliprect_enabled) {
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
} else {
|
||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -956,9 +1006,15 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c
|
|||
case SDL_RENDERCMD_SETCLIPRECT:
|
||||
{
|
||||
const SDL_Rect *rect = &cmd->data.cliprect.rect;
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
if (data->drawstate.cliprect_enabled != cmd->data.cliprect.enabled) {
|
||||
data->drawstate.cliprect_enabled = cmd->data.cliprect.enabled;
|
||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||
if (!data->drawstate.cliprect_enabled && data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ typedef struct
|
|||
{
|
||||
SDL_Rect viewport;
|
||||
SDL_bool viewport_dirty;
|
||||
SDL_bool viewport_is_set;
|
||||
SDL_Texture *texture;
|
||||
SDL_Texture *target;
|
||||
SDL_Color color;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
#include <pspkerneltypes.h>
|
||||
#include <pspthreadman.h>
|
||||
|
||||
#define PSP_THREAD_NAME_MAX 32
|
||||
|
||||
static int ThreadEntry(SceSize args, void *argp)
|
||||
{
|
||||
SDL_RunThread(*(SDL_Thread **)argp);
|
||||
|
|
@ -44,6 +46,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
|
|||
{
|
||||
SceKernelThreadInfo status;
|
||||
int priority = 32;
|
||||
char thread_name[PSP_THREAD_NAME_MAX];
|
||||
|
||||
/* Set priority of new thread to the same as the current thread */
|
||||
status.size = sizeof(SceKernelThreadInfo);
|
||||
|
|
@ -51,7 +54,12 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
|
|||
priority = status.currentPriority;
|
||||
}
|
||||
|
||||
thread->handle = sceKernelCreateThread(thread->name, ThreadEntry,
|
||||
SDL_strlcpy(thread_name, "SDL thread", PSP_THREAD_NAME_MAX);
|
||||
if (thread->name) {
|
||||
SDL_strlcpy(thread_name, thread->name, PSP_THREAD_NAME_MAX);
|
||||
}
|
||||
|
||||
thread->handle = sceKernelCreateThread(thread_name, ThreadEntry,
|
||||
priority, thread->stacksize ? ((int)thread->stacksize) : 0x8000,
|
||||
PSP_THREAD_ATTR_VFPU, NULL);
|
||||
if (thread->handle < 0) {
|
||||
|
|
|
|||
|
|
@ -355,8 +355,7 @@ struct SDL_VideoDevice
|
|||
SDL_bool checked_texture_framebuffer;
|
||||
SDL_bool is_dummy;
|
||||
SDL_bool suspend_screensaver;
|
||||
SDL_Window *wakeup_window;
|
||||
SDL_mutex *wakeup_lock; /* Initialized only if WaitEventTimeout/SendWakeupEvent are supported */
|
||||
void *wakeup_window;
|
||||
int num_displays;
|
||||
SDL_VideoDisplay *displays;
|
||||
SDL_Window *windows;
|
||||
|
|
|
|||
|
|
@ -3368,9 +3368,7 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
_this->current_glwin = NULL;
|
||||
}
|
||||
|
||||
if (_this->wakeup_window == window) {
|
||||
_this->wakeup_window = NULL;
|
||||
}
|
||||
SDL_AtomicCASPtr(&_this->wakeup_window, window, NULL);
|
||||
|
||||
/* Now invalidate magic */
|
||||
window->magic = NULL;
|
||||
|
|
|
|||
|
|
@ -287,9 +287,19 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
|||
/* The menu bar of SDL apps which don't have the typical .app bundle
|
||||
* structure fails to work the first time a window is created (until it's
|
||||
* de-focused and re-focused), if this call is in Cocoa_RegisterApp instead
|
||||
* of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051
|
||||
* of here. https://github.com/libsdl-org/SDL/issues/1913
|
||||
*/
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
||||
|
||||
/* this apparently became unnecessary on macOS 14.0, and will addition pop up a
|
||||
hidden dock if you're moving the mouse during launch, so change the default
|
||||
behaviour there. https://github.com/libsdl-org/SDL/issues/10340
|
||||
(13.6 still needs it, presumably 13.7 does, too.) */
|
||||
SDL_bool background_app_default = SDL_FALSE;
|
||||
if (@available(macOS 14.0, *)) {
|
||||
background_app_default = SDL_TRUE; /* by default, don't explicitly activate the dock and then us again to force to foreground */
|
||||
}
|
||||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, background_app_default)) {
|
||||
/* Get more aggressive for Catalina: activate the Dock first so we definitely reset all activation state. */
|
||||
for (NSRunningApplication *i in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) {
|
||||
[i activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ static void Cocoa_VideoQuit(_THIS);
|
|||
static void Cocoa_DeleteDevice(SDL_VideoDevice * device)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
CFBridgingRelease(device->driverdata);
|
||||
SDL_free(device);
|
||||
}}
|
||||
|
|
@ -76,7 +73,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
device->driverdata = (void *)CFBridgingRetain(data);
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = Cocoa_VideoInit;
|
||||
|
|
|
|||
|
|
@ -855,6 +855,11 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
||||
|
||||
/* The OS can resize the window automatically if the display density
|
||||
changes while the window is miniaturized or hidden */
|
||||
if (![nswindow isVisible])
|
||||
return;
|
||||
|
||||
/* isZoomed always returns true if the window is not resizable */
|
||||
if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
|
||||
zoomed = YES;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
|
|||
if (!Module['SDL2']) Module['SDL2'] = {};
|
||||
var SDL2 = Module['SDL2'];
|
||||
if (SDL2.ctxCanvas !== Module['canvas']) {
|
||||
SDL2.ctx = Module['createContext'](Module['canvas'], false, true);
|
||||
SDL2.ctx = Browser.createContext(Module['canvas'], false, true);
|
||||
SDL2.ctxCanvas = Module['canvas'];
|
||||
}
|
||||
if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,48 @@
|
|||
*/
|
||||
#define PIPE_MS_TIMEOUT 14
|
||||
|
||||
/* sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it.
|
||||
* Based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation
|
||||
*/
|
||||
#ifndef HAVE_SIGTIMEDWAIT
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
static int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
|
||||
{
|
||||
struct timespec elapsed = { 0 }, rem = { 0 };
|
||||
sigset_t pending;
|
||||
int signo;
|
||||
do {
|
||||
/* Check the pending signals, and call sigwait if there is at least one of interest in the set. */
|
||||
sigpending(&pending);
|
||||
for (signo = 1; signo < NSIG; ++signo) {
|
||||
if (sigismember(set, signo) && sigismember(&pending, signo)) {
|
||||
if (!sigwait(set, &signo)) {
|
||||
if (info) {
|
||||
SDL_memset(info, 0, sizeof *info);
|
||||
info->si_signo = signo;
|
||||
}
|
||||
return signo;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout->tv_sec || timeout->tv_nsec) {
|
||||
long ns = 20000000L; // 2/100ths of a second
|
||||
nanosleep(&(struct timespec){ 0, ns }, &rem);
|
||||
ns -= rem.tv_nsec;
|
||||
elapsed.tv_sec += (elapsed.tv_nsec + ns) / 1000000000L;
|
||||
elapsed.tv_nsec = (elapsed.tv_nsec + ns) % 1000000000L;
|
||||
}
|
||||
} while (elapsed.tv_sec < timeout->tv_sec || (elapsed.tv_sec == timeout->tv_sec && elapsed.tv_nsec < timeout->tv_nsec));
|
||||
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_t *pos)
|
||||
{
|
||||
int ready = 0;
|
||||
|
|
@ -75,7 +117,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
|
|||
}
|
||||
}
|
||||
|
||||
sigtimedwait(&sig_set, 0, &zerotime);
|
||||
sigtimedwait(&sig_set, NULL, &zerotime);
|
||||
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
|
||||
|
|
|
|||
|
|
@ -162,9 +162,6 @@ static void Wayland_DeleteDevice(SDL_VideoDevice *device)
|
|||
WAYLAND_wl_display_flush(data->display);
|
||||
WAYLAND_wl_display_disconnect(data->display);
|
||||
}
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(data);
|
||||
SDL_free(device);
|
||||
SDL_WAYLAND_UnloadSymbols();
|
||||
|
|
@ -233,7 +230,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
|
|||
}
|
||||
|
||||
device->driverdata = data;
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = Wayland_VideoInit;
|
||||
|
|
|
|||
|
|
@ -93,9 +93,6 @@ static void WIN_DeleteDevice(SDL_VideoDevice *device)
|
|||
SDL_UnloadObject(data->shcoreDLL);
|
||||
}
|
||||
#endif
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
|
@ -120,7 +117,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
device->driverdata = data;
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
data->userDLL = SDL_LoadObject("USER32.DLL");
|
||||
|
|
|
|||
|
|
@ -108,9 +108,6 @@ static void X11_DeleteDevice(SDL_VideoDevice *device)
|
|||
X11_XCloseDisplay(data->request_display);
|
||||
}
|
||||
SDL_free(data->windowlist);
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
|
||||
|
|
@ -204,8 +201,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
#ifdef X11_DEBUG
|
||||
X11_XSynchronize(data->display, True);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue