Skip to content

Commit

Permalink
SDL2: Update to 2.30.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
Esme Povirk committed Nov 22, 2024
1 parent 21f3e86 commit 8f517a7
Show file tree
Hide file tree
Showing 45 changed files with 222 additions and 247 deletions.
2 changes: 1 addition & 1 deletion SDL2/.git-hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79ec168f3c1e2fe27335cb8886439f7ef676fb49
c98c4fbff6d8f3016a3ce6685bf8f43433c3efcc
2 changes: 1 addition & 1 deletion SDL2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 30)
set(SDL_MICRO_VERSION 8)
set(SDL_MICRO_VERSION 9)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")

# Set defaults preventing destination file conflicts
Expand Down
2 changes: 1 addition & 1 deletion SDL2/Makefile.os2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 30
MICRO_VERSION = 8
MICRO_VERSION = 9
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2

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

LIBHOME = .
Expand Down
2 changes: 1 addition & 1 deletion SDL2/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.30.8
2.30.9
2 changes: 1 addition & 1 deletion SDL2/VisualC/pkg-support/cmake/sdl2-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if(EXISTS "${_sdl2main_library}")
endif()
set(SDL2_SDL2main_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
set(SDL2_SDL2main_FOUND FALSE)
endif()
unset(_sdl2main_library)

Expand Down
4 changes: 2 additions & 2 deletions SDL2/Xcode/SDL/Info-Framework.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.30.8</string>
<string>2.30.9</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.30.8</string>
<string>2.30.9</string>
</dict>
</plist>
12 changes: 6 additions & 6 deletions SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9729,7 +9729,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.8.0;
DYLIB_CURRENT_VERSION = 3001.9.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
Expand Down Expand Up @@ -9770,7 +9770,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.30.8;
MARKETING_VERSION = 2.30.9;
OTHER_LDFLAGS = "-liconv";
};
name = Release;
Expand Down Expand Up @@ -9814,7 +9814,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.8.0;
DYLIB_CURRENT_VERSION = 3001.9.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -9856,7 +9856,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.30.8;
MARKETING_VERSION = 2.30.9;
OTHER_LDFLAGS = "-liconv";
};
name = Debug;
Expand Down Expand Up @@ -10063,7 +10063,7 @@
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.8.0;
DYLIB_CURRENT_VERSION = 3001.9.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
Expand Down Expand Up @@ -10115,7 +10115,7 @@
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.8.0;
DYLIB_CURRENT_VERSION = 3001.9.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down
2 changes: 1 addition & 1 deletion SDL2/Xcode/SDL/pkg-support/SDL.info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Title SDL 2.30.8
Title SDL 2.30.9
Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 8;
private static final int SDL_MICRO_VERSION = 9;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
Expand Down
2 changes: 1 addition & 1 deletion SDL2/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3508,7 +3508,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=8
SDL_MICRO_VERSION=9
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
Expand Down
2 changes: 1 addition & 1 deletion SDL2/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=8
SDL_MICRO_VERSION=9
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
Expand Down
2 changes: 1 addition & 1 deletion SDL2/include/SDL_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
* frames_ (with stereo output, two samples--left and right--would make a
* single sample frame). This number should be a power of two, and may be
* adjusted by the audio driver to a value more suitable for the hardware.
* Good values seem to range between 512 and 8096 inclusive, depending on
* Good values seem to range between 512 and 4096 inclusive, depending on
* the application and CPU speed. Smaller values reduce latency, but can
* lead to underflow if the application is doing heavy processing and cannot
* fill the audio buffer in time. Note that the number of sample frames is
Expand Down
2 changes: 1 addition & 1 deletion SDL2/include/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ typedef uint64_t Uint64;
#define SDL_PRIs64 "I64d"
#elif defined(PRIs64)
#define SDL_PRIs64 PRIs64
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
Expand Down
2 changes: 1 addition & 1 deletion SDL2/include/SDL_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct SDL_version
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 30
#define SDL_PATCHLEVEL 8
#define SDL_PATCHLEVEL 9

