Compare commits

...
Author SHA1 Message Date
Sam Lantinga 4478ad67d2 Lock joysticks when they are connected/disconnected on emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11499

(cherry picked from commit 0281071243)
(cherry picked from commit d9836d15e7)
2025-12-08 21:01:47 -08:00
Cameron Gutman 667e4e9020 egl: Fix X11 EGL window creation on Nvidia
This is a port of 808a3f5 to SDL2.

Fixes #13094

(cherry picked from commit 3146374e4a)
2025-12-05 23:20:45 -06:00
Ozkan Sezer 2430122b21 alsa: fix signature of snd_pcm_hw_params_get_rate()
Reference issue: https://github.com/libsdl-org/SDL/issues/13845.
2025-12-03 21:40:32 +03:00
Joshua Root 18c96e27d2 Guard use of @available in SDL_cocoaevents.m
Older compilers don't understand this syntax.

(cherry picked from commit eb974470ec)
2025-12-03 10:04:26 -05:00
vanfanel 0dcfa78be6 SDL2: Fill the SDL_AudioSpec in add_device()
(cherry picked from commit 34691de22b)
2025-12-03 10:02:20 -05:00
Cameron Gutman c636332031 quit: don't call signal() if we're using sigaction()
At best, this is a no-op.

At worst, it might:
 - Clobber a signal handler someone registered after us
 - Overwrite the signal mask or flags
 - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal())

(cherry picked from commit 1d852d1c28)
2025-12-01 19:46:00 -06:00
Sam Lantinga 385e995790 Check for wine_get_version() to detect Wine/Proton
If this application is being run under Wine but Steam doesn't know that, Steam won't set STEAM_COMPAT_PROTON. So we'll use wine_get_version() to detect that we're running under Wine instead.

(cherry picked from commit e2e8f86076)
(cherry picked from commit f36d683b61)
2025-11-12 23:09:35 -08:00
Sam Lantinga a069ac41e5 Don't check SteamVirtualGamepadInfo when running as Wine
Wine will ignore the Steam Virtual Gamepad if it looks like it has the original (blocked) controller VID/PID.

Fixes https://github.com/libsdl-org/SDL/issues/14410

(cherry picked from commit 493bc621e4)
(cherry picked from commit 5bdf7bc625)
2025-11-12 23:09:35 -08:00
Ozkan Sezer dc086d6454 Revert "pipewire: disable -Wdeclaration-after-statement for pipewire headers"
This reverts commit 876baf6b0e.

Issue in pipewire release candidate 1.5.81 has been resolved in 1.5.82

Reference issue: Fixes: https://github.com/libsdl-org/SDL/issues/14343
2025-11-06 19:55:55 +03:00
yuanhecai 1acc405bd4 loongarch: add SDL_FillRect4LSX opt
(cherry picked from commit 14eebdab3c)
2025-11-06 07:29:07 -08:00
yuanhecai a07b00ccb0 loongarch: add BlitRGBtoRGBPixelAlphaLSX opt
(cherry picked from commit 686c18026b)
2025-11-06 07:29:07 -08:00
Sam Lantinga e458305c43 Clamp the audio drain delay to 100 ms
Fixes https://github.com/libsdl-org/SDL/issues/9829

(cherry picked from commit 0882623092)
(cherry picked from commit 6db23faa44)
2025-11-02 11:20:55 -08:00
Sam Lantinga 3ff58bf062 Don't consider USB devices which have already been skipped
Fixes https://github.com/libsdl-org/SDL/issues/14367

(cherry picked from commit 6570d9e23f)
2025-11-02 09:25:43 -08:00
Sam Lantinga 7eb78c5070 Fixed the right touchpad calculation for the BLE Steam Controller
Fixes https://github.com/libsdl-org/SDL/issues/14368

(cherry picked from commit eb87a36940)
(cherry picked from commit 2bb0eb4641)
2025-11-02 08:34:41 -08:00
Petar Popovic 6e5cad8e1e Fix leak in SDL_GameControllerTypeForIndex()
(cherry picked from commit 398bacbac3)
2025-11-01 08:40:37 -07:00
Ozkan Sezer 876baf6b0e pipewire: disable -Wdeclaration-after-statement for pipewire headers
Fixes: https://github.com/libsdl-org/SDL/issues/14343

(cherry picked from commit f9435eab16)
2025-11-01 00:45:32 +03:00
Ozkan Sezer c0d0b31d1c SDL_kmsdrmvideo.c: fix build in C90 mode
(cherry picked from commit 00d4f1c2c4)
2025-10-26 04:35:40 +03:00
Sam Lantinga 80cbc908a1 Perform full rectangle intersection for empty rects
If we don't do that, we leave the x and y values uninitialized.

Fixes https://github.com/libsdl-org/sdl12-compat/issues/365

(cherry picked from commit ffd0ca4391)
(cherry picked from commit 1c19bee000)
2025-10-25 13:52:34 -07:00
Frank Praznik 735d8a2dc8 wayland: Special-case relative warp mode to deliver accelerated relative motion
The Wayland backend lacks pointer warp functionality, so special-case the relative warp mode hint to deliver accelerated relative motion deltas, which is ultimately what the client wants by enabling this hint.

(cherry picked from commit 235e4870af)
2025-10-09 11:29:12 -04:00
AL2009man bc67702d8d Disable SDL_HINT_JOYSTICK_RAWINPUT by default
backported from SDL3 commit aa870d5

 Fixes #13047

(cherry picked from commit 8ef0a07a52)
2025-10-08 11:35:46 -07:00
Ozkan Sezer 40625e9e7e ci: bump cross-platform-actions.
(cherry-picked from commit 97c1df66a8)
2025-10-07 14:28:50 +03:00
Brad Smith a5f445dba1 Use elf_aux_info() on OpenBSD
NFC for ARMv7. For PowerPC move elf_aux_info() to higher priority over
sysctl for newer systems.

