Compare commits
43
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a96677bdf6 | ||
|
|
67f89d0a2b | ||
|
|
f6de8877ec | ||
|
|
7c189b1f17 | ||
|
|
a7947080c0 | ||
|
|
08c82a3781 | ||
|
|
589aea50c2 | ||
|
|
72acd7c9df | ||
|
|
1a70d1158e | ||
|
|
ae915c6516 | ||
|
|
54d573332e | ||
|
|
0204a69f6b | ||
|
|
b2689ff76a | ||
|
|
611940fb80 | ||
|
|
16c0329a2a | ||
|
|
2743716132 | ||
|
|
a744eee993 | ||
|
|
0e24267eb5 | ||
|
|
f4d6043aa4 | ||
|
|
9fb9bd31a3 | ||
|
|
c3828bb0a3 | ||
|
|
40371f0907 | ||
|
|
94f9434564 | ||
|
|
bfaf247d30 | ||
|
|
2287c43b59 | ||
|
|
15cc0f5f91 | ||
|
|
68e0108b1c | ||
|
|
7b3796bc39 | ||
|
|
b5bc6d2cc4 | ||
|
|
0d1d4ea1f9 | ||
|
|
1a48f897f2 | ||
|
|
2b42789de6 | ||
|
|
b9c1da10ba | ||
|
|
56f5a76696 | ||
|
|
c7e8977e60 | ||
|
|
e6ba3612db | ||
|
|
5e77fb314c | ||
|
|
1a2841deb1 | ||
|
|
688637eca8 | ||
|
|
85d1d70ca1 | ||
|
|
09356c709a | ||
|
|
07b9e86d02 | ||
|
|
8e46e5d8b4 |
No files matched your search
@@ -54,6 +54,7 @@ class SdlPlatform(Enum):
|
||||
Riscos = "riscos"
|
||||
FreeBSD = "freebsd"
|
||||
NetBSD = "netbsd"
|
||||
OpenBSD = "openbsd"
|
||||
|
||||
|
||||
class Msys2Platform(Enum):
|
||||
@@ -137,6 +138,7 @@ JOB_SPECS = {
|
||||
"vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ),
|
||||
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
|
||||
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ),
|
||||
"openbsd": JobSpec(name="OpenBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.OpenBSD, artifact="SDL-openbsd-x64", ),
|
||||
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ),
|
||||
}
|
||||
|
||||
@@ -554,6 +556,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
"testmultiaudio-apk",
|
||||
"testsprite-apk",
|
||||
]
|
||||
|
||||
# -fPIC is required after updating NDK from 21 to 28
|
||||
job.cflags.append("-fPIC")
|
||||
job.cxxflags.append("-fPIC")
|
||||
case SdlPlatform.Emscripten:
|
||||
job.clang_tidy = False # clang-tidy does not understand -gsource-map
|
||||
job.shared = False
|
||||
@@ -720,7 +726,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
))
|
||||
job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake"
|
||||
job.static_lib = StaticLibType.A
|
||||
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD:
|
||||
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD | SdlPlatform.OpenBSD:
|
||||
job.cpactions = True
|
||||
job.no_cmake = True
|
||||
job.run_tests = False
|
||||
@@ -744,6 +750,12 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
job.cpactions_arch = "x86-64"
|
||||
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
|
||||
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_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"
|
||||
case _:
|
||||
raise ValueError(f"Unsupported platform={spec.platform}")
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
id: setup-ndk
|
||||
with:
|
||||
local-cache: true
|
||||
ndk-version: r21e
|
||||
ndk-version: r28c
|
||||
- name: 'Configure Android NDK variables'
|
||||
if: ${{ matrix.platform.android-ndk }}
|
||||
shell: sh
|
||||
@@ -406,6 +406,14 @@ jobs:
|
||||
build-scripts/test-versioning.sh
|
||||
python build-scripts/check_android_jni.py
|
||||
python build-scripts/check_stdlib_usage.py
|
||||
- name: 'Verify alignment of Android test apks'
|
||||
if: ${{ matrix.platform.android-ndk && !matrix.platform.no-cmake }}
|
||||
run: |
|
||||
find ./ -iname '*.apk' | xargs -L1 ./build-scripts/check_elf_alignment.sh
|
||||
- name: 'Verify alignment of Android .so files'
|
||||
if: ${{ matrix.platform.android-ndk && !matrix.platform.no-cmake }}
|
||||
run: |
|
||||
find ./ -iname '*.so' | xargs -L1 ./build-scripts/check_elf_alignment.sh
|
||||
- name: 'Upload binary package'
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') && (matrix.platform.enable-artifacts || steps.tests.outcome == 'failure') }}
|
||||
@@ -428,4 +436,4 @@ jobs:
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: '${{ matrix.platform.artifact }}-apks'
|
||||
path: build/test/*.apk
|
||||
path: build/test/*.apk
|
||||
@@ -535,7 +535,7 @@ jobs:
|
||||
uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
local-cache: true
|
||||
ndk-version: r21e
|
||||
ndk-version: r28c
|
||||
- name: 'Setup Java JDK'
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
||||
@@ -107,10 +107,6 @@ LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
|
||||
|
||||
LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script=$(LOCAL_PATH)/src/dynapi/SDL_dynapi.sym
|
||||
|
||||
# https://developer.android.com/guide/practices/page-sizes
|
||||
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
|
||||
LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384"
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
cmd-strip :=
|
||||
endif
|
||||
|
||||
+33
-40
@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
# See docs/release_checklist.md
|
||||
project(SDL3 LANGUAGES C VERSION "3.2.20")
|
||||
project(SDL3 LANGUAGES C VERSION "3.2.22")
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDL3_MAINPROJECT ON)
|
||||
@@ -183,29 +183,6 @@ if(MSVC)
|
||||
set(SDL_RELOCATABLE_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(NOT SDL_LIBC)
|
||||
# Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
|
||||
endforeach(flag_var)
|
||||
set(CMAKE_MSVC_RUNTIME_CHECKS "")
|
||||
endif()
|
||||
|
||||
if(MSVC_CLANG)
|
||||
# clang-cl treats /W4 as '-Wall -Wextra' -- we don't need -Wextra
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
string(REGEX REPLACE "/W4" "/W3" ${flag_var} "${${flag_var}}")
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SDL_SHARED_DEFAULT ON)
|
||||
set(SDL_STATIC_DEFAULT ON)
|
||||
|
||||
@@ -424,6 +401,29 @@ if(SDL_PRESEED)
|
||||
SDL_Preseed_CMakeCache()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(NOT SDL_LIBC)
|
||||
# Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
|
||||
endforeach(flag_var)
|
||||
set(CMAKE_MSVC_RUNTIME_CHECKS "")
|
||||
endif()
|
||||
|
||||
if(MSVC_CLANG)
|
||||
# clang-cl treats /W4 as '-Wall -Wextra' -- we don't need -Wextra
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
string(REGEX REPLACE "/W4" "/W3" ${flag_var} "${${flag_var}}")
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_SHARED)
|
||||
add_library(SDL3-shared SHARED)
|
||||
add_library(SDL3::SDL3-shared ALIAS SDL3-shared)
|
||||
@@ -761,19 +761,14 @@ if(SDL_ASSEMBLY)
|
||||
if(SDL_SSE4_2)
|
||||
cmake_push_check_state()
|
||||
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2 -mcrc32")
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <nmmintrin.h>
|
||||
unsigned calc_crc32c(const char *text, unsigned len) {
|
||||
unsigned crc32c = ~0;
|
||||
for (; len >= 4; len -= 4, text += 4) {
|
||||
crc32c = (unsigned)_mm_crc32_u32(crc32c, *(unsigned*)text);
|
||||
}
|
||||
return crc32c;
|
||||
}
|
||||
__m128i bitmask;
|
||||
char data[16];
|
||||
int main(int argc, char **argv) {
|
||||
calc_crc32c(\"SDL_SSE4\",8);
|
||||
bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data));
|
||||
return 0;
|
||||
}" COMPILER_SUPPORTS_SSE4_2)
|
||||
cmake_pop_check_state()
|
||||
@@ -1060,8 +1055,10 @@ if(SDL_LIBC)
|
||||
cmake_push_check_state()
|
||||
if(MSVC)
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -we4244 -WX") # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
else()
|
||||
elseif(HAVE_GCC_WFLOAT_CONVERSION)
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -Wfloat-conversion -Werror")
|
||||
else()
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -Wconversion -Werror")
|
||||
endif()
|
||||
foreach(math_fn isinf isnan)
|
||||
string(TOUPPER "${math_fn}" MATH_FN)
|
||||
@@ -1099,6 +1096,7 @@ if(SDL_LIBC)
|
||||
check_symbol_exists(gethostname "unistd.h" HAVE_GETHOSTNAME)
|
||||
check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
|
||||
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
|
||||
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
|
||||
check_symbol_exists(gmtime_r "time.h" HAVE_GMTIME_R)
|
||||
@@ -1487,11 +1485,6 @@ if(ANDROID)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET SDL3-shared)
|
||||
target_link_options(SDL3-shared PRIVATE "-Wl,-z,max-page-size=16384")
|
||||
target_link_options(SDL3-shared PRIVATE "-Wl,-z,common-page-size=16384")
|
||||
endif()
|
||||
|
||||
elseif(EMSCRIPTEN)
|
||||
# Hide noisy warnings that intend to aid mostly during initial stages of porting a new
|
||||
# project. Uncomment at will for verbose cross-compiling -I/../ path info.
|
||||
@@ -2965,7 +2958,7 @@ if(WINDOWS)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/windows/*.c")
|
||||
set(SDL_PROCESS_WINDOWS 1)
|
||||
set(HAVE_SDL_PROCESS TRUE)
|
||||
else()
|
||||
elseif(NOT ANDROID)
|
||||
check_c_source_compiles("
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.2.20</string>
|
||||
<string>3.2.22</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.2.20</string>
|
||||
<string>3.2.22</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -3086,7 +3086,7 @@
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 201.20.0;
|
||||
DYLIB_CURRENT_VERSION = 201.22.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -3121,7 +3121,7 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.2.20;
|
||||
MARKETING_VERSION = 3.2.22;
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
|
||||
PRODUCT_NAME = SDL3;
|
||||
@@ -3150,7 +3150,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 201.20.0;
|
||||
DYLIB_CURRENT_VERSION = 201.22.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -3182,7 +3182,7 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.2.20;
|
||||
MARKETING_VERSION = 3.2.22;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title SDL 3.2.20
|
||||
Title SDL 3.2.22
|
||||
Version 1
|
||||
Description SDL Library for macOS (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
||||
@@ -19,7 +19,7 @@ android {
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
cmake {
|
||||
arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DAPP_SUPPORT_FLEXIBLE_PAGE_SIZES=true"
|
||||
arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static"
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
|
||||
@@ -8,6 +8,3 @@ APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
|
||||
|
||||
# Min runtime API level
|
||||
APP_PLATFORM=android-21
|
||||
|
||||
# https://developer.android.com/guide/practices/page-sizes#update-packaging
|
||||
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
|
||||
@@ -26,9 +26,4 @@ endif()
|
||||
add_library(main SHARED
|
||||
YourSourceHere.c
|
||||
)
|
||||
|
||||
#https://developer.android.com/guide/practices/page-sizes#update-packaging
|
||||
target_link_options(main PRIVATE "-Wl,-z,max-page-size=16384")
|
||||
target_link_options(main PRIVATE "-Wl,-z,common-page-size=16384")
|
||||
|
||||
target_link_libraries(main PRIVATE SDL3::SDL3)
|
||||
@@ -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 = 3;
|
||||
private static final int SDL_MINOR_VERSION = 2;
|
||||
private static final int SDL_MICRO_VERSION = 20;
|
||||
private static final int SDL_MICRO_VERSION = 22;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
@@ -30,7 +30,6 @@ abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64"
|
||||
obj=
|
||||
lib=
|
||||
ndk_args=
|
||||
flexpage=true
|
||||
|
||||
# Allow an external caller to specify locations and platform.
|
||||
while [ $# -gt 0 ]; do
|
||||
@@ -43,8 +42,6 @@ while [ $# -gt 0 ]; do
|
||||
platform=${arg#APP_PLATFORM=}
|
||||
elif [ "${arg:0:8}" == "APP_ABI=" ]; then
|
||||
abi=${arg#APP_ABI=}
|
||||
elif [ "${arg:0:32}" == "APP_SUPPORT_FLEXIBLE_PAGE_SIZES=" ]; then
|
||||
flexpage=${arg#APP_SUPPORT_FLEXIBLE_PAGE_SIZES=}
|
||||
else
|
||||
ndk_args="$ndk_args $arg"
|
||||
fi
|
||||
@@ -70,9 +67,6 @@ done
|
||||
# APP_* variables set in the environment here will not be seen by the
|
||||
# ndk-build makefile segments that use them, e.g., default-application.mk.
|
||||
# For consistency, pass all values on the command line.
|
||||
#
|
||||
# Add support for Google Play 16 KB Page size requirement:
|
||||
# https://developer.android.com/guide/practices/page-sizes#ndk-build
|
||||
ndk-build \
|
||||
NDK_PROJECT_PATH=null \
|
||||
NDK_OUT=$obj \
|
||||
@@ -81,5 +75,4 @@ ndk-build \
|
||||
APP_ABI="$abi" \
|
||||
APP_PLATFORM="$platform" \
|
||||
APP_MODULES="SDL3" \
|
||||
APP_SUPPORT_FLEXIBLE_PAGE_SIZES="$flexpage" \
|
||||
$ndk_args
|
||||
@@ -542,6 +542,7 @@ class AndroidApiVersion:
|
||||
def __repr__(self) -> str:
|
||||
return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>"
|
||||
|
||||
ANDROID_ABI_EXTRA_LINK_OPTIONS = {}
|
||||
|
||||
class Releaser:
|
||||
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
|
||||
@@ -1013,6 +1014,7 @@ class Releaser:
|
||||
android_devel_file_tree = ArchiveFileTree()
|
||||
|
||||
for android_abi in android_abis:
|
||||
extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS.get(android_abi, "")
|
||||
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
|
||||
build_dir = self.root / "build-android" / f"{android_abi}-build"
|
||||
install_dir = self.root / "install-android" / f"{android_abi}-install"
|
||||
@@ -1023,8 +1025,11 @@ class Releaser:
|
||||
"cmake",
|
||||
"-S", str(self.root),
|
||||
"-B", str(build_dir),
|
||||
f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
# NDK 21e does not support -ffile-prefix-map
|
||||
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
|
||||
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
|
||||
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
|
||||
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
|
||||
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
|
||||
@@ -1530,7 +1535,7 @@ def main(argv=None) -> int:
|
||||
parser.error("Invalid --android-api, and/or could not be detected")
|
||||
android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}"
|
||||
if not android_api_path.is_dir():
|
||||
parser.error(f"Android API directory does not exist ({android_api_path})")
|
||||
logger.warning(f"Android API directory does not exist ({android_api_path})")
|
||||
with section_printer.group("Android arguments"):
|
||||
print(f"android_home = {args.android_home}")
|
||||
print(f"android_ndk_home = {args.android_ndk_home}")
|
||||
|
||||
Executable
+127
@@ -0,0 +1,127 @@
|
||||
#!/bin/bash
|
||||
progname="${0##*/}"
|
||||
progname="${progname%.sh}"
|
||||
|
||||
# usage: check_elf_alignment.sh [path to *.so files|path to *.apk]
|
||||
|
||||
cleanup_trap() {
|
||||
if [ -n "${tmp}" -a -d "${tmp}" ]; then
|
||||
rm -rf ${tmp}
|
||||
fi
|
||||
exit $1
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Host side script to check the ELF alignment of shared libraries."
|
||||
echo "Shared libraries are reported ALIGNED when their ELF regions are"
|
||||
echo "16 KB or 64 KB aligned. Otherwise they are reported as UNALIGNED."
|
||||
echo
|
||||
echo "Usage: ${progname} [input-path|input-APK|input-APEX]"
|
||||
}
|
||||
|
||||
if [ ${#} -ne 1 ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
case ${1} in
|
||||
--help | -h | -\?)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
dir="${1}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -f "${dir}" -o -d "${dir}" ]; then
|
||||
echo "Invalid file: ${dir}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${dir}" == *.apk ]]; then
|
||||
trap 'cleanup_trap' EXIT
|
||||
|
||||
echo
|
||||
echo "Recursively analyzing $dir"
|
||||
echo
|
||||
|
||||
if { zipalign --help 2>&1 | grep -q "\-P <pagesize_kb>"; }; then
|
||||
echo "=== APK zip-alignment ==="
|
||||
zipalign -v -c -P 16 4 "${dir}" | egrep 'lib/arm64-v8a|lib/x86_64|Verification'
|
||||
echo "========================="
|
||||
else
|
||||
echo "NOTICE: Zip alignment check requires build-tools version 35.0.0-rc3 or higher."
|
||||
echo " You can install the latest build-tools by running the below command"
|
||||
echo " and updating your \$PATH:"
|
||||
echo
|
||||
echo " sdkmanager \"build-tools;35.0.0-rc3\""
|
||||
fi
|
||||
|
||||
dir_filename=$(basename "${dir}")
|
||||
tmp=$(mktemp -d -t "${dir_filename%.apk}_out_XXXXX")
|
||||
unzip "${dir}" lib/* -d "${tmp}" >/dev/null 2>&1
|
||||
dir="${tmp}"
|
||||
fi
|
||||
|
||||
if [[ "${dir}" == *.apex ]]; then
|
||||
trap 'cleanup_trap' EXIT
|
||||
|
||||
echo
|
||||
echo "Recursively analyzing $dir"
|
||||
echo
|
||||
|
||||
dir_filename=$(basename "${dir}")
|
||||
tmp=$(mktemp -d -t "${dir_filename%.apex}_out_XXXXX")
|
||||
deapexer extract "${dir}" "${tmp}" || { echo "Failed to deapex." && exit 1; }
|
||||
dir="${tmp}"
|
||||
fi
|
||||
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
ENDCOLOR="\e[0m"
|
||||
|
||||
unaligned_libs=()
|
||||
unaligned_critical_libs=()
|
||||
|
||||
echo
|
||||
echo "=== ELF alignment ==="
|
||||
|
||||
matches="$(find "${dir}" -type f)"
|
||||
IFS=$'\n'
|
||||
for match in $matches; do
|
||||
# We could recursively call this script or rewrite it to though.
|
||||
[[ "${match}" == *".apk" ]] && echo "WARNING: doesn't recursively inspect .apk file: ${match}"
|
||||
[[ "${match}" == *".apex" ]] && echo "WARNING: doesn't recursively inspect .apex file: ${match}"
|
||||
|
||||
[[ $(file "${match}") == *"ELF"* ]] || continue
|
||||
|
||||
res="$(objdump -p "${match}" | grep LOAD | awk '{ print $NF }' | head -1)"
|
||||
if [[ $res =~ 2\*\*(1[4-9]|[2-9][0-9]|[1-9][0-9]{2,}) ]]; then
|
||||
echo -e "${match}: ${GREEN}ALIGNED${ENDCOLOR} ($res)"
|
||||
else
|
||||
unaligned_libs+=("${match}")
|
||||
# Check if this is a critical architecture (arm64-v8a or x86_64)
|
||||
if [[ "${match}" == *"arm64-v8a"* ]] || [[ "${match}" == *"x86_64"* ]]; then
|
||||
unaligned_critical_libs+=("${match}")
|
||||
echo -e "${match}: ${RED}UNALIGNED${ENDCOLOR} ($res)"
|
||||
else
|
||||
echo -e "${match}: UNALIGNED ($res)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#unaligned_libs[@]} -gt 0 ]; then
|
||||
echo -e "Found ${#unaligned_libs[@]} unaligned libs (only arm64-v8a/x86_64 libs need to be aligned).${ENDCOLOR}"
|
||||
fi
|
||||
echo "====================="
|
||||
|
||||
# Exit with appropriate code: 1 if critical unaligned libs found, 0 otherwise
|
||||
if [ ${#unaligned_critical_libs[@]} -gt 0 ]; then
|
||||
echo -e "${RED}Found ${#unaligned_critical_libs[@]} critical unaligned libs.${ENDCOLOR}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}ELF Verification Successful${ENDCOLOR}"
|
||||
exit 0
|
||||
fi
|
||||
@@ -183,7 +183,7 @@
|
||||
],
|
||||
"api-minimum": 21,
|
||||
"api-target": 35,
|
||||
"ndk-minimum": 21,
|
||||
"ndk-minimum": 28,
|
||||
"aar-files": {
|
||||
"": [
|
||||
"android-project/app/proguard-rules.pro:proguard.txt",
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# libtool assumes that the compiler can handle the -fPIC flag
|
||||
# This isn't always true (for example, nasm can't handle it)
|
||||
command=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-?PIC)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
-fno-common)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
*)
|
||||
command="$command $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
echo $command
|
||||
exec $command
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main include header for the SDL library, version 3.2.20
|
||||
* Main include header for the SDL library, version 3.2.22
|
||||
*
|
||||
* It is almost always best to include just this one header instead of
|
||||
* picking out individual headers included here. There are exceptions to
|
||||
|
||||
@@ -126,7 +126,7 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1310
|
||||
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
|
||||
/* Don't include intrin.h here because it contains C++ code */
|
||||
extern void __cdecl __debugbreak(void);
|
||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||
|
||||
@@ -119,7 +119,7 @@ typedef struct SDL_CameraSpec
|
||||
int width; /**< Frame width */
|
||||
int height; /**< Frame height */
|
||||
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
||||
int framerate_denominator; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
||||
int framerate_denominator; /**< Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
||||
} SDL_CameraSpec;
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,7 +128,7 @@ _m_prefetch(void *__P)
|
||||
* \sa SDL_BIG_ENDIAN
|
||||
*/
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
|
||||
#elif defined(SDL_PLATFORM_LINUX)
|
||||
#elif defined(SDL_PLATFORM_LINUX) || defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER __BYTE_ORDER
|
||||
#elif defined(SDL_PLATFORM_SOLARIS)
|
||||
|
||||
@@ -224,8 +224,8 @@
|
||||
* - `drawIndirectFirstInstance`
|
||||
*
|
||||
* **D3D12:** Supported on Windows 10 or newer, Xbox One (GDK), and Xbox
|
||||
* Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level
|
||||
* 11_1.
|
||||
* Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and
|
||||
* Resource Binding Tier 2 or above.
|
||||
*
|
||||
* **Metal:** Supported on macOS 10.14+ and iOS/tvOS 13.0+. Hardware
|
||||
* requirements vary by operating system:
|
||||
@@ -1091,7 +1091,7 @@ typedef enum SDL_GPUCompareOp
|
||||
SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */
|
||||
SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */
|
||||
SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */
|
||||
SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */
|
||||
SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evaluates reference >= test. */
|
||||
SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */
|
||||
} SDL_GPUCompareOp;
|
||||
|
||||
@@ -2648,7 +2648,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel(
|
||||
const char *text);
|
||||
|
||||
/**
|
||||
* Begins a debug group with an arbitary name.
|
||||
* Begins a debug group with an arbitrary name.
|
||||
*
|
||||
* Used for denoting groups of calls when viewing the command buffer
|
||||
* callstream in a graphics debugging tool.
|
||||
|
||||
@@ -595,7 +595,7 @@ extern "C" {
|
||||
* A variable that limits what CPU features are available.
|
||||
*
|
||||
* By default, SDL marks all features the current CPU supports as available.
|
||||
* This hint allows to limit these to a subset.
|
||||
* This hint allows the enabled features to be limited to a subset.
|
||||
*
|
||||
* When the hint is unset, or empty, SDL will enable all detected CPU
|
||||
* features.
|
||||
|
||||
@@ -2612,7 +2612,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, flo
|
||||
* Draw debug text to an SDL_Renderer.
|
||||
*
|
||||
* This function will render a printf()-style format string to a renderer.
|
||||
* Note that this is a convinence function for debugging, with severe
|
||||
* Note that this is a convenience function for debugging, with severe
|
||||
* limitations, and is not intended to be used for production apps and games.
|
||||
*
|
||||
* For the full list of limitations and other useful information, see
|
||||
|
||||
@@ -138,7 +138,8 @@ typedef enum SDL_SensorType
|
||||
SDL_SENSOR_ACCEL_L, /**< Accelerometer for left Joy-Con controller and Wii nunchuk */
|
||||
SDL_SENSOR_GYRO_L, /**< Gyroscope for left Joy-Con controller */
|
||||
SDL_SENSOR_ACCEL_R, /**< Accelerometer for right Joy-Con controller */
|
||||
SDL_SENSOR_GYRO_R /**< Gyroscope for right Joy-Con controller */
|
||||
SDL_SENSOR_GYRO_R, /**< Gyroscope for right Joy-Con controller */
|
||||
SDL_SENSOR_COUNT
|
||||
} SDL_SensorType;
|
||||
|
||||
|
||||
|
||||
@@ -3426,7 +3426,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes
|
||||
* Convert an integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3454,7 +3454,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_itoa(int value, char *str, int radix);
|
||||
* Convert an unsigned integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3482,7 +3482,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_uitoa(unsigned int value, char *str, int
|
||||
* Convert a long integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3510,7 +3510,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix);
|
||||
* Convert an unsigned long integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3540,7 +3540,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int
|
||||
* Convert a long long integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3568,7 +3568,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int rad
|
||||
* Convert an unsigned long long integer into a string.
|
||||
*
|
||||
* This requires a radix to specified for string format. Specifying 10
|
||||
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
|
||||
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
|
||||
* to 36.
|
||||
*
|
||||
* Note that this function will overflow a buffer if `str` is not large enough
|
||||
@@ -3923,7 +3923,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Searches a string for the first occurence of any character contained in a
|
||||
* Searches a string for the first occurrence of any character contained in a
|
||||
* breakset, and returns a pointer from the string to that character.
|
||||
*
|
||||
* \param str The null-terminated string to be searched. Must not be NULL, and
|
||||
@@ -3931,7 +3931,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *st
|
||||
* \param breakset A null-terminated string containing the list of characters
|
||||
* to look for. Must not be NULL, and must not overlap with
|
||||
* `str`.
|
||||
* \returns A pointer to the location, in str, of the first occurence of a
|
||||
* \returns A pointer to the location, in str, of the first occurrence of a
|
||||
* character present in the breakset, or NULL if none is found.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
@@ -5821,7 +5821,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
||||
* This function converts text between encodings, reading from and writing to
|
||||
* a buffer.
|
||||
*
|
||||
* It returns the number of succesful conversions on success. On error,
|
||||
* It returns the number of successful conversions on success. On error,
|
||||
* SDL_ICONV_E2BIG is returned when the output buffer is too small, or
|
||||
* SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered,
|
||||
* or SDL_ICONV_EINVAL is returned when an incomplete input sequence is
|
||||
|
||||
@@ -62,7 +62,7 @@ extern "C" {
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MICRO_VERSION 20
|
||||
#define SDL_MICRO_VERSION 22
|
||||
|
||||
/**
|
||||
* This macro turns the version numbers into a numeric value.
|
||||
|
||||
@@ -1473,7 +1473,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
|
||||
* - `SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`: the `(__unsafe_unretained)`
|
||||
* NSWindow associated with the window
|
||||
* - `SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
|
||||
* assocated with metal views on the window
|
||||
* associated with metal views on the window
|
||||
*
|
||||
* On OpenVR:
|
||||
*
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
#cmakedefine HAVE_MEMFD_CREATE 1
|
||||
#cmakedefine HAVE_POSIX_FALLOCATE 1
|
||||
#cmakedefine HAVE_SIGACTION 1
|
||||
#cmakedefine HAVE_SIGTIMEDWAIT 1
|
||||
#cmakedefine HAVE_SA_SIGACTION 1
|
||||
#cmakedefine HAVE_ST_MTIM 1
|
||||
#cmakedefine HAVE_SETJMP 1
|
||||
|
||||
@@ -420,7 +420,8 @@ static bool UpdateAudioSession(SDL_AudioDevice *device, bool open, bool allow_pl
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
|
||||
if (hint) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0 ||
|
||||
SDL_strcasecmp(hint, "ambient") == 0) {
|
||||
category = AVAudioSessionCategoryAmbient;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
|
||||
category = AVAudioSessionCategorySoloAmbient;
|
||||
|
||||
@@ -426,28 +426,33 @@ static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device)
|
||||
|
||||
static bool OPENSLES_CreatePCMPlayer(SDL_AudioDevice *device)
|
||||
{
|
||||
/* If we want to add floating point audio support (requires API level 21)
|
||||
it can be done as described here:
|
||||
https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
|
||||
*/
|
||||
/* according to https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android,
|
||||
Android's OpenSL ES only supports Uint8 and _littleendian_ Sint16.
|
||||
(and float32, with an extension we use, below.) */
|
||||
if (SDL_GetAndroidSDKVersion() >= 21) {
|
||||
const SDL_AudioFormat *closefmts = SDL_ClosestAudioFormats(device->spec.format);
|
||||
SDL_AudioFormat test_format;
|
||||
while ((test_format = *(closefmts++)) != 0) {
|
||||
if (SDL_AUDIO_ISSIGNED(test_format)) {
|
||||
switch (test_format) {
|
||||
case SDL_AUDIO_U8:
|
||||
case SDL_AUDIO_S16LE:
|
||||
case SDL_AUDIO_F32:
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!test_format) {
|
||||
// Didn't find a compatible format :
|
||||
LOGI("No compatible audio format, using signed 16-bit audio");
|
||||
test_format = SDL_AUDIO_S16;
|
||||
LOGI("No compatible audio format, using signed 16-bit LE audio");
|
||||
test_format = SDL_AUDIO_S16LE;
|
||||
}
|
||||
device->spec.format = test_format;
|
||||
} else {
|
||||
// Just go with signed 16-bit audio as it's the most compatible
|
||||
device->spec.format = SDL_AUDIO_S16;
|
||||
device->spec.format = SDL_AUDIO_S16LE;
|
||||
}
|
||||
|
||||
// Update the fragment size as size in bytes
|
||||
|
||||
@@ -1080,7 +1080,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)(
|
||||
{
|
||||
const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
|
||||
|
||||
SDL_AddTouch((SDL_TouchID)touchId, SDL_TOUCH_DEVICE_DIRECT, utfname);
|
||||
SDL_AddTouch(Android_ConvertJavaTouchID(touchId),
|
||||
SDL_TOUCH_DEVICE_DIRECT, utfname);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, name, utfname);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "SDL_fcitx.h"
|
||||
#include "../../video/SDL_sysvideo.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "../../core/unix/SDL_appid.h"
|
||||
#include "SDL_dbus.h"
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
@@ -53,32 +54,14 @@ typedef struct FcitxClient
|
||||
|
||||
static FcitxClient fcitx_client;
|
||||
|
||||
static char *GetAppName(void)
|
||||
static const char *GetAppName(void)
|
||||
{
|
||||
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD)
|
||||
char *spot;
|
||||
char procfile[1024];
|
||||
char linkfile[1024];
|
||||
int linksize;
|
||||
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
|
||||
#elif defined(SDL_PLATFORM_FREEBSD)
|
||||
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
|
||||
#endif
|
||||
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
|
||||
if (linksize > 0) {
|
||||
linkfile[linksize] = '\0';
|
||||
spot = SDL_strrchr(linkfile, '/');
|
||||
if (spot) {
|
||||
return SDL_strdup(spot + 1);
|
||||
} else {
|
||||
return SDL_strdup(linkfile);
|
||||
}
|
||||
const char *exe_name = SDL_GetExeName();
|
||||
if (exe_name) {
|
||||
return exe_name;
|
||||
}
|
||||
#endif // SDL_PLATFORM_LINUX || SDL_PLATFORM_FREEBSD
|
||||
|
||||
return SDL_strdup("SDL_App");
|
||||
return "SDL_App";
|
||||
}
|
||||
|
||||
static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
@@ -281,7 +264,7 @@ static bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appname,
|
||||
|
||||
static bool FcitxClientCreateIC(FcitxClient *client)
|
||||
{
|
||||
char *appname = GetAppName();
|
||||
const char *appname = GetAppName();
|
||||
char *ic_path = NULL;
|
||||
SDL_DBusContext *dbus = client->dbus;
|
||||
|
||||
@@ -290,8 +273,6 @@ static bool FcitxClientCreateIC(FcitxClient *client)
|
||||
ic_path = NULL; // just in case.
|
||||
}
|
||||
|
||||
SDL_free(appname);
|
||||
|
||||
if (ic_path) {
|
||||
SDL_free(client->ic_path);
|
||||
client->ic_path = SDL_strdup(ic_path);
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,2,20,0
|
||||
PRODUCTVERSION 3,2,20,0
|
||||
FILEVERSION 3,2,22,0
|
||||
PRODUCTVERSION 3,2,22,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "3, 2, 20, 0\0"
|
||||
VALUE "FileVersion", "3, 2, 22, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL3.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "3, 2, 20, 0\0"
|
||||
VALUE "ProductVersion", "3, 2, 22, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -78,7 +78,7 @@ static char *search_path_for_binary(const char *bin)
|
||||
char *envr;
|
||||
size_t alloc_size;
|
||||
char *exe = NULL;
|
||||
char *start = envr;
|
||||
char *start;
|
||||
char *ptr;
|
||||
|
||||
if (!envr_real) {
|
||||
@@ -86,7 +86,7 @@ static char *search_path_for_binary(const char *bin)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
envr = SDL_strdup(envr_real);
|
||||
start = envr = SDL_strdup(envr_real);
|
||||
if (!envr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1785,6 +1785,8 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
|
||||
commandBufferHeader->render_pass.num_color_targets = num_color_targets;
|
||||
if (depth_stencil_target_info != NULL) {
|
||||
commandBufferHeader->render_pass.depth_stencil_target = depth_stencil_target_info->texture;
|
||||
} else {
|
||||
commandBufferHeader->render_pass.depth_stencil_target = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,8 +109,8 @@
|
||||
#define DXGI_GET_DEBUG_INTERFACE_FUNC "DXGIGetDebugInterface"
|
||||
#define D3D12_GET_DEBUG_INTERFACE_FUNC "D3D12GetDebugInterface"
|
||||
#define WINDOW_PROPERTY_DATA "SDL_GPUD3D12WindowPropertyData"
|
||||
#define D3D_FEATURE_LEVEL_CHOICE D3D_FEATURE_LEVEL_11_1
|
||||
#define D3D_FEATURE_LEVEL_CHOICE_STR "11_1"
|
||||
#define D3D_FEATURE_LEVEL_CHOICE D3D_FEATURE_LEVEL_11_0
|
||||
#define D3D_FEATURE_LEVEL_CHOICE_STR "11_0"
|
||||
#define MAX_ROOT_SIGNATURE_PARAMETERS 64
|
||||
#define D3D12_FENCE_UNSIGNALED_VALUE 0
|
||||
#define D3D12_FENCE_SIGNAL_VALUE 1
|
||||
@@ -8353,6 +8353,7 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
|
||||
IDXGIFactory4 *factory4;
|
||||
IDXGIFactory6 *factory6;
|
||||
IDXGIAdapter1 *adapter;
|
||||
bool supports_64UAVs = false;
|
||||
|
||||
// Can we load D3D12?
|
||||
|
||||
@@ -8441,12 +8442,39 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(featurelevel, D3D_FEATURE_LEVEL_CHOICE < D3D_FEATURE_LEVEL_11_1);
|
||||
|
||||
// Check feature level 11_1 first, guarantees 64+ UAVs unlike 11_0 Tier1
|
||||
res = D3D12CreateDeviceFunc(
|
||||
(IUnknown *)adapter,
|
||||
D3D_FEATURE_LEVEL_CHOICE,
|
||||
D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_GUID(D3D_IID_ID3D12Device),
|
||||
(void **)&device);
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
supports_64UAVs = true;
|
||||
} else {
|
||||
res = D3D12CreateDeviceFunc(
|
||||
(IUnknown *)adapter,
|
||||
D3D_FEATURE_LEVEL_CHOICE,
|
||||
D3D_GUID(D3D_IID_ID3D12Device),
|
||||
(void **)&device);
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS featureOptions;
|
||||
SDL_zero(featureOptions);
|
||||
|
||||
res = ID3D12Device_CheckFeatureSupport(
|
||||
device,
|
||||
D3D12_FEATURE_D3D12_OPTIONS,
|
||||
&featureOptions,
|
||||
sizeof(featureOptions));
|
||||
if (SUCCEEDED(res) && featureOptions.ResourceBindingTier >= D3D12_RESOURCE_BINDING_TIER_2) {
|
||||
supports_64UAVs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
ID3D12Device_Release(device);
|
||||
}
|
||||
@@ -8456,6 +8484,11 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
|
||||
SDL_UnloadObject(d3d12Dll);
|
||||
SDL_UnloadObject(dxgiDll);
|
||||
|
||||
if (!supports_64UAVs) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Tier 2 Resource binding is not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(res)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Could not create D3D12Device with feature level " D3D_FEATURE_LEVEL_CHOICE_STR);
|
||||
return false;
|
||||
|
||||
@@ -6089,7 +6089,6 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
colorAttachmentReferenceCount += 1;
|
||||
|
||||
if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) {
|
||||
VulkanTextureContainer *resolveContainer = (VulkanTextureContainer *)colorTargetInfos[i].resolve_texture;
|
||||
@@ -6104,12 +6103,16 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
resolveReferences[resolveReferenceCount].attachment = attachmentDescriptionCount;
|
||||
resolveReferences[resolveReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
resolveReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
||||
resolveReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
resolveReferenceCount += 1;
|
||||
} else {
|
||||
resolveReferences[colorAttachmentReferenceCount].attachment = VK_ATTACHMENT_UNUSED;
|
||||
}
|
||||
|
||||
colorAttachmentReferenceCount += 1;
|
||||
}
|
||||
|
||||
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||
@@ -9405,6 +9408,8 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer(
|
||||
commandBuffer->usedUniformBuffers = SDL_malloc(
|
||||
commandBuffer->usedUniformBufferCapacity * sizeof(VulkanUniformBuffer *));
|
||||
|
||||
commandBuffer->swapchainRequested = false;
|
||||
|
||||
// Pool it!
|
||||
|
||||
vulkanCommandPool->inactiveCommandBuffers[vulkanCommandPool->inactiveCommandBufferCount] = commandBuffer;
|
||||
@@ -9587,6 +9592,7 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
|
||||
|
||||
commandBuffer->autoReleaseFence = true;
|
||||
|
||||
commandBuffer->swapchainRequested = false;
|
||||
commandBuffer->isDefrag = 0;
|
||||
|
||||
/* Reset the command buffer here to avoid resets being called
|
||||
@@ -10494,11 +10500,18 @@ static bool VULKAN_Wait(
|
||||
VkResult result;
|
||||
Sint32 i;
|
||||
|
||||
SDL_LockMutex(renderer->submitLock);
|
||||
|
||||
result = renderer->vkDeviceWaitIdle(renderer->logicalDevice);
|
||||
|
||||
CHECK_VULKAN_ERROR_AND_RETURN(result, vkDeviceWaitIdle, false);
|
||||
|
||||
SDL_LockMutex(renderer->submitLock);
|
||||
if (result != VK_SUCCESS) {
|
||||
if (renderer->debugMode) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
|
||||
}
|
||||
SDL_SetError("%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
|
||||
SDL_UnlockMutex(renderer->submitLock);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1) {
|
||||
commandBuffer = renderer->submittedCommandBuffers[i];
|
||||
|
||||
@@ -1117,13 +1117,12 @@ bool SDL_SYS_HapticResume(SDL_Haptic *haptic)
|
||||
*/
|
||||
bool SDL_SYS_HapticStopAll(SDL_Haptic *haptic)
|
||||
{
|
||||
int i, ret;
|
||||
int i;
|
||||
|
||||
// Linux does not support this natively so we have to loop.
|
||||
for (i = 0; i < haptic->neffects; i++) {
|
||||
if (haptic->effects[i].hweffect != NULL) {
|
||||
ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
|
||||
if (ret < 0) {
|
||||
if (!SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i])) {
|
||||
return SDL_SetError("Haptic: Error while trying to stop all playing effects.");
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -260,19 +260,19 @@ static int get_usage(uint8_t *report_descriptor, size_t size,
|
||||
}
|
||||
|
||||
if (key_cmd == 0x4) {
|
||||
*usage_page = get_bytes(report_descriptor, size, data_len, i);
|
||||
*usage_page = (unsigned short)get_bytes(report_descriptor, size, data_len, i);
|
||||
usage_page_found = 1;
|
||||
//printf("Usage Page: %x\n", (uint32_t)*usage_page);
|
||||
}
|
||||
if (key_cmd == 0x8) {
|
||||
if (data_len == 4) { /* Usages 5.5 / Usage Page 6.2.2.7 */
|
||||
*usage_page = get_bytes(report_descriptor, size, 2, i + 2);
|
||||
*usage_page = (unsigned short)get_bytes(report_descriptor, size, 2, i + 2);
|
||||
usage_page_found = 1;
|
||||
*usage = get_bytes(report_descriptor, size, 2, i);
|
||||
*usage = (unsigned short)get_bytes(report_descriptor, size, 2, i);
|
||||
usage_found = 1;
|
||||
}
|
||||
else {
|
||||
*usage = get_bytes(report_descriptor, size, data_len, i);
|
||||
*usage = (unsigned short)get_bytes(report_descriptor, size, data_len, i);
|
||||
usage_found = 1;
|
||||
}
|
||||
//printf("Usage: %x\n", (uint32_t)*usage);
|
||||
@@ -640,7 +640,7 @@ static int hid_get_report_descriptor_libusb(libusb_device_handle *handle, int in
|
||||
/* Get the HID Report Descriptor.
|
||||
See USB HID Specification, section 7.1.1
|
||||
*/
|
||||
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), interface_num, tmp, expected_report_descriptor_size, 5000);
|
||||
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), (uint16_t)interface_num, tmp, expected_report_descriptor_size, 5000);
|
||||
if (res >= 0) {
|
||||
if (res > (int)buf_size)
|
||||
res = (int)buf_size;
|
||||
@@ -1191,7 +1191,7 @@ static void *read_thread(void *param)
|
||||
dev->transfer = libusb_alloc_transfer(0);
|
||||
libusb_fill_interrupt_transfer(dev->transfer,
|
||||
dev->device_handle,
|
||||
dev->input_endpoint,
|
||||
(unsigned char)dev->input_endpoint,
|
||||
buf,
|
||||
(int) length,
|
||||
read_callback,
|
||||
@@ -1610,8 +1610,8 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
|
||||
res = libusb_control_transfer(dev->device_handle,
|
||||
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
|
||||
0x09/*HID Set_Report*/,
|
||||
(2/*HID output*/ << 8) | report_number,
|
||||
dev->interface,
|
||||
(uint16_t)((2/*HID output*/ << 8) | report_number),
|
||||
(uint16_t)dev->interface,
|
||||
(unsigned char *)data, (uint16_t)length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -1627,7 +1627,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
|
||||
/* Use the interrupt out endpoint */
|
||||
int actual_length;
|
||||
res = libusb_interrupt_transfer(dev->device_handle,
|
||||
dev->output_endpoint,
|
||||
(unsigned char)dev->output_endpoint,
|
||||
(unsigned char*)data,
|
||||
(int) length,
|
||||
&actual_length, 1000);
|
||||
@@ -1776,8 +1776,8 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
|
||||
res = libusb_control_transfer(dev->device_handle,
|
||||
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
|
||||
0x09/*HID set_report*/,
|
||||
(3/*HID feature*/ << 8) | report_number,
|
||||
dev->interface,
|
||||
(uint16_t)((3/*HID feature*/ << 8) | report_number),
|
||||
(uint16_t)dev->interface,
|
||||
(unsigned char *)data, (uint16_t)length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -1807,8 +1807,8 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
||||
res = libusb_control_transfer(dev->device_handle,
|
||||
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN,
|
||||
0x01/*HID get_report*/,
|
||||
(3/*HID feature*/ << 8) | report_number,
|
||||
dev->interface,
|
||||
(uint16_t)((3/*HID feature*/ << 8) | report_number),
|
||||
(uint16_t)dev->interface,
|
||||
(unsigned char *)data, (uint16_t)length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -1837,8 +1837,8 @@ int HID_API_EXPORT HID_API_CALL hid_get_input_report(hid_device *dev, unsigned c
|
||||
res = libusb_control_transfer(dev->device_handle,
|
||||
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN,
|
||||
0x01/*HID get_report*/,
|
||||
(1/*HID Input*/ << 8) | report_number,
|
||||
dev->interface,
|
||||
(uint16_t)((1/*HID Input*/ << 8) | report_number),
|
||||
(uint16_t)dev->interface,
|
||||
(unsigned char *)data, (uint16_t)length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -1930,7 +1930,7 @@ int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index
|
||||
{
|
||||
wchar_t *str;
|
||||
|
||||
str = get_usb_string(dev->device_handle, string_index);
|
||||
str = get_usb_string(dev->device_handle, (uint8_t)string_index);
|
||||
if (str) {
|
||||
wcsncpy(string, str, maxlen);
|
||||
string[maxlen-1] = L'\0';
|
||||
@@ -2118,7 +2118,7 @@ uint16_t get_usb_code_for_current_locale(void)
|
||||
/* Chop off the encoding part, and make it lower case. */
|
||||
ptr = search_string;
|
||||
while (*ptr) {
|
||||
*ptr = tolower(*ptr);
|
||||
*ptr = (char)tolower(*ptr);
|
||||
if (*ptr == '.') {
|
||||
*ptr = '\0';
|
||||
break;
|
||||
@@ -2139,7 +2139,7 @@ uint16_t get_usb_code_for_current_locale(void)
|
||||
/* Chop off the variant. Chop it off at the '_'. */
|
||||
ptr = search_string;
|
||||
while (*ptr) {
|
||||
*ptr = tolower(*ptr);
|
||||
*ptr = (char)tolower(*ptr);
|
||||
if (*ptr == '_') {
|
||||
*ptr = '\0';
|
||||
break;
|
||||
|
||||
@@ -2683,8 +2683,8 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
|
||||
}
|
||||
#endif
|
||||
|
||||
if (name && SDL_strcmp(name, "uinput-fpc") == 0) {
|
||||
// The Google Pixel fingerprint sensor reports itself as a joystick
|
||||
if (name && SDL_startswith(name, "uinput-")) {
|
||||
// The Google Pixel fingerprint sensor, as well as other fingerprint sensors, reports itself as a joystick
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +328,10 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (SDL_ShouldIgnoreJoystick(vendor_id, product_id, 0, name)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_JOYSTICK
|
||||
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
|
||||
#endif
|
||||
|
||||
@@ -305,6 +305,7 @@ static SDL_JoystickID EMSCRIPTEN_JoystickGetDeviceInstanceID(int device_index)
|
||||
static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
{
|
||||
SDL_joylist_item *item = JoystickByDeviceIndex(device_index);
|
||||
bool rumble_available = false;
|
||||
|
||||
if (!item) {
|
||||
return SDL_SetError("No such device");
|
||||
@@ -323,6 +324,22 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
joystick->nbuttons = item->nbuttons;
|
||||
joystick->naxes = item->naxes;
|
||||
|
||||
rumble_available = EM_ASM_INT({
|
||||
let gamepads = navigator['getGamepads']();
|
||||
if (!gamepads) {
|
||||
return 0;
|
||||
}
|
||||
let gamepad = gamepads[$0];
|
||||
if (!gamepad || !gamepad['vibrationActuator']) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}, item->index);
|
||||
|
||||
if (rumble_available) {
|
||||
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -390,7 +407,29 @@ static SDL_GUID EMSCRIPTEN_JoystickGetDeviceGUID(int device_index)
|
||||
|
||||
static bool EMSCRIPTEN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
|
||||
|
||||
// clang-format off
|
||||
bool result = EM_ASM_INT({
|
||||
let gamepads = navigator['getGamepads']();
|
||||
if (!gamepads) {
|
||||
return 0;
|
||||
}
|
||||
let gamepad = gamepads[$0];
|
||||
if (!gamepad || !gamepad['vibrationActuator']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
gamepad['vibrationActuator']['playEffect']('dual-rumble', {
|
||||
'startDelay': 0,
|
||||
'duration': 3000,
|
||||
'weakMagnitude': $1 / 0xFFFF,
|
||||
'strongMagnitude': $2 / 0xFFFF,
|
||||
});
|
||||
return 1;
|
||||
}, item->index, low_frequency_rumble, high_frequency_rumble);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool EMSCRIPTEN_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
|
||||
@@ -471,7 +471,7 @@ bool SDL_SendJoystickVirtualSensorDataInner(SDL_Joystick *joystick, SDL_SensorTy
|
||||
return false;
|
||||
}
|
||||
hwdata->sensor_events = sensor_events;
|
||||
hwdata->max_sensor_events = hwdata->max_sensor_events;
|
||||
hwdata->max_sensor_events = new_max_sensor_events;
|
||||
}
|
||||
|
||||
VirtualSensorEvent *event = &hwdata->sensor_events[hwdata->num_sensor_events++];
|
||||
|
||||
@@ -3306,10 +3306,6 @@ bool SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||
return SDL_InvalidParamError("blendMode");
|
||||
}
|
||||
|
||||
if (blendMode == SDL_BLENDMODE_INVALID) {
|
||||
return SDL_InvalidParamError("blendMode");
|
||||
}
|
||||
|
||||
if (!IsSupportedBlendMode(renderer, blendMode)) {
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
+12
-1
@@ -173,6 +173,7 @@ static VideoBootStrap *bootstrap[] = {
|
||||
#if defined(SDL_PLATFORM_MACOS) && defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
// Support for macOS fullscreen spaces, etc.
|
||||
extern bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window);
|
||||
extern bool Cocoa_IsWindowInFullscreenSpaceTransition(SDL_Window *window);
|
||||
extern bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, bool state, bool blocking);
|
||||
extern bool Cocoa_IsShowingModalDialog(SDL_Window *window);
|
||||
#endif
|
||||
@@ -1162,7 +1163,7 @@ float SDL_GetDisplayContentScale(SDL_DisplayID displayID)
|
||||
|
||||
void SDL_SetWindowHDRProperties(SDL_Window *window, const SDL_HDROutputProperties *HDR, bool send_event)
|
||||
{
|
||||
if (window->HDR.HDR_headroom != HDR->HDR_headroom || window->HDR.SDR_white_level != window->HDR.SDR_white_level) {
|
||||
if (window->HDR.HDR_headroom != HDR->HDR_headroom || window->HDR.SDR_white_level != HDR->SDR_white_level) {
|
||||
SDL_PropertiesID window_props = SDL_GetWindowProperties(window);
|
||||
|
||||
SDL_SetFloatProperty(window_props, SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT, SDL_max(HDR->HDR_headroom, 1.0f));
|
||||
@@ -2111,6 +2112,16 @@ bool SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode
|
||||
* is in progress. It will be overwritten if a new request is made.
|
||||
*/
|
||||
SDL_copyp(&window->current_fullscreen_mode, &window->requested_fullscreen_mode);
|
||||
|
||||
#if defined(SDL_PLATFORM_MACOS) && defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
/* If this is called while in the middle of a Cocoa fullscreen spaces transition,
|
||||
* wait until the transition has completed, or the window can wind up in a weird,
|
||||
* broken state if a mode switch occurs while in a fullscreen space.
|
||||
*/
|
||||
if (SDL_strcmp(_this->name, "cocoa") == 0 && Cocoa_IsWindowInFullscreenSpaceTransition(window)) {
|
||||
SDL_SyncWindow(window);
|
||||
}
|
||||
#endif
|
||||
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window)) {
|
||||
SDL_UpdateFullscreenMode(window, SDL_FULLSCREEN_OP_UPDATE, true);
|
||||
SDL_SyncIfRequired(window);
|
||||
|
||||
@@ -47,6 +47,25 @@ void Android_QuitTouch(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SDL_TouchID Android_ConvertJavaTouchID(int touchID)
|
||||
{
|
||||
SDL_TouchID retval = touchID;
|
||||
|
||||
if (touchID < 0) {
|
||||
// Touch ID -1 appears when using Android emulator, eg:
|
||||
// adb shell input mouse tap 100 100
|
||||
// adb shell input touchscreen tap 100 100
|
||||
//
|
||||
// Prevent to be -1, since it's used in SDL internal for synthetic events:
|
||||
retval -= 1;
|
||||
} else {
|
||||
// Touch ID 0 is invalid
|
||||
retval += 1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
|
||||
{
|
||||
SDL_TouchID touchDeviceId = 0;
|
||||
@@ -56,11 +75,7 @@ void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_fin
|
||||
return;
|
||||
}
|
||||
|
||||
/* Touch device -1 appears when using Android emulator, eg:
|
||||
* adb shell input mouse tap 100 100
|
||||
* adb shell input touchscreen tap 100 100
|
||||
*/
|
||||
touchDeviceId = (SDL_TouchID)(touch_device_id_in + 2);
|
||||
touchDeviceId = Android_ConvertJavaTouchID(touch_device_id_in);
|
||||
|
||||
// Finger ID should be greater than 0
|
||||
fingerId = (SDL_FingerID)(pointer_finger_id_in + 1);
|
||||
|
||||
@@ -25,3 +25,4 @@
|
||||
extern void Android_InitTouch(void);
|
||||
extern void Android_QuitTouch(void);
|
||||
extern void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p);
|
||||
extern SDL_TouchID Android_ConvertJavaTouchID(int touchID);
|
||||
@@ -411,6 +411,19 @@ bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
bool Cocoa_IsWindowInFullscreenSpaceTransition(SDL_Window *window)
|
||||
{
|
||||
@autoreleasepool {
|
||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||
|
||||
if ([data.listener isInFullscreenSpaceTransition]) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Cocoa_IsWindowZoomed(SDL_Window *window)
|
||||
{
|
||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||
|
||||
@@ -1540,7 +1540,7 @@ static SDL_VideoDevice *OPENVR_CreateDevice(void)
|
||||
SDL_SetError("Could not get interfaces for the OpenVR System (%s), Overlay (%s) and Input (%s) versions", IVRSystem_Version, IVROverlay_Version, IVRInput_Version);
|
||||
}
|
||||
|
||||
const char *hint = SDL_GetHint("SDL_OPENVR_INPUT_PROFILE");
|
||||
hint = SDL_GetHint("SDL_OPENVR_INPUT_PROFILE");
|
||||
char *loadpath = 0;
|
||||
EVRInputError err;
|
||||
|
||||
|
||||
@@ -41,6 +41,48 @@
|
||||
*/
|
||||
#define PIPE_TIMEOUT_NS SDL_MS_TO_NS(14)
|
||||
|
||||
/* sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it.
|
||||
* Based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation
|
||||
*/
|
||||
#ifndef HAVE_SIGTIMEDWAIT
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
static int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
|
||||
{
|
||||
struct timespec elapsed = { 0 }, rem = { 0 };
|
||||
sigset_t pending;
|
||||
|
||||
do {
|
||||
// Check the pending signals, and call sigwait if there is at least one of interest in the set.
|
||||
sigpending(&pending);
|
||||
for (int signo = 1; signo < NSIG; ++signo) {
|
||||
if (sigismember(set, signo) && sigismember(&pending, signo)) {
|
||||
if (!sigwait(set, &signo)) {
|
||||
if (info) {
|
||||
SDL_memset(info, 0, sizeof *info);
|
||||
info->si_signo = signo;
|
||||
}
|
||||
return signo;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout->tv_sec || timeout->tv_nsec) {
|
||||
long ns = 20000000L; // 2/100ths of a second
|
||||
nanosleep(&(struct timespec){ 0, ns }, &rem);
|
||||
ns -= rem.tv_nsec;
|
||||
elapsed.tv_sec += (elapsed.tv_nsec + ns) / 1000000000L;
|
||||
elapsed.tv_nsec = (elapsed.tv_nsec + ns) % 1000000000L;
|
||||
}
|
||||
} while (elapsed.tv_sec < timeout->tv_sec || (elapsed.tv_sec == timeout->tv_sec && elapsed.tv_nsec < timeout->tv_nsec));
|
||||
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_t *pos)
|
||||
{
|
||||
int ready = 0;
|
||||
@@ -76,7 +118,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
|
||||
}
|
||||
}
|
||||
|
||||
sigtimedwait(&sig_set, 0, &zerotime);
|
||||
sigtimedwait(&sig_set, NULL, &zerotime);
|
||||
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
|
||||
|
||||
@@ -2201,7 +2201,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
|
||||
case WM_NCCALCSIZE:
|
||||
{
|
||||
SDL_WindowFlags window_flags = SDL_GetWindowFlags(data->window);
|
||||
SDL_WindowFlags window_flags = data->window->flags;
|
||||
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
|
||||
// When borderless, need to tell windows that the size of the non-client area is 0
|
||||
NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
|
||||
|
||||
@@ -889,7 +889,7 @@ static int SDLCALL rect_testIntersectRectEmpty(void *arg)
|
||||
*/
|
||||
static int SDLCALL rect_testIntersectRectParam(void *arg)
|
||||
{
|
||||
SDL_Rect rectA;
|
||||
SDL_Rect rectA = { 0 };
|
||||
SDL_Rect rectB = { 0 };
|
||||
SDL_Rect result;
|
||||
bool intersection;
|
||||
@@ -1138,7 +1138,7 @@ static int SDLCALL rect_testHasIntersectionEmpty(void *arg)
|
||||
*/
|
||||
static int SDLCALL rect_testHasIntersectionParam(void *arg)
|
||||
{
|
||||
SDL_Rect rectA;
|
||||
SDL_Rect rectA = { 0 };
|
||||
SDL_Rect rectB = { 0 };
|
||||
bool intersection;
|
||||
|
||||
@@ -1699,7 +1699,7 @@ static int SDLCALL rect_testUnionRectInside(void *arg)
|
||||
*/
|
||||
static int SDLCALL rect_testUnionRectParam(void *arg)
|
||||
{
|
||||
SDL_Rect rectA, rectB = { 0 };
|
||||
SDL_Rect rectA = { 0 }, rectB = { 0 };
|
||||
SDL_Rect result;
|
||||
|
||||
/* invalid parameter combinations */
|
||||
|
||||
@@ -679,7 +679,7 @@ void SetupVulkanRenderProperties(VulkanVideoContext *context, SDL_PropertiesID p
|
||||
SDL_SetNumberProperty(props, SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, context->graphicsQueueFamilyIndex);
|
||||
}
|
||||
|
||||
#if LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 34, 100)
|
||||
static void AddQueueFamily(AVVulkanDeviceContext *ctx, int idx, int num, VkQueueFlagBits flags)
|
||||
{
|
||||
AVVulkanDeviceQueueFamily *entry = &ctx->qf[ctx->nb_qf++];
|
||||
@@ -687,7 +687,7 @@ static void AddQueueFamily(AVVulkanDeviceContext *ctx, int idx, int num, VkQueue
|
||||
entry->num = num;
|
||||
entry->flags = flags;
|
||||
}
|
||||
#endif /* LIBAVUTIL_VERSION_MAJOR */
|
||||
#endif /* LIBAVUTIL_VERSION_INT */
|
||||
|
||||
void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceContext *ctx)
|
||||
{
|
||||
@@ -700,7 +700,7 @@ void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceCon
|
||||
ctx->nb_enabled_inst_extensions = context->instanceExtensionsCount;
|
||||
ctx->enabled_dev_extensions = context->deviceExtensions;
|
||||
ctx->nb_enabled_dev_extensions = context->deviceExtensionsCount;
|
||||
#if LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 34, 100)
|
||||
AddQueueFamily(ctx, context->graphicsQueueFamilyIndex, context->graphicsQueueCount, VK_QUEUE_GRAPHICS_BIT);
|
||||
AddQueueFamily(ctx, context->transferQueueFamilyIndex, context->transferQueueCount, VK_QUEUE_TRANSFER_BIT);
|
||||
AddQueueFamily(ctx, context->computeQueueFamilyIndex, context->computeQueueCount, VK_QUEUE_COMPUTE_BIT);
|
||||
@@ -716,7 +716,7 @@ void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceCon
|
||||
ctx->nb_encode_queues = 0;
|
||||
ctx->queue_family_decode_index = context->decodeQueueFamilyIndex;
|
||||
ctx->nb_decode_queues = context->decodeQueueCount;
|
||||
#endif /* LIBAVUTIL_VERSION_MAJOR */
|
||||
#endif /* LIBAVUTIL_VERSION_INT */
|
||||
}
|
||||
|
||||
static int CreateCommandBuffers(VulkanVideoContext *context, SDL_Renderer *renderer)
|
||||
|
||||
Reference in new issue
Block a user