/**
* Macro to determine SDL version program was compiled against.
Expand Down
4 changes: 4 additions & 0 deletions SDL2/include/SDL_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ extern "C" {
VK_DEFINE_HANDLE(VkInstance)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)

/* Make sure to undef to avoid issues in case of later vulkan include */
#undef VK_DEFINE_HANDLE
#undef VK_DEFINE_NON_DISPATCHABLE_HANDLE

#endif /* !NO_SDL_VULKAN_TYPEDEFS */

typedef VkInstance SDL_vulkanInstance;
Expand Down
4 changes: 3 additions & 1 deletion SDL2/src/SDL_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
break;
}
}
#elif defined(HAVE_STDIO_H)
#elif defined(HAVE_STDIO_H) && !defined(__3DS__)
/* this is a little hacky. */
for (;;) {
char buf[32];
Expand All @@ -319,6 +319,8 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
break;
}
}
#else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Assertion Failed", message, window);
#endif /* HAVE_STDIO_H */
}

Expand Down
2 changes: 0 additions & 2 deletions SDL2/src/audio/aaudio/SDL_aaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
}

ctx.AAudioStreamBuilder_setErrorCallback(ctx.builder, aaudio_errorCallback, private);
ctx.AAudioStreamBuilder_setPerformanceMode(ctx.builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);

LOGI("AAudio Try to open %u hz %u bit chan %u %s samples %u",
this->spec.freq, SDL_AUDIO_BITSIZE(this->spec.format),
Expand Down Expand Up @@ -239,7 +238,6 @@ static int RebuildAAudioStream(SDL_AudioDevice *device)
}

ctx.AAudioStreamBuilder_setErrorCallback(ctx.builder, aaudio_errorCallback, hidden);
ctx.AAudioStreamBuilder_setPerformanceMode(ctx.builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);

LOGI("AAudio Try to reopen %u hz %u bit chan %u %s samples %u",
device->spec.freq, SDL_AUDIO_BITSIZE(device->spec.format),
Expand Down
2 changes: 1 addition & 1 deletion SDL2/src/audio/aaudio/SDL_aaudiofuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SDL_PROC(void, AAudioStreamBuilder_setFormat, (AAudioStreamBuilder * builder, aa
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setSharingMode, (AAudioStreamBuilder * builder, aaudio_sharing_mode_t sharingMode))
SDL_PROC(void, AAudioStreamBuilder_setDirection, (AAudioStreamBuilder * builder, aaudio_direction_t direction))
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setBufferCapacityInFrames, (AAudioStreamBuilder * builder, int32_t numFrames))
SDL_PROC(void, AAudioStreamBuilder_setPerformanceMode, (AAudioStreamBuilder * builder, aaudio_performance_mode_t mode))
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setPerformanceMode, (AAudioStreamBuilder * builder, aaudio_performance_mode_t mode))
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setUsage, (AAudioStreamBuilder * builder, aaudio_usage_t usage)) /* API 28 */
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setContentType, (AAudioStreamBuilder * builder, aaudio_content_type_t contentType)) /* API 28 */
SDL_PROC_UNUSED(void, AAudioStreamBuilder_setInputPreset, (AAudioStreamBuilder * builder, aaudio_input_preset_t inputPreset)) /* API 28 */
Expand Down
8 changes: 7 additions & 1 deletion SDL2/src/audio/emscripten/SDL_emscriptenaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ static void FeedAudioDevice(_THIS, const void *buf, const int buflen)
/* *INDENT-OFF* */ /* clang-format off */
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
/* Convert incoming buf pointer to a HEAPF32 offset. */
#ifdef __wasm64__
var buf = $0 / 4;
#else
var buf = $0 >>> 2;
#endif
var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels'];
for (var c = 0; c < numChannels; ++c) {
var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c);
Expand All @@ -47,7 +53,7 @@ static void FeedAudioDevice(_THIS, const void *buf, const int buflen)
}

for (var j = 0; j < $1; ++j) {
channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */
channelData[j] = HEAPF32[buf + (j*numChannels + c)];
}
}
}, buf, buflen / framelen);
Expand Down
6 changes: 6 additions & 0 deletions SDL2/src/audio/wasapi/SDL_wasapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ static int UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec)
}
}

