mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 19:38:14 +00:00
Compare commits
13 Commits
SDL2
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e11183ea6c | ||
![]() |
024c27645a | ||
![]() |
c2047f0496 | ||
![]() |
220895d4d2 | ||
![]() |
282f7a84fc | ||
![]() |
9be8c2a899 | ||
![]() |
51e20f1666 | ||
![]() |
a34c8403e7 | ||
![]() |
dc74448014 | ||
![]() |
155f99a4e6 | ||
![]() |
63bb1a8583 | ||
![]() |
8b0c9e1dce | ||
![]() |
7f74c1ed63 |
14
.github/workflows/create-test-plan.py
vendored
14
.github/workflows/create-test-plan.py
vendored
@@ -28,7 +28,6 @@ class JobOs(Enum):
|
||||
WindowsLatest = "windows-latest"
|
||||
UbuntuLatest = "ubuntu-latest"
|
||||
MacosLatest = "macos-latest"
|
||||
Ubuntu20_04 = "ubuntu-20.04"
|
||||
Ubuntu22_04 = "ubuntu-22.04"
|
||||
Ubuntu24_04 = "ubuntu-24.04"
|
||||
Macos13 = "macos-13"
|
||||
@@ -57,13 +56,11 @@ class SdlPlatform(Enum):
|
||||
class Msys2Platform(Enum):
|
||||
Mingw32 = "mingw32"
|
||||
Mingw64 = "mingw64"
|
||||
Clang32 = "clang32"
|
||||
Clang64 = "clang64"
|
||||
Ucrt64 = "ucrt64"
|
||||
|
||||
|
||||
class IntelCompiler(Enum):
|
||||
Icc = "icc"
|
||||
Icx = "icx"
|
||||
|
||||
|
||||
@@ -107,7 +104,6 @@ class JobSpec:
|
||||
JOB_SPECS = {
|
||||
"msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ),
|
||||
"msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ),
|
||||
"msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ),
|
||||
"msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ),
|
||||
"msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ),
|
||||
"msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ),
|
||||
@@ -120,11 +116,9 @@ JOB_SPECS = {
|
||||
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
|
||||
"msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ),
|
||||
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
|
||||
"ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", autotools=True),
|
||||
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", autotools=True),
|
||||
"steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ),
|
||||
"ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ),
|
||||
"ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ),
|
||||
"ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ),
|
||||
"macos-gnu-arm64-x64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-x64-gnu",autotools=True, apple_archs={AppleArch.X86_64, AppleArch.ARM64, }, ),
|
||||
"ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ),
|
||||
"tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ),
|
||||
@@ -344,10 +338,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
case IntelCompiler.Icx:
|
||||
job.cc = "icx"
|
||||
job.cxx = "icpx"
|
||||
case IntelCompiler.Icc:
|
||||
job.cc = "icc"
|
||||
job.cxx = "icpc"
|
||||
job.cppflags.append("-diag-disable=10441")
|
||||
case _:
|
||||
raise ValueError(f"Invalid intel={spec.intel}")
|
||||
job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;"
|
||||
@@ -627,7 +617,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
"clang64": "mingw-w64-clang-x86_64",
|
||||
"ucrt64": "mingw-w64-ucrt-x86_64",
|
||||
}[spec.msys2_platform.value]
|
||||
job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, Msys2Platform.Clang32)
|
||||
job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, )
|
||||
job.shared_lib = SharedLibType.WIN32
|
||||
job.static_lib = StaticLibType.A
|
||||
case SdlPlatform.Riscos:
|
||||
|
@@ -89,7 +89,7 @@ endif()
|
||||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 32)
|
||||
set(SDL_MICRO_VERSION 0)
|
||||
set(SDL_MICRO_VERSION 2)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
|
@@ -15,7 +15,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 32
|
||||
MICRO_VERSION = 0
|
||||
MICRO_VERSION = 2
|
||||
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 = 0
|
||||
MICRO_VERSION = 2
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.32.0</string>
|
||||
<string>2.32.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.32.0</string>
|
||||
<string>2.32.2</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.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.2.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.0;
|
||||
MARKETING_VERSION = 2.32.2;
|
||||
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.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.2.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.0;
|
||||
MARKETING_VERSION = 2.32.2;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -10063,7 +10063,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.2.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.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3201.2.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Title SDL 2.32.0
|
||||
Title SDL 2.32.2
|
||||
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 = 0;
|
||||
private static final int SDL_MICRO_VERSION = 2;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
2
configure
vendored
2
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=0
|
||||
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`
|
||||
|
@@ -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=0
|
||||
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`
|
||||
|
@@ -1423,6 +1423,27 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE"
|
||||
|
||||
|
||||
/**
|
||||
* A variable containing a list of devices and their desired number of haptic
|
||||
* (force feedback) enabled axis.
|
||||
*
|
||||
* The format of the string is a comma separated list of USB VID/PID pairs in
|
||||
* hexadecimal form plus the number of desired axes, e.g.
|
||||
*
|
||||
* `0xAAAA/0xBBBB/1,0xCCCC/0xDDDD/3`
|
||||
*
|
||||
* This hint supports a "wildcard" device that will set the number of haptic
|
||||
* axes on all initialized haptic devices which were not defined explicitly in
|
||||
* this hint.
|
||||
*
|
||||
* `0xFFFF/0xFFFF/1`
|
||||
*
|
||||
* This hint should be set before a controller is opened. The number of haptic
|
||||
* axes won't exceed the number of real axes found on the device.
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HAPTIC_AXES "SDL_JOYSTICK_HAPTIC_AXES"
|
||||
|
||||
/**
|
||||
* A variable controlling whether joysticks on Linux will always treat 'hat'
|
||||
* axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking
|
||||
|
@@ -255,7 +255,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
||||
* On some platforms using this function activates the screen keyboard.
|
||||
*
|
||||
* On desktop platforms, SDL_StartTextInput() is implicitly called on SDL
|
||||
* window creation which will cause events SDL_TextInputEvent and
|
||||
* video subsystem initialization which will cause SDL_TextInputEvent and
|
||||
* SDL_TextEditingEvent to begin emitting.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
|
@@ -58,7 +58,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 32
|
||||
#define SDL_PATCHLEVEL 0
|
||||
#define SDL_PATCHLEVEL 2
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
@@ -310,7 +310,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; }
|
||||
audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0);
|
||||
SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer;
|
||||
dynCall('vi', $2, [$3]);
|
||||
dynCall('vp', $2, [$3]);
|
||||
};
|
||||
SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode);
|
||||
SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination);
|
||||
@@ -326,7 +326,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0);
|
||||
var silence_callback = function() {
|
||||
SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer;
|
||||
dynCall('vi', $2, [$3]);
|
||||
dynCall('vp', $2, [$3]);
|
||||
};
|
||||
|
||||
SDL2.capture.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000);
|
||||
@@ -351,7 +351,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
SDL2.audio.silenceBuffer = undefined;
|
||||
}
|
||||
SDL2.audio.currentOutputBuffer = e['outputBuffer'];
|
||||
dynCall('vi', $2, [$3]);
|
||||
dynCall('vp', $2, [$3]);
|
||||
};
|
||||
|
||||
SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']);
|
||||
@@ -369,7 +369,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
// the buffer that gets filled here just gets ignored, so the app can make progress
|
||||
// and/or avoid flooding audio queues until we can actually play audio.
|
||||
SDL2.audio.currentOutputBuffer = SDL2.audio.silenceBuffer;
|
||||
dynCall('vi', $2, [$3]);
|
||||
dynCall('vp', $2, [$3]);
|
||||
SDL2.audio.currentOutputBuffer = undefined;
|
||||
};
|
||||
|
||||
|
@@ -497,7 +497,7 @@ static void PULSEAUDIO_FlushCapture(_THIS)
|
||||
{
|
||||
struct SDL_PrivateAudioData *h = this->hidden;
|
||||
const void *data = NULL;
|
||||
size_t nbytes = 0;
|
||||
size_t nbytes = 0, buflen = 0;
|
||||
|
||||
PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
|
||||
|
||||
@@ -507,19 +507,19 @@ static void PULSEAUDIO_FlushCapture(_THIS)
|
||||
h->capturelen = 0;
|
||||
}
|
||||
|
||||
while (SDL_AtomicGet(&this->enabled) && (PULSEAUDIO_pa_stream_readable_size(h->stream) > 0)) {
|
||||
buflen = PULSEAUDIO_pa_stream_readable_size(h->stream);
|
||||
while (SDL_AtomicGet(&this->enabled) && (buflen > 0)) {
|
||||
PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop);
|
||||
if ((PULSEAUDIO_pa_context_get_state(pulseaudio_context) != PA_CONTEXT_READY) || (PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY)) {
|
||||
/*printf("PULSEAUDIO DEVICE FAILURE IN FLUSHCAPTURE!\n");*/
|
||||
SDL_OpenedAudioDeviceDisconnected(this);
|
||||
break;
|
||||
}
|
||||
|
||||
if (PULSEAUDIO_pa_stream_readable_size(h->stream) > 0) {
|
||||
/* a new fragment is available! Just dump it. */
|
||||
PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes);
|
||||
PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */
|
||||
}
|
||||
/* a fragment of audio present before FlushCapture was call is
|
||||
available! Just drop it. */
|
||||
PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes);
|
||||
PULSEAUDIO_pa_stream_drop(h->stream);
|
||||
buflen -= nbytes;
|
||||
}
|
||||
|
||||
PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop);
|
||||
|
@@ -440,19 +440,24 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
|
||||
|
||||
static void SDL_InitDynamicAPILocked(void)
|
||||
{
|
||||
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
||||
SDL_bool use_internal = SDL_TRUE;
|
||||
|
||||
/* this can't use SDL_getenv_REAL, because it might allocate memory before the app can set their allocator */
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||
/* We've always used LoadLibraryA for this, so this has never worked with Unicode paths on Windows. Sorry. */
|
||||
char envbuf[512]; /* overflows will just report as environment variable being unset, but LoadLibraryA has a MAX_PATH of 260 anyhow, apparently. */
|
||||
const DWORD rc = GetEnvironmentVariableA(SDL_DYNAMIC_API_ENVVAR, envbuf, (DWORD) sizeof (envbuf));
|
||||
char *libname = ((rc != 0) && (rc < sizeof (envbuf))) ? envbuf : NULL;
|
||||
#elif defined(__OS2__)
|
||||
char * libname;
|
||||
if (DosScanEnv(SDL_DYNAMIC_API_ENVVAR, &libname) != NO_ERROR) {
|
||||
libname = NULL;
|
||||
}
|
||||
#else
|
||||
char *libname = getenv(SDL_DYNAMIC_API_ENVVAR);
|
||||
#endif
|
||||
|
||||
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
||||
SDL_bool use_internal = SDL_TRUE;
|
||||
|
||||
if (libname) {
|
||||
while (*libname && !entry) {
|
||||
char *ptr = libname;
|
||||
|
@@ -23,6 +23,85 @@
|
||||
#include "SDL_syshaptic.h"
|
||||
#include "SDL_haptic_c.h"
|
||||
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
|
||||
#include "SDL_hints.h"
|
||||
#include "../SDL_hints_c.h"
|
||||
|
||||
typedef struct SDL_Haptic_VIDPID_Naxes {
|
||||
Uint16 vid;
|
||||
Uint16 pid;
|
||||
Uint16 naxes;
|
||||
} SDL_Haptic_VIDPID_Naxes;
|
||||
|
||||
static void SDL_HapticLoadAxesList(SDL_Haptic_VIDPID_Naxes **entries, int *num_entries)
|
||||
{
|
||||
SDL_Haptic_VIDPID_Naxes entry;
|
||||
const char *spot;
|
||||
int length = 0;
|
||||
|
||||
spot = SDL_GetHint(SDL_HINT_JOYSTICK_HAPTIC_AXES);
|
||||
if (!spot)
|
||||
return;
|
||||
|
||||
while (SDL_sscanf(spot, "0x%hx/0x%hx/%hu%n", &entry.vid, &entry.pid, &entry.naxes, &length) == 3) {
|
||||
SDL_assert(length > 0);
|
||||
spot += length;
|
||||
length = 0;
|
||||
|
||||
if ((*num_entries % 8) == 0) {
|
||||
int new_max = *num_entries + 8;
|
||||
SDL_Haptic_VIDPID_Naxes *new_entries =
|
||||
(SDL_Haptic_VIDPID_Naxes *)SDL_realloc(*entries, new_max * sizeof(**entries));
|
||||
|
||||
// Out of memory, go with what we have already
|
||||
if (!new_entries)
|
||||
break;
|
||||
|
||||
*entries = new_entries;
|
||||
}
|
||||
(*entries)[(*num_entries)++] = entry;
|
||||
|
||||
if (spot[0] == ',')
|
||||
spot++;
|
||||
}
|
||||
}
|
||||
|
||||
// /* Return -1 if not found */
|
||||
static int SDL_HapticNaxesListIndex(struct SDL_Haptic_VIDPID_Naxes *entries, int num_entries, Uint16 vid, Uint16 pid)
|
||||
{
|
||||
int i;
|
||||
if (!entries)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < num_entries; ++i) {
|
||||
if (entries[i].vid == vid && entries[i].pid == pid)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check if device needs a custom number of naxes
|
||||
static int SDL_HapticGetNaxes(Uint16 vid, Uint16 pid)
|
||||
{
|
||||
int num_entries = 0, index = 0, naxes = -1;
|
||||
SDL_Haptic_VIDPID_Naxes *naxes_list = NULL;
|
||||
|
||||
SDL_HapticLoadAxesList(&naxes_list, &num_entries);
|
||||
if (!num_entries || !naxes_list)
|
||||
return -1;
|
||||
|
||||
// Perform "wildcard" pass
|
||||
index = SDL_HapticNaxesListIndex(naxes_list, num_entries, 0xffff, 0xffff);
|
||||
if (index >= 0)
|
||||
naxes = naxes_list[index].naxes;
|
||||
|
||||
index = SDL_HapticNaxesListIndex(naxes_list, num_entries, vid, pid);
|
||||
if (index >= 0)
|
||||
naxes = naxes_list[index].naxes;
|
||||
|
||||
SDL_free(naxes_list);
|
||||
return naxes;
|
||||
}
|
||||
|
||||
/* Global for SDL_windowshaptic.c */
|
||||
#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT)
|
||||
@@ -258,6 +337,8 @@ SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
|
||||
{
|
||||
SDL_Haptic *haptic;
|
||||
SDL_Haptic *hapticlist;
|
||||
int naxes, general_axes;
|
||||
Uint16 vid, pid;
|
||||
|
||||
/* Make sure there is room. */
|
||||
if (SDL_NumHaptics() <= 0) {
|
||||
@@ -314,6 +395,18 @@ SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
|
||||
}
|
||||
SDL_UnlockJoysticks();
|
||||
|
||||
vid = SDL_JoystickGetVendor(joystick);
|
||||
pid = SDL_JoystickGetProduct(joystick);
|
||||
general_axes = SDL_JoystickNumAxes(joystick);
|
||||
|
||||
naxes = SDL_HapticGetNaxes(vid, pid);
|
||||
if (naxes > 0)
|
||||
haptic->naxes = naxes;
|
||||
|
||||
// Limit to the actual number of axes found on the device
|
||||
if (general_axes >= 0 && naxes > general_axes)
|
||||
haptic->naxes = general_axes;
|
||||
|
||||
/* Add haptic to list */
|
||||
++haptic->ref_count;
|
||||
/* Link the haptic in the list */
|
||||
|
@@ -79,7 +79,7 @@ case $host in
|
||||
backend="mac"
|
||||
os="darwin"
|
||||
threads="pthreads"
|
||||
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
|
||||
LIBS="${LIBS} -framework IOKit -framework CoreFoundation -framework AppKit"
|
||||
;;
|
||||
*-freebsd*)
|
||||
AC_MSG_RESULT([ (FreeBSD back-end)])
|
||||
|
@@ -14,7 +14,7 @@ COBJS=hid.o
|
||||
CPPOBJS=../hidtest/hidtest.o
|
||||
OBJS=$(COBJS) $(CPPOBJS)
|
||||
CFLAGS+=-I../hidapi -Wall -g -c
|
||||
LIBS=-framework IOKit -framework CoreFoundation
|
||||
LIBS=-framework IOKit -framework CoreFoundation -framework AppKit
|
||||
|
||||
|
||||
hidtest: $(OBJS)
|
||||
|
@@ -37,6 +37,9 @@
|
||||
|
||||
#define VALVE_USB_VID 0x28DE
|
||||
|
||||
/* As defined in AppKit.h, but we don't need the entire AppKit for a single constant. */
|
||||
extern const double NSAppKitVersionNumber;
|
||||
|
||||
/* Barrier implementation because Mac OSX doesn't have pthread_barrier.
|
||||
It also doesn't have clock_gettime(). So much for POSIX and SUSv2.
|
||||
This implementation came from Brent Priddy and was posted on
|
||||
@@ -131,6 +134,7 @@ struct hid_device_list_node
|
||||
};
|
||||
|
||||
static IOHIDManagerRef hid_mgr = 0x0;
|
||||
static int is_macos_10_10_or_greater = 0;
|
||||
static struct hid_device_list_node *device_list = 0x0;
|
||||
|
||||
static hid_device *new_hid_device(void)
|
||||
@@ -485,6 +489,7 @@ static int init_hid_manager(void)
|
||||
int HID_API_EXPORT hid_init(void)
|
||||
{
|
||||
if (!hid_mgr) {
|
||||
is_macos_10_10_or_greater = (NSAppKitVersionNumber >= 1343); /* NSAppKitVersionNumber10_10 */
|
||||
return init_hid_manager();
|
||||
}
|
||||
|
||||
@@ -1138,8 +1143,10 @@ void HID_API_EXPORT hid_close(hid_device *dev)
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
/* Disconnect the report callback before close. */
|
||||
if (!dev->disconnected) {
|
||||
/* Disconnect the report callback before close.
|
||||
See comment below.
|
||||
*/
|
||||
if (is_macos_10_10_or_greater || !dev->disconnected) {
|
||||
IOHIDDeviceRegisterInputReportCallback(
|
||||
dev->device_handle, dev->input_report_buf, dev->max_input_report_len,
|
||||
NULL, dev);
|
||||
@@ -1162,8 +1169,14 @@ void HID_API_EXPORT hid_close(hid_device *dev)
|
||||
|
||||
/* Close the OS handle to the device, but only if it's not
|
||||
been unplugged. If it's been unplugged, then calling
|
||||
IOHIDDeviceClose() will crash. */
|
||||
if (!dev->disconnected) {
|
||||
IOHIDDeviceClose() will crash.
|
||||
|
||||
UPD: The crash part was true in/until some version of macOS.
|
||||
Starting with macOS 10.15, there is an opposite effect in some environments:
|
||||
crash happenes if IOHIDDeviceClose() is not called.
|
||||
Not leaking a resource in all tested environments.
|
||||
*/
|
||||
if (is_macos_10_10_or_greater || !dev->disconnected) {
|
||||
IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
|
||||
}
|
||||
|
||||
|
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,32,0,0
|
||||
PRODUCTVERSION 2,32,0,0
|
||||
FILEVERSION 2,32,2,0
|
||||
PRODUCTVERSION 2,32,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 32, 0, 0\0"
|
||||
VALUE "FileVersion", "2, 32, 2, 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, 0, 0\0"
|
||||
VALUE "ProductVersion", "2, 32, 2, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@@ -1113,6 +1113,7 @@ static SDL_bool CharacterMatchesSet(char c, const char *set, size_t set_len)
|
||||
/* NOLINTNEXTLINE(readability-non-const-parameter) */
|
||||
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
|
||||
{
|
||||
const char *start = text;
|
||||
int retval = 0;
|
||||
|
||||
if (!text || !*text) {
|
||||
@@ -1383,6 +1384,36 @@ int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
|
||||
}
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
switch (inttype) {
|
||||
case DO_SHORT:
|
||||
{
|
||||
short *valuep = va_arg(ap, short *);
|
||||
*valuep = (short)(text - start);
|
||||
} break;
|
||||
case DO_INT:
|
||||
{
|
||||
int *valuep = va_arg(ap, int *);
|
||||
*valuep = (int)(text - start);
|
||||
} break;
|
||||
case DO_LONG:
|
||||
{
|
||||
long *valuep = va_arg(ap, long *);
|
||||
*valuep = (long)(text - start);
|
||||
} break;
|
||||
case DO_LONGLONG:
|
||||
{
|
||||
long long *valuep = va_arg(ap, long long *);
|
||||
*valuep = (long long)(text - start);
|
||||
} break;
|
||||
case DO_SIZE_T:
|
||||
{
|
||||
size_t *valuep = va_arg(ap, size_t *);
|
||||
*valuep = (size_t)(text - start);
|
||||
} break;
|
||||
}
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
case '[':
|
||||
{
|
||||
const char *set = fmt + 1;
|
||||
|
@@ -159,7 +159,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
inf.dwFlags = 0;
|
||||
|
||||
/* The debugger catches this, renames the thread, continues on. */
|
||||
RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR *)&inf);
|
||||
RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG_PTR), (const ULONG_PTR *)&inf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -393,6 +393,7 @@ int stdlib_getsetenv(void *arg)
|
||||
#endif
|
||||
|
||||
#define FMT_PRILLd "%lld"
|
||||
#define FMT_PRILLdn "%lld%lln"
|
||||
#define FMT_PRILLu "%llu"
|
||||
|
||||
/**
|
||||
@@ -403,11 +404,12 @@ int stdlib_sscanf(void *arg)
|
||||
{
|
||||
int output;
|
||||
int result;
|
||||
int length;
|
||||
int expected_output;
|
||||
int expected_result;
|
||||
short short_output, expected_short_output;
|
||||
long long_output, expected_long_output;
|
||||
long long long_long_output, expected_long_long_output;
|
||||
short short_output, expected_short_output, short_length;
|
||||
long long_output, expected_long_output, long_length;
|
||||
long long long_long_output, expected_long_long_output, long_long_length;
|
||||
size_t size_output, expected_size_output;
|
||||
char text[128], text2[128];
|
||||
|
||||
@@ -426,43 +428,51 @@ int stdlib_sscanf(void *arg)
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
output = 123;
|
||||
length = 0;
|
||||
expected_output = 2;
|
||||
expected_result = 1;
|
||||
result = SDL_sscanf("2", "%i", &output);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i\", &output)");
|
||||
result = SDL_sscanf("2", "%i%n", &output, &length);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i%%n\", &output, &length)");
|
||||
SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
SDLTest_AssertCheck(length == 1, "Check length, expected: 1, got: %i", length);
|
||||
|
||||
output = 123;
|
||||
length = 0;
|
||||
expected_output = 0xa;
|
||||
expected_result = 1;
|
||||
result = SDL_sscanf("aa", "%1x", &output);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"aa\", \"%%1x\", &output)");
|
||||
result = SDL_sscanf("aa", "%1x%n", &output, &length);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"aa\", \"%%1x%%n\", &output, &length)");
|
||||
SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
SDLTest_AssertCheck(length == 1, "Check length, expected: 1, got: %i", length);
|
||||
|
||||
#define SIZED_TEST_CASE(type, var, format_specifier) \
|
||||
#define SIZED_TEST_CASE(type, var, printf_specifier, scanf_specifier) \
|
||||
var##_output = 123; \
|
||||
var##_length = 0; \
|
||||
expected_##var##_output = (type)(((unsigned type)(~0)) >> 1); \
|
||||
expected_result = 1; \
|
||||
result = SDL_snprintf(text, sizeof(text), format_specifier, expected_##var##_output); \
|
||||
result = SDL_sscanf(text, format_specifier, &var##_output); \
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"%s\", \"%s\", &output)", text, #format_specifier); \
|
||||
SDLTest_AssertCheck(expected_##var##_output == var##_output, "Check output, expected: " format_specifier ", got: " format_specifier, expected_##var##_output, var##_output); \
|
||||
result = SDL_snprintf(text, sizeof(text), printf_specifier, expected_##var##_output); \
|
||||
result = SDL_sscanf(text, scanf_specifier, &var##_output, &var##_length); \
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"%s\", %s, &output, &length)", text, #scanf_specifier); \
|
||||
SDLTest_AssertCheck(expected_##var##_output == var##_output, "Check output, expected: " printf_specifier ", got: " printf_specifier, expected_##var##_output, var##_output); \
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); \
|
||||
SDLTest_AssertCheck(var##_length == (type)SDL_strlen(text), "Check length, expected: %i, got: %i", (int)SDL_strlen(text), (int)var##_length); \
|
||||
\
|
||||
var##_output = 123; \
|
||||
var##_length = 0; \
|
||||
expected_##var##_output = ~(type)(((unsigned type)(~0)) >> 1); \
|
||||
expected_result = 1; \
|
||||
result = SDL_snprintf(text, sizeof(text), format_specifier, expected_##var##_output); \
|
||||
result = SDL_sscanf(text, format_specifier, &var##_output); \
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"%s\", \"%s\", &output)", text, #format_specifier); \
|
||||
SDLTest_AssertCheck(expected_##var##_output == var##_output, "Check output, expected: " format_specifier ", got: " format_specifier, expected_##var##_output, var##_output); \
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
result = SDL_snprintf(text, sizeof(text), printf_specifier, expected_##var##_output); \
|
||||
result = SDL_sscanf(text, scanf_specifier, &var##_output, &var##_length); \
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"%s\", %s, &output, &length)", text, #scanf_specifier); \
|
||||
SDLTest_AssertCheck(expected_##var##_output == var##_output, "Check output, expected: " printf_specifier ", got: " printf_specifier, expected_##var##_output, var##_output); \
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); \
|
||||
SDLTest_AssertCheck(var##_length == (type)SDL_strlen(text), "Check length, expected: %i, got: %i", (int)SDL_strlen(text), (int)var##_length); \
|
||||
|
||||
SIZED_TEST_CASE(short, short, "%hd")
|
||||
SIZED_TEST_CASE(long, long, "%ld")
|
||||
SIZED_TEST_CASE(long long, long_long, "%lld")
|
||||
SIZED_TEST_CASE(short, short, "%hd", "%hd%hn")
|
||||
SIZED_TEST_CASE(long, long, "%ld", "%ld%ln")
|
||||
SIZED_TEST_CASE(long long, long_long, FMT_PRILLd, FMT_PRILLdn)
|
||||
|
||||
size_output = 123;
|
||||
expected_size_output = ~((size_t)0);
|
||||
|
Reference in New Issue
Block a user