(cherry picked from commit b299e0de46)
(cherry picked from commit 641201a99a)
2025-09-27 09:01:58 -07:00
Fierelier f172ee3d0e [SDL3] [PS2] Framebuffer resolution + 240p/480p + PAL support (#13993)
* Do not override NTSC/PAL

* Fix PS2 build instructions

* Add PS2 GS hints
Allows for switching between NTSC/PAL, progressive/interlaced, etc

(cherry picked from commit 3fd0b46215)
(cherry picked from commit 7b28fb29bd)
2025-09-26 08:26:29 -07:00
Sam Lantinga 7fe49da380 Removed UWP workflow from CI
The GitHub runners no longer have the needed SDK for this

(cherry picked from commit ecb72142fd)
2025-09-19 08:34:09 -07:00
krnl32 0efcafc74d Added a default case to the switch statement in the HEADER FILE to prevent compiler warnings about missing defaults. This change helps avoid compilation breaks when warnings are treated as errors.
(cherry picked from commit 9859c05178)
2025-09-16 17:17:42 -07:00
Ozkan Sezer dcc72b43ba fix build.
(cherry picked from commit 07c3b3fb7c)
2025-09-15 20:30:20 +03:00
Ozkan Sezer b8430e4135 SDL_endian.h: don't add _m_prefetch hack for clang-cl if available as a builtin
Fixes: https://github.com/libsdl-org/SDL/issues/13952 .

(backport from SDL3 commit 81f2f44843)
(cherry picked from commit 9343246616)
2025-09-15 20:11:10 +03:00
Sam Lantinga 394d9bfa1a Remove Windows 32-bit ARM build from CI
This architecture is deprecated and is now failing with:
Windows SDK 10.0.22621.0 : 'C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um' not found or was incomplete

Fixes https://github.com/libsdl-org/SDL/issues/13949

(cherry picked from commit cc3274b6f1)
(cherry picked from commit b55059b487)
2025-09-14 18:03:32 -07:00
Sam Lantinga ecc71c02ea Only use a transparent cursor on Windows when connected via RDP
VMware relies on the cursor being set to NULL to optimize relative mouse motion for games.

We should also revisit whether current RDP works better with a NULL cursor or a transparent cursor.

Fixes https://github.com/libsdl-org/SDL/issues/13700

(cherry picked from commit dac6af4ba6)
(cherry picked from commit 55b599d693)
2025-09-14 17:32:38 -07:00
Gianfranco Berardi 60515350ae Provide Android targetsdk 35 support in SDL2 (#13776)
(cherry picked from commit be6ab7f9a6)
2025-09-13 07:19:52 -07:00
Ozkan Sezer 05c9b16183 alsa: fix signature of snd_pcm_info_free
Reference issue: https://github.com/libsdl-org/SDL/issues/13845.
2025-09-02 17:02:28 +03:00
Sam Lantinga 2db8436d8c Updated to version 2.32.11 for development 2025-09-01 15:12:02 -07:00
44 changed files with 454 additions and 121 deletions

No files matched your search

+5 -23
View File
@@ -20,7 +20,6 @@ class AppleArch(Enum):
class MsvcArch(Enum):
X86 = "x86"
X64 = "x64"
Arm32 = "arm"
Arm64 = "arm64"
@@ -97,7 +96,6 @@ class JobSpec:
msvc_static_crt: bool = False
clang_cl: bool = False
gdk: bool = False
uwp: bool = False
vita_gles: Optional[VitaGLES] = None
watcom_platform: Optional[WatcomPlatform] = None
@@ -113,9 +111,7 @@ JOB_SPECS = {
"msvc-static-x64": JobSpec(name="Windows (MSVC, static VCRT, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_static_crt=True, ),
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"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-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", ),
@@ -367,10 +363,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
"-DCMAKE_EXE_LINKER_FLAGS=-DEBUG",
"-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG",
))
if spec.uwp:
job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>DLL'")
else:
job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>'")
job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>'")
if spec.clang_cl:
job.cmake_arguments.extend((
@@ -402,21 +395,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.msvc_vcvars_arch = "x64_x86"
case MsvcArch.X64:
job.msvc_vcvars_arch = "x64"
case MsvcArch.Arm32:
job.msvc_vcvars_arch = "x64_arm"
job.msvc_vcvars_sdk = "10.0.22621.0" # 10.0.26100.0 dropped ARM32 um and ucrt libraries
job.run_tests = False
case MsvcArch.Arm64:
job.msvc_vcvars_arch = "x64_arm64"
job.run_tests = False
if spec.uwp:
job.build_tests = False
job.cmake_arguments.extend((
"-DCMAKE_SYSTEM_NAME=WindowsStore",
"-DCMAKE_SYSTEM_VERSION=10.0",
))
job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0")
elif spec.gdk:
if spec.gdk:
job.setup_gdk_folder = "VisualC-GDK"
else:
match spec.msvc_arch:
@@ -656,7 +638,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
match spec.platform:
case SdlPlatform.FreeBSD:
job.cpactions_os = "freebsd"
job.cpactions_version = "14.2"
job.cpactions_version = "14.3"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg update"
job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd"
@@ -672,10 +654,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
case SdlPlatform.OpenBSD:
job.cpactions_os = "openbsd"
job.cpactions_version = "7.4"
job.cpactions_version = "7.7"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg_add -u"
job.cpactions_install_cmd = "sudo pkg_add cmake ninja pkgconf wayland wayland-protocols xwayland libxkbcommon libinotify pulseaudio dbus ibus"
job.cpactions_install_cmd = "sudo pkg_add cmake ninja pkgconf wayland wayland-protocols libxkbcommon libinotify pulseaudio dbus ibus"
case SdlPlatform.Watcom:
match spec.watcom_platform:
case WatcomPlatform.OS2:
+1 -1
View File
@@ -264,7 +264,7 @@ jobs:
- name: 'Build (cross-platform-actions, BSD)'
id: cpactions
if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.27.0
uses: cross-platform-actions/action@v0.29.0
with:
operating_system: '${{ matrix.platform.cpactions-os }}'
architecture: '${{ matrix.platform.cpactions-arch }}'
+1 -1
View File
@@ -89,7 +89,7 @@ endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 32)
set(SDL_MICRO_VERSION 10)
set(SDL_MICRO_VERSION 11)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# Set defaults preventing destination file conflicts
+1 -1
View File
@@ -15,7 +15,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 32
MICRO_VERSION = 10
MICRO_VERSION = 11
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2
+1 -1
View File
@@ -6,7 +6,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 32
MICRO_VERSION = 10
MICRO_VERSION = 11
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
LIBHOME = .
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.32.10</string>
<string>2.32.11</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.32.10</string>
<string>2.32.11</string>
</dict>
</plist>
+6 -6
View File
@@ -9729,7 +9729,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.10.0;
DYLIB_CURRENT_VERSION = 3201.11.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.10;
MARKETING_VERSION = 2.32.11;
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.10.0;
DYLIB_CURRENT_VERSION = 3201.11.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.10;
MARKETING_VERSION = 2.32.11;
OTHER_LDFLAGS = "-liconv";
};
name = Debug;
@@ -10063,7 +10063,7 @@
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.10.0;
DYLIB_CURRENT_VERSION = 3201.11.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.10.0;
DYLIB_CURRENT_VERSION = 3201.11.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 2.32.10
Title SDL 2.32.11
Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
+4 -4
View File
@@ -11,15 +11,15 @@ android {
if (buildAsApplication) {
namespace "org.libsdl.app"
}
compileSdkVersion 34
compileSdkVersion 35
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
minSdkVersion 21
targetSdkVersion 35
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-19"
arguments "APP_PLATFORM=android-21"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
// cmake {
@@ -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 = 10;
private static final int SDL_MICRO_VERSION = 11;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
+1 -1
View File
@@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.android.tools.build:gradle:8.6.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
+1 -1
View File
@@ -1,6 +1,6 @@
#Thu Nov 11 18:20:34 PST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -1
View File
@@ -3516,7 +3516,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=32
SDL_MICRO_VERSION=10
SDL_MICRO_VERSION=11
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
+1 -1
View File
@@ -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=10
SDL_MICRO_VERSION=11
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
+5 -1
View File
@@ -11,7 +11,7 @@ Credit to
## Building
To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
```bash
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/share/ps2dev.cmake
cmake --build build
cmake --install build
```
@@ -19,6 +19,10 @@ cmake --install build
## Hints
The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
- `SDL_HINT_PS2_GS_WIDTH`: Width of the framebuffer. Defaults to 640.
- `SDL_HINT_PS2_GS_HEIGHT`: Height of the framebuffer. Defaults to 448.
- `SDL_HINT_PS2_GS_PROGRESSIVE`: Whether to use progressive, instead of interlaced. Defaults to 0.
- `SDL_HINT_PS2_GS_MODE`: Regional standard of the signal. "NTSC" (60hz), "PAL" (50hz) or "" (the console's region, default).
## Notes
If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
+1 -1
View File
@@ -33,7 +33,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__
#if defined(__clang__) && !_SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
+33 -2
View File
@@ -1262,8 +1262,8 @@ extern "C" {
*
* This variable can be set to the following values:
*
* - "0": RAWINPUT drivers are not used
* - "1": RAWINPUT drivers are used (the default)
* - "0": RAWINPUT drivers are not used (the default)
* - "1": RAWINPUT drivers are used
*/
#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
@@ -2024,6 +2024,37 @@ extern "C" {
*/
#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED"
/**
* Variable controlling the width of the PS2's framebuffer in pixels
*
* By default, this variable is "640"
*/
#define SDL_HINT_PS2_GS_WIDTH "SDL_PS2_GS_WIDTH"
/**
* Variable controlling the height of the PS2's framebuffer in pixels
*
* By default, this variable is "448"
*/
#define SDL_HINT_PS2_GS_HEIGHT "SDL_PS2_GS_HEIGHT"
/**
* Variable controlling whether the signal is interlaced or progressive
*
* - "0": Image is interlaced. (default)
* - "1": Image is progressive
*/
#define SDL_HINT_PS2_GS_PROGRESSIVE "SDL_PS2_GS_PROGRESSIVE"
/**
* Variable controlling the video mode of the console
*
* - "": Console-native. (default)
* - "NTSC": 60hz region
* - "PAL": 50hz region
*/
#define SDL_HINT_PS2_GS_MODE "SDL_PS2_GS_MODE"
/**
* A variable controlling if VSYNC is automatically disable if doesn't reach
* the enough FPS
+1
View File
@@ -565,6 +565,7 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
return;
}
switch (dwords % 4) {
default:
case 0: do { *_p++ = _val; SDL_FALLTHROUGH;
case 3: *_p++ = _val; SDL_FALLTHROUGH;
case 2: *_p++ = _val; SDL_FALLTHROUGH;
+1 -1
View File
@@ -58,7 +58,7 @@ typedef struct SDL_version
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 32
#define SDL_PATCHLEVEL 10
#define SDL_PATCHLEVEL 11
/**
* Macro to determine SDL version program was compiled against.
+8 -3
View File
@@ -678,6 +678,7 @@ static int SDLCALL SDL_RunAudio(void *userdata)
int data_len = 0;
Uint8 *data;
Uint8 *device_buf_keepsafe = NULL;
Uint32 delay;
SDL_assert(!device->iscapture);
@@ -761,7 +762,7 @@ static int SDLCALL SDL_RunAudio(void *userdata)
SDL_assert((got <= 0) || (got == device->spec.size));
if (data == NULL) { /* device is having issues... */
const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
delay = ((device->spec.samples * 1000) / device->spec.freq);
SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */
} else {
if (got != device->spec.size) {
@@ -781,7 +782,7 @@ static int SDLCALL SDL_RunAudio(void *userdata)
}
} else if (data == device->work_buffer) {
/* nothing to do; pause like we queued a buffer to play. */
const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
delay = ((device->spec.samples * 1000) / device->spec.freq);
SDL_Delay(delay);
} else { /* writing directly to the device. */
/* queue this buffer and wait for it to finish playing. */
@@ -791,7 +792,11 @@ static int SDLCALL SDL_RunAudio(void *userdata)
}
/* Wait for the audio to drain. */
SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
delay = ((device->spec.samples * 1000) / device->spec.freq) * 2;
if (delay > 100) {
delay = 100;
}
SDL_Delay(delay);
current_audio.impl.ThreadDeinit(device);
+45 -6
View File
@@ -62,6 +62,7 @@ static int (*ALSA_snd_pcm_hw_params_set_access)(snd_pcm_t *, snd_pcm_hw_params_t
static int (*ALSA_snd_pcm_hw_params_set_format)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
static int (*ALSA_snd_pcm_hw_params_set_channels)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
static int (*ALSA_snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *, unsigned int *);
static int (*ALSA_snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *, unsigned int*, int*);
static int (*ALSA_snd_pcm_hw_params_set_rate_near)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
static int (*ALSA_snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
static int (*ALSA_snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
@@ -88,7 +89,7 @@ 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 *);
static void (*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);
@@ -138,6 +139,7 @@ static int load_alsa_syms(void)
SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
SDL_ALSA_SYM(snd_pcm_hw_params_get_rate);
SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
@@ -470,6 +472,9 @@ static void ALSA_CloseDevice(_THIS)
ALSA_snd_pcm_drop() can hang, so don't use that.
*/
Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2;
if (delay > 100) {
delay = 100;
}
SDL_Delay(delay);
ALSA_snd_pcm_close(this->hidden->pcm_handle);
@@ -780,6 +785,16 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
char *desc;
char *handle = NULL;
char *ptr;
snd_pcm_t *pcm_handle;
snd_pcm_stream_t stream;
snd_pcm_hw_params_t *hwparams;
unsigned int freq = 0;
int dir;
unsigned int channels = 0;
snd_pcm_uframes_t samples = 0;
SDL_AudioSpec spec;
if (!dev) {
return;
@@ -819,12 +834,36 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
SDL_free(dev);
return;
}
stream = iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK;
if (ALSA_snd_pcm_open(&pcm_handle, handle, stream, SND_PCM_NONBLOCK) < 0) {
SDL_free(dev);
return;
}
/* Note that spec is NULL, because we are required to open the device before
* acquiring the mix format, making this information inaccessible at
* enumeration time
*/
SDL_AddAudioDevice(iscapture, desc, NULL, handle);
snd_pcm_hw_params_alloca(&hwparams);
ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
ALSA_snd_pcm_hw_params_get_rate(hwparams, &freq, &dir);
ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
ALSA_snd_pcm_hw_params_get_period_size(hwparams, &samples, &dir);
ALSA_snd_pcm_close(pcm_handle);
/* Let's fill the spec */
spec.freq = freq;
spec.channels = channels;
spec.samples = samples;
spec.silence = 0;
spec.padding = 0;
/* Can't calculate size yet because this is an exploratory device opening
* so we don't know the sample format.
* Probably AUDIO_S16SYS/SND_PCM_FORMAT_S16_LE would be a good default
* if required.*/
spec.size = 0;
SDL_AddAudioDevice(iscapture, desc, &spec, handle);
if (hint) {
free(desc);
}
+18
View File
@@ -199,6 +199,24 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO
}
#endif
BOOL WIN_IsWine(void)
{
static SDL_bool checked;
static SDL_bool is_wine;
if (!checked) {
HMODULE ntdll = LoadLibrary(TEXT("ntdll.dll"));
if (ntdll) {
if (GetProcAddress(ntdll, "wine_get_version") != NULL) {
is_wine = SDL_TRUE;
}
FreeLibrary(ntdll);
}
checked = SDL_TRUE;
}
return is_wine;
}
BOOL WIN_IsWindowsVistaOrGreater(void)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
+3
View File
@@ -136,6 +136,9 @@ extern void WIN_CoUninitialize(void);
extern HRESULT WIN_RoInitialize(void);
extern void WIN_RoUninitialize(void);
/* Returns true if we're running on Wine */
extern BOOL WIN_IsWine(void);
/* Returns SDL_TRUE if we're running on Windows Vista and newer */
extern BOOL WIN_IsWindowsVistaOrGreater(void);
+10 -11
View File
@@ -50,13 +50,12 @@
#endif
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */
#elif defined(__OpenBSD__) && defined(__powerpc__)
#elif defined(__OpenBSD__) && defined(__powerpc__) && !defined(HAVE_ELF_AUX_INFO)
#include <sys/types.h>
#include <sys/sysctl.h> /* For AltiVec check */
#include <machine/cpu.h>
#elif defined(__FreeBSD__) && defined(__powerpc__)
#elif defined(__FreeBSD__) && defined(__powerpc__) && defined(HAVE_ELF_AUX_INFO)
#include <machine/cpu.h>
#include <sys/auxv.h>
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
#include <signal.h>
#include <setjmp.h>
@@ -343,7 +342,12 @@ static int CPU_haveAltiVec(void)
{
volatile int altivec = 0;
#ifndef SDL_CPUINFO_DISABLED
#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
#if (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__powerpc__) && defined(HAVE_ELF_AUX_INFO)
unsigned long cpufeatures = 0;
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
return altivec;
#elif (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
#ifdef __OpenBSD__
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
#else
@@ -355,11 +359,6 @@ static int CPU_haveAltiVec(void)
if (0 == error) {
altivec = (hasVectorUnit != 0);
}
#elif defined(__FreeBSD__) && defined(__powerpc__)
unsigned long cpufeatures = 0;
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)
@@ -489,8 +488,6 @@ static int CPU_haveNEON(void)
return 0; /* assume anything else from Apple doesn't have NEON. */
#elif !defined(__arm__)
return 0; /* not an ARM CPU at all. */
#elif defined(__OpenBSD__)
return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */
#elif defined(HAVE_ELF_AUX_INFO)
unsigned long hasneon = 0;
if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0) {
@@ -527,6 +524,8 @@ static int CPU_haveNEON(void)
}
return 0;
}
#elif defined(__OpenBSD__)
return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */
#else
#warning SDL_HasNEON is not implemented for this ARM platform. Write me.
return 0;
+9
View File
@@ -1121,6 +1121,15 @@ int SDL_WarpMouseGlobal(int x, int y)
static SDL_bool ShouldUseRelativeModeWarp(SDL_Mouse *mouse)
{
#ifdef SDL_VIDEO_DRIVER_WAYLAND
SDL_VideoDevice *vid = SDL_GetVideoDevice();
/* Wayland can't warp the mouse, but uses this hint internally to deliver accelerated motion */
if (SDL_strcmp(vid->name, "wayland") == 0) {
return SDL_FALSE;
}
#endif
if (!mouse->WarpMouse) {
/* Need this functionality for relative mode warp implementation */
return SDL_FALSE;
+3 -1
View File
@@ -49,8 +49,10 @@ static SDL_bool send_foregrounding_pending = SDL_FALSE;
static void SDL_HandleSIG(int sig)
{
/* Reset the signal handler */
#ifndef HAVE_SIGACTION
/* Reset the signal handler if it was installed with signal() */
(void)signal(sig, SDL_HandleSIG);
#endif
/* Send a quit event next time the event loop pumps. */
/* We can't send it in signal handler; SDL_malloc() might be interrupted! */
+5
View File
@@ -1337,6 +1337,11 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
#endif
#ifdef HAVE_LIBUSB
for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
if (use_libusb_whitelist) {
if (!IsInWhitelist(usb_dev->vendor_id, usb_dev->product_id)) {
continue;
}
}
if (raw_dev->vendor_id == usb_dev->vendor_id &&
raw_dev->product_id == usb_dev->product_id &&
(raw_dev->interface_number < 0 || raw_dev->interface_number == usb_dev->interface_number)) {
+8 -2
View File
@@ -37,6 +37,10 @@
#include "../events/SDL_events_c.h"
#endif
#if defined(__WIN32__)
#include "../core/windows/SDL_windows.h"
#endif
#if defined(__ANDROID__)
#include "SDL_system.h"
#endif
@@ -1984,7 +1988,7 @@ const char *SDL_GameControllerPathForIndex(int joystick_index)
SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index)
{
SDL_JoystickGUID joystick_guid = SDL_JoystickGetDeviceGUID(joystick_index);
const char *mapping = SDL_GameControllerMappingForGUID(joystick_guid);
char *mapping = SDL_GameControllerMappingForGUID(joystick_guid);
char *type_string, *comma;
SDL_GameControllerType type;
if (mapping) {
@@ -1999,8 +2003,10 @@ SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index)
} else {
type = SDL_GetGameControllerTypeFromString(type_string);
}
SDL_free(mapping);
return type;
}
SDL_free(mapping);
}
return SDL_GetJoystickGameControllerTypeFromGUID(joystick_guid, SDL_JoystickNameForIndex(joystick_index));
}
@@ -2128,7 +2134,7 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
#ifdef __WIN32__
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE) &&
SDL_GetHintBoolean("STEAM_COMPAT_PROTON", SDL_FALSE)) {
WIN_IsWine()) {
/* We are launched by Steam and running under Proton
* We can't tell whether this controller is a Steam Virtual Gamepad,
* so assume that Proton is doing the appropriate filtering of controllers
+35
View File
@@ -31,6 +31,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#endif
#ifdef __LINUX__
#include <unistd.h>
#endif
#define SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE "SteamVirtualGamepadInfo"
@@ -123,6 +126,28 @@ static void AddVirtualGamepadInfo(int slot, SDL_SteamVirtualGamepadInfo *info)
SDL_zerop(info);
}
#ifdef __LINUX__
static const char *SDL_GetExeName(void)
{
const char *proc_name = NULL;
static char linkfile[1024];
int linksize;
const char *proc_path = "/proc/self/exe";
linksize = readlink(proc_path, linkfile, sizeof(linkfile) - 1);
if (linksize > 0) {
linkfile[linksize] = '\0';
proc_name = SDL_strrchr(linkfile, '/');
if (proc_name) {
++proc_name;
} else {
proc_name = linkfile;
}
}
return proc_name;
}
#endif /* __LINUX__ */
void SDL_InitSteamVirtualGamepadInfo(void)
{
const char *file;
@@ -131,6 +156,16 @@ void SDL_InitSteamVirtualGamepadInfo(void)
file = SDL_GetHint(SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
if (file && *file) {
#ifdef __LINUX__
/* Older versions of Wine will blacklist the Steam Virtual Gamepad if
* it appears to have the real controller's VID/PID, so ignore this.
*/
const char *exe = SDL_GetExeName();
if (exe && SDL_strcmp(exe, "wine64-preloader") == 0) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Wine launched by Steam, ignoring %s", SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
return;
}
#endif
SDL_steam_virtual_gamepad_info_file = SDL_strdup(file);
}
SDL_UpdateSteamVirtualGamepadInfo();
+16 -6
View File
@@ -40,17 +40,18 @@ static int numjoysticks = 0;
static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
{
SDL_joylist_item *item;
int i;
SDL_joylist_item *item;
SDL_LockJoysticks();
if (JoystickByIndex(gamepadEvent->index) != NULL) {
return 1;
goto done;
}
item = (SDL_joylist_item *)SDL_malloc(sizeof(SDL_joylist_item));
if (!item) {
return 1;
goto done;
}
SDL_zerop(item);
@@ -59,14 +60,14 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
item->name = SDL_CreateJoystickName(0, 0, NULL, gamepadEvent->id);
if (!item->name) {
SDL_free(item);
return 1;
goto done;
}
item->mapping = SDL_strdup(gamepadEvent->mapping);
if (!item->mapping) {
SDL_free(item->name);
SDL_free(item);
return 1;
goto done;
}
item->naxes = gamepadEvent->numAxes;
@@ -103,6 +104,9 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
SDL_Log("Added joystick with index %d", item->index);
#endif
done:
SDL_UnlockJoysticks();
return 1;
}
@@ -111,6 +115,8 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
SDL_joylist_item *item = SDL_joylist;
SDL_joylist_item *prev = NULL;
SDL_LockJoysticks();
while (item) {
if (item->index == gamepadEvent->index) {
break;
@@ -120,7 +126,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
}
if (!item) {
return 1;
goto done;
}
if (item->joystick) {
@@ -148,6 +154,10 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
SDL_free(item->name);
SDL_free(item->mapping);
SDL_free(item);
done:
SDL_UnlockJoysticks();
return 1;
}
+18 -16
View File
@@ -644,13 +644,6 @@ static void RotatePad(int *pX, int *pY, float flAngleInRad)
*pX = (int)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (int)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
}
static void RotatePadShort(short *pX, short *pY, float flAngleInRad)
{
short int origX = *pX, origY = *pY;
*pX = (short)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (short)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
}
//---------------------------------------------------------------------------
// Format the first part of the state packet
@@ -774,9 +767,16 @@ static void FormatStatePacketUntilGyro(SteamControllerStateInternal_t *pState, V
//---------------------------------------------------------------------------
static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, SteamControllerStateInternal_t *pState)
{
const float flRotationAngle = 0.261799f;
int nLeftPadX;
int nLeftPadY;
int nRightPadX;
int nRightPadY;
int nPadOffset;
uint32_t ucOptionDataMask;
// 15 degrees in rad
const float flRotationAngle = 0.261799f;
pState->unPacketNum++;
ucOptionDataMask = (*pData++ & 0xF0);
ucOptionDataMask |= (uint32_t)(*pData++) << 8;
@@ -805,7 +805,6 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
}
if (ucOptionDataMask & k_EBLELeftTrackpadChunk) {
int nLength = sizeof(pState->sLeftPadX) + sizeof(pState->sLeftPadY);
int nPadOffset;
SDL_memcpy(&pState->sLeftPadX, pData, nLength);
if (pState->ulButtons & STEAM_LEFTPAD_FINGERDOWN_MASK) {
nPadOffset = 1000;
@@ -813,14 +812,15 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
nPadOffset = 0;
}
RotatePadShort(&pState->sLeftPadX, &pState->sLeftPadY, -flRotationAngle);
pState->sLeftPadX = clamp(pState->sLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = clamp(pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
nLeftPadX = pState->sLeftPadX;
nLeftPadY = pState->sLeftPadY;
RotatePad(&nLeftPadX, &nLeftPadY, -flRotationAngle);
pState->sLeftPadX = (short)clamp(nLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = (short)clamp(nLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLERightTrackpadChunk) {
int nLength = sizeof(pState->sRightPadX) + sizeof(pState->sRightPadY);
int nPadOffset = 0;
SDL_memcpy(&pState->sRightPadX, pData, nLength);
@@ -830,9 +830,11 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
nPadOffset = 0;
}
RotatePadShort(&pState->sRightPadX, &pState->sRightPadY, flRotationAngle);
pState->sRightPadX = clamp(pState->sRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = clamp(pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
nRightPadX = pState->sRightPadX;
nRightPadY = pState->sRightPadY;
RotatePad(&nRightPadX, &nRightPadY, flRotationAngle);
pState->sRightPadX = (short)clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = (short)clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLEIMUAccelChunk) {
+1 -1
View File
@@ -1027,7 +1027,7 @@ static int RAWINPUT_JoystickInit(void)
{
SDL_assert(!SDL_RAWINPUT_inited);
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_TRUE)) {
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT, SDL_FALSE)) {
return 0;
}
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,32,10,0
PRODUCTVERSION 2,32,10,0
FILEVERSION 2,32,11,0
PRODUCTVERSION 2,32,11,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "2, 32, 10, 0\0"
VALUE "FileVersion", "2, 32, 11, 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, 10, 0\0"
VALUE "ProductVersion", "2, 32, 11, 0\0"
END
END
BLOCK "VarFileInfo"
+36 -2
View File
@@ -624,8 +624,42 @@ static int PS2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, Uint32
gsGlobal = gsKit_init_global_custom(RENDER_QUEUE_OS_POOLSIZE, RENDER_QUEUE_PER_POOLSIZE);
gsGlobal->Mode = GS_MODE_NTSC;
gsGlobal->Height = 448;
// GS interlaced/progressive
if (SDL_GetHintBoolean(SDL_HINT_PS2_GS_PROGRESSIVE, false)) {
gsGlobal->Interlace = GS_NONINTERLACED;
} else {
gsGlobal->Interlace = GS_INTERLACED;
}
// GS width/height
gsGlobal->Width = 0;
gsGlobal->Height = 0;
const char *hint = SDL_GetHint(SDL_HINT_PS2_GS_WIDTH);
if (hint) {
gsGlobal->Width = SDL_atoi(hint);
}
hint = SDL_GetHint(SDL_HINT_PS2_GS_HEIGHT);
if (hint) {
gsGlobal->Height = SDL_atoi(hint);
}
if (gsGlobal->Width <= 0) {
gsGlobal->Width = 640;
}
if (gsGlobal->Height <= 0) {
gsGlobal->Height = 448;
}
// GS region
hint = SDL_GetHint(SDL_HINT_PS2_GS_MODE);
if (hint) {
if (SDL_strcasecmp(SDL_GetHint(SDL_HINT_PS2_GS_MODE), "NTSC") == 0) {
gsGlobal->Mode = GS_MODE_NTSC;
}
if (SDL_strcasecmp(SDL_GetHint(SDL_HINT_PS2_GS_MODE), "PAL") == 0) {
gsGlobal->Mode = GS_MODE_PAL;
}
}
gsGlobal->PSM = GS_PSM_CT24;
gsGlobal->PSMZ = GS_PSMZ_16S;
+67 -2
View File
@@ -412,6 +412,66 @@ static void BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo *info)
#endif /* __MMX__ */
#if defined(__loongarch_sx)
static void
BlitRGBtoRGBPixelAlphaLSX(SDL_BlitInfo * info)
{
int width = info->dst_w;
int height = info->dst_h;
Uint32 *srcp = (Uint32 *) info->src;
int srcskip = info->src_skip >> 2;
Uint32 *dstp = (Uint32 *) info->dst;
int dstskip = info->dst_skip >> 2;
SDL_PixelFormat *sf = info->src_fmt;
Uint32 amask = sf->Amask;
Uint32 ashift = sf->Ashift;
Uint64 multmask, multmask2;
__m128i src1, src2, src3, dst1, alpha, alpha2;
multmask = 0x00FF;
multmask <<= (ashift * 2);
multmask2 = 0x00FF00FF00FF00FFULL;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP4({
Uint32 alpha1 = *srcp & amask;
if (alpha1 == 0) {
/* do nothing */
} else if (alpha1 == amask) {
*dstp = *srcp;
} else {
src1 = __lsx_vreplgr2vr_w(*srcp);
src1 = __lsx_vinsgr2vr_w(src1, *dstp, 1);
src2 = __lsx_vsllwil_hu_bu(src1, 0);
alpha = __lsx_vreplgr2vr_w(alpha1);
alpha = __lsx_vsrl_d(alpha, __lsx_vreplgr2vr_d(ashift));
alpha = __lsx_vilvl_h(alpha, alpha);
alpha2 = __lsx_vilvl_w(alpha, alpha);
alpha = __lsx_vor_v(alpha2, __lsx_vreplgr2vr_d(multmask));
alpha2 = __lsx_vxor_v(alpha2, __lsx_vreplgr2vr_d(multmask2));
src3 = __lsx_vilvl_d(alpha2, alpha);
src1 = __lsx_vmul_h(src2, src3);
src1 = __lsx_vsrli_h(src1, 8);
src2 = __lsx_vilvh_d(src1, src1);
src1 = __lsx_vadd_h(src1, src2);
dst1 = __lsx_vssrlni_bu_h(src1, src1, 0);
__lsx_vstelm_w(dst1, dstp, 0, 0);
}
++srcp;
++dstp;
}, width);
/* *INDENT-ON* */
srcp += srcskip;
dstp += dstskip;
}
}
#endif /* __loongarch_sx */
#ifdef SDL_ARM_SIMD_BLITTERS
void BlitARGBto565PixelAlphaARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride);
@@ -1456,7 +1516,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
case 4:
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
#if defined(__MMX__) || defined(__3dNOW__)
#if defined(__MMX__) || defined(__3dNOW__) || defined(__loongarch_sx)
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
#ifdef __3dNOW__
if (SDL_Has3DNow()) {
@@ -1467,9 +1527,14 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
if (SDL_HasMMX()) {
return BlitRGBtoRGBPixelAlphaMMX;
}
#endif
#ifdef __loongarch_sx
if (SDL_HasLSX()) {
return BlitRGBtoRGBPixelAlphaLSX;
}
#endif
}
#endif /* __MMX__ || __3dNOW__ */
#endif /* __MMX__ || __3dNOW__ || __loongarch_sx*/
if (sf->Amask == 0xff000000) {
#ifdef SDL_ARM_NEON_BLITTERS
if (SDL_HasNEON()) {
+12
View File
@@ -1186,6 +1186,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
/* max 2 key+value pairs, plus terminator. */
EGLint attribs[5];
int attr = 0;
int opaque_ext_idx = -1;
EGLSurface *surface;
@@ -1220,6 +1221,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
#ifdef EGL_EXT_present_opaque
if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_EXT_present_opaque")) {
const SDL_bool allow_transparent = SDL_GetHintBoolean(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, SDL_FALSE);
opaque_ext_idx = attr;
attribs[attr++] = EGL_PRESENT_OPAQUE_EXT;
attribs[attr++] = allow_transparent ? EGL_FALSE : EGL_TRUE;
}
@@ -1231,6 +1233,16 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
_this->egl_data->egl_display,
_this->egl_data->egl_config,
nw, &attribs[0]);
if (surface == EGL_NO_SURFACE) {
/* we had a report of Nvidia drivers that report EGL_BAD_ATTRIBUTE if you try to
* use EGL_PRESENT_OPAQUE_EXT, even when EGL_EXT_present_opaque is reported as available.
* If we used it, try a second time without this attribute. */
if ((_this->egl_data->eglGetError() == EGL_BAD_ATTRIBUTE) && (opaque_ext_idx >= 0)) {
SDL_memmove(&attribs[opaque_ext_idx], &attribs[opaque_ext_idx + 2], sizeof (attribs[0]) * ((attr - opaque_ext_idx) - 2));
surface = _this->egl_data->eglCreateWindowSurface(_this->egl_data->egl_display, _this->egl_data->egl_config, nw, &attribs[0]);
}
}
if (surface == EGL_NO_SURFACE) {
SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface");
}
+62
View File
@@ -135,6 +135,61 @@ DEFINE_SSE_FILLRECT(4, Uint32)
/* *INDENT-ON* */ /* clang-format on */
#endif /* __SSE__ */
#if defined(__loongarch_sx)
#define LSX_BEGIN __m128i c128 = __lsx_vreplgr2vr_w(color);
#define LSX_WORK \
for (i = n / 64; i--;) { \
__lsx_vst(c128, p, 0); \
__lsx_vst(c128, p, 16); \
__lsx_vst(c128, p, 32); \
__lsx_vst(c128, p, 48); \
p += 64; \
}
#define DEFINE_LSX_FILLRECT(bpp, type) \
static void \
SDL_FillRect##bpp##LSX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
{ \
int i, n; \
Uint8 *p = NULL; \
\
LSX_BEGIN; \
\
while (h--) { \
n = w * bpp; \
p = pixels; \
\
if (n > 63) { \
int adjust = 16 - ((uintptr_t)p & 15); \
if (adjust < 16) { \
n -= adjust; \
adjust /= bpp; \
while (adjust--) { \
*((type *)p) = (type)color; \
p += bpp; \
} \
} \
LSX_WORK; \
} \
if (n & 63) { \
int remainder = (n & 63); \
remainder /= bpp; \
while (remainder--) { \
*((type *)p) = (type)color; \
p += bpp; \
} \
} \
pixels += pitch; \
} \
\
}
DEFINE_LSX_FILLRECT(4, Uint32)
#endif
static void SDL_FillRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
int n;
@@ -423,6 +478,13 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
break;
}
#endif
#ifdef __loongarch_sx
if (SDL_HasLSX()) {
fill_function = SDL_FillRect4LSX;
break;
}
#endif
fill_function = SDL_FillRect4;
break;
}
-6
View File
@@ -31,8 +31,6 @@ SDL_bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
} else if (!B) {
SDL_InvalidParamError("B");
return SDL_FALSE;
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) {
return SDL_FALSE; /* Special cases for empty rects */
}
/* Horizontal intersection */
@@ -79,10 +77,6 @@ SDL_bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *resul
} else if (!result) {
SDL_InvalidParamError("result");
return SDL_FALSE;
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { /* Special cases for empty rects */
result->w = 0;
result->h = 0;
return SDL_FALSE;
}
/* Horizontal intersection */
+2
View File
@@ -295,9 +295,11 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
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 _SDL_HAS_BUILTIN(__builtin_available)
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 */
}
#endif
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. */
+2 -1
View File
@@ -338,6 +338,7 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
unsigned w, h;
int rc = -1;
int num_planes = 0;
int i;
uint32_t format, strides[4] = { 0 }, handles[4] = { 0 }, offsets[4] = { 0 }, flags = 0;
uint64_t modifiers[4] = { 0 };
@@ -374,7 +375,7 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
modifiers[0] = KMSDRM_gbm_bo_get_modifier(bo);
num_planes = KMSDRM_gbm_bo_get_plane_count(bo);
for (int i = 0; i < num_planes; i++) {
for (i = 0; i < num_planes; i++) {
strides[i] = KMSDRM_gbm_bo_get_stride_for_plane(bo, i);
handles[i] = KMSDRM_gbm_bo_get_handle_for_plane(bo, i).u32;
offsets[i] = KMSDRM_gbm_bo_get_offset(bo, i);
+14 -9
View File
@@ -2681,23 +2681,28 @@ static void relative_pointer_handle_relative_motion(void *data,
struct SDL_WaylandInput *input = data;
SDL_VideoData *d = input->display;
SDL_WindowData *window = input->pointer_focus;
double dx_unaccel;
double dy_unaccel;
double dx;
double dy;
double dx_mod;
double dy_mod;
dx_unaccel = wl_fixed_to_double(dx_unaccel_w);
dy_unaccel = wl_fixed_to_double(dy_unaccel_w);
if (!d->relative_mode_accelerated) {
dx = wl_fixed_to_double(dx_unaccel_w);
dy = wl_fixed_to_double(dy_unaccel_w);
} else {
dx = wl_fixed_to_double(dx_w) * (window ? window->pointer_scale_x : 1.0);
dy = wl_fixed_to_double(dy_w) * (window ? window->pointer_scale_y : 1.0);
}
/* Add left over fraction from last event. */
dx_unaccel += input->dx_frac;
dy_unaccel += input->dy_frac;
dx += input->dx_frac;
dy += input->dy_frac;
input->dx_frac = modf(dx_unaccel, &dx);
input->dy_frac = modf(dy_unaccel, &dy);
input->dx_frac = modf(dx, &dx_mod);
input->dy_frac = modf(dy, &dy_mod);
if (input->pointer_focus && d->relative_mouse_mode) {
SDL_SendMouseMotion(window->sdlwindow, 0, 1, (int)dx, (int)dy);
SDL_SendMouseMotion(window->sdlwindow, 0, 1, (int)dx_mod, (int)dy_mod);
}
}
+3
View File
@@ -537,6 +537,9 @@ static int Wayland_SetRelativeMouseMode(SDL_bool enabled)
SDL_VideoData *data = (SDL_VideoData *)vd->driverdata;
if (enabled) {
/* Clients use relative warp mode to get accelerated motion deltas, which Wayland delivers internally. */
data->relative_mode_accelerated = SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE);
/* Disable mouse warp emulation if it's enabled. */
if (data->input->relative_mode_override) {
data->input->relative_mode_override = SDL_FALSE;
+1
View File
@@ -101,6 +101,7 @@ typedef struct
char *classname;
int relative_mouse_mode;
int relative_mode_accelerated;
SDL_bool egl_transparency_enabled;
} SDL_VideoData;
+4 -1
View File
@@ -250,7 +250,10 @@ static void WIN_FreeCursor(SDL_Cursor *cursor)
static int WIN_ShowCursor(SDL_Cursor *cursor)
{
if (!cursor) {
cursor = SDL_blank_cursor;
if (GetSystemMetrics(SM_REMOTESESSION)) {
// Use a blank cursor so we continue to get relative motion over RDP
cursor = SDL_blank_cursor;
}
}
if (cursor) {
SDL_cursor = (HCURSOR)cursor->driverdata;