/* if the device sample size changed, make sure we're asking for enough data. */
if (this->callbackspec.samples != this->spec.samples) {
this->callbackspec.samples = this->spec.samples;
SDL_CalculateAudioSpec(&this->callbackspec);
}

/* make sure our scratch buffer can cover the new device spec. */
if (this->spec.size > this->work_buffer_len) {
Uint8 *ptr = (Uint8 *)SDL_realloc(this->work_buffer, this->spec.size);
Expand Down
22 changes: 2 additions & 20 deletions SDL2/src/joystick/SDL_gamecontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,28 +2123,10 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
return SDL_TRUE;
}

if (SDL_allowed_controllers.num_included_entries == 0 &&
SDL_ignored_controllers.num_included_entries == 0) {
return SDL_FALSE;
}

SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);

if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
/* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */
/* https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices */
SDL_bool bSteamVirtualGamepad = SDL_FALSE;
#if defined(__LINUX__)
bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD);
#elif defined(__MACOSX__)
bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 1);
#elif defined(__WIN32__)
/* We can't tell on Windows, but Steam will block others in input hooks */
bSteamVirtualGamepad = SDL_TRUE;
#endif
if (bSteamVirtualGamepad) {
return SDL_FALSE;
}
if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) {
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
}

if (SDL_allowed_controllers.num_included_entries > 0) {
Expand Down
4 changes: 2 additions & 2 deletions SDL2/src/joystick/SDL_gamecontrollerdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ static const char *s_ControllerMappings[] = {
"03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,",
"03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000222c00001020000011010000,Qanba Drone 2 Arcade Joystick (PS5),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000222c00001220000011010000,Qanba Drone 2 Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000222c00001020000011010000,Qanba Drone 2 Arcade Joystick (PS5),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000222c00000020000011010000,Qanba Drone Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,",
"03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
Expand Down Expand Up @@ -925,7 +925,7 @@ static const char *s_ControllerMappings[] = {
"050000004c050000c4050000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"050000004c050000cc090000fffe3f80,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a3,rightx:a4,righty:a5,start:b16,x:b0,y:b2,",
"050000004c050000cc090000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"050000004c050000e60c0000fffe3f80,PS5 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a3,rightx:a4,righty:a5,start:b16,x:b0,y:b2,",
"050000004c050000e60c0000fffe3f80,PS5 Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a3,rightx:a4,righty:a5,start:b16,x:b2,y:b17,",
"050000004c050000e60c0000ffff3f00,PS5 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"05000000f8270000bf0b0000ffff3f00,Razer Kishi,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"050000003215000005070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
Expand Down
9 changes: 9 additions & 0 deletions SDL2/src/joystick/SDL_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -2843,6 +2843,15 @@ SDL_bool SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 product
return vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR;
}

SDL_bool SDL_IsJoystickSteamVirtualGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version)
{
#ifdef __MACOSX__
return (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0);
#else
return (vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD);
#endif
}

SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
Expand Down
3 changes: 3 additions & 0 deletions SDL2/src/joystick/SDL_joystick_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConRight(Uint16 vendor_id, Uint16
extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConGrip(Uint16 vendor_id, Uint16 product_id);
extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 product_id);

/* Function to return whether a joystick is a Steam Virtual Gamepad */
extern SDL_bool SDL_IsJoystickSteamVirtualGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version);

/* Function to return whether a joystick is a Steam Controller */
extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id);

Expand Down
5 changes: 5 additions & 0 deletions SDL2/src/joystick/darwin/SDL_iokitjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice)
CFNumberGetValue(refCF, kCFNumberSInt32Type, &version);
}

if (SDL_IsJoystickXboxOne(vendor, product)) {
/* We can't actually use this API for Xbox controllers */
return false;
}

/* get device name */
refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDManufacturerKey));
if ((!refCF) || (!CFStringGetCString(refCF, manufacturer_string, sizeof(manufacturer_string), kCFStringEncodingUTF8))) {
Expand Down
Loading

0 comments on commit 8f517a7

Please sign in to